summaryrefslogtreecommitdiff
path: root/monitor_italk.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2009-03-03 20:17:33 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2009-03-03 20:17:33 +0000
commit556141e0667914625a5910291ab48c4621a58dee (patch)
treedce84db5675c9586aa855cbf8345bab8426b281e /monitor_italk.c
parent8b980caecabb5f25b6204419368b6ebc9dd294fe (diff)
downloadgpsd-556141e0667914625a5910291ab48c4621a58dee.tar.gz
Parse the satellite status
Diffstat (limited to 'monitor_italk.c')
-rw-r--r--monitor_italk.c77
1 files changed, 68 insertions, 9 deletions
diff --git a/monitor_italk.c b/monitor_italk.c
index b9ee455e..92a05c37 100644
--- a/monitor_italk.c
+++ b/monitor_italk.c
@@ -23,32 +23,91 @@
#include "gpsmon.h"
#ifdef ITRAX_ENABLE
+#include "driver_italk.h"
+
extern const struct gps_type_t italk_binary;
+static WINDOW *satwin;
static bool italk_initialize(void)
{
- return true;
+ int i;
+
+ /* "heavily inspired" by monitor_nmea.c */
+ if ((satwin = derwin(devicewin, 15, 27, 6, 0)) == NULL)
+ return false;
+ (void)wborder(satwin, 0, 0, 0, 0, 0, 0, 0, 0),
+ (void)syncok(satwin, true);
+ (void)wattrset(satwin, A_BOLD);
+ (void)mvwprintw(satwin, 1, 1, "Ch SV Az El S/N Flag U");
+ for (i = 0; i < SIRF_CHANNELS; i++)
+ (void)mvwprintw(satwin, (int)(i+2), 1, "%2d",i);
+ (void)mvwprintw(satwin, 14, 7, " PRN_STATUS ");
+ (void)wattrset(satwin, A_NORMAL);
+
+ return true;
+}
+
+static void display_itk_prnstatus(unsigned char *buf, size_t len)
+{
+ unsigned int i, nchan;
+ if (len < 62)
+ return;
+
+ nchan = (unsigned int)((len - 10 - 52) / 20);
+ for (i = 0; i < nchan; i++) {
+ unsigned int off = 7+ 52 + 20 * i;
+ unsigned short fl;
+ unsigned char ss, prn, el, az;
+
+ fl = getleuw(buf, off);
+ ss = (unsigned char)getleuw(buf, off+2)&0xff;
+ prn = (unsigned char)getleuw(buf, off+4)&0xff;
+ el = (unsigned char)getlesw(buf, off+6)&0xff;
+ az = (unsigned char)getlesw(buf, off+8)&0xff;
+ wmove(satwin, i+2, 4);
+ wprintw(satwin, "%3d %3d %2d %02d %04x %c",
+ prn, az, el, ss, fl,
+ (fl & PRN_FLAG_USE_IN_NAV)? 'Y' : ' ');
+ }
+ wnoutrefresh(satwin);
+ return;
}
static void italk_update(void)
{
+ unsigned char *buf;
+ size_t len;
+ unsigned char type;
+
+ buf = session.packet.outbuffer;
+ len = session.packet.outbuflen;
+ type = getub(buf, 4);
+ switch (type) {
+ case ITALK_PRN_STATUS:
+ display_itk_prnstatus(buf, len);
+ break;
+ default:
+ break;
+ }
}
-static int italk_command(char line[])
+static int italk_command(char line[] UNUSED)
{
- return COMMAND_UNKNOWN;
+ return COMMAND_UNKNOWN;
}
static void italk_wrap(void)
{
+ delwin(satwin);
+ return;
}
const struct monitor_object_t italk_mmt = {
- .initialize = italk_initialize,
- .update = italk_update,
- .command = NULL,
- .wrap = NULL,
- .min_y = 20, .min_x = 80, /* size of the device window */
- .driver = &italk_binary,
+ .initialize = italk_initialize,
+ .update = italk_update,
+ .command = italk_command,
+ .wrap = italk_wrap,
+ .min_y = 23, .min_x = 80, /* size of the device window */
+ .driver = &italk_binary,
};
#endif