X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2Faps.c;h=234a2c2ed4b33d05834add6c92e6f00ff42def75;hb=17cd5711411f45df26b33c51288780627b7377e2;hp=b99ad57ea5ffcfcbd9e8180ca02065cc7cf24d16;hpb=09ed626f25fb3e7c57ad7a59e5261ea005aa498f;p=ap-utils.git diff --git a/lib/aps.c b/lib/aps.c index b99ad57..234a2c2 100644 --- a/lib/aps.c +++ b/lib/aps.c @@ -2,6 +2,7 @@ * aps.c from Access Point SNMP Utils for Linux * * Copyright (c) 2002 Roman Festchook + * Copyright (c) 2004 Jan Rafaj * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License Version 2 from @@ -25,10 +26,11 @@ #include #include #include "ap-utils.h" -#include "ap-curses.h" -extern WINDOW *main_sub/*, *win_for_menu*/; -extern short ap_type; +#define KNOWN_APS _("Known Access Points") + +extern WINDOW *main_win, *main_sub /* *win_for_menu */; +extern short ap_type, ap_vendorext; extern int sockfd, atmel410_filter; extern struct in_addr ap_ip; @@ -151,19 +153,8 @@ void APs() wattrset(main_sub, A_NORMAL); mvwaddstr(main_sub, 12, 20, _("Do you want to continue? ")); wrefresh(main_sub); - print_help(_("(Y - Yes; N - No (it's safer to answer No)")); - i = 1; - while (i) - switch (getch()) { - case 'Y': - case 'y': - clear_main(3); - i = 0; - break; - case 'n': - case 'N': - goto quit; - } + if (help_ysn()) + goto quit; needs_opmode_restore = 1; print_help(WAIT_RET); @@ -185,6 +176,9 @@ void APs() sleep(7); } + sprintf(message, "%s%c", VIEW, ap_viewtype + '0'); + print_top(message, KNOWN_APS); + get_stats: varbinds[0].oid = KnownAP; varbinds[0].len_oid = sizeof(KnownAP); @@ -199,12 +193,9 @@ get_stats: show_stats: - print_title(_("Known Access Points")); - print_viewtype(ap_viewtype); - /* display column info in main_sub */ mvwin(main_sub, 0, 0); - wattrset(main_sub, COLOR_PAIR(3)); + wattrset(main_sub, COLOR_PAIR(13)); for (i = 0; i < 64; i++) waddch(main_sub, ' '); switch (ap_viewtype) { @@ -316,17 +307,18 @@ show_stats: /* display RSSI and LQ indicators */ switch (ap_viewtype) { case 1: - sprintf(message, "%3d", -96 + app->q1); - mvwaddstr(main_sub, aps_num+1, 56, message); + sprintf(message, "%3d%%", + (int)((minimum (app->q1, 40)) * (float)2.5)); + mvwaddstr(main_sub, aps_num+1, 55, message); if (ap_type == ATMEL410) { - sprintf(message, "%3d", (int)(100 - (minimum (app->q2, 40)) * (float)2.5) ); - mvwaddstr(main_sub, aps_num+1, 61, message); + sprintf(message, "%3d%%", + (int)(100 - (minimum (app->q2, 40)) * (float)2.5) ); + mvwaddstr(main_sub, aps_num+1, 60, message); } break; case 2: - sprintf(message, "%3d%%", - (int)((minimum (app->q1, 40)) * (float)2.5)); - mvwaddstr(main_sub, aps_num+1, 55, message); + sprintf(message, "%3d", dbmconv(app->q1)); + mvwaddstr(main_sub, aps_num+1, 56, message); if (ap_type == ATMEL410) { sprintf(message, "%3d%%", (int)(100 - (minimum (app->q2, 40)) * (float)2.5) ); @@ -347,37 +339,37 @@ show_stats: /* display legend in main_sub */ switch (ap_viewtype) { - case 2: - mvwaddstr(main_sub, LINES - 7, 0, - _("CN: Channel Name; P: Preambule Type (S: Short; L: Long);")); + case 1: mvwaddstr(main_sub, LINES - 6, 0, - _("RSSI: Radio Signal Strength Indicator [%];")); + _("CN: Channel Name; P: Preambule Type (S: Short; L: Long);")); + mvwaddstr(main_sub, LINES - 5, 0, + _("RSSI: Radio Signal Strength Indicator [%]")); if (ap_type == ATMEL410) - mvwaddstr(main_sub, LINES - 5, 0, _("LQ: Link Quality [%]")); + waddstr(main_sub, _("; LQ: Link Quality [%]")); break; - case 1: - mvwaddstr(main_sub, LINES - 7, 0, - _("CN: Channel Name; P: Preambule Type (S: Short; L: Long);")); + case 2: mvwaddstr(main_sub, LINES - 6, 0, - _("RSSI: Radio Signal Strength Indicator [dBm];")); + _("CN: Channel Name; P: Preambule Type (S: Short; L: Long);")); + mvwaddstr(main_sub, LINES - 5, 0, + _("RSSI: Radio Signal Strength Indicator [dBm]")); if (ap_type == ATMEL410) - mvwaddstr(main_sub, LINES - 5, 0, _("LQ: Link Quality [%]")); + waddstr(main_sub, _("; LQ: Link Quality [%]")); break; case 3: - mvwaddstr(main_sub, LINES - 7, 0, - _("CN: Channel Name; P: Preambule Type (S: Short; L: Long);")); mvwaddstr(main_sub, LINES - 6, 0, - _("RSSI: Radio Signal Strength Indicator [raw];")); + _("CN: Channel Name; P: Preambule Type (S: Short; L: Long);")); + mvwaddstr(main_sub, LINES - 5, 0, + _("RSSI: Radio Signal Strength Indicator [raw]")); if (ap_type == ATMEL410) - mvwaddstr(main_sub, LINES - 5, 0, _("LQ: Link Quality [raw]")); + waddstr(main_sub, _("; LQ: Link Q. [raw]")); break; } wrefresh(main_sub); if (ap_type == ATMEL410) - print_help(_("# con. to this AP; R refresh with reset; S refresh w/o reset; T toggle; Q quit")); + print_help(_("# con. to AP #; R refresh with reset; T toggle; Q quit; Other = refr. w/o reset")); else /* ATMEL12350 */ - print_help(_("# con. to this AP; R initiate AP scan; S refresh view; T toggle view; Q quit")); + print_help(_("# con. to AP #; R initiate AP scan; T toggle view; Q quit; Other = refresh view")); while (1) switch (i = getch()) { @@ -561,18 +553,19 @@ show_stats: getch(); } goto get_stats; - case 'S': - case 's': - print_help(WAIT_RET); - clear_main(0); - goto get_stats; case 'T': case 't': ap_viewtype += 1; if (ap_viewtype > 4) ap_viewtype = 1; clear_main(0); + sprintf(message, "%s%c", VIEW, ap_viewtype + '0'); + print_top(message, KNOWN_APS); goto show_stats; + default: + print_help(WAIT_RET); + clear_main(0); + goto get_stats; } restore_before_exit: @@ -598,7 +591,7 @@ show_stats: exit: getch(); quit: - print_title(""); + print_top(NULL, NULL); clear_main(0); }