1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410 |
- #ifndef _GPSD_GPS_H_
- #define _GPSD_GPS_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <inttypes.h> /* stdint.h would be smaller but not all have it */
- #include <limits.h>
- #include <pthread.h> /* pacifies OpenBSD's compiler */
- #include <signal.h>
- #include <stdbool.h>
- #include <stdio.h>
- #include <sys/time.h> // for struct timespec
- #include <sys/types.h>
- #include <time.h>
- #define GPSD_API_MAJOR_VERSION 9 /* bump on incompatible changes */
- #define GPSD_API_MINOR_VERSION 0 /* bump on compatible changes */
- #define MAXCHANNELS 140 /* u-blox 9 tracks 140 signals */
- #define MAXUSERDEVS 4 /* max devices per user */
- #define GPS_PATH_MAX 128 /* for names like /dev/serial/by-id/... */
- #define DEG_NORM(deg) \
- if (0 > (deg)) {(deg) += 360;} else if (360 <= (deg)) {(deg) -= 360;};
- typedef struct timespec timespec_t;
- struct gps_fix_t {
- timespec_t time;
- int mode;
- #define MODE_NOT_SEEN 0 /* mode update not seen yet */
- #define MODE_NO_FIX 1 /* none */
- #define MODE_2D 2 /* good for latitude/longitude */
- #define MODE_3D 3 /* good for altitude/climb too */
- double ept;
- double latitude;
- double epy;
- double longitude;
- double epx;
- double altHAE;
- double altMSL;
- double epv;
- double track;
- double epd;
- double speed;
- double eps;
- double climb;
- double epc;
-
-
- double eph;
-
-
- double sep;
-
- double geoid_sep;
- double magnetic_track;
- double magnetic_var;
- double depth;
-
- struct {
- double x, y, z;
- double pAcc;
- double vx, vy, vz;
- double vAcc;
- } ecef;
-
- struct {
- double relPosN, relPosE, relPosD;
- double velN, velE, velD;
- } NED;
- char datum[40];
-
- double dgps_age;
-
- int dgps_station;
- };
- #define GLONASS_PRN_OFFSET 64
- struct gst_t {
- timespec_t utctime;
- double rms_deviation;
- double smajor_deviation;
- double sminor_deviation;
- double smajor_orientation;
- double lat_err_deviation;
- double lon_err_deviation;
- double alt_err_deviation;
- };
- #define RTCM2_WORDS_MAX 33
- #define MAXCORRECTIONS 18 /* max correction count in type 1 or 9 */
- #define MAXSTATIONS 10 /* maximum stations in almanac, type 5 */
- #define MAXHEALTH (RTCM2_WORDS_MAX-2)
- typedef uint32_t isgps30bits_t;
- #define NAVSYSTEM_GPS 0
- #define NAVSYSTEM_GLONASS 1
- #define NAVSYSTEM_GALILEO 2
- #define NAVSYSTEM_UNKNOWN 3
- struct rtcm2_t {
-
- unsigned type;
- unsigned length;
- double zcount;
- unsigned refstaid;
- unsigned seqnum;
- unsigned stathlth;
-
- union {
- struct {
- unsigned int nentries;
- struct gps_rangesat_t {
- unsigned ident;
- unsigned udre;
- unsigned iod;
- double prc;
- double rrc;
- } sat[MAXCORRECTIONS];
- } gps_ranges;
- struct {
- bool valid;
- double x, y, z;
- } ecef;
- struct {
- bool valid;
- int system;
- int sense;
- #define SENSE_INVALID 0
- #define SENSE_GLOBAL 1
- #define SENSE_LOCAL 2
- char datum[6];
- double dx, dy, dz;
- } reference;
- struct {
- unsigned int nentries;
- struct consat_t {
- unsigned ident;
- bool iodl;
- unsigned int health;
- #define HEALTH_NORMAL (0) /* Radiobeacon operation normal */
- #define HEALTH_UNMONITORED (1) /* No integrity monitor operating */
- #define HEALTH_NOINFO (2) /* No information available */
- #define HEALTH_DONOTUSE (3) /* Do not use this radiobeacon */
- int snr;
- #define SNR_BAD -1 /* not reported */
- bool health_en;
- bool new_data;
- bool los_warning;
- unsigned int tou;
- } sat[MAXHEALTH];
- } conhealth;
- struct {
- unsigned int nentries;
- struct station_t {
- double latitude, longitude;
- unsigned int range;
- double frequency;
- unsigned int health;
- unsigned int station_id;
- unsigned int bitrate;
- } station[MAXSTATIONS];
- } almanac;
- struct {
- bool status;
- bool rangeflag;
- double lat, lon;
- unsigned int range;
- } xmitter;
- struct {
- unsigned int week;
- unsigned int hour;
- unsigned int leapsecs;
- } gpstime;
- struct {
- unsigned int nentries;
- struct glonass_rangesat_t {
- unsigned ident;
- unsigned udre;
- unsigned tod;
- bool change;
- double prc;
- double rrc;
- } sat[MAXCORRECTIONS];
- } glonass_ranges;
-
- char message[(RTCM2_WORDS_MAX-2) * sizeof(isgps30bits_t)];
-
- isgps30bits_t words[RTCM2_WORDS_MAX-2];
- };
- };
- #define RTCM3_MAX_SATELLITES 64
- #define RTCM3_MAX_DESCRIPTOR 31
- #define RTCM3_MAX_ANNOUNCEMENTS 32
- struct rtcm3_rtk_hdr {
-
- unsigned int station_id;
- time_t tow;
- bool sync;
- unsigned short satcount;
- bool smoothing;
- unsigned int interval;
- };
- struct rtcm3_basic_rtk {
- unsigned char indicator;
- unsigned int channel;
- double pseudorange;
- double rangediff;
- unsigned char locktime;
- };
- struct rtcm3_extended_rtk {
- unsigned char indicator;
- unsigned int channel;
- double pseudorange;
- double rangediff;
- unsigned char locktime;
- unsigned char ambiguity;
- double CNR;
- };
- struct rtcm3_network_rtk_header {
- unsigned int network_id;
- unsigned int subnetwork_id;
- time_t time;
- bool multimesg;
- unsigned master_id;
- unsigned aux_id;
- unsigned char satcount;
- };
- struct rtcm3_correction_diff {
- unsigned char ident;
- enum {reserved, correct, widelane, uncertain} ambiguity;
- unsigned char nonsync;
- double geometric_diff;
- unsigned char iode;
- double ionospheric_diff;
- };
- struct rtcm3_t {
-
- unsigned type;
- unsigned length;
- union {
-
- struct {
- struct rtcm3_rtk_hdr header;
- struct rtcm3_1001_t {
- unsigned ident;
- struct rtcm3_basic_rtk L1;
- } rtk_data[RTCM3_MAX_SATELLITES];
- } rtcm3_1001;
- struct {
- struct rtcm3_rtk_hdr header;
- struct rtcm3_1002_t {
- unsigned ident;
- struct rtcm3_extended_rtk L1;
- } rtk_data[RTCM3_MAX_SATELLITES];
- } rtcm3_1002;
- struct rtcm3_1003_t {
- struct rtcm3_rtk_hdr header;
- struct {
- unsigned ident;
- struct rtcm3_basic_rtk L1;
- struct rtcm3_basic_rtk L2;
- } rtk_data[RTCM3_MAX_SATELLITES];
- } rtcm3_1003;
- struct rtcm3_1004_t {
- struct rtcm3_rtk_hdr header;
- struct {
- unsigned ident;
- struct rtcm3_extended_rtk L1;
- struct rtcm3_extended_rtk L2;
- } rtk_data[RTCM3_MAX_SATELLITES];
- } rtcm3_1004;
- struct rtcm3_1005_t {
- unsigned int station_id;
- int system;
- bool reference_station;
- bool single_receiver;
- double ecef_x, ecef_y, ecef_z;
- } rtcm3_1005;
- struct rtcm3_1006_t {
- unsigned int station_id;
- int system;
- bool reference_station;
- bool single_receiver;
- double ecef_x, ecef_y, ecef_z;
- double height;
- } rtcm3_1006;
- struct {
- unsigned int station_id;
- char descriptor[RTCM3_MAX_DESCRIPTOR+1];
- unsigned int setup_id;
- } rtcm3_1007;
- struct {
- unsigned int station_id;
- char descriptor[RTCM3_MAX_DESCRIPTOR+1];
- unsigned int setup_id;
- char serial[RTCM3_MAX_DESCRIPTOR+1];
- } rtcm3_1008;
- struct {
- struct rtcm3_rtk_hdr header;
- struct rtcm3_1009_t {
- unsigned ident;
- struct rtcm3_basic_rtk L1;
- } rtk_data[RTCM3_MAX_SATELLITES];
- } rtcm3_1009;
- struct {
- struct rtcm3_rtk_hdr header;
- struct rtcm3_1010_t {
- unsigned ident;
- struct rtcm3_extended_rtk L1;
- } rtk_data[RTCM3_MAX_SATELLITES];
- } rtcm3_1010;
- struct {
- struct rtcm3_rtk_hdr header;
- struct rtcm3_1011_t {
- unsigned ident;
- struct rtcm3_extended_rtk L1;
- struct rtcm3_extended_rtk L2;
- } rtk_data[RTCM3_MAX_SATELLITES];
- } rtcm3_1011;
- struct {
- struct rtcm3_rtk_hdr header;
- struct rtcm3_1012_t {
- unsigned ident;
- struct rtcm3_extended_rtk L1;
- struct rtcm3_extended_rtk L2;
- } rtk_data[RTCM3_MAX_SATELLITES];
- } rtcm3_1012;
- struct {
- unsigned int station_id;
- unsigned short mjd;
- unsigned int sod;
- unsigned char leapsecs;
- unsigned char ncount;
- struct rtcm3_1013_t {
- unsigned short id;
- bool sync;
- unsigned short interval;
- } announcements[RTCM3_MAX_ANNOUNCEMENTS];
- } rtcm3_1013;
-
- struct rtcm3_1014_t {
- unsigned int network_id;
- unsigned int subnetwork_id;
- unsigned int stationcount;
- unsigned int master_id;
- unsigned int aux_id;
- double d_lat, d_lon, d_alt;
- } rtcm3_1014;
- struct rtcm3_1015_t {
- struct rtcm3_network_rtk_header header;
- struct rtcm3_correction_diff corrections[RTCM3_MAX_SATELLITES];
- } rtcm3_1015;
- struct rtcm3_1016_t {
- struct rtcm3_network_rtk_header header;
- struct rtcm3_correction_diff corrections[RTCM3_MAX_SATELLITES];
- } rtcm3_1016;
- struct rtcm3_1017_t {
- struct rtcm3_network_rtk_header header;
- struct rtcm3_correction_diff corrections[RTCM3_MAX_SATELLITES];
- } rtcm3_1017;
-
- struct rtcm3_1019_t {
- unsigned int ident;
- unsigned int week;
- unsigned char sv_accuracy;
- enum {reserved_code, p, ca, l2c} code;
- double idot;
- unsigned char iode;
-
- unsigned int t_sub_oc;
- signed int a_sub_f2;
- signed int a_sub_f1;
- signed int a_sub_f0;
- unsigned int iodc;
- signed int C_sub_rs;
- signed int delta_sub_n;
- signed int M_sub_0;
- signed int C_sub_uc;
- unsigned int e;
- signed int C_sub_us;
- unsigned int sqrt_sub_A;
- unsigned int t_sub_oe;
- signed int C_sub_ic;
- signed int OMEGA_sub_0;
- signed int C_sub_is;
- signed int i_sub_0;
- signed int C_sub_rc;
- signed int argument_of_perigee;
- signed int omegadot;
- signed int t_sub_GD;
- unsigned char sv_health;
- bool p_data;
- bool fit_interval;
- } rtcm3_1019;
- struct rtcm3_1020_t {
- unsigned int ident;
- unsigned short channel;
-
- bool C_sub_n;
- bool health_avAilability_indicator;
- unsigned char P1;
- unsigned short t_sub_k;
- bool msb_of_B_sub_n;
- bool P2;
- bool t_sub_b;
- signed int x_sub_n_t_of_t_sub_b_prime;
- signed int x_sub_n_t_of_t_sub_b;
- signed int x_sub_n_t_of_t_sub_b_prime_prime;
- signed int y_sub_n_t_of_t_sub_b_prime;
- signed int y_sub_n_t_of_t_sub_b;
- signed int y_sub_n_t_of_t_sub_b_prime_prime;
- signed int z_sub_n_t_of_t_sub_b_prime;
- signed int z_sub_n_t_of_t_sub_b;
- signed int z_sub_n_t_of_t_sub_b_prime_prime;
- bool P3;
- signed int gamma_sub_n_of_t_sub_b;
- unsigned char MP;
- bool Ml_n;
- signed int tau_n_of_t_sub_b;
- signed int M_delta_tau_sub_n;
- unsigned int E_sub_n;
- bool MP4;
- unsigned char MF_sub_T;
- unsigned char MN_sub_T;
- unsigned char MM;
- bool additioinal_data_availability;
- unsigned int N_sup_A;
- unsigned int tau_sub_c;
- unsigned int M_N_sub_4;
- signed int M_tau_sub_GPS;
- bool M_l_sub_n;
- } rtcm3_1020;
- struct rtcm3_1029_t {
- unsigned int station_id;
- unsigned short mjd;
- unsigned int sod;
- size_t len;
- size_t unicode_units;
- unsigned char text[128];
- } rtcm3_1029;
- struct rtcm3_1033_t {
- unsigned int station_id;
- char descriptor[RTCM3_MAX_DESCRIPTOR+1];
- unsigned int setup_id;
- char serial[RTCM3_MAX_DESCRIPTOR+1];
- char receiver[RTCM3_MAX_DESCRIPTOR+1];
- char firmware[RTCM3_MAX_DESCRIPTOR+1];
- } rtcm3_1033;
- unsigned char data[1024];
- } rtcmtypes;
- };
- #define GPS_AMBIGUITY_MODULUS 299792.458 /* 1004, DF014*/
- #define GLONASS_AMBIGUITY_MODULUS 599584.916 /* 1012, DF044 */
- #define MESSAGE_INTERVAL_UNITS 0.1 /* 1013, DF047 */
- struct almanac_t
- {
- uint8_t sv;
-
- uint8_t toa;
- long l_toa;
-
- uint8_t svh;
-
- int16_t deltai;
- double d_deltai;
-
- int32_t M0;
- double d_M0;
-
- int32_t Omega0;
- double d_Omega0;
-
- int32_t omega;
- double d_omega;
-
- int16_t af0;
- double d_af0;
-
- int16_t af1;
- double d_af1;
-
- uint16_t e;
- double d_eccentricity;
-
- uint32_t sqrtA;
- double d_sqrtA;
-
- int16_t Omegad;
- double d_Omegad;
- };
- struct subframe_t {
-
- uint8_t subframe_num;
-
- uint8_t data_id;
-
- uint8_t pageid;
-
- uint8_t tSVID;
-
- uint32_t TOW17;
- long l_TOW17;
-
- bool integrity;
-
- bool alert;
-
- bool antispoof;
- int is_almanac;
- union {
-
- struct {
-
- uint16_t WN;
-
- uint16_t IODC;
-
- uint16_t toc;
- long l_toc;
-
- uint8_t l2;
-
- uint8_t l2p;
-
- unsigned int ura;
-
- unsigned int hlth;
-
- int32_t af0;
- double d_af0;
-
- int16_t af1;
- double d_af1;
-
- int8_t af2;
- double d_af2;
-
- int8_t Tgd;
- double d_Tgd;
- } sub1;
-
- struct {
-
- uint8_t IODE;
-
- uint8_t AODO;
- uint16_t u_AODO;
-
- uint8_t fit;
-
- uint16_t toe;
- long l_toe;
-
- int16_t Crs;
- double d_Crs;
-
- int16_t Cus;
- double d_Cus;
-
- int16_t Cuc;
- double d_Cuc;
-
- int16_t deltan;
- double d_deltan;
-
- int32_t M0;
- double d_M0;
-
- uint32_t e;
- double d_eccentricity;
-
- uint32_t sqrtA;
- double d_sqrtA;
- } sub2;
-
- struct {
-
- uint8_t IODE;
-
- int16_t IDOT;
- double d_IDOT;
-
- int16_t Cic;
- double d_Cic;
-
- int16_t Cis;
- double d_Cis;
-
- int16_t Crc;
- double d_Crc;
-
- int32_t i0;
- double d_i0;
-
- int32_t Omega0;
- double d_Omega0;
-
- int32_t omega;
- double d_omega;
-
- int32_t Omegad;
- double d_Omegad;
- } sub3;
- struct {
- struct almanac_t almanac;
- } sub4;
-
- struct {
-
-
- char ERD[33];
-
- unsigned char ai;
- } sub4_13;
-
- struct {
- char str[24];
- } sub4_17;
-
- struct {
-
-
- int32_t A0;
- double d_A0;
-
- int32_t A1;
- double d_A1;
-
-
- int8_t alpha0;
- double d_alpha0;
-
- int8_t alpha1;
- double d_alpha1;
-
- int8_t alpha2;
- double d_alpha2;
-
- int8_t alpha3;
- double d_alpha3;
-
-
- int8_t beta0;
- double d_beta0;
-
- int8_t beta1;
- double d_beta1;
-
- int8_t beta2;
- double d_beta2;
-
- int8_t beta3;
- double d_beta3;
-
- int8_t leap;
-
- int8_t lsf;
-
- uint8_t tot;
- time_t t_tot;
-
- uint8_t WNt;
-
- uint8_t WNlsf;
-
- uint8_t DN;
- } sub4_18;
-
- struct {
-
- unsigned char svf[33];
-
- uint8_t svhx[8];
- } sub4_25;
- struct {
- struct almanac_t almanac;
- } sub5;
- struct {
-
- uint8_t toa;
- long l_toa;
-
- uint8_t WNa;
-
- uint8_t sv[25];
- } sub5_25;
- };
- };
- typedef uint64_t gps_mask_t;
- #define AIS_AUXILIARY_MMSI(n) ((n) / 10000000 == 98)
- #define AIS_LON3_NOT_AVAILABLE 181000
- #define AIS_LAT3_NOT_AVAILABLE 91000
- #define AIS_LATLON3_DIV 60000.0
- #define AIS_LON4_NOT_AVAILABLE 1810000
- #define AIS_LAT4_NOT_AVAILABLE 910000
- #define AIS_LATLON4_DIV 600000.0
- struct route_info {
- unsigned int linkage;
- unsigned int sender;
- unsigned int rtype;
- unsigned int month;
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- unsigned int duration;
- int waycount;
- struct waypoint_t {
- signed int lon;
- signed int lat;
- } waypoints[16];
- };
- struct ais_t
- {
- unsigned int type;
- unsigned int repeat;
- unsigned int mmsi;
- union {
-
- struct {
- unsigned int status;
- signed turn;
- #define AIS_TURN_HARD_LEFT -127
- #define AIS_TURN_HARD_RIGHT 127
- #define AIS_TURN_NOT_AVAILABLE 128
- unsigned int speed;
- #define AIS_SPEED_NOT_AVAILABLE 1023
- #define AIS_SPEED_FAST_MOVER 1022 /* >= 102.2 knots */
- bool accuracy;
- #define AIS_LATLON_DIV 600000.0
- int lon;
- #define AIS_LON_NOT_AVAILABLE 0x6791AC0
- int lat;
- #define AIS_LAT_NOT_AVAILABLE 0x3412140
- unsigned int course;
- #define AIS_COURSE_NOT_AVAILABLE 3600
- unsigned int heading;
- #define AIS_HEADING_NOT_AVAILABLE 511
-
- unsigned int second;
- #define AIS_SEC_NOT_AVAILABLE 60
- #define AIS_SEC_MANUAL 61
- #define AIS_SEC_ESTIMATED 62
- #define AIS_SEC_INOPERATIVE 63
- unsigned int maneuver;
-
- bool raim;
- unsigned int radio;
- } type1;
-
- struct {
- unsigned int year;
- #define AIS_YEAR_NOT_AVAILABLE 0
- unsigned int month;
- #define AIS_MONTH_NOT_AVAILABLE 0
- unsigned int day;
- #define AIS_DAY_NOT_AVAILABLE 0
- unsigned int hour;
- #define AIS_HOUR_NOT_AVAILABLE 24
- unsigned int minute;
- #define AIS_MINUTE_NOT_AVAILABLE 60
- unsigned int second;
- #define AIS_SECOND_NOT_AVAILABLE 60
- bool accuracy;
- int lon;
- int lat;
- unsigned int epfd;
-
- bool raim;
- unsigned int radio;
- } type4;
-
- struct {
- unsigned int ais_version;
- unsigned int imo;
-
- char callsign[7+1];
- #define AIS_SHIPNAME_MAXLEN 20
-
- char shipname[AIS_SHIPNAME_MAXLEN+1];
- unsigned int shiptype;
- unsigned int to_bow;
- unsigned int to_stern;
- unsigned int to_port;
- unsigned int to_starboard;
- unsigned int epfd;
- unsigned int month;
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- unsigned int draught;
- char destination[20+1];
- unsigned int dte;
-
- } type5;
-
- struct {
- unsigned int seqno;
- unsigned int dest_mmsi;
- bool retransmit;
-
- unsigned int dac;
- unsigned int fid;
- bool structured;
- #define AIS_TYPE6_BINARY_MAX 920 /* 920 bits */
- size_t bitcount;
- union {
-
- char bitdata[(AIS_TYPE6_BINARY_MAX + 7) / 8];
-
- struct {
- char country[2+1];
- char locode[3+1];
- char section[5+1];
- char terminal[5+1];
- char hectometre[5+1];
- unsigned int month;
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- unsigned int tugs;
- unsigned int airdraught;
- } dac200fid21;
-
- struct {
- char country[2+1];
- char locode[3+1];
- char section[5+1];
- char terminal[5+1];
- char hectometre[5+1];
- unsigned int month;
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- unsigned int status;
- #define DAC200FID22_STATUS_OPERATIONAL 0
- #define DAC200FID22_STATUS_LIMITED 1
- #define DAC200FID22_STATUS_OUT_OF_ORDER 2
- #define DAC200FID22_STATUS_NOT_AVAILABLE 0
- } dac200fid22;
-
- struct {
- unsigned int crew;
- unsigned int passengers;
- unsigned int personnel;
- #define DAC200FID55_COUNT_NOT_AVAILABLE 255
- } dac200fid55;
-
- struct {
- unsigned int ana_int;
- unsigned int ana_ext1;
- unsigned int ana_ext2;
- unsigned int racon;
- unsigned int light;
- bool alarm;
- unsigned int stat_ext;
- bool off_pos;
- } dac235fid10;
-
- struct {
- char lastport[5+1];
- unsigned int lmonth;
- unsigned int lday;
- unsigned int lhour;
- unsigned int lminute;
- char nextport[5+1];
- unsigned int nmonth;
- unsigned int nday;
- unsigned int nhour;
- unsigned int nminute;
- char dangerous[20+1];
- char imdcat[4+1];
- unsigned int unid;
- unsigned int amount;
- unsigned int unit;
- } dac1fid12;
-
- struct {
- unsigned int airdraught;
- } dac1fid15;
-
- struct {
- unsigned persons;
- } dac1fid16;
-
- struct {
- unsigned int linkage;
- unsigned int month;
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- char portname[20+1];
- char destination[5+1];
- signed int lon;
- signed int lat;
- } dac1fid18;
-
- struct {
- unsigned int linkage;
- unsigned int berth_length;
- unsigned int berth_depth;
- unsigned int position;
- unsigned int month;
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- unsigned int availability;
- unsigned int agent;
- unsigned int fuel;
- unsigned int chandler;
- unsigned int stevedore;
- unsigned int electrical;
- unsigned int water;
- unsigned int customs;
- unsigned int cartage;
- unsigned int crane;
- unsigned int lift;
- unsigned int medical;
- unsigned int navrepair;
- unsigned int provisions;
- unsigned int shiprepair;
- unsigned int surveyor;
- unsigned int steam;
- unsigned int tugs;
- unsigned int solidwaste;
- unsigned int liquidwaste;
- unsigned int hazardouswaste;
- unsigned int ballast;
- unsigned int additional;
- unsigned int regional1;
- unsigned int regional2;
- unsigned int future1;
- unsigned int future2;
- char berth_name[20+1];
- signed int berth_lon;
- signed int berth_lat;
- } dac1fid20;
-
-
- struct {
- bool wmo;
- union {
- struct {
- char location[20+1];
- signed int lon;
- signed int lat;
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- bool vislimit;
- unsigned int visibility;
- #define DAC1FID21_VISIBILITY_NOT_AVAILABLE 127
- #define DAC1FID21_VISIBILITY_SCALE 10.0
- unsigned humidity;
- unsigned int wspeed;
- unsigned int wgust;
- #define DAC1FID21_WSPEED_NOT_AVAILABLE 127
- unsigned int wdir;
- #define DAC1FID21_WDIR_NOT_AVAILABLE 360
- unsigned int pressure;
- #define DAC1FID21_NONWMO_PRESSURE_NOT_AVAILABLE 403
- #define DAC1FID21_NONWMO_PRESSURE_HIGH 402 /* > 1200hPa */
- #define DAC1FID21_NONWMO_PRESSURE_OFFSET 400 /* N/A */
- unsigned int pressuretend;
- int airtemp;
- #define DAC1FID21_AIRTEMP_NOT_AVAILABLE -1024
- #define DAC1FID21_AIRTEMP_SCALE 10.0
- unsigned int watertemp;
- #define DAC1FID21_WATERTEMP_NOT_AVAILABLE 501
- #define DAC1FID21_WATERTEMP_SCALE 10.0
- unsigned int waveperiod;
- #define DAC1FID21_WAVEPERIOD_NOT_AVAILABLE 63
- unsigned int wavedir;
- #define DAC1FID21_WAVEDIR_NOT_AVAILABLE 360
- unsigned int swellheight;
- unsigned int swellperiod;
- unsigned int swelldir;
- } nonwmo_obs;
- struct {
- signed int lon;
- signed int lat;
- unsigned int month;
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- unsigned int course;
- unsigned int speed;
- #define DAC1FID21_SOG_NOT_AVAILABLE 31
- #define DAC1FID21_SOG_HIGH_SPEED 30
- #define DAC1FID21_SOG_SCALE 2.0
- unsigned int heading;
- #define DAC1FID21_HDG_NOT_AVAILABLE 127
- #define DAC1FID21_HDG_SCALE 5.0
- unsigned int pressure;
- #define DAC1FID21_WMO_PRESSURE_SCALE 10
- #define DAC1FID21_WMO_PRESSURE_OFFSET 90.0
- unsigned int pdelta;
- #define DAC1FID21_PDELTA_SCALE 10
- #define DAC1FID21_PDELTA_OFFSET 50.0
- unsigned int ptend;
- unsigned int twinddir;
- #define DAC1FID21_TWINDDIR_NOT_AVAILABLE 127
- unsigned int twindspeed;
- #define DAC1FID21_TWINDSPEED_SCALE 2
- #define DAC1FID21_RWINDSPEED_NOT_AVAILABLE 255
- unsigned int rwinddir;
- #define DAC1FID21_RWINDDIR_NOT_AVAILABLE 127
- unsigned int rwindspeed;
- #define DAC1FID21_RWINDSPEED_SCALE 2
- #define DAC1FID21_RWINDSPEED_NOT_AVAILABLE 255
- unsigned int mgustspeed;
- #define DAC1FID21_MGUSTSPEED_SCALE 2
- #define DAC1FID21_MGUSTSPEED_NOT_AVAILABLE 255
- unsigned int mgustdir;
- #define DAC1FID21_MGUSTDIR_NOT_AVAILABLE 127
- unsigned int airtemp;
- #define DAC1FID21_AIRTEMP_OFFSET 223
- unsigned humidity;
- #define DAC1FID21_HUMIDITY_NOT_VAILABLE 127
-
- } wmo_obs;
- };
- } dac1fid21;
-
-
- struct {
- unsigned int unit;
- unsigned int amount;
- int ncargos;
- struct cargo_t {
- unsigned int code;
- unsigned int subtype;
- } cargos[28];
- } dac1fid25;
-
- struct route_info dac1fid28;
-
- struct {
- unsigned int linkage;
- #define AIS_DAC1FID30_TEXT_MAX 154 /* 920 bits of six-bit, plus NUL */
- char text[AIS_DAC1FID30_TEXT_MAX];
- } dac1fid30;
-
- struct {
- unsigned int month;
- unsigned int day;
- signed int ntidals;
- struct tidal_t {
- signed int lon;
- signed int lat;
- unsigned int from_hour;
- unsigned int from_min;
- unsigned int to_hour;
- unsigned int to_min;
- #define DAC1FID32_CDIR_NOT_AVAILABLE 360
- unsigned int cdir;
- #define DAC1FID32_CSPEED_NOT_AVAILABLE 127
- unsigned int cspeed;
- } tidals[3];
- } dac1fid32;
- };
- } type6;
-
- struct {
- unsigned int mmsi1;
- unsigned int seqno1;
- unsigned int mmsi2;
- unsigned int seqno2;
- unsigned int mmsi3;
- unsigned int seqno3;
- unsigned int mmsi4;
- unsigned int seqno4;
-
- } type7;
-
- struct {
- unsigned int dac;
- unsigned int fid;
- #define AIS_TYPE8_BINARY_MAX 952 /* 952 bits */
- size_t bitcount;
- bool structured;
- union {
-
- char bitdata[(AIS_TYPE8_BINARY_MAX + 7) / 8];
-
- struct {
- char vin[8+1];
- unsigned int length;
- unsigned int beam;
- unsigned int shiptype;
- unsigned int hazard;
- #define DAC200FID10_HAZARD_MAX 5
- unsigned int draught;
- unsigned int loaded;
- bool speed_q;
- bool course_q;
- bool heading_q;
- } dac200fid10;
-
- struct {
- unsigned int start_year;
- unsigned int start_month;
- unsigned int start_day;
- unsigned int end_year;
- unsigned int end_month;
- unsigned int end_day;
- unsigned int start_hour;
- unsigned int start_minute;
- unsigned int end_hour;
- unsigned int end_minute;
- signed int start_lon;
- signed int start_lat;
- signed int end_lon;
- signed int end_lat;
- unsigned int type;
- #define DAC200FID23_TYPE_UNKNOWN 0
- signed int min;
- #define DAC200FID23_MIN_UNKNOWN 255
- signed int max;
- #define DAC200FID23_MAX_UNKNOWN 255
- unsigned int intensity;
- #define DAC200FID23_CLASS_UNKNOWN 0
- unsigned int wind;
- #define DAC200FID23_WIND_UNKNOWN 0
- } dac200fid23;
- struct {
- char country[2+1];
- signed int ngauges;
- struct gauge_t {
- unsigned int id;
- #define DAC200FID24_GAUGE_ID_UNKNOWN 0
- signed int level;
- #define DAC200FID24_GAUGE_LEVEL_UNKNOWN 0
- } gauges[4];
- } dac200fid24;
- struct {
- signed int lon;
- signed int lat;
- unsigned int form;
- #define DAC200FID40_FORM_UNKNOWN 0
- unsigned int facing;
- #define DAC200FID40_FACING_UNKNOWN 0
- unsigned int direction;
- #define DAC200FID40_DIRECTION_UNKNOWN 0
- unsigned int status;
- #define DAC200FID40_STATUS_UNKNOWN 0
- } dac200fid40;
-
- struct {
- #define DAC1FID11_LATLON_SCALE 1000
- int lon;
- #define DAC1FID11_LON_NOT_AVAILABLE 0xFFFFFF
- int lat;
- #define DAC1FID11_LAT_NOT_AVAILABLE 0x7FFFFF
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- unsigned int wspeed;
- unsigned int wgust;
- #define DAC1FID11_WSPEED_NOT_AVAILABLE 127
- unsigned int wdir;
- unsigned int wgustdir;
- #define DAC1FID11_WDIR_NOT_AVAILABLE 511
- unsigned int airtemp;
- #define DAC1FID11_AIRTEMP_NOT_AVAILABLE 2047
- #define DAC1FID11_AIRTEMP_OFFSET 600
- #define DAC1FID11_AIRTEMP_DIV 10.0
- unsigned int humidity;
- #define DAC1FID11_HUMIDITY_NOT_AVAILABLE 127
- unsigned int dewpoint;
- #define DAC1FID11_DEWPOINT_NOT_AVAILABLE 1023
- #define DAC1FID11_DEWPOINT_OFFSET 200
- #define DAC1FID11_DEWPOINT_DIV 10.0
- unsigned int pressure;
- #define DAC1FID11_PRESSURE_NOT_AVAILABLE 511
- #define DAC1FID11_PRESSURE_OFFSET -800
- unsigned int pressuretend;
- #define DAC1FID11_PRESSURETREND_NOT_AVAILABLE 3
- unsigned int visibility;
- #define DAC1FID11_VISIBILITY_NOT_AVAILABLE 255
- #define DAC1FID11_VISIBILITY_DIV 10.0
- int waterlevel;
- #define DAC1FID11_WATERLEVEL_NOT_AVAILABLE 511
- #define DAC1FID11_WATERLEVEL_OFFSET 100
- #define DAC1FID11_WATERLEVEL_DIV 10.0
- unsigned int leveltrend;
- #define DAC1FID11_WATERLEVELTREND_NOT_AVAILABLE 3
- unsigned int cspeed;
- #define DAC1FID11_CSPEED_NOT_AVAILABLE 255
- #define DAC1FID11_CSPEED_DIV 10.0
- unsigned int cdir;
- #define DAC1FID11_CDIR_NOT_AVAILABLE 511
- unsigned int cspeed2;
- unsigned int cdir2;
- unsigned int cdepth2;
- #define DAC1FID11_CDEPTH_NOT_AVAILABLE 31
- unsigned int cspeed3;
- unsigned int cdir3;
- unsigned int cdepth3;
- unsigned int waveheight;
- #define DAC1FID11_WAVEHEIGHT_NOT_AVAILABLE 255
- #define DAC1FID11_WAVEHEIGHT_DIV 10.0
- unsigned int waveperiod;
- #define DAC1FID11_WAVEPERIOD_NOT_AVAILABLE 63
- unsigned int wavedir;
- #define DAC1FID11_WAVEDIR_NOT_AVAILABLE 511
- unsigned int swellheight;
- unsigned int swellperiod;
- unsigned int swelldir;
- unsigned int seastate;
- #define DAC1FID11_SEASTATE_NOT_AVAILABLE 15
- unsigned int watertemp;
- #define DAC1FID11_WATERTEMP_NOT_AVAILABLE 1023
- #define DAC1FID11_WATERTEMP_OFFSET 100
- #define DAC1FID11_WATERTEMP_DIV 10.0
- unsigned int preciptype;
- #define DAC1FID11_PRECIPTYPE_NOT_AVAILABLE 7
- unsigned int salinity;
- #define DAC1FID11_SALINITY_NOT_AVAILABLE 511
- #define DAC1FID11_SALINITY_DIV 10.0
- unsigned int ice;
- #define DAC1FID11_ICE_NOT_AVAILABLE 3
- } dac1fid11;
-
- struct {
- char reason[20+1];
- char closefrom[20+1];
- char closeto[20+1];
- unsigned int radius;
- #define AIS_DAC1FID13_RADIUS_NOT_AVAILABLE 10001
- unsigned int extunit;
- #define AIS_DAC1FID13_EXTUNIT_NOT_AVAILABLE 0
- unsigned int fday;
- unsigned int fmonth;
- unsigned int fhour;
- unsigned int fminute;
- unsigned int tday;
- unsigned int tmonth;
- unsigned int thour;
- unsigned int tminute;
- } dac1fid13;
-
- struct {
- unsigned int airdraught;
- } dac1fid15;
-
- struct {
- unsigned persons;
- } dac1fid16;
-
- struct {
- signed int ntargets;
- struct target_t {
- #define DAC1FID17_IDTYPE_MMSI 0
- #define DAC1FID17_IDTYPE_IMO 1
- #define DAC1FID17_IDTYPE_CALLSIGN 2
- #define DAC1FID17_IDTYPE_OTHER 3
- unsigned int idtype;
- union target_id {
- unsigned int mmsi;
- unsigned int imo;
- #define DAC1FID17_ID_LENGTH 7
-
- char callsign[DAC1FID17_ID_LENGTH+1];
- char other[DAC1FID17_ID_LENGTH+1];
- } id;
- signed int lat;
- signed int lon;
- #define DAC1FID17_COURSE_NOT_AVAILABLE 360
- unsigned int course;
- unsigned int second;
- #define DAC1FID17_SPEED_NOT_AVAILABLE 255
- unsigned int speed;
- } targets[4];
- } dac1fid17;
-
- struct {
- unsigned int linkage;
- char station[20+1];
- signed int lon;
- signed int lat;
- unsigned int status;
- unsigned int signal;
- unsigned int hour;
- unsigned int minute;
- unsigned int nextsignal;
- } dac1fid19;
-
- struct route_info dac1fid27;
-
- struct {
- unsigned int linkage;
- #define AIS_DAC1FID29_TEXT_MAX 162 /* 920 bits of six-bit, plus NUL */
- char text[AIS_DAC1FID29_TEXT_MAX];
- } dac1fid29;
-
- struct {
- bool accuracy;
- #define DAC1FID31_LATLON_SCALE 1000
- int lon;
- #define DAC1FID31_LON_NOT_AVAILABLE (181*60*DAC1FID31_LATLON_SCALE)
- int lat;
- #define DAC1FID31_LAT_NOT_AVAILABLE (91*60*DAC1FID31_LATLON_SCALE)
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- unsigned int wspeed;
- unsigned int wgust;
- #define DAC1FID31_WIND_HIGH 126
- #define DAC1FID31_WIND_NOT_AVAILABLE 127
- unsigned int wdir;
- unsigned int wgustdir;
- #define DAC1FID31_DIR_NOT_AVAILABLE 360
- int airtemp;
- #define DAC1FID31_AIRTEMP_NOT_AVAILABLE -1024
- #define DAC1FID31_AIRTEMP_DIV 10.0
- unsigned int humidity;
- #define DAC1FID31_HUMIDITY_NOT_AVAILABLE 101
- int dewpoint;
- #define DAC1FID31_DEWPOINT_NOT_AVAILABLE 501
- #define DAC1FID31_DEWPOINT_DIV 10.0
- unsigned int pressure;
- #define DAC1FID31_PRESSURE_NOT_AVAILABLE 511
- #define DAC1FID31_PRESSURE_HIGH 402
- #define DAC1FID31_PRESSURE_OFFSET -799
- unsigned int pressuretend;
- #define DAC1FID31_PRESSURETEND_NOT_AVAILABLE 3
- bool visgreater;
- unsigned int visibility;
- #define DAC1FID31_VISIBILITY_NOT_AVAILABLE 127
- #define DAC1FID31_VISIBILITY_DIV 10.0
- int waterlevel;
- #define DAC1FID31_WATERLEVEL_NOT_AVAILABLE 4001
- #define DAC1FID31_WATERLEVEL_OFFSET 1000
- #define DAC1FID31_WATERLEVEL_DIV 100.0
- unsigned int leveltrend;
- #define DAC1FID31_WATERLEVELTREND_NOT_AVAILABLE 3
- unsigned int cspeed;
- #define DAC1FID31_CSPEED_NOT_AVAILABLE 255
- #define DAC1FID31_CSPEED_DIV 10.0
- unsigned int cdir;
- unsigned int cspeed2;
- unsigned int cdir2;
- unsigned int cdepth2;
- #define DAC1FID31_CDEPTH_NOT_AVAILABLE 301
- #define DAC1FID31_CDEPTH_SCALE 10.0
- unsigned int cspeed3;
- unsigned int cdir3;
- unsigned int cdepth3;
- unsigned int waveheight;
- #define DAC1FID31_HEIGHT_NOT_AVAILABLE 31
- #define DAC1FID31_HEIGHT_DIV 10.0
- unsigned int waveperiod;
- #define DAC1FID31_PERIOD_NOT_AVAILABLE 63
- unsigned int wavedir;
- unsigned int swellheight;
- unsigned int swellperiod;
- unsigned int swelldir;
- unsigned int seastate;
- #define DAC1FID31_SEASTATE_NOT_AVAILABLE 15
- int watertemp;
- #define DAC1FID31_WATERTEMP_NOT_AVAILABLE 601
- #define DAC1FID31_WATERTEMP_DIV 10.0
- unsigned int preciptype;
- #define DAC1FID31_PRECIPTYPE_NOT_AVAILABLE 7
- unsigned int salinity;
- #define DAC1FID31_SALINITY_NOT_AVAILABLE 510
- #define DAC1FID31_SALINITY_DIV 10.0
- unsigned int ice;
- #define DAC1FID31_ICE_NOT_AVAILABLE 3
- } dac1fid31;
- };
- } type8;
-
- struct {
- unsigned int alt;
- #define AIS_ALT_NOT_AVAILABLE 4095
- #define AIS_ALT_HIGH 4094 /* 4094 meters or higher */
- unsigned int speed;
- #define AIS_SAR_SPEED_NOT_AVAILABLE 1023
- #define AIS_SAR_FAST_MOVER 1022
- bool accuracy;
- int lon;
- int lat;
- unsigned int course;
-
- unsigned int second;
- unsigned int regional;
- unsigned int dte;
-
- bool assigned;
- bool raim;
- unsigned int radio;
- } type9;
-
- struct {
-
- unsigned int dest_mmsi;
-
- } type10;
-
- struct {
- unsigned int seqno;
- unsigned int dest_mmsi;
- bool retransmit;
-
- #define AIS_TYPE12_TEXT_MAX 157 /* 936 bits of six-bit, plus NUL */
- char text[AIS_TYPE12_TEXT_MAX];
- } type12;
-
- struct {
-
- #define AIS_TYPE14_TEXT_MAX 161 /* 952 bits of six-bit, plus NUL */
- char text[AIS_TYPE14_TEXT_MAX];
- } type14;
-
- struct {
-
- unsigned int mmsi1;
- unsigned int type1_1;
- unsigned int offset1_1;
-
- unsigned int type1_2;
- unsigned int offset1_2;
-
- unsigned int mmsi2;
- unsigned int type2_1;
- unsigned int offset2_1;
-
- } type15;
-
- struct {
-
- unsigned int mmsi1;
- unsigned int offset1;
- unsigned int increment1;
- unsigned int mmsi2;
- unsigned int offset2;
- unsigned int increment2;
- } type16;
-
- struct {
-
- #define AIS_GNSS_LATLON_DIV 600.0
- int lon;
- int lat;
-
- #define AIS_TYPE17_BINARY_MAX 736 /* 920 bits */
- size_t bitcount;
- char bitdata[(AIS_TYPE17_BINARY_MAX + 7) / 8];
- } type17;
-
- struct {
- unsigned int reserved;
- unsigned int speed;
- bool accuracy;
- int lon;
- #define AIS_GNS_LON_NOT_AVAILABLE 0x1a838
- int lat;
- #define AIS_GNS_LAT_NOT_AVAILABLE 0xd548
- unsigned int course;
- unsigned int heading;
-
- unsigned int second;
- unsigned int regional;
- bool cs;
- bool display;
- bool dsc;
- bool band;
- bool msg22;
- bool assigned;
- bool raim;
- unsigned int radio;
- } type18;
-
- struct {
- unsigned int reserved;
- unsigned int speed;
- bool accuracy;
- int lon;
- int lat;
- unsigned int course;
- unsigned int heading;
-
- unsigned int second;
- unsigned int regional;
-
- char shipname[AIS_SHIPNAME_MAXLEN+1];
- unsigned int shiptype;
- unsigned int to_bow;
- unsigned int to_stern;
- unsigned int to_port;
- unsigned int to_starboard;
- unsigned int epfd;
- bool raim;
- unsigned int dte;
- bool assigned;
-
- } type19;
-
- struct {
-
- unsigned int offset1;
- unsigned int number1;
- unsigned int timeout1;
- unsigned int increment1;
- unsigned int offset2;
- unsigned int number2;
- unsigned int timeout2;
- unsigned int increment2;
- unsigned int offset3;
- unsigned int number3;
- unsigned int timeout3;
- unsigned int increment3;
- unsigned int offset4;
- unsigned int number4;
- unsigned int timeout4;
- unsigned int increment4;
- } type20;
-
- struct {
- unsigned int aid_type;
- char name[35];
- bool accuracy;
- int lon;
- int lat;
- unsigned int to_bow;
- unsigned int to_stern;
- unsigned int to_port;
- unsigned int to_starboard;
- unsigned int epfd;
-
- unsigned int second;
- bool off_position;
- unsigned int regional;
- bool raim;
- bool virtual_aid;
- bool assigned;
-
- } type21;
-
- struct {
-
- unsigned int channel_a;
- unsigned int channel_b;
- unsigned int txrx;
- bool power;
- #define AIS_CHANNEL_LATLON_DIV 600.0
- union {
- struct {
- int ne_lon;
- int ne_lat;
- int sw_lon;
- int sw_lat;
- } area;
- struct {
- unsigned int dest1;
- unsigned int dest2;
- } mmsi;
- };
- bool addressed;
- bool band_a;
- bool band_b;
- unsigned int zonesize;
- } type22;
-
- struct {
- int ne_lon;
- int ne_lat;
- int sw_lon;
- int sw_lat;
-
- unsigned int stationtype;
- unsigned int shiptype;
-
- unsigned int txrx;
- unsigned int interval;
- unsigned int quiet;
-
- } type23;
-
- struct {
- char shipname[AIS_SHIPNAME_MAXLEN+1];
- enum {
- both,
- part_a,
- part_b,
- } part;
- unsigned int shiptype;
- char vendorid[8];
- unsigned int model;
- unsigned int serial;
- char callsign[8];
- union {
- unsigned int mothership_mmsi;
- struct {
- unsigned int to_bow;
- unsigned int to_stern;
- unsigned int to_port;
- unsigned int to_starboard;
- } dim;
- };
- } type24;
-
- struct {
- bool addressed;
- bool structured;
- unsigned int dest_mmsi;
- unsigned int app_id;
- #define AIS_TYPE25_BINARY_MAX 128 /* Up to 128 bits */
- size_t bitcount;
- char bitdata[(AIS_TYPE25_BINARY_MAX + 7) / 8];
- } type25;
-
- struct {
- bool addressed;
- bool structured;
- unsigned int dest_mmsi;
- unsigned int app_id;
- #define AIS_TYPE26_BINARY_MAX 1004 /* Up to 128 bits */
- size_t bitcount;
- char bitdata[(AIS_TYPE26_BINARY_MAX + 7) / 8];
- unsigned int radio;
- } type26;
-
- struct {
- bool accuracy;
- bool raim;
- unsigned int status;
- #define AIS_LONGRANGE_LATLON_DIV 600.0
- int lon;
- #define AIS_LONGRANGE_LON_NOT_AVAILABLE 0x1a838
- int lat;
- #define AIS_LONGRANGE_LAT_NOT_AVAILABLE 0xd548
- unsigned int speed;
- #define AIS_LONGRANGE_SPEED_NOT_AVAILABLE 63
- unsigned int course;
- #define AIS_LONGRANGE_COURSE_NOT_AVAILABLE 511
- bool gnss;
- } type27;
- };
- };
- struct satellite_t {
-
- double ss;
- bool used;
-
- short PRN;
- double elevation;
- double azimuth;
-
- unsigned char gnssid;
- #define GNSSID_GPS 0
- #define GNSSID_SBAS 1
- #define GNSSID_GAL 2
- #define GNSSID_BD 3
- #define GNSSID_IMES 4
- #define GNSSID_QZSS 5
- #define GNSSID_GLO 6
- #define GNSSID_IRNSS 7 /* Not defined by u-blox */
- #define GNSSID_CNT 8 /* count for array size */
-
- unsigned char svid;
-
- unsigned char sigid;
- signed char freqid;
- unsigned char health;
- #define SAT_HEALTH_UNK 0
- #define SAT_HEALTH_OK 1
- #define SAT_HEALTH_BAD 2
- };
- struct attitude_t {
- timespec_t mtime;
- double acc_len;
- double acc_x;
- double acc_y;
- double acc_z;
- double depth;
- double dip;
- double gyro_x;
- double gyro_y;
- double heading;
- double mag_len;
- double mag_x;
- double mag_y;
- double mag_z;
- double pitch;
- double roll;
- double temp;
- double yaw;
-
- char mag_st;
- char pitch_st;
- char roll_st;
- char yaw_st;
- };
- struct navdata_t {
- unsigned int version;
- double compass_heading;
- double compass_deviation;
- double compass_variation;
- double air_temp;
- double air_pressure;
- double water_temp;
- double depth;
- double depth_offset;
- double wind_speed;
- double wind_dir;
- double crosstrack_error;
- unsigned int compass_status;
- unsigned int log_cumulative;
- unsigned int log_trip;
- unsigned int crosstrack_status;
- };
- struct dop_t {
-
- double xdop, ydop, pdop, hdop, vdop, tdop, gdop;
- };
- struct rawdata_t {
-
- timespec_t mtime;
- struct meas_t {
-
- unsigned char gnssid;
-
- unsigned char svid;
-
- unsigned char sigid;
-
- unsigned char snr;
- unsigned char freqid;
- unsigned char lli;
- char obs_code[4];
-
- double codephase;
- double carrierphase;
- double pseudorange;
- double deltarange;
- double doppler;
- #define LOCKMAX 64500 /* locktime capped at 64500 */
- unsigned locktime;
- double l2c;
- double c2c;
- unsigned satstat;
- #define SAT_ACQUIRED 0x01 /* satellite acquired */
- #define SAT_CODE_TRACK 0x02 /* code-tracking loop acquired */
- #define SAT_CARR_TRACK 0x04 /* carrier-tracking loop acquired */
- #define SAT_DATA_SYNC 0x08 /* data-bit synchronization done */
- #define SAT_FRAME_SYNC 0x10 /* frame synchronization done */
- #define SAT_EPHEMERIS 0x20 /* ephemeris collected */
- #define SAT_FIX_USED 0x40 /* used for position fix */
- } meas[MAXCHANNELS];
- };
- struct version_t {
- char release[64];
- char rev[64];
- int proto_major, proto_minor;
- char remote[GPS_PATH_MAX];
- };
- #define HEXDATA_MAX 512 /* hex encoded command buffer, max */
- struct devconfig_t {
- char path[GPS_PATH_MAX];
- int flags;
- #define SEEN_GPS 0x01
- #define SEEN_RTCM2 0x02
- #define SEEN_RTCM3 0x04
- #define SEEN_AIS 0x08
- char driver[64];
-
- char subtype[128];
- char subtype1[128];
-
- char hexdata[HEXDATA_MAX];
- timespec_t activated;
- unsigned int baudrate, stopbits;
- char parity;
- timespec_t cycle, mincycle;
- int driver_mode;
- };
- struct gps_policy_t {
- bool watcher;
- bool json;
- bool nmea;
- int raw;
- bool scaled;
- bool timing;
- bool split24;
- bool pps;
- int loglevel;
- char devpath[GPS_PATH_MAX];
- char remote[GPS_PATH_MAX];
- };
- #ifndef TIMEDELTA_DEFINED
- #define TIMEDELTA_DEFINED
- struct timedelta_t {
- timespec_t real;
- timespec_t clock;
- };
- #endif /* TIMEDELTA_DEFINED */
- struct oscillator_t {
- bool running;
- bool reference;
- bool disciplined;
- int delta;
- };
- typedef int socket_t;
- #define BAD_SOCKET(s) ((s) == -1)
- #define INVALIDATE_SOCKET(s) do { s = -1; } while (0)
- #define WATCH_ENABLE 0x000001u /* enable streaming */
- #define WATCH_DISABLE 0x000002u /* disable watching */
- #define WATCH_JSON 0x000010u /* JSON output */
- #define WATCH_NMEA 0x000020u /* output in NMEA */
- #define WATCH_RARE 0x000040u /* output of packets in hex */
- #define WATCH_RAW 0x000080u /* output of raw packets */
- #define WATCH_SCALED 0x000100u /* scale output to floats */
- #define WATCH_TIMING 0x000200u /* timing information */
- #define WATCH_DEVICE 0x000800u /* watch specific device */
- #define WATCH_SPLIT24 0x001000u /* split AIS Type 24s */
- #define WATCH_PPS 0x002000u /* enable PPS JSON */
- #define WATCH_NEWSTYLE 0x010000u /* force JSON streaming */
- struct gps_data_t {
- gps_mask_t set;
- #define ONLINE_SET (1llu<<1)
- #define TIME_SET (1llu<<2)
- #define TIMERR_SET (1llu<<3)
- #define LATLON_SET (1llu<<4)
- #define ALTITUDE_SET (1llu<<5)
- #define SPEED_SET (1llu<<6)
- #define TRACK_SET (1llu<<7)
- #define CLIMB_SET (1llu<<8)
- #define STATUS_SET (1llu<<9)
- #define MODE_SET (1llu<<10)
- #define DOP_SET (1llu<<11)
- #define HERR_SET (1llu<<12)
- #define VERR_SET (1llu<<13)
- #define ATTITUDE_SET (1llu<<14)
- #define SATELLITE_SET (1llu<<15)
- #define SPEEDERR_SET (1llu<<16)
- #define TRACKERR_SET (1llu<<17)
- #define CLIMBERR_SET (1llu<<18)
- #define DEVICE_SET (1llu<<19)
- #define DEVICELIST_SET (1llu<<20)
- #define DEVICEID_SET (1llu<<21)
- #define RTCM2_SET (1llu<<22)
- #define RTCM3_SET (1llu<<23)
- #define AIS_SET (1llu<<24)
- #define PACKET_SET (1llu<<25)
- #define SUBFRAME_SET (1llu<<26)
- #define GST_SET (1llu<<27)
- #define VERSION_SET (1llu<<28)
- #define POLICY_SET (1llu<<29)
- #define LOGMESSAGE_SET (1llu<<30)
- #define ERROR_SET (1llu<<31)
- #define TOFF_SET (1llu<<32) /* not yet used */
- #define PPS_SET (1llu<<33)
- #define NAVDATA_SET (1llu<<34)
- #define OSCILLATOR_SET (1llu<<35)
- #define ECEF_SET (1llu<<36)
- #define VECEF_SET (1llu<<37)
- #define MAGNETIC_TRACK_SET (1llu<<38)
- #define RAW_SET (1llu<<39)
- #define NED_SET (1llu<<40)
- #define VNED_SET (1llu<<41)
- #define SET_HIGH_BIT 42
- timespec_t online; /* NZ if GPS is on line, 0 if not.
- *
- * Note: gpsd clears this time when sentences
- * fail to show up within the GPS's normal
- * send cycle time. If the host-to-GPS
- * link is lossy enough to drop entire
- * sentences, this field will be
- * prone to false zero values.
- */
- #ifndef USE_QT
- socket_t gps_fd; /* socket or file descriptor to GPS */
- #else
- void* gps_fd;
- #endif
- struct gps_fix_t fix; /* accumulated PVT data */
- /* GPS status -- always valid */
- int status; /* Do we have a fix? */
- #define STATUS_NO_FIX 0 /* no */
- /* yes, plain GPS (SPS Mode), without DGPS, PPS, RTK, DR, etc. */
- #define STATUS_FIX 1
- #define STATUS_DGPS_FIX 2 /* yes, with DGPS */
- #define STATUS_RTK_FIX 3 /* yes, with RTK Fixed */
- #define STATUS_RTK_FLT 4 /* yes, with RTK Float */
- #define STATUS_DR 5 /* yes, with dead reckoning */
- #define STATUS_GNSSDR 6 /* yes, with GNSS + dead reckoning */
- #define STATUS_TIME 7 /* yes, time only (surveyed in, manual) */
- #define STATUS_SIM 8 /* yes, simulated */
- /* yes, Precise Positioning Service (PPS)
- * Not to be confused with Pulse per Second (PPS)
- * PPS is the encrypted military P(Y)-code */
- #define STATUS_PPS_FIX 9
- /* precision of fix -- valid if satellites_used > 0 */
- int satellites_used;
- struct dop_t dop;
-
- timespec_t skyview_time;
- int satellites_visible;
- struct satellite_t skyview[MAXCHANNELS];
- struct devconfig_t dev;
- struct gps_policy_t policy;
- struct {
- timespec_t time;
- int ndevices;
- struct devconfig_t list[MAXUSERDEVS];
- } devices;
-
- #define UNION_SET (AIS_SET|ATTITUDE_SET|ERROR_SET|GST_SET| \
- LOGMESSAGE_SET|OSCILLATOR_SET|PPS_SET|RAW_SET| \
- RTCM2_SET|RTCM3_SET|SUBFRAME_SET|TOFF_SET|VERSION_SET)
- union {
-
- struct rtcm2_t rtcm2;
- struct rtcm3_t rtcm3;
- struct subframe_t subframe;
- struct ais_t ais;
- struct attitude_t attitude;
- struct navdata_t navdata;
- struct rawdata_t raw;
- struct gst_t gst;
- struct oscillator_t osc;
-
- struct version_t version;
- char error[256];
- };
-
-
- struct timedelta_t toff;
- struct timedelta_t pps;
-
- long qErr;
-
- timespec_t qErr_time;
-
- void *privdata;
- };
- extern int gps_open(const char *, const char *,
- struct gps_data_t *);
- extern int gps_close(struct gps_data_t *);
- extern int gps_send(struct gps_data_t *, const char *, ... );
- extern int gps_read(struct gps_data_t *, char *message, int message_len);
- extern int gps_unpack(char *, struct gps_data_t *);
- extern bool gps_waiting(const struct gps_data_t *, int);
- extern int gps_stream(struct gps_data_t *, unsigned int, void *);
- extern int gps_mainloop(struct gps_data_t *, int,
- void (*)(struct gps_data_t *));
- extern const char *gps_data(const struct gps_data_t *);
- extern const char *gps_errstr(const int);
- int json_toff_read(const char *buf, struct gps_data_t *,
- const char **);
- int json_pps_read(const char *buf, struct gps_data_t *,
- const char **);
- int json_oscillator_read(const char *buf, struct gps_data_t *,
- const char **);
- extern void libgps_trace(int errlevel, const char *, ...);
- extern void gps_clear_att(struct attitude_t *);
- extern void gps_clear_dop( struct dop_t *);
- extern void gps_clear_fix(struct gps_fix_t *);
- extern void gps_merge_fix(struct gps_fix_t *, gps_mask_t, struct gps_fix_t *);
- extern void gps_enable_debug(int, FILE *);
- extern const char *gps_maskdump(gps_mask_t);
- extern double safe_atof(const char *);
- extern time_t mkgmtime(struct tm *);
- extern timespec_t iso8601_to_timespec(char *);
- extern char *now_to_iso8601(char[], size_t len);
- extern char *timespec_to_iso8601(timespec_t t, char[], size_t len);
- extern double earth_distance(double, double, double, double);
- extern double earth_distance_and_bearings(double, double, double, double,
- double *,
- double *);
- extern double wgs84_separation(double, double);
- extern double mag_var(double, double);
- extern void datum_code_string(int code, char *buffer, size_t len);
- #define METERS_TO_FEET (1 / 0.3048) /* Meters to International Foot */
- #define METERS_TO_MILES 0.00062137119 /* Meters to miles */
- #define METERS_TO_FATHOMS 0.54680665 /* Meters to fathoms */
- #define KNOTS_TO_MPH 1.1507794 /* Knots to miles per hour */
- #define KNOTS_TO_KPH 1.852 /* Knots to kilometers per hour */
- #define KNOTS_TO_MPS 0.51444444 /* Knots to meters per second */
- #define MPS_TO_KPH 3.6 /* Meters per second to klicks/hr */
- #define MPS_TO_MPH 2.2369363 /* Meters/second to miles per hour */
- #define MPS_TO_KNOTS 1.9438445 /* Meters per second to knots */
- #define GPS_PI 3.1415926535897932384626433832795029
- #define RAD_2_DEG 57.2957795130823208767981548141051703
- #define DEG_2_RAD 0.0174532925199432957692369076848861271
- #define GPS_LN2 0.693147180559945309417232121458176568
- #define WGS84A 6378137.0 /* equatorial radius (semi-major axis) */
- #define WGS84F 298.257223563 /* flattening */
- #define WGS84B 6356752.314245 /* polar radius (semi-minor axis) */
- #define WGS84E 0.006694379990197585 /* 1st eccentricity squared */
- #define WGS84E2 0.006739496742333464 /* 2nd eccentricy squared */
- #define CLIGHT 299792458.0 /* speed of light (m/s) */
- #define NL_NOSERVICE -1 /* can't get service entry */
- #define NL_NOHOST -2 /* can't get host entry */
- #define NL_NOPROTO -3 /* can't get protocol entry */
- #define NL_NOSOCK -4 /* can't create socket */
- #define NL_NOSOCKOPT -5 /* error SETSOCKOPT SO_REUSEADDR */
- #define NL_NOCONNECT -6 /* can't connect to host/socket pair */
- #define SHM_NOSHARED -7 /* shared-memory segment not available */
- #define SHM_NOATTACH -8 /* shared-memory attach failed */
- #define DBUS_FAILURE -9 /* DBUS initialization failure */
- #define DEFAULT_GPSD_PORT "2947" /* IANA assignment */
- #define DEFAULT_RTCM_PORT "2101" /* IANA assignment */
- #define GPSD_SHARED_MEMORY "shared memory"
- #define GPSD_DBUS_EXPORT "DBUS export"
- #ifdef __cplusplus
- }
- #endif
- #endif /* _GPSD_GPS_H_ */
|