00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00041 #ifndef FAP_H
00042 #define FAP_H
00043
00044
00045 #include <time.h>
00046
00047
00048 #ifdef __cplusplus
00049 extern "C" {
00050 #endif
00051
00052
00053
00055 typedef enum
00056 {
00057 fapPACKET_NO,
00058 fapPACKET_SHORT,
00059 fapPACKET_NOBODY,
00060
00061 fapSRCCALL_NOAX25,
00062 fapSRCCALL_BADCHARS,
00063
00064 fapDSTPATH_TOOMANY,
00065 fapDSTCALL_NONE,
00066 fapDSTCALL_NOAX25,
00067
00068 fapDIGICALL_NOAX25,
00069 fapDIGICALL_BADCHARS,
00070
00071 fapTIMESTAMP_INV_LOC,
00072 fapTIMESTAMP_INV_OBJ,
00073 fapTIMESTAMP_INV_STA,
00074 fapTIMESTAMP_INV_GPGGA,
00075 fapTIMESTAMP_INV_GPGLL,
00076
00077 fapPACKET_INVALID,
00078
00079 fapNMEA_INV_CVAL,
00080 fapNMEA_LARGE_EW,
00081 fapNMEA_LARGE_NS,
00082 fapNMEA_INV_SIGN,
00083 fapNMEA_INV_CKSUM,
00084
00085 fapGPRMC_FEWFIELDS,
00086 fapGPRMC_NOFIX,
00087 fapGPRMC_INV_TIME,
00088 fapGPRMC_INV_DATE,
00089 fapGPRMC_DATE_OUT,
00090
00091 fapGPGGA_FEWFIELDS,
00092 fapGPGGA_NOFIX,
00093
00094 fapGPGLL_FEWFIELDS,
00095 fapGPGLL_NOFIX,
00096
00097 fapNMEA_UNSUPP,
00098
00099 fapOBJ_SHORT,
00100 fapOBJ_INV,
00101 fapOBJ_DEC_ERR,
00102
00103 fapITEM_SHORT,
00104 fapITEM_INV,
00105 fapITEM_DEC_ERR,
00106
00107 fapLOC_SHORT,
00108 fapLOC_INV,
00109 fapLOC_LARGE,
00110 fapLOC_AMB_INV,
00111
00112 fapMICE_SHORT,
00113 fapMICE_INV,
00114 fapMICE_INV_INFO,
00115 fapMICE_AMB_LARGE,
00116 fapMICE_AMB_INV,
00117 fapMICE_AMB_ODD,
00118
00119 fapCOMP_INV,
00120 fapCOMP_SHORT,
00121
00122 fapMSG_INV,
00123
00124 fapWX_UNSUPP,
00125 fapUSER_UNSUPP,
00126
00127 fapDX_INV_SRC,
00128 fapDX_INF_FREQ,
00129 fapDX_NO_DX,
00130
00131 fapTLM_INV,
00132 fapTLM_LARGE,
00133 fapTLM_UNSUPP,
00134
00135 fapEXP_UNSUPP,
00136 fapSYM_INV_TABLE,
00137
00138 fapNOT_IMPLEMENTED,
00139 fapNMEA_NOFIELDS,
00140
00141 fapNO_APRS
00142 } fap_error_code_t;
00143
00144
00146 typedef enum
00147 {
00148 fapLOCATION,
00149 fapOBJECT,
00150 fapITEM,
00151 fapMICE,
00152 fapNMEA,
00153
00154 fapWX,
00155 fapMESSAGE,
00156 fapCAPABILITIES,
00157 fapSTATUS,
00158 fapTELEMETRY,
00159 fapTELEMETRY_MESSAGE,
00160 fapDX_SPOT,
00161
00162 fapEXPERIMENTAL
00163 } fap_packet_type_t;
00164
00165
00167 typedef enum
00168 {
00169 fapPOS_COMPRESSED,
00170 fapPOS_UNCOMPRESSED,
00171 fapPOS_MICE,
00172 fapPOS_NMEA
00173 } fap_pos_format_t;
00174
00175
00177 typedef struct
00178 {
00180 double* wind_gust;
00182 unsigned int* wind_dir;
00184 double* wind_speed;
00185
00187 double* temp;
00189 double* temp_in;
00190
00192 double* rain_1h;
00194 double* rain_24h;
00196 double* rain_midnight;
00197
00199 unsigned int* humidity;
00201 unsigned int* humidity_in;
00202
00204 double* pressure;
00206 unsigned int* luminosity;
00207
00209 double* snow_24h;
00210
00212 char* soft;
00213 } fap_wx_report_t;
00214
00215
00216
00218 typedef struct
00219 {
00221 unsigned int seq;
00223 double val1;
00225 double val2;
00227 double val3;
00229 double val4;
00231 double val5;
00232
00234 char bits[8];
00235 } fap_telemetry_t;
00236
00237
00238
00240 typedef struct
00241 {
00243 fap_error_code_t* error_code;
00245 char* error_message;
00247 fap_packet_type_t* type;
00248
00250 char* orig_packet;
00252 unsigned int orig_packet_len;
00253
00255 char* header;
00257 char* body;
00259 unsigned int body_len;
00261 char* src_callsign;
00263 char* dst_callsign;
00265 char** path;
00267 unsigned int path_len;
00268
00270 double* latitude;
00272 double* longitude;
00274 fap_pos_format_t* format;
00276 double* pos_resolution;
00278 unsigned int* pos_ambiguity;
00280 char dao_datum_byte;
00281
00283 double* altitude;
00285 unsigned int* course;
00287 double* speed;
00288
00290 char symbol_table;
00292 char symbol_code;
00293
00295 short* messaging;
00297 char* destination;
00299 char* message;
00301 char* message_ack;
00303 char* message_nack;
00305 char* message_id;
00307
00313 char* comment;
00315 unsigned int comment_len;
00316
00318 char* object_or_item_name;
00320 short* alive;
00321
00323 short* gps_fix_status;
00325 unsigned int* radio_range;
00327 char* phg;
00329 time_t* timestamp;
00331 short* nmea_checksum_ok;
00332
00334 fap_wx_report_t* wx_report;
00335
00337 fap_telemetry_t* telemetry;
00338
00340 char* messagebits;
00342 char* status;
00344 unsigned int status_len;
00346 char** capabilities;
00348 unsigned int capabilities_len;
00349
00350 } fap_packet_t;
00351
00352
00353
00354
00356
00375 fap_packet_t* fap_parseaprs(char const* input, unsigned int const input_len, short const is_ax25);
00376
00377
00379 char* fap_explain_error(fap_error_code_t const error);
00380
00382
00385 char* fap_mice_mbits_to_message(char* bits);
00386
00388
00394 double fap_distance(double lon0, double lat0, double lon1, double lat1);
00395
00396
00398
00403 double fap_direction(double lon0, double lat0, double lon1, double lat1);
00404
00405
00407
00412 int fap_count_digihops(fap_packet_t const* packet);
00413
00414
00416
00426 char* fap_check_ax25_call(char const* input, short const add_ssid0);
00427
00428
00430
00445 int fap_kiss_to_tnc2(char const* kissframe, unsigned int kissframe_len,
00446 char* tnc2frame, unsigned int* tnc2frame_len, unsigned int* tnc_id);
00447
00448
00450
00461 int fap_tnc2_to_kiss(char const* tnc2frame, unsigned int tnc2frame_len, unsigned int const tnc_id,
00462 char* kissframe, unsigned int* kissframe_len);
00463
00464
00465
00466
00467
00469
00472 int fap_ax25_to_tnc2(char const* ax25frame, unsigned int ax25frame_len,
00473 char* tnc2frame, unsigned int* tnc2frame_len);
00474
00476
00479 int fap_tnc2_to_ax25(char const* tnc2frame, unsigned int tnc2frame_len,
00480 char* ax25frame, unsigned int* ax25frame_len);
00481
00482
00484
00488 void fap_free(fap_packet_t* packet);
00489
00490
00491
00493
00497 void fap_init();
00498
00499
00500
00502
00506 void fap_cleanup();
00507
00508
00509 #ifdef __cplusplus
00510 }
00511 #endif
00512
00513 #endif // FAP_H