I've asked questions before about forwarding UBX_MON_HW messages, and was told:
"I would just add the decoder in driver_ubx.c. Then you'll get a nice
message. Or just watch the raw sentences as they come back. no need for
a raw hook."
and
"You can look in driver_ubx.c for how the other messages are decoded. Adding a new decode is easy."
I looked at driver_ubx_c and i do find that there is a good spot to handle the message
case UBX_MON_HW:
gpsd_report(LOG_IO, "UBX_MON_HW\n");
// my addition..:
ubx_msg_mon_hw(session, &buf[6], data_len);
break;
and added a unsigned int ant_status in the ubx driver:
static void ubx_msg_mon_hw(struct gps_device_t *session, unsigned char *buf, size_t data_len)
{
// first field to decode... i know there are more..
session->driver.ubx.ant_status = (unsigned int)getub(buf, 20);
switch( session->driver.ubx.ant_status )
{
case 0:
gpsd_report(LOG_IO, "ANT_STATUS: INIT\n");
break;
case 1:
gpsd_report(LOG_IO, "ANT_STATUS: DONT_KNOW\n");
break;
case 2:
gpsd_report(LOG_IO, "ANT_STATUS: OK\n");
break;
case 3:
gpsd_report(LOG_IO, "ANT_STATUS: SHORT\n");
break;
case 4:
gpsd_report(LOG_IO, "ANT_STATUS: OPEN\n");
break;
default:
gpsd_report(LOG_IO, "ANT_STATUS: : %d\n", session->driver.ubx.ant_status );
break;
}
}
and this works.. it picks up the values of the Antenna correctly. (Yay)
How would i go about forwarding this antenna status back to the gpsd-lib client ? Or am i abusing gpsd for something that is too device specific ?
Kind Regards,
Tom