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
00158 typedef enum
00159 {
00160 fapPOS_COMPRESSED,
00161 fapPOS_UNCOMPRESSED,
00162 fapPOS_MICE,
00163 fapPOS_NMEA
00164 } fap_pos_format_t;
00165
00166
00168 typedef struct
00169 {
00171 double* wind_gust;
00173 unsigned int* wind_dir;
00175 double* wind_speed;
00176
00178 double* temp;
00180 double* temp_in;
00181
00183 double* rain_1h;
00185 double* rain_24h;
00187 double* rain_midnight;
00188
00190 unsigned int* humidity;
00192 unsigned int* humidity_in;
00193
00195 double* pressure;
00197 unsigned int* luminosity;
00198
00200 double* snow_24h;
00201
00203 char* soft;
00204 } fap_wx_report_t;
00205
00206
00207
00209 typedef struct
00210 {
00212 unsigned int seq;
00214 double val1;
00216 double val2;
00218 double val3;
00220 double val4;
00222 double val5;
00223
00225 char bits[8];
00226 } fap_telemetry_t;
00227
00228
00229
00231 typedef struct
00232 {
00234 fap_error_code_t* error_code;
00236 char* error_message;
00238 fap_packet_type_t* type;
00239
00241 char* orig_packet;
00243 unsigned int orig_packet_len;
00244
00246 char* header;
00248 char* body;
00250 unsigned int body_len;
00252 char* src_callsign;
00254 char* dst_callsign;
00256 char** path;
00258 unsigned int path_len;
00259
00261 double* latitude;
00263 double* longitude;
00265 fap_pos_format_t* format;
00267 double* pos_resolution;
00269 unsigned int* pos_ambiguity;
00271 char dao_datum_byte;
00272
00274 double* altitude;
00276 unsigned int* course;
00278 double* speed;
00279
00281 char symbol_table;
00283 char symbol_code;
00284
00286 short* messaging;
00288 char* destination;
00290 char* message;
00292 char* message_ack;
00294 char* message_nack;
00296 char* message_id;
00298
00304 char* comment;
00306 unsigned int comment_len;
00307
00309 char* object_or_item_name;
00311 short* alive;
00312
00314 short* gps_fix_status;
00316 unsigned int* radio_range;
00318 char* phg;
00320 time_t* timestamp;
00322 short* nmea_checksum_ok;
00323
00325 fap_wx_report_t* wx_report;
00326
00328 fap_telemetry_t* telemetry;
00329
00331 char* messagebits;
00333 char* status;
00335 unsigned int status_len;
00337 char** capabilities;
00339 unsigned int capabilities_len;
00340
00341 } fap_packet_t;
00342
00343
00344
00345
00347
00366 fap_packet_t* fap_parseaprs(char const* input, unsigned int const input_len, short const is_ax25);
00367
00368
00370 char* fap_explain_error(fap_error_code_t const error);
00371
00373
00376 char* fap_mice_mbits_to_message(char* bits);
00377
00379
00385 double fap_distance(double lon0, double lat0, double lon1, double lat1);
00386
00387
00389
00394 double fap_direction(double lon0, double lat0, double lon1, double lat1);
00395
00396
00398
00403 int fap_count_digihops(fap_packet_t const* packet);
00404
00405
00407
00417 char* fap_check_ax25_call(char const* input, short const add_ssid0);
00418
00419
00421
00436 int fap_kiss_to_tnc2(char const* kissframe, unsigned int kissframe_len,
00437 char* tnc2frame, unsigned int* tnc2frame_len, unsigned int* tnc_id);
00438
00439
00441
00452 int fap_tnc2_to_kiss(char const* tnc2frame, unsigned int tnc2frame_len, unsigned int const tnc_id,
00453 char* kissframe, unsigned int* kissframe_len);
00454
00455
00456
00457
00458
00460
00463 int fap_ax25_to_tnc2(char const* ax25frame, unsigned int ax25frame_len,
00464 char* tnc2frame, unsigned int* tnc2frame_len);
00465
00467
00470 int fap_tnc2_to_ax25(char const* tnc2frame, unsigned int tnc2frame_len,
00471 char* ax25frame, unsigned int* ax25frame_len);
00472
00473
00475
00479 void fap_free(fap_packet_t* packet);
00480
00481
00482
00484
00488 void fap_init();
00489
00490
00491
00493
00497 void fap_cleanup();
00498
00499
00500 #ifdef __cplusplus
00501 }
00502 #endif
00503
00504 #endif // FAP_H