00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00033 #ifndef FAP_H
00034 #define FAP_H
00035
00036
00037 #include <time.h>
00038
00039
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043
00044
00045
00047 typedef enum
00048 {
00049 fapPACKET_NO,
00050 fapPACKET_SHORT,
00051 fapPACKET_NOBODY,
00052
00053 fapSRCCALL_NOAX25,
00054 fapSRCCALL_BADCHARS,
00055
00056 fapDSTPATH_TOOMANY,
00057 fapDSTCALL_NONE,
00058 fapDSTCALL_NOAX25,
00059
00060 fapDIGICALL_NOAX25,
00061 fapDIGICALL_BADCHARS,
00062
00063 fapTIMESTAMP_INV_LOC,
00064 fapTIMESTAMP_INV_OBJ,
00065 fapTIMESTAMP_INV_STA,
00066 fapTIMESTAMP_INV_GPGGA,
00067 fapTIMESTAMP_INV_GPGLL,
00068
00069 fapPACKET_INVALID,
00070
00071 fapNMEA_INV_CVAL,
00072 fapNMEA_LARGE_EW,
00073 fapNMEA_LARGE_NS,
00074 fapNMEA_INV_SIGN,
00075 fapNMEA_INV_CKSUM,
00076
00077 fapGPRMC_FEWFIELDS,
00078 fapGPRMC_NOFIX,
00079 fapGPRMC_INV_TIME,
00080 fapGPRMC_INV_DATE,
00081 fapGPRMC_DATE_OUT,
00082
00083 fapGPGGA_FEWFIELDS,
00084 fapGPGGA_NOFIX,
00085
00086 fapGPGLL_FEWFIELDS,
00087 fapGPGLL_NOFIX,
00088
00089 fapNMEA_UNSUPP,
00090
00091 fapOBJ_SHORT,
00092 fapOBJ_INV,
00093 fapOBJ_DEC_ERR,
00094
00095 fapITEM_SHORT,
00096 fapITEM_INV,
00097 fapITEM_DEC_ERR,
00098
00099 fapLOC_SHORT,
00100 fapLOC_INV,
00101 fapLOC_LARGE,
00102 fapLOC_AMB_INV,
00103
00104 fapMICE_SHORT,
00105 fapMICE_INV,
00106 fapMICE_INV_INFO,
00107 fapMICE_AMB_LARGE,
00108 fapMICE_AMB_INV,
00109 fapMICE_AMB_ODD,
00110
00111 fapCOMP_INV,
00112
00113 fapMSG_INV,
00114
00115 fapWX_UNSUPP,
00116 fapUSER_UNSUPP,
00117
00118 fapDX_INV_SRC,
00119 fapDX_INF_FREQ,
00120 fapDX_NO_DX,
00121
00122 fapTLM_INV,
00123 fapTLM_LARGE,
00124 fapTLM_UNSUPP,
00125
00126 fapEXP_UNSUPP,
00127 fapSYM_INV_TABLE,
00128
00129 fapNOT_IMPLEMENTED,
00130 fapNMEA_NOFIELDS,
00131
00132 fapNO_APRS
00133 } fap_error_code_t;
00134
00135
00137 typedef enum
00138 {
00139 fapLOCATION,
00140 fapOBJECT,
00141 fapITEM,
00142 fapMICE,
00143 fapNMEA,
00144
00145 fapWX,
00146 fapMESSAGE,
00147 fapCAPABILITIES,
00148 fapSTATUS,
00149 fapTELEMETRY,
00150 fapTELEMETRY_MESSAGE,
00151 fapDX_SPOT,
00152
00153 fapEXPERIMENTAL,
00154 } fap_packet_type_t;
00155
00156
00157
00159 typedef struct
00160 {
00162 double* wind_gust;
00164 unsigned int* wind_dir;
00166 double* wind_speed;
00167
00169 double* temp;
00171 double* temp_in;
00172
00174 double* rain_1h;
00176 double* rain_24h;
00178 double* rain_midnight;
00179
00181 unsigned int* humidity;
00183 unsigned int* humidity_in;
00184
00186 double* pressure;
00188 unsigned int* luminosity;
00189
00191 double* snow_24h;
00192
00194 char* soft;
00195 } fap_wx_report_t;
00196
00197
00198
00200 typedef struct
00201 {
00203 unsigned int seq;
00205 double val1;
00207 double val2;
00209 double val3;
00211 double val4;
00213 double val5;
00214
00216 char bits[8];
00217 } fap_telemetry_t;
00218
00219
00220
00222 typedef struct
00223 {
00225 fap_error_code_t* error_code;
00227 char* error_message;
00229 fap_packet_type_t* type;
00230
00232 char* orig_packet;
00234 unsigned int orig_packet_len;
00235
00237 char* header;
00239 char* body;
00241 unsigned int body_len;
00243 char* src_callsign;
00245 char* dst_callsign;
00247 char** path;
00249 unsigned int path_len;
00250
00252 double* latitude;
00254 double* longitude;
00256 double* pos_resolution;
00258 unsigned int* pos_ambiguity;
00260 char dao_datum_byte;
00261
00263 double* altitude;
00265 unsigned int* course;
00267 double* speed;
00268
00270 char symbol_table;
00272 char symbol_code;
00273
00275 short* messaging;
00277 char* destination;
00279 char* message;
00281 char* message_ack;
00283 char* message_nack;
00285 char* message_id;
00287
00293 char* comment;
00295 unsigned int comment_len;
00296
00298 char* object_or_item_name;
00300 short* alive;
00301
00303 short* gps_fix_status;
00305 unsigned int* radio_range;
00307 char* phg;
00309 time_t* timestamp;
00311 short* nmea_checksum_ok;
00312
00314 fap_wx_report_t* wx_report;
00315
00317 fap_telemetry_t* telemetry;
00318
00320 char* messagebits;
00322 char* status;
00324 unsigned int status_len;
00326 char** capabilities;
00328 unsigned int capabilities_len;
00329
00330 } fap_packet_t;
00331
00332
00333
00334
00336
00355 fap_packet_t* fap_parseaprs(char const* input, unsigned int const input_len, short const is_ax25);
00356
00357
00359 char* fap_explain_error(fap_error_code_t const error);
00360
00362
00365 char* fap_mice_mbits_to_message(char* bits);
00366
00368
00374 double fap_distance(double lon0, double lat0, double lon1, double lat1);
00375
00376
00378
00383 double fap_direction(double lon0, double lat0, double lon1, double lat1);
00384
00385
00387
00392 int fap_count_digihops(fap_packet_t const* packet);
00393
00394
00396
00406 char* fap_check_ax25_call(char const* input, short const add_ssid0);
00407
00408
00410
00425 int fap_kiss_to_tnc2(char const* kissframe, unsigned int kissframe_len,
00426 char* tnc2frame, unsigned int* tnc2frame_len, unsigned int* tnc_id);
00427
00428
00430
00441 int fap_tnc2_to_kiss(char const* tnc2frame, unsigned int tnc2frame_len, unsigned int const tnc_id,
00442 char* kissframe, unsigned int* kissframe_len);
00443
00444
00445
00446
00447
00449
00452 int fap_ax25_to_tnc2(char const* ax25frame, unsigned int ax25frame_len,
00453 char* tnc2frame, unsigned int* tnc2frame_len);
00454
00456
00459 int fap_tnc2_to_ax25(char const* tnc2frame, unsigned int tnc2frame_len,
00460 char* ax25frame, unsigned int* ax25frame_len);
00461
00462
00464
00468 void fap_free(fap_packet_t* packet);
00469
00470
00471
00473
00477 void fap_init();
00478
00479
00480
00482
00486 void fap_cleanup();
00487
00488
00489 #ifdef __cplusplus
00490 }
00491 #endif
00492
00493 #endif // FAP_H