RadioLib Universal wireless communication library for Arduino

APRS.h
1 #if !defined(_RADIOLIB_RADIOLIB_APRS_H)
2 #define _RADIOLIB_RADIOLIB_APRS_H
3
4 #include "../../TypeDef.h"
5
6 #if !defined(RADIOLIB_EXCLUDE_APRS)
7
8 #include "../PhysicalLayer/PhysicalLayer.h"
9 #include "../AX25/AX25.h"
10
11 // APRS data type identifiers
12 #define RADIOLIB_APRS_DATA_TYPE_POSITION_NO_TIME_NO_MSG "!"
13 #define RADIOLIB_APRS_DATA_TYPE_GPS_RAW "$"
14 #define RADIOLIB_APRS_DATA_TYPE_ITEM ")"
15 #define RADIOLIB_APRS_DATA_TYPE_TEST ","
16 #define RADIOLIB_APRS_DATA_TYPE_POSITION_TIME_NO_MSG "/"
17 #define RADIOLIB_APRS_DATA_TYPE_MSG ":"
18 #define RADIOLIB_APRS_DATA_TYPE_OBJECT ";"
19 #define RADIOLIB_APRS_DATA_TYPE_STATION_CAPABILITES "<"
20 #define RADIOLIB_APRS_DATA_TYPE_POSITION_NO_TIME_MSG "="
21 #define RADIOLIB_APRS_DATA_TYPE_STATUS ">"
22 #define RADIOLIB_APRS_DATA_TYPE_QUERY "?"
23 #define RADIOLIB_APRS_DATA_TYPE_POSITION_TIME_MSG "@"
24 #define RADIOLIB_APRS_DATA_TYPE_TELEMETRY "T"
25 #define RADIOLIB_APRS_DATA_TYPE_MAIDENHEAD_BEACON "["
26 #define RADIOLIB_APRS_DATA_TYPE_WEATHER_REPORT "_"
27 #define RADIOLIB_APRS_DATA_TYPE_USER_DEFINED "{"
28 #define RADIOLIB_APRS_DATA_TYPE_THIRD_PARTY "}"
29
35 #define RADIOLIB_APRS_MIC_E_TYPE_OFF_DUTY 0b00000111
36 #define RADIOLIB_APRS_MIC_E_TYPE_EN_ROUTE 0b00000110
37 #define RADIOLIB_APRS_MIC_E_TYPE_IN_SERVICE 0b00000101
38 #define RADIOLIB_APRS_MIC_E_TYPE_RETURNING 0b00000100
39 #define RADIOLIB_APRS_MIC_E_TYPE_COMMITTED 0b00000011
40 #define RADIOLIB_APRS_MIC_E_TYPE_SPECIAL 0b00000010
41 #define RADIOLIB_APRS_MIC_E_TYPE_PRIORITY 0b00000001
42 #define RADIOLIB_APRS_MIC_E_TYPE_EMERGENCY 0b00000000
47 // magic offset applied to encode extra bits in the Mic-E destination field
48 #define RADIOLIB_APRS_MIC_E_DEST_BIT_OFFSET 25
49
50 // Mic-E data types
51 #define RADIOLIB_APRS_MIC_E_GPS_DATA_CURRENT '`'
52 #define RADIOLIB_APRS_MIC_E_GPS_DATA_OLD '\''
53
54 // Mic-E telemetry flags
55 #define RADIOLIB_APRS_MIC_E_TELEMETRY_LEN_2 '`'
56 #define RADIOLIB_APRS_MIC_E_TELEMETRY_LEN_5 '\''
57
58 // alias for unused altitude in Mic-E
59 #define RADIOLIB_APRS_MIC_E_ALTITUDE_UNUSED -1000000
60
65 class APRSClient {
66 public:
71 explicit APRSClient(AX25Client* ax);
72
73 // basic methods
74
81 int16_t begin(char sym, bool alt = false);
82
93 int16_t sendPosition(char* destCallsign, uint8_t destSSID, char* lat, char* lon, char* msg = NULL, char* time = NULL);
94
108 int16_t sendMicE(float lat, float lon, uint16_t heading, uint16_t speed, uint8_t type, uint8_t* telem = NULL, size_t telemLen = 0, char* grid = NULL, char* status = NULL, int32_t alt = RADIOLIB_APRS_MIC_E_ALTITUDE_UNUSED);
109
117 int16_t sendFrame(char* destCallsign, uint8_t destSSID, char* info);
118
119 #if !defined(RADIOLIB_GODMODE)
120 private:
121 #endif
122 AX25Client* axClient;
123
124 // default APRS symbol (car)
125 char symbol = '>';
126 char table = '/';
127 };
128
129 #endif
130
131 #endif
APRSClient
Client for APRS communication.
Definition: APRS.h:65
APRSClient::sendFrame
int16_t sendFrame(char *destCallsign, uint8_t destSSID, char *info)
Transmit generic APRS frame.
Definition: APRS.cpp:221
APRSClient::APRSClient
APRSClient(AX25Client *ax)
Default constructor.
Definition: APRS.cpp:7
APRSClient::begin
int16_t begin(char sym, bool alt=false)
Initialization method.
Definition: APRS.cpp:11
APRSClient::sendPosition
int16_t sendPosition(char *destCallsign, uint8_t destSSID, char *lat, char *lon, char *msg=NULL, char *time=NULL)
Transmit position.
Definition: APRS.cpp:24
APRSClient::sendMicE
int16_t sendMicE(float lat, float lon, uint16_t heading, uint16_t speed, uint8_t type, uint8_t *telem=NULL, size_t telemLen=0, char *grid=NULL, char *status=NULL, int32_t alt=RADIOLIB_APRS_MIC_E_ALTITUDE_UNUSED)
Transmit position using Mic-E encoding.
Definition: APRS.cpp:61
AX25Client
Client for AX25 communication.
Definition: AX25.h:249