gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-users] Antenna status U-BLOX


From: Federico Buti
Subject: Re: [gpsd-users] Antenna status U-BLOX
Date: Fri, 17 Nov 2017 08:17:20 +0100

Hi Tom.

Thanks for the reply. I just skimmed the mailing list when I wrote the mail and didn't find your original message. Sorry for the duplicate then.
I've looked at the patch and probably/possibly there are difference with my approach. Currently I'm finalizing some other stuff for a deadline. As soon as the deadline is over and I can get back to the gpsd stuff I'm going to try out that patch and see if that can help in solving my issue.

Thanks a lot!
F.


---
Federico Buti

On 17 November 2017 at 04:12, tom <address@hidden> wrote:
where are you parsing the UBX_MON_HW message ? I remember trying a different way of doing it and it turned out that if there is no antenna the gps data is not valid and it doesn't go into the sending loop.. you might have run into the same problem ? I remember finding it using the debugger, then i went back and asked for some advice and they told me to do it in the way below: (if you search in the email list you will find my communication about this topic)

I've included a patch that i did to get it working here. please note that this assumes your client uses libgpsd to receive the antenna status and that something else sends the BX-UBX-CFG-ANT and MON-HW. (but it sounds like you already do that)

perhaps you could use it.

From c486e9f1ec90bc33b4a63733b76e94aced35228c Mon Sep 17 00:00:00 2001
From: tom schuring <address@hidden>
Date: Tue, 19 Sep 2017 17:10:05 +1000
Subject: [PATCH] handle the antenna status in the UBX HW-MON msg

---
 driver_ubx.c  | 33 +++++++++++++++++++++++++++++++++
 gps.h         |  7 +++++++
 gpsd_json.c   |  2 ++
 gpsd_json.xml |  5 +++++
 libgps_json.c |  2 ++
 5 files changed, 49 insertions(+)

diff --git a/driver_ubx.c b/driver_ubx.c
index 88be6c0..421aa04 100644
--- a/driver_ubx.c
+++ b/driver_ubx.c
@@ -73,6 +73,8 @@ static gps_mask_t ubx_msg_nav_timegps(struct gps_device_t
*session,
       unsigned char *buf, size_t data_len);
 static void ubx_msg_mon_ver(struct gps_device_t *session,
       unsigned char *buf, size_t data_len);
+static void ubx_msg_mon_hw(struct gps_device_t *session,
+ unsigned char *buf);
 #ifdef RECONFIGURE_ENABLE
 static void ubx_mode(struct gps_device_t *session, int mode);
 #endif /* RECONFIGURE_ENABLE */
@@ -393,6 +395,36 @@ static void ubx_msg_sbas(struct gps_device_t *session,
unsigned char *buf)
 }

 /*
+ * Hardare Monitor status
+ */
+static void ubx_msg_mon_hw(struct gps_device_t *session, unsigned char
*buf)
+{
+ session->gpsdata.ant_status = (int)getub(buf, 20);
+
+ switch( session->gpsdata.ant_status )
+ {
+ case ANT_STATUS_INIT:
+ gpsd_log(&session->context->errout, LOG_PROG, "ANT_STATUS: INIT\n");
+ break;
+ case ANT_STATUS_DONT_KNOW:
+ gpsd_log(&session->context->errout, LOG_PROG, "ANT_STATUS: DONT_KNOW\n");
+ break;
+ case ANT_STATUS_OK:
+ gpsd_log(&session->context->errout, LOG_PROG, "ANT_STATUS: OK\n");
+ break;
+ case ANT_STATUS_SHORT:
+ gpsd_log(&session->context->errout, LOG_PROG, "ANT_STATUS: SHORT\n");
+ break;
+ case ANT_STATUS_OPEN:
+ gpsd_log(&session->context->errout, LOG_PROG, "ANT_STATUS: OPEN\n");
+ break;
+ default:
+ gpsd_log(&session->context->errout, LOG_PROG, "ANT_STATUS: : %d\n",
session->gpsdata.ant_status );
+ break;
+ }
+}
+
+/*
  * Raw Subframes
  */
 static gps_mask_t ubx_msg_sfrb(struct gps_device_t *session, unsigned char
*buf)
@@ -578,6 +610,7 @@ gps_mask_t ubx_parse(struct gps_device_t * session,
unsigned char *buf,
  break;
     case UBX_MON_HW:
  gpsd_log(&session->context->errout, LOG_DATA, "UBX_MON_HW\n");
+ ubx_msg_mon_hw(session, &buf[6]);
  break;
     case UBX_MON_USB:
  gpsd_log(&session->context->errout, LOG_DATA, "UBX_MON_USB\n");
diff --git a/gps.h b/gps.h
index 77c1bcb..c6fc4e9 100644
--- a/gps.h
+++ b/gps.h
@@ -2024,9 +2024,16 @@ struct gps_data_t {
 #define STATUS_FIX 1 /* yes, without DGPS */
 #define STATUS_DGPS_FIX 2 /* yes, with DGPS */

+/* Antenna status */
+#define ANT_STATUS_INIT 0
+#define ANT_STATUS_DONT_KNOW 1
+#define ANT_STATUS_OK 2
+#define ANT_STATUS_SHORT 3
+#define ANT_STATUS_OPEN  4
     /* precision of fix -- valid if satellites_used > 0 */
     int satellites_used; /* Number of satellites used in solution */
     struct dop_t dop;
+    int ant_status; /* antenna status */

     /* redundant with the estimate elements in the fix structure */
     double epe;  /* spherical position error, 95% confidence (meters)  */
diff --git a/gpsd_json.c b/gpsd_json.c
index 825851e..84f443e 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -287,6 +287,8 @@ void json_sky_dump(const struct gps_data_t *datap,
  str_appendf(reply, replylen, "\"gdop\":%.2f,", datap->dop.gdop);
     if (isnan(datap->dop.pdop) == 0)
  str_appendf(reply, replylen, "\"pdop\":%.2f,", datap->dop.pdop);
+    if (isnan(datap->ant_status) == 0 && datap->ant_status !=
ANT_STATUS_INIT)
+ str_appendf(reply, replylen, "\"ant\":%d,", datap->ant_status);
     /* insurance against flaky drivers */
     for (i = 0; i < datap->satellites_visible; i++)
  if (datap->skyview[i].PRN)
diff --git a/gpsd_json.xml b/gpsd_json.xml
index 88c8a66..a89b7f7 100644
--- a/gpsd_json.xml
+++ b/gpsd_json.xml
@@ -337,6 +337,11 @@ yet, only the "class" field will reliably be
present.</para>
  error estimate.</entry>
 </row>
 <row>
+        <entry>ant</entry>
+ <entry>No</entry>
+ <entry>numeric</entry>
+ <entry>Antenna status. If supported by the driver and the device</entry>
+<row>
  <entry>satellites</entry>
  <entry>Yes</entry>
  <entry>list</entry>
diff --git a/libgps_json.c b/libgps_json.c
index 6a71185..b0c6273 100644
--- a/libgps_json.c
+++ b/libgps_json.c
@@ -142,6 +142,8 @@ static int json_sky_read(const char *buf, struct
gps_data_t *gpsdata,
                              .dflt.real = NAN},
  {"gdop",       t_real,    .addr.real    = &gpsdata->dop.gdop,
                              .dflt.real = NAN},
+ {"ant",       t_integer, .addr.integer = &gpsdata->ant_status,
+         .dflt.integer = ANT_STATUS_INIT},
  {"satellites", t_array,
                            STRUCTARRAY(gpsdata->skyview,
  json_attrs_satellites,



On Fri, 17 Nov 2017 at 1:14 pm, Federico Buti <address@hidden> wrote:
Hi Tom.

Thanks for the reply.
I should have specified that statement, sorry. I was meaning the antenna. If I unscrew the antenna, the PVT messages stop whereas the antenna messages keep coming. Unfortunately those antenna message are always "OK".
I've also read of a specific command to be sent to activate the three pin antenna supervisor (0x06 0x41) but even after sending it, there has been no improvement at all.

Beste regards,
F.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]