RadioLib
Universal wireless communication library for Arduino
Loading...
Searching...
No Matches
APRS.h
1#if !defined(_RADIOLIB_APRS_H)
2#define _RADIOLIB_APRS_H
3
4#include "../../TypeDef.h"
5
6#if !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
36#define RADIOLIB_APRS_MIC_E_TYPE_OFF_DUTY 0b00000111
37
39#define RADIOLIB_APRS_MIC_E_TYPE_EN_ROUTE 0b00000110
40
42#define RADIOLIB_APRS_MIC_E_TYPE_IN_SERVICE 0b00000101
43
45#define RADIOLIB_APRS_MIC_E_TYPE_RETURNING 0b00000100
46
48#define RADIOLIB_APRS_MIC_E_TYPE_COMMITTED 0b00000011
49
51#define RADIOLIB_APRS_MIC_E_TYPE_SPECIAL 0b00000010
52
54#define RADIOLIB_APRS_MIC_E_TYPE_PRIORITY 0b00000001
55
57#define RADIOLIB_APRS_MIC_E_TYPE_EMERGENCY 0b00000000
58
63// magic offset applied to encode extra bits in the Mic-E destination field
64#define RADIOLIB_APRS_MIC_E_DEST_BIT_OFFSET 25
65
66// Mic-E data types
67#define RADIOLIB_APRS_MIC_E_GPS_DATA_CURRENT '`'
68#define RADIOLIB_APRS_MIC_E_GPS_DATA_OLD '\''
69
70// Mic-E telemetry flags
71#define RADIOLIB_APRS_MIC_E_TELEMETRY_LEN_2 '`'
72#define RADIOLIB_APRS_MIC_E_TELEMETRY_LEN_5 '\''
73
74// alias for unused altitude in Mic-E
75#define RADIOLIB_APRS_MIC_E_ALTITUDE_UNUSED -1000000
76
77// special header applied for APRS over LoRa
78#define RADIOLIB_APRS_LORA_HEADER "<\xff\x01"
79#define RADIOLIB_APRS_LORA_HEADER_LEN (3)
80
86 public:
91 explicit APRSClient(AX25Client* ax);
92
97 explicit APRSClient(PhysicalLayer* phy);
98
99 // basic methods
100
109 int16_t begin(char sym, const char* callsign = NULL, uint8_t ssid = 0, bool alt = false);
110
121 int16_t sendPosition(char* destCallsign, uint8_t destSSID, const char* lat, const char* lon, const char* msg = NULL, const char* time = NULL);
122
136 int16_t sendMicE(float lat, float lon, uint16_t heading, uint16_t speed, uint8_t type, const uint8_t* telem = NULL, size_t telemLen = 0, const char* grid = NULL, const char* status = NULL, int32_t alt = RADIOLIB_APRS_MIC_E_ALTITUDE_UNUSED);
137
145 int16_t sendFrame(char* destCallsign, uint8_t destSSID, char* info);
146
154 void useRepeaters(char** repeaterCallsigns, uint8_t* repeaterSSIDs, uint8_t numRepeaters);
155
160 void dropRepeaters();
161
162#if !RADIOLIB_GODMODE
163 private:
164#endif
165 AX25Client* axClient;
166 PhysicalLayer* phyLayer;
167
168 // default APRS symbol (car)
169 char symbol = '>';
170 char table = '/';
171
172 // repeaters
173 char** repCalls = NULL;
174 uint8_t* repSSIDs = NULL;
175 uint8_t numReps = 0;
176
177 // source callsign when using APRS over LoRa
178 char src[RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1] = { 0 };
179 uint8_t id = 0;
180};
181
182#endif
183
184#endif
Client for APRS communication.
Definition APRS.h:85
int16_t sendFrame(char *destCallsign, uint8_t destSSID, char *info)
Transmit generic APRS frame.
Definition APRS.cpp:252
void useRepeaters(char **repeaterCallsigns, uint8_t *repeaterSSIDs, uint8_t numRepeaters)
Set the repeater callsigns and SSIDs to be used by the frames sent by sendPosition,...
Definition APRS.cpp:285
int16_t begin(char sym, const char *callsign=NULL, uint8_t ssid=0, bool alt=false)
Initialization method.
Definition APRS.cpp:17
int16_t sendMicE(float lat, float lon, uint16_t heading, uint16_t speed, uint8_t type, const uint8_t *telem=NULL, size_t telemLen=0, const char *grid=NULL, const char *status=NULL, int32_t alt=RADIOLIB_APRS_MIC_E_ALTITUDE_UNUSED)
Transmit position using Mic-E encoding.
Definition APRS.cpp:87
int16_t sendPosition(char *destCallsign, uint8_t destSSID, const char *lat, const char *lon, const char *msg=NULL, const char *time=NULL)
Transmit position.
Definition APRS.cpp:42
void dropRepeaters()
Stop using repeaters.
Definition APRS.cpp:291
Client for AX25 communication.
Definition AX25.h:233
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition PhysicalLayer.h:216