static bool evermore_nmea_config(struct gps_device_t *session, int mode) /* mode = 0 : EverMore default */ /* mode = 1 : gpsd best */ /* mode = 2 : EverMore search, activate PEMT101 message */ { unsigned char tmp8; /*@ +charint */ unsigned char evrm_nmeaout_config[] = { 0x8e, /* 0: msg ID, NMEA Message Control */ 0xff, /* 1: NMEA sentence bitmask, GGA(0), GLL(1), GSA(2), GSV(3), ... */ 0x01, /* 2: nmea checksum no(0), yes(1) */ 1, /* 3: GPGGA, interval 0-255s */ 0, /* 4: GPGLL, interval 0-255s */ 1, /* 5: GPGSA, interval 0-255s */ 1, /* 6: GPGSV, interval 0-255s */ 1, /* 7: GPRMC, interval 0-255s */ 0, /* 8: GPVTG, interval 0-255s */ 0, /* 9: PEMT,101, interval 0-255s */ 0, 0, 0, 0, 0, 0, /* 10-15: reserved */ }; /*@ -charint */ gpsd_report(LOG_PROG, "evermore_nmea_config(%d)\n", mode); /*@i1@*/ tmp8 = (mode == 1) ? 5 : 1; /* NMEA GPGSV, gpsd */ evrm_nmeaout_config[6] = tmp8; /* GPGSV, 1s or 5s */ /*@i1@*/ tmp8 = (mode == 2) ? 1 : 0; /* NMEA PEMT101 */ evrm_nmeaout_config[9] = tmp8; /* PEMT101, 1s or 0s */ return (evermore_control_send(session, (char *)evrm_nmeaout_config, sizeof(evrm_nmeaout_config)) != -1); }
static bool evermore_protocol(struct gps_device_t *session, int protocol) { /*@ +charint */ char tmp8; char evrm_protocol_config[] = { (char)0x84, /* 0: msg ID, Protocol Configuration */ (char)0x00, /* 1: mode; EverMore binary(0), NMEA(1) */ (char)0x00, /* 2: reserved */ (char)0x00, /* 3: reserved */ }; /*@ -charint */ gpsd_report(LOG_PROG, "evermore_protocol(%d)\n", protocol); /*@i1@*/ tmp8 = (protocol != 0) ? 1 : 0; /* NMEA : binary */ evrm_protocol_config[1] = tmp8; return (evermore_control_send (session, evrm_protocol_config, sizeof(evrm_protocol_config)) != -1); }
static bool evermore_speed(struct gps_device_t *session, speed_t speed, char parity, int stopbits) { /*@ -type @*/ gpsd_log(&session->context->errout, LOG_PROG, "evermore_speed(%u%c%d)\n", (unsigned int)speed, parity, stopbits); /* parity and stopbit switching aren't available on this chip */ if (parity != session->gpsdata.dev.parity || stopbits != (int)session->gpsdata.dev.parity) { return false; } else { unsigned char tmp8; unsigned char msg[] = { 0x89, /* 0: msg ID, Serial Port Configuration */ 0x01, /* 1: bit 0 cfg for main serial, bit 1 cfg for DGPS port */ 0x00, /* 2: baud rate for main serial; 4800(0), 9600(1), 19200(2), 38400(3) */ 0x00, /* 3: baud rate for DGPS serial port; 4800(0), 9600(1), etc */ }; switch (speed) { case 4800: tmp8 = 0; break; case 9600: tmp8 = 1; break; case 19200: tmp8 = 2; break; case 38400: tmp8 = 3; break; default: return false; } msg[2] = tmp8; return (evermore_control_send(session, (char *)msg, sizeof(msg)) != -1); } /*@ +type @*/ }
static bool evermore_rate_switcher(struct gps_device_t *session, double rate) /* change the sample rate of the GPS */ { /*@ +charint @*/ unsigned char evrm_rate_config[] = { 0x84, /* 1: msg ID, Operating Mode Configuration */ 0x02, /* 2: normal mode with 1PPS */ 0x00, /* 3: navigation update rate */ 0x00, /* 4: RF/GPSBBP On Time */ }; if (rate < 1 || rate > 10) { gpsd_report(LOG_ERROR, "valid rate range is 1-10.\n"); return false; } else { evrm_rate_config[2] = (unsigned char)trunc(rate); return (evermore_control_send(session, (char *)evrm_rate_config, sizeof(evrm_rate_config)) != -1); } /*@ -charint @*/ }