#include <fcntl.h>
#include <stdlib.h>
#include "ap-utils.h"
-#include "ap-curses.h"
-extern WINDOW *main_sub/*, *win_for_menu*/;
+#define KNOWN_APS _("Known Access Points")
+
+extern WINDOW *main_win, *main_sub /* *win_for_menu */;
extern short ap_type;
extern int sockfd, atmel410_filter;
extern struct in_addr ap_ip;
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);
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);
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));
/* 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", -96 + 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) );
/* 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()) {
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:
exit:
getch();
quit:
- print_title("");
+ print_top(NULL, NULL);
clear_main(0);
}