diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-04-14 00:41:24 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-04-14 00:41:24 -0400 |
commit | 2daef1ab8aafd0afe69cf80866a0dd390a269370 (patch) | |
tree | 9e0ddfd73edd5d18b7306127bcaf01b2a96096b3 /monitor_superstar2.c | |
parent | b54cbc920bac03a3c01412f5379c3473aff52c1d (diff) | |
download | gpsd-2daef1ab8aafd0afe69cf80866a0dd390a269370.tar.gz |
Reindent monitor mdules. Live test of gpsmon works.
Diffstat (limited to 'monitor_superstar2.c')
-rw-r--r-- | monitor_superstar2.c | 125 |
1 files changed, 62 insertions, 63 deletions
diff --git a/monitor_superstar2.c b/monitor_superstar2.c index 725e271d..340f59f8 100644 --- a/monitor_superstar2.c +++ b/monitor_superstar2.c @@ -33,79 +33,78 @@ static WINDOW *satwin; static bool superstar2_initialize(void) { - int i; - - /*@ -onlytrans @*/ - /* "heavily inspired" by monitor_nmea.c */ - if ((satwin = derwin(devicewin, 15, 27, 7, 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 PRN Az El S/N Fl U"); - for (i = 0; i < 12; i++) - (void)mvwprintw(satwin, (int)(i+2), 1, "%2d",i); - (void)mvwprintw(satwin, 14, 1, " Satellite Data & Status "); - (void)wattrset(satwin, A_NORMAL); - /*@ +onlytrans @*/ - - return true; + int i; + + /*@ -onlytrans @*/ + /* "heavily inspired" by monitor_nmea.c */ + if ((satwin = derwin(devicewin, 15, 27, 7, 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 PRN Az El S/N Fl U"); + for (i = 0; i < 12; i++) + (void)mvwprintw(satwin, (int)(i + 2), 1, "%2d", i); + (void)mvwprintw(satwin, 14, 1, " Satellite Data & Status "); + (void)wattrset(satwin, A_NORMAL); + /*@ +onlytrans @*/ + + return true; } static void display_superstar2_svinfo(unsigned char *buf, size_t data_len) { - int i; - - if (data_len != 67) - return; - - for (i = 0; i < 12; i++) { - /* get info for one channel/satellite */ - int off = i*5 + 5; - unsigned char fl, porn, ss; - char el; - unsigned short az; - - /*@ +charint */ - if ((porn = (unsigned char)getub(buf, off) & 0x1f) == 0) - porn = ((unsigned char)getub(buf, off+3) >> 1) + 87; - /*@ -charint */ - - ss = (unsigned char)getub(buf, off+4); - el = getsb(buf, off+1); - az = (unsigned short)(getub(buf, off+2) + - ((getub(buf, off+3) & 0x1) << 1)); - fl = (unsigned char)getub(buf, off) & 0xe0; - (void)wmove(satwin, i+2, 4); - /*@ +charint */ - (void)wprintw(satwin, "%3u %3d %2d %02d %02x %c", - porn, az, el, ss, fl, - ((fl & 0x60) == 0x60)? 'Y' : ' '); - /*@ -charint */ - } - (void)wnoutrefresh(satwin); + int i; + + if (data_len != 67) return; + + for (i = 0; i < 12; i++) { + /* get info for one channel/satellite */ + int off = i * 5 + 5; + unsigned char fl, porn, ss; + char el; + unsigned short az; + + /*@ +charint */ + if ((porn = (unsigned char)getub(buf, off) & 0x1f) == 0) + porn = ((unsigned char)getub(buf, off + 3) >> 1) + 87; + /*@ -charint */ + + ss = (unsigned char)getub(buf, off + 4); + el = getsb(buf, off + 1); + az = (unsigned short)(getub(buf, off + 2) + + ((getub(buf, off + 3) & 0x1) << 1)); + fl = (unsigned char)getub(buf, off) & 0xe0; + (void)wmove(satwin, i + 2, 4); + /*@ +charint */ + (void)wprintw(satwin, "%3u %3d %2d %02d %02x %c", + porn, az, el, ss, fl, + ((fl & 0x60) == 0x60) ? 'Y' : ' '); + /*@ -charint */ + } + (void)wnoutrefresh(satwin); + return; } static void superstar2_update(void) { - unsigned char *buf; - size_t len; - unsigned char type; - - buf = session.packet.outbuffer; - len = session.packet.outbuflen; - type = buf[SUPERSTAR2_TYPE_OFFSET]; - switch (type) { - case SUPERSTAR2_SVINFO: - display_superstar2_svinfo(buf, len-3); - break; - default: - break; - } + unsigned char *buf; + size_t len; + unsigned char type; + + buf = session.packet.outbuffer; + len = session.packet.outbuflen; + type = buf[SUPERSTAR2_TYPE_OFFSET]; + switch (type) { + case SUPERSTAR2_SVINFO: + display_superstar2_svinfo(buf, len - 3); + break; + default: + break; + } } -static int superstar2_command(char line[] UNUSED) +static int superstar2_command(char line[]UNUSED) { return COMMAND_UNKNOWN; } @@ -119,7 +118,7 @@ const struct monitor_object_t superstar2_mmt = { .update = superstar2_update, .command = superstar2_command, .wrap = superstar2_wrap, - .min_y = 23, .min_x = 80, /* size of the device window */ + .min_y = 23,.min_x = 80, /* size of the device window */ .driver = &superstar2_binary, }; #endif |