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
00050 fapPACKET_NO,
00051 fapPACKET_SHORT,
00052 fapPACKET_NOBODY,
00053
00054 fapSRCCALL_NOAX25,
00055 fapSRCCALL_BADCHARS,
00056
00057 fapDSTPATH_TOOMANY,
00058 fapDSTCALL_NONE,
00059 fapDSTCALL_NOAX25,
00060
00061 fapDIGICALL_NOAX25,
00062 fapDIGICALL_BADCHARS,
00063
00064 fapTIMESTAMP_INV_LOC,
00065 fapTIMESTAMP_INV_OBJ,
00066 fapTIMESTAMP_INV_STA,
00067 fapTIMESTAMP_INV_GPGGA,
00068 fapTIMESTAMP_INV_GPGLL,
00069
00070 fapPACKET_INVALID,
00071
00072 fapNMEA_INV_CVAL,
00073 fapNMEA_LARGE_EW,
00074 fapNMEA_LARGE_NS,
00075 fapNMEA_INV_SIGN,
00076 fapNMEA_INV_CKSUM,
00077
00078 fapGPRMC_FEWFIELDS,
00079 fapGPRMC_NOFIX,
00080 fapGPRMC_INV_TIME,
00081 fapGPRMC_INV_DATE,
00082 fapGPRMC_DATE_OUT,
00083
00084 fapGPGGA_FEWFIELDS,
00085 fapGPGGA_NOFIX,
00086
00087 fapGPGLL_FEWFIELDS,
00088 fapGPGLL_NOFIX,
00089
00090 fapNMEA_UNSUPP,
00091
00092 fapOBJ_SHORT,
00093 fapOBJ_INV,
00094 fapOBJ_DEC_ERR,
00095
00096 fapITEM_SHORT,
00097 fapITEM_INV,
00098 fapITEM_DEC_ERR,
00099
00100 fapLOC_SHORT,
00101 fapLOC_INV,
00102 fapLOC_LARGE,
00103 fapLOC_AMB_INV,
00104
00105 fapMICE_SHORT,
00106 fapMICE_INV,
00107 fapMICE_INV_INFO,
00108 fapMICE_AMB_LARGE,
00109 fapMICE_AMB_INV,
00110 fapMICE_AMB_ODD,
00111
00112 fapCOMP_INV,
00113
00114 fapMSG_INV,
00115
00116 fapWX_UNSUPP,
00117 fapUSER_UNSUPP,
00118
00119 fapDX_INV_SRC,
00120 fapDX_INF_FREQ,
00121 fapDX_NO_DX,
00122
00123 fapTLM_INV,
00124 fapTLM_LARGE,
00125 fapTLM_UNSUPP,
00126
00127 fapEXP_UNSUPP,
00128 fapSYM_INV_TABLE,
00129
00130 fapNOT_IMPLEMENTED,
00131 fapNMEA_NOFIELDS
00132 } fap_error_code_t;
00133
00134
00136 typedef enum
00137 {
00138 fapLOCATION,
00139 fapOBJECT,
00140 fapITEM,
00141 fapMICE,
00142 fapNMEA,
00143
00144 fapWX,
00145 fapMESSAGE,
00146 fapCAPABILITIES,
00147 fapSTATUS,
00148 fapTELEMETRY,
00149 fapTELEMETRY_MESSAGE,
00150 fapDX_SPOT,
00151
00152 fapEXPERIMENTAL,
00153 } fap_packet_type_t;
00154
00155
00156
00158 typedef struct
00159 {
00161 double* wind_gust;
00163 unsigned int* wind_dir;
00165 double* wind_speed;
00166
00168 double* temp;
00170 double* temp_in;
00171
00173 double* rain_1h;
00175 double* rain_24h;
00177 double* rain_midnight;
00178
00180 unsigned int* humidity;
00182 unsigned int* humidity_in;
00183
00185 double* pressure;
00187 unsigned int* luminosity;
00188 } fap_wx_report_t;
00189
00190
00191
00193 typedef struct
00194 {
00196 unsigned int seq;
00198 double val1;
00200 double val2;
00202 double val3;
00204 double val4;
00206 double val5;
00207
00209 char bits[8];
00210 } fap_telemetry_t;
00211
00212
00213
00215 typedef struct
00216 {
00218 fap_error_code_t* error_code;
00220 char* error_message;
00222 fap_packet_type_t* type;
00223
00225 char* orig_packet;
00227 unsigned int orig_packet_len;
00228
00230 char* header;
00232 char* body;
00234 unsigned int body_len;
00236 char* src_callsign;
00238 char* dst_callsign;
00240 char** path;
00242 unsigned int path_len;
00243
00245 double* latitude;
00247 double* longitude;
00249 double* pos_resolution;
00251 unsigned int* pos_ambiguity;
00253 char dao_datum_byte;
00254
00256 int* altitude;
00258 unsigned int* course;
00260 unsigned int* speed;
00261
00263 char symbol_table;
00265 char symbol_code;
00266
00268 short* messaging;
00270 char* destination;
00272 char* message;
00274 char* message_ack;
00276 char* message_nack;
00278 char* message_id;
00280 char* comment;
00282 unsigned int comment_len;
00283
00285 char* object_or_item_name;
00287 short* alive;
00288
00290 short* gps_fix_status;
00292 unsigned int* radio_range;
00294 char* phg;
00296 time_t* timestamp;
00298 short* nmea_checksum_ok;
00299
00301 fap_wx_report_t* wx_report;
00302
00304 fap_telemetry_t* telemetry;
00305
00307 char* messagebits;
00309 char* status;
00311 unsigned int status_len;
00313 char** capabilities;
00315 unsigned int capabilities_len;
00316
00317 } fap_packet_t;
00318
00319
00320
00321
00323
00340 fap_packet_t* fap_parseaprs(char const* input, unsigned int const input_len, short const is_ax25);
00341
00342
00344 char* fap_explain_error(fap_error_code_t const error);
00345
00347
00350 char* fap_mice_mbits_to_message(char* bits);
00351
00353
00359 double fap_distance(double lon0, double lat0, double lon1, double lat1);
00360
00361
00363
00368 double fap_direction(double lon0, double lat0, double lon1, double lat1);
00369
00370
00372
00377 int fap_count_digihops(fap_packet_t const* packet);
00378
00379
00381
00391 char* fap_check_ax25_call(char const* input, short const add_ssid0);
00392
00393
00395
00410 int fap_kiss_to_tnc2(char const* kissframe, unsigned int kissframe_len,
00411 char* tnc2frame, unsigned int* tnc2frame_len, unsigned int* tnc_id);
00412
00413
00415
00426 int fap_tnc2_to_kiss(char const* tnc2frame, unsigned int tnc2frame_len, unsigned int const tnc_id,
00427 char* kissframe, unsigned int* kissframe_len);
00428
00429
00430
00431
00432
00433
00435
00439 void fap_free(fap_packet_t* packet);
00440
00441
00442
00444
00448 void fap_init();
00449
00450
00451
00453
00457 void fap_cleanup();
00458
00459
00460 #ifdef __cplusplus
00461 }
00462 #endif
00463
00464 #endif // FAP_H