+/*
+ * Convert time and date stamp string to unix time.
+ */
+static time_t timestampToSec(uint32_t time_stamp, uint32_t date_stamp)
+{
+ struct tm t;
+ uint16_t msec;
+ uint16_t tmr[3];
+ uint16_t date[3];
+
+ memset(&t, 0, sizeof(t));
+ memset(&tmr, 0, sizeof(tmr));
+ memset(&date, 0, sizeof(date));
+
+ LOG_INFO("time_s[%lu],date[%lu]\n", (long)time_stamp, (long)date_stamp);
+ uint32_t res = time_stamp / 1000;
+ uint32_t all = time_stamp;
+ msec = all - res * 1000;
+
+ for (int i = 0; i < 3; i++)
+ {
+ all = res;
+ res = all / 100;
+ tmr[i] = all - res * 100;
+ LOG_INFO("t[%d]%d\n", tmr[i],i);
+ }
+
+ t.tm_sec = tmr[0] + (ROUND_UP(msec, 1000) / 1000);
+ t.tm_min = tmr[1];
+ t.tm_hour = tmr[2];
+ //If we do not have refence data, we set 1/1/1970 as default
+ t.tm_mday = 1;
+ t.tm_mon = 0;
+ t.tm_year = 70;
+
+ if (date_stamp)
+ {
+ res = all = date_stamp;
+ for (int i = 0; i < 3; i++)
+ {
+ all = res;
+ res = all / 100;
+ date[i] = all - res * 100;
+ LOG_INFO("d[%d]%d\n", date[i],i);
+ }
+ t.tm_mday = date[2];
+ t.tm_mon = date[1] - 1; // time struct count month from 0 to 11;
+ // we should specify the number of years from 1900, but the year field
+ // is only two digits, so we add 100 (2000 - 1900)..
+ t.tm_year = date[0] + 100;
+ }
+ LOG_INFO("times=%d,%d,%d,%d,%d,%d\n",t.tm_sec, t.tm_min, t.tm_hour, t.tm_year, t.tm_mon, t.tm_mday);
+
+ return mktime(&t);
+}
+
+/**
+ * Callout example for GGA data
+ */
+void gpgga_callout(nmeap_context_t *context, void *data, void *user_data)
+{
+ (void)context;
+ (void)user_data;
+ (void)data;
+ LOG_INFOB(
+ NmeaGga *gga = (NmeaGga *)data;
+ LOG_INFO("Found GPGGA message %ld %ld %d %lu %d %d %d %d\n",
+ (long)gga->latitude,
+ (long)gga->longitude,
+ gga->altitude,
+ gga->time,
+ gga->satellites,
+ gga->quality,
+ gga->hdop,
+ gga->geoid);
+ );
+}
+
+/**
+ * Callout example for RMC
+ */
+void gprmc_callout(nmeap_context_t *context, void *data, void *user_data)
+{
+ (void)context;
+ (void)user_data;
+ (void)data;
+ LOG_INFOB(
+ NmeaRmc *rmc = (NmeaRmc *)data;
+
+ LOG_INFO("Found GPRMC message %lu %c %ld %ld %d %d %d\n",
+ rmc->time,
+ rmc->warn,
+ (long)rmc->latitude,
+ (long)rmc->longitude,
+ rmc->speed,
+ rmc->course,
+ rmc->mag_var);
+ );
+}
+
+/**
+ * Callout example for GSV data
+ */
+void gpgsv_callout(nmeap_context_t *context, void *data, void *user_data)
+{
+ (void)context;
+ (void)user_data;
+ (void)data;
+ LOG_INFOB(
+ NmeaGsv *gsv = (NmeaGsv *)data;
+
+ LOG_INFO("Found GPGSV message %d %d %d\n", gsv->tot_message, gsv->message_num, gsv->tot_svv);
+
+ for (int i = 0; i < 4; i++)
+ LOG_INFO("%d %d %d %d\n", gsv->info[i].sv_prn, gsv->info[i].elevation, gsv->info[i].azimut, gsv->info[i].snr);
+ );
+}
+
+/**
+ * Callout example for VTG data
+ */
+void gpvtg_callout(nmeap_context_t *context, void *data, void *user_data)
+{
+ (void)context;
+ (void)user_data;
+ (void)data;
+ LOG_INFOB(
+ NmeaVtg *vtg = (NmeaVtg *)data;
+ LOG_INFO("Found GPVTG message %d %d %d\n", vtg->track_good, vtg->knot_speed, vtg->km_speed);
+ );
+}
+
+
+