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 fap_packet_type_t* type;
00246
00248 char* orig_packet;
00250 unsigned int orig_packet_len;
00251
00253 char* header;
00255 char* body;
00257 unsigned int body_len;
00259 char* src_callsign;
00261 char* dst_callsign;
00263 char** path;
00265 unsigned int path_len;
00266
00268 double* latitude;
00270 double* longitude;
00272 fap_pos_format_t* format;
00274 double* pos_resolution;
00276 unsigned int* pos_ambiguity;
00278 char dao_datum_byte;
00279
00281 double* altitude;
00283 unsigned int* course;
00285 double* speed;
00286
00288 char symbol_table;
00290 char symbol_code;
00291
00293 short* messaging;
00295 char* destination;
00297 char* message;
00299 char* message_ack;
00301 char* message_nack;
00303 char* message_id;
00305
00311 char* comment;
00313 unsigned int comment_len;
00314
00316 char* object_or_item_name;
00318 short* alive;
00319
00321 short* gps_fix_status;
00323 unsigned int* radio_range;
00325 char* phg;
00327 time_t* timestamp;
00329 short* nmea_checksum_ok;
00330
00332 fap_wx_report_t* wx_report;
00333
00335 fap_telemetry_t* telemetry;
00336
00338 char* messagebits;
00340 char* status;
00342 unsigned int status_len;
00344 char** capabilities;
00346 unsigned int capabilities_len;
00347
00348 } fap_packet_t;
00349
00350
00351
00352
00354
00373 fap_packet_t* fap_parseaprs(char const* input, unsigned int const input_len, short const is_ax25);
00374
00375
00377
00381 void fap_explain_error(fap_error_code_t const error, char* buffer);
00382
00384
00388 void fap_mice_mbits_to_message(char const* bits, char* buffer);
00389
00391
00397 double fap_distance(double lon0, double lat0, double lon1, double lat1);
00398
00399
00401
00406 double fap_direction(double lon0, double lat0, double lon1, double lat1);
00407
00408
00410
00415 int fap_count_digihops(fap_packet_t const* packet);
00416
00417
00419
00429 char* fap_check_ax25_call(char const* input, short const add_ssid0);
00430
00431
00433
00448 int fap_kiss_to_tnc2(char const* kissframe, unsigned int kissframe_len,
00449 char* tnc2frame, unsigned int* tnc2frame_len, unsigned int* tnc_id);
00450
00451
00453
00464 int fap_tnc2_to_kiss(char const* tnc2frame, unsigned int tnc2frame_len, unsigned int const tnc_id,
00465 char* kissframe, unsigned int* kissframe_len);
00466
00467
00468
00469
00470
00472
00475 int fap_ax25_to_tnc2(char const* ax25frame, unsigned int ax25frame_len,
00476 char* tnc2frame, unsigned int* tnc2frame_len);
00477
00479
00482 int fap_tnc2_to_ax25(char const* tnc2frame, unsigned int tnc2frame_len,
00483 char* ax25frame, unsigned int* ax25frame_len);
00484
00485
00487
00491 void fap_free(fap_packet_t* packet);
00492
00493
00494
00496
00500 void fap_init();
00501
00502
00503
00505
00509 void fap_cleanup();
00510
00511
00512 #ifdef __cplusplus
00513 }
00514 #endif
00515
00516 #endif // FAP_H