X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ap-gl%2Fstations.c;h=d8913808bdc1ab061d7314c5d634f3acc4c8f74d;hb=de41f9e3b34a50d3a579dfa62cfc6bc53ebdbeec;hp=7e596982a5dd7e8ef3119d1231e1ffe53fe07a87;hpb=09ed626f25fb3e7c57ad7a59e5261ea005aa498f;p=ap-utils.git diff --git a/ap-gl/stations.c b/ap-gl/stations.c index 7e59698..d891380 100644 --- a/ap-gl/stations.c +++ b/ap-gl/stations.c @@ -24,18 +24,25 @@ #include #include #include "ap-utils.h" -#include "ap-curses.h" #define MAX_LINES LINES-4 -#define STAS _("Associated Stations") - extern int LINES; extern WINDOW *main_sub; extern short ap_type; -void stations() +void atmel_stations() { + char StasNum[] = { + 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x05, 0x01, 0x00 + }; + char StasMac[] = { + 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x05, 0x02, 0x00 + }; + char bridgeOperationalMode[] = { + 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01, 0x04, 0x01, 0x00 + }; + struct AssociatedSTAsInfo { unsigned short Num; unsigned char MacAddress[6]; @@ -47,26 +54,13 @@ void stations() unsigned char IP[4]; unsigned char Reserved[2]; } *mac = NULL, get; - char StasNum[] = - { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x05, 0x01, - 0x00 - }; - - char StasMac[] = - { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x05, 0x02, - 0x00 - }; - char bridgeOperationalMode[] = { - 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01, 0x04, 0x01, 0x00 - }; - struct MacListStat *first = NULL, *curr = NULL; char message[1024]; int mac_num, begin, end, total_mac; varbind varbinds[1]; - print_title(STAS); + print_top(NULL, ST_TITLE); varbinds[0].oid = bridgeOperationalMode; varbinds[0].len_oid = sizeof(bridgeOperationalMode); @@ -80,15 +74,14 @@ void stations() } if (*(varbinds[0].value) == 3) { - mvwaddstr(main_sub, 3, 1, _("AP now in AP Client Mode and don't has any associated stations")); - print_help(ANY_KEY); - wrefresh(main_sub); - getch(); - goto exit; - } + mvwaddstr(main_sub, 3, 1, _("AP is currently in AP Client Mode => " + "no associated STAtions.")); + print_help(ANY_KEY); + wrefresh(main_sub); + getch(); + goto exit; + } - - varbinds[0].oid = StasNum; varbinds[0].len_oid = sizeof(StasNum); varbinds[0].value = StasNum; @@ -104,9 +97,12 @@ void stations() total_mac = *(varbinds[0].value); mac_num = 1; - sprintf(message, "%s: %d", STAS, total_mac); - print_title(message); - mvwaddstr(main_sub, 0, 1, _("# MAC LQ RSSI Status Port IP")); + sprintf(message, "%s: %d", ST_TITLE, total_mac); + print_top(NULL, message); + wattrset(main_sub, COLOR_PAIR(13)); + mvwaddstr(main_sub, 0, 0, + _(" # MAC Parent MAC RSSI LQ Sts MACn IP ")); + wattrset(main_sub, A_NORMAL); noecho(); while (mac_num <= total_mac) { @@ -151,7 +147,9 @@ void stations() // memcpy(curr->ParentMacAddress, mac->ParentMacAddress, 6); memcpy(&(curr->IP.s_addr), mac->IP, 4); curr->quality = 100 - (minimum(mac->LinkQuality, 40)*2.5); - curr->rssi = - 96 + mac->RSSI; +// curr->rssi = - 96 + mac->RSSI; +// curr->quality = mac->LinkQuality; + curr->rssi = mac->RSSI; curr->Port = mac->Port; curr->Status = mac->Status; @@ -159,10 +157,10 @@ void stations() mac_num++; } begin = 1; - end = (MAX_LINES < mac_num) ? MAX_LINES : mac_num; + end = (mac_num > MAX_LINES) ? MAX_LINES : mac_num; scroll_rows(first, begin, end, 1, 2); - print_help(_("Arrows - scroll; S - save to file; Q - quit to menu.")); while (1) { + print_help(_("Arrows - scroll; S - save to file; Q - quit to menu.")); switch (getch()) { case 'S': case 's': @@ -195,7 +193,7 @@ void stations() first = curr->next; free(curr); } - print_title(""); + print_top(NULL, NULL); clear_main(0); }