Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lora-aprs/APRS-IS-Lib
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.0.5
Choose a base ref
...
head repository: lora-aprs/APRS-IS-Lib
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 19 commits
  • 9 files changed
  • 2 contributors

Commits on May 26, 2020

  1. addd cppcheck

    peterus committed May 26, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    deb9fdd View commit details

Commits on May 29, 2020

  1. checktool update

    peterus committed May 29, 2020
    Copy the full SHA
    e01883e View commit details
  2. lets remove clang-tidy again

    peterus committed May 29, 2020
    Copy the full SHA
    fbe8e40 View commit details

Commits on Jun 4, 2020

  1. add APRSMessage support

    peterus committed Jun 4, 2020
    Copy the full SHA
    893a543 View commit details
  2. Update library.properties

    peterus authored Jun 4, 2020
    Copy the full SHA
    d0b2b3c View commit details

Commits on Aug 2, 2020

  1. Update library.properties

    peterus authored Aug 2, 2020
    Copy the full SHA
    35f2dce View commit details
  2. add docs

    peterus committed Aug 2, 2020
    Copy the full SHA
    5516441 View commit details
  3. Copy the full SHA
    595d36a View commit details

Commits on Feb 12, 2021

  1. lib update

    peterus committed Feb 12, 2021
    Copy the full SHA
    288d37d View commit details
  2. add github stuff

    peterus committed Feb 12, 2021
    Copy the full SHA
    2e7d301 View commit details
  3. fixing github actions

    peterus committed Feb 12, 2021
    Copy the full SHA
    50680b8 View commit details
  4. github actions fix

    peterus committed Feb 12, 2021
    Copy the full SHA
    abbcc9d View commit details
  5. github actions fix

    peterus committed Feb 12, 2021
    Copy the full SHA
    058fb45 View commit details
  6. github actions update

    peterus committed Feb 12, 2021
    Copy the full SHA
    e4719ec View commit details
  7. dummy fix

    peterus committed Feb 12, 2021
    Copy the full SHA
    be3867e View commit details
  8. remove travis

    peterus committed Feb 12, 2021
    Copy the full SHA
    1ec9bb8 View commit details
  9. 3
    Copy the full SHA
    36fe268 View commit details
  10. little fixes

    peterus committed Feb 12, 2021
    Copy the full SHA
    bced609 View commit details

Commits on May 12, 2021

  1. Create library.properties

    peterus authored May 12, 2021
    Copy the full SHA
    b5c23b4 View commit details
Showing with 169 additions and 32 deletions.
  1. +4 −0 .github/FUNDING.yml
  2. +57 −0 .github/workflows/build_check.yml
  3. +0 −16 .travis.yml
  4. +15 −0 ci_platformio.ini
  5. +20 −0 library.json
  6. +2 −2 library.properties
  7. +8 −0 platformio.ini
  8. +57 −12 src/APRS-IS.cpp
  9. +6 −2 src/APRS-IS.h
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: ['peterus']
custom: ['paypal.me/peterus07']
57 changes: 57 additions & 0 deletions .github/workflows/build_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build check and build

on: [push, pull_request]

jobs:
PlatformIO-Check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Run PlatformIO Check
run: platformio check --fail-on-defect low --fail-on-defect medium --fail-on-defect high

PlatformIO-Build:
runs-on: ubuntu-latest
strategy:
matrix:
example: [examples/decoder, examples/simple_aprs, examples/simple_fixed_position]
steps:
- uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Run PlatformIO CI
run: platformio ci --lib="." -c ci_platformio.ini
env:
PLATFORMIO_CI_SRC: ${{ matrix.example }}
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

15 changes: 15 additions & 0 deletions ci_platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[env]
lib_deps =
APRS-Decoder-Lib @ 0.0.6
peterus/esp-logger @ 0.0.1
NTPClient

[env:ttgo-lora32-v1]
platform = espressif32
framework = arduino
board = ttgo-lora32-v1

[env:d1_mini]
platform = espressif8266
framework = arduino
board = d1_mini
20 changes: 20 additions & 0 deletions library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "APRS-IS-Lib",
"keywords": "aprs, aprs-is, hamradio, lora",
"description": "This library will provide an simple interface to the APRS-Servers with the help of APRS-IS.",
"authors":
[
{
"name": "Peter Buchegger",
"email": "peter@pbuchegger.at"
}
],
"repository":
{
"type": "git",
"url": "https://github.com/lora-aprs/APRS-IS-Lib.git"
},
"version": "0.0.8",
"frameworks": "arduino",
"platforms": "espressif"
}
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name=APRS-IS-Lib
version=0.0.5
version=0.0.8
author=Peter Buchegger <peter@pbuchegger.at>
maintainer=Peter Buchegger <peter@pbuchegger.at>
sentence=APRS-IS library for ESP32
paragraph=This library will provide an simple interface to the APRS-Servers with the help of APRS-IS.
category=Communication
url=https://github.com/peterus/APRS-IS-Lib
url=https://github.com/lora-aprs/APRS-IS-Lib
architectures=*
includes=APRS-IS.h
depends=
8 changes: 8 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[env:native]
platform = native
lib_compat_mode = off
test_build_project_src = yes
lib_deps = https://github.com/peterus/UnixHostDuino
check_tool = cppcheck
check_flags =
cppcheck: --suppress=*:*.pio\* --suppress=unusedFunction
69 changes: 57 additions & 12 deletions src/APRS-IS.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <logger.h>
#include "APRS-IS.h"

APRS_IS::APRS_IS(const String & user, const String & passcode, const String & tool_name, const String & version)
@@ -8,24 +9,39 @@ APRS_IS::APRS_IS(const String & user, const String & passcode, const String & to
bool APRS_IS::connect(const String & server, const int port)
{
const String login = "user " + _user + " pass " + _passcode + " vers " + _tool_name + " " + _version + "\n\r";
return connect_(server, port, login);
return _connect(server, port, login);
}

bool APRS_IS::connect(const String & server, const int port, const String & filter)
{
const String login = "user " + _user + " pass " + _passcode + " vers " + _tool_name + " " + _version + " filter " + filter + "\n\r";
return connect_(server, port, login);
return _connect(server, port, login);
}

bool APRS_IS::connect_(const String & server, const int port, const String & login_line)
bool APRS_IS::_connect(const String & server, const int port, const String & login_line)
{
if(!_client.connect(server.c_str(), port))
{
logPrintlnE("Something went wrong on connecting! Is the server reachable?");
return false;
}
sendMessage(login_line);
// TODO: implement check if auth was successfull!
//while(!available());
while(true)
{
String line = _client.readStringUntil('\n');
if(line.indexOf("logresp") != -1)
{
if(line.indexOf("unverified") == -1)
{
return true;
}
else
{
logPrintlnE("User can not be verified with passcode!");
return false;
}
}
}
return true;
}

@@ -34,16 +50,24 @@ bool APRS_IS::connected()
return _client.connected();
}

bool APRS_IS::sendMessage(const String & package)
bool APRS_IS::sendMessage(const String & message)
{
if(!connected())
{
return false;
}
_client.println(message);
return true;
}

bool APRS_IS::sendMessage(const std::shared_ptr<APRSMessage> message)
{
if(connected())
if(!connected())
{
_client.println(package);
Serial.print("--> ");
Serial.println(package);
return true;
return false;
}
return false;
_client.println(message->encode() + "\n");
return true;
}

int APRS_IS::available()
@@ -60,3 +84,24 @@ String APRS_IS::getMessage()
}
return line;
}

std::shared_ptr<APRSMessage> APRS_IS::getAPRSMessage()
{
String line;
if (_client.available() > 0)
{
line = _client.readStringUntil('\n');
}
if(line.startsWith("#"))
{
logPrintlnD(line);
return 0;
}
if(line.length() == 0)
{
return 0;
}
std::shared_ptr<APRSMessage> msg = std::shared_ptr<APRSMessage>(new APRSMessage());
msg->decode(line);
return msg;
}
8 changes: 6 additions & 2 deletions src/APRS-IS.h
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
#else
#include <WiFi.h>
#endif
#include <APRS-Decoder.h>

class APRS_IS
{
@@ -15,21 +16,24 @@ class APRS_IS

bool connect(const String & server, const int port);
bool connect(const String & server, const int port, const String & filter);
bool connect_(const String & server, const int port, const String & login_line);
bool connected();

bool sendMessage(const String & package);
bool sendMessage(const String & message);
bool sendMessage(const std::shared_ptr<APRSMessage> message);

int available();

String getMessage();
std::shared_ptr<APRSMessage> getAPRSMessage();

private:
const String _user;
const String _passcode;
const String _tool_name;
const String _version;
WiFiClient _client;

bool _connect(const String & server, const int port, const String & login_line);
};

#endif