#include <signal.h>
#include <string.h>
#include "ap-utils.h"
-#include "ap-curses.h"
-#define STAS _("Associated Stations")
-#define STAS_HEADER \
+/*
+ * NOTE: SBRIDGES seems to be currently handled by ap-gl =>
+ * no SBRIDGES-related code here (yet)!
+ */
+
+#define TITLE_AP _("AP link state")
+
+/* following for any non-VERNET ATMEL* MIB */
+#define HEADER_STAS \
_(" # MAC ")
/* following for VERNET-enhanced ATMEL12350 MIB */
-#define STAS_HEADER_VERNET \
+#define HEADER_STAS_VERNET \
_(" # MAC Parent MAC RSSI Status MACn IP ")
#define MAX_LINES LINES-4
extern int LINES;
extern WINDOW *main_sub;
-extern short ap_type;
-extern char IS_ATMEL12350_VERNET;
+extern short ap_type, ap_vendorext;
extern int sts_viewtype;
-void stations()
+void atmel_stations()
{
char bridgeOperationalMode[] = {
0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01, 0x04, 0x01, 0x00
int mac_idx, begin, end, total_mac;
varbind varbinds[1];
-
if (ap_type == ATMEL12350) {
bridgeOperationalMode[5] = 0xE0;
bridgeOperationalMode[6] = 0x3E;
}
/* for AP in AP-Client mode & without VERNET firmware, disable status */
- if (*(varbinds[0].value) == 3 && !IS_ATMEL12350_VERNET) {
+ if (*(varbinds[0].value) == 3 && ap_vendorext != VERNET) {
mvwaddstr(main_sub, 3, 1, _("AP is currently in AP Client Mode => "
"no associated STAtions."));
print_help(ANY_KEY);
noecho();
wattrset(main_sub, COLOR_PAIR(3));
- if (IS_ATMEL12350_VERNET)
- mvwaddstr(main_sub, 0, 0, STAS_HEADER_VERNET);
+ if (ap_vendorext == VERNET)
+ mvwaddstr(main_sub, 0, 0, HEADER_STAS_VERNET);
else
- mvwaddstr(main_sub, 0, 0, STAS_HEADER);
+ mvwaddstr(main_sub, 0, 0, HEADER_STAS);
wattrset(main_sub, A_NORMAL);
refresh:
memcpy(curr->addr, mac->MacAddress, 6);
- if (IS_ATMEL12350_VERNET) {
+ if (ap_vendorext == VERNET) {
curr->Status = mac->Status;
curr->Port = mac->Port;
memcpy(curr->ParentMacAddress, mac->ParentMacAddress, 6);
begin = 1;
end = (MAX_LINES < mac_idx) ? MAX_LINES : mac_idx;
- if (IS_ATMEL12350_VERNET)
- print_help(_("Arrows - scroll; S - save to file; Q - return; "
- "T - toggle view; Other key - refresh"));
- else
- print_help(_("Arrows - scroll; S - save to file; Q - return; "
- "Other key - refresh"));
-
+ sprintf(message, "%s: %d", TITLE_STAS, total_mac);
while (1) {
- sprintf(message, "%s: %d", STAS, total_mac);
- print_title(message);
+ if (ap_vendorext == VERNET) {
+ print_top_rssi(message);
- if (IS_ATMEL12350_VERNET) {
- print_viewtype_rssi();
+ print_help(_("Arrows - scroll; S - save to file; Q - return; "
+ "T - toggle view; Other - refresh"));
scroll_rows(first, begin, end, 1, 3);
- } else
+ } else {
+ print_top(NULL, message);
+ print_help(_("Arrows - scroll; S - save to file; Q - return; "
+ "Other key - refresh"));
scroll_rows(first, begin, end, 1, 0);
+ }
switch (getch()) {
case 'S':
goto exit;
case 'T':
case 't':
- if (IS_ATMEL12350_VERNET) {
+ if (ap_vendorext == VERNET) {
sts_viewtype += 1;
if (sts_viewtype == 3)
sts_viewtype = 0;
first = curr->next;
free(curr);
}
- print_title("");
+ print_top(NULL, NULL);
clear_main(0);
}
mac_idx = 0;
- print_title(_("Associated stations"));
+ print_top(NULL, TITLE_STAS);
mvwaddstr(main_sub, 0, 3,
- _("Id MAC address Quality Age RSSI"));
+ _("Id MAC address Quality Age RSSI"));
noecho();
print_help(WAIT_RET);
next_num = varbinds[0].oid[varbinds[0].len_oid - 1];
}
- sprintf(message, "%s: %d", _("Associated stations"), mac_idx);
- print_title(message);
+
if(mac_idx) {
+
begin = 1;
- end = (MAX_LINES < mac_idx+1) ? MAX_LINES : mac_idx+1;
- scroll_rows(first, begin, end, 1, 1);
- print_help(_("Arrows - scroll; S - save to file; Q - quit to menu."));
+ end = (MAX_LINES < mac_idx + 1) ? MAX_LINES : mac_idx + 1;
+
while (1) {
+ print_help(_("Arrows - scroll; S - save to file; Q - return; "
+ "T - toggle view; Other - refresh"));
+
+ scroll_rows(first, begin, end, 1, 1);
+
+ sprintf(message, "%s: %d", TITLE_STAS, mac_idx);
+ print_top_rssi(message);
+
switch (getch()) {
case 'S':
case 's':
if (end < mac_idx+1) {
begin++;
end++;
- scroll_rows(first, begin, end, 1, 1);
}
continue;
case KEY_UP:
if (begin > 1) {
begin--;
end--;
- scroll_rows(first, begin, end, 1, 1);
}
continue;
case 'Q':
case 'q':
goto exit;
+ case 'T':
+ case 't':
+ sts_viewtype += 1;
+ if (sts_viewtype == 3)
+ sts_viewtype = 0;
+
+ continue;
}
}
}
free(curr);
}
- print_title("");
+ print_top(NULL, NULL);
clear_main(0);
}