acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
APRS.h (5306B)
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 30 /*! 31 \defgroup mic_e_message_types Mic-E message types. 32 33 \{ 34 */ 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 43 /*! 44 \} 45 */ 46 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 61 /*! 62 \class APRSClient 63 64 \brief Client for APRS communication. 65 */ 66 class APRSClient { 67 public: 68 /*! 69 \brief Default constructor. 70 71 \param ax Pointer to the instance of AX25Client to be used for APRS. 72 */ 73 explicit APRSClient(AX25Client* ax); 74 75 // basic methods 76 77 /*! 78 \brief Initialization method. 79 80 \param symbol APRS symbol to be displayed. 81 82 \param alt Whether to use the primary (false) or alternate (true) symbol table. Defaults to primary table. 83 84 \returns \ref status_codes 85 */ 86 int16_t begin(char symbol, bool alt = false); 87 88 /*! 89 \brief Transmit position. 90 91 \param destCallsign Destination station callsign. 92 93 \param destSSID Destination station SSID. 94 95 \param lat Latitude as a null-terminated string. 96 97 \param long Longitude as a null-terminated string. 98 99 \param msg Message to be transmitted. Defaults to NULL (no message). 100 101 \param msg Position timestamp. Defaults to NULL (no timestamp). 102 103 \returns \ref status_codes 104 */ 105 int16_t sendPosition(char* destCallsign, uint8_t destSSID, char* lat, char* lon, char* msg = NULL, char* time = NULL); 106 107 /* 108 \brief Transmit position using Mic-E encoding. 109 110 \param lat Geographical latitude, positive for north, negative for south. 111 112 \param lon Geographical longitude, positive for east, negative for west. 113 114 \param heading Heading in degrees. 115 116 \param speed Speed in knots. 117 118 \param type Mic-E message type - see \ref mic_e_message_types. 119 120 \param telem Pointer to telemetry array (either 2 or 5 bytes long). NULL when telemetry is not used. 121 122 \param telemLen Telemetry length, 2 or 5. 0 when telemetry is not used. 123 124 \param grid Maidenhead grid locator. NULL when not used. 125 126 \param status Status message to send. NULL when not used. 127 128 \param alt Altitude to send. RADIOLIB_APRS_MIC_E_ALTITUDE_UNUSED when not used. 129 */ 130 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); 131 132 /*! 133 \brief Transmit generic APRS frame. 134 135 \param destCallsign Destination station callsign. 136 137 \param destSSID Destination station SSID. 138 139 \param info AX.25 info field contents. 140 141 \returns \ref status_codes 142 */ 143 int16_t sendFrame(char* destCallsign, uint8_t destSSID, char* info); 144 145 #if !defined(RADIOLIB_GODMODE) 146 private: 147 #endif 148 AX25Client* _ax; 149 150 // default APRS symbol (car) 151 char _symbol = '>'; 152 char _table = '/'; 153 }; 154 155 #endif 156 157 #endif