|
|
@ -127,6 +127,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
NSStatusBar* bar = [NSStatusBar systemStatusBar];
|
|
|
|
NSStatusBar* bar = [NSStatusBar systemStatusBar];
|
|
|
|
_appMenu = [bar statusItemWithLength:NSVariableStatusItemLength];
|
|
|
|
_appMenu = [bar statusItemWithLength:NSVariableStatusItemLength];
|
|
|
|
|
|
|
|
[_appMenu setAction:@selector(refreshMenu:)];
|
|
|
|
|
|
|
|
[_appMenu setTarget:self];
|
|
|
|
[_appMenu retain];
|
|
|
|
[_appMenu retain];
|
|
|
|
|
|
|
|
|
|
|
|
//[self setMenubarText:@"000KB/s\n000KB/s"];
|
|
|
|
//[self setMenubarText:@"000KB/s\n000KB/s"];
|
|
|
@ -137,7 +139,7 @@
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
[_appMenu setHighlightMode:YES];
|
|
|
|
[_appMenu setHighlightMode:YES];
|
|
|
|
[_appMenu setMenu:AppMenu];
|
|
|
|
//[_appMenu setMenu:AppMenu];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) hideMenubar
|
|
|
|
- (void) hideMenubar
|
|
|
@ -352,8 +354,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
- (void) throughputCallback:(NSData *)data
|
|
|
|
- (void) throughputCallback:(NSData *)data
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[wrt_client getStatusUpdate:@"Status_Router.live.asp" delegate:self callback:@selector(doUpdateStatus:)];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSString *stringData = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
|
|
|
NSString *stringData = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
|
|
|
|
|
|
|
|
|
|
|
NSString *key = [NSString stringWithFormat:@"%@:", [wrt_client getWanPort]];
|
|
|
|
NSString *key = [NSString stringWithFormat:@"%@:", [wrt_client getWanPort]];
|
|
|
@ -388,6 +388,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
-(void)doUpdateStatus:(NSData *)data
|
|
|
|
-(void)doUpdateStatus:(NSData *)data
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
[wrt_client getStatusUpdate:@"Status_Internet.live.asp" delegate:self callback:@selector(wanRequestCallback:)];
|
|
|
|
|
|
|
|
|
|
|
|
NSString *stringData = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
|
|
|
NSString *stringData = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
|
|
|
|
|
|
|
|
|
|
|
NSString *ipconn = [wrt_client getKey:stringData key:@"ip_conntrack"];
|
|
|
|
NSString *ipconn = [wrt_client getKey:stringData key:@"ip_conntrack"];
|
|
|
@ -408,12 +410,13 @@
|
|
|
|
[menuLoad setTitle:load];
|
|
|
|
[menuLoad setTitle:load];
|
|
|
|
[menuLoad setHidden:false];
|
|
|
|
[menuLoad setHidden:false];
|
|
|
|
[menuClientsConnections setTitle:[NSString stringWithFormat:@"%@ Connection%@", ipconn, ([ipconn isEqualToString:@"1"] ? @"" : @"s")]];
|
|
|
|
[menuClientsConnections setTitle:[NSString stringWithFormat:@"%@ Connection%@", ipconn, ([ipconn isEqualToString:@"1"] ? @"" : @"s")]];
|
|
|
|
|
|
|
|
|
|
|
|
[wrt_client getStatusUpdate:@"Status_Internet.live.asp" delegate:self callback:@selector(wanRequestCallback:)];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) refreshMenu:(id)sender
|
|
|
|
- (void) refreshMenu:(id)sender
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
NSLog(@"Refresh Menu");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[wrt_client getStatusUpdate:@"Status_Router.live.asp" delegate:self callback:@selector(doUpdateStatus:)];
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -424,15 +427,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
- (void) refreshWanMenu:(id)sender
|
|
|
|
- (void) refreshWanMenu:(id)sender
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NSLog(@"Refreshing Wan Menu");
|
|
|
|
|
|
|
|
//WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//[wrtr doRequest:self requestSelector:@selector(wanRequestCallback:) uri:@"Status_Internet.live.asp"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) wanRequestCallback:(NSData *)data
|
|
|
|
- (void) wanRequestCallback:(NSData *)data
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
[wrt_client getStatusUpdate:@"Status_Lan.live.asp" delegate:self callback:@selector(cbClientsRequest:)];
|
|
|
|
|
|
|
|
|
|
|
|
NSString *stringData = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
|
|
|
NSString *stringData = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
|
|
|
|
|
|
|
|
|
|
|
NSString *wanStatus = [wrt_client getKey:stringData key:@"wan_status"];
|
|
|
|
NSString *wanStatus = [wrt_client getKey:stringData key:@"wan_status"];
|
|
|
@ -506,7 +507,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
- (void) refreshClientsMenu:(id)sender
|
|
|
|
- (void) refreshClientsMenu:(id)sender
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[wrt_client getStatusUpdate:@"Status_Lan.live.asp" delegate:self callback:@selector(cbClientsRequest:)];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) cbClientsRequest:(NSData*)data
|
|
|
|
- (void) cbClientsRequest:(NSData*)data
|
|
|
@ -533,7 +534,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
NSArray *clientsData = [clientsStringData componentsSeparatedByString:@","];
|
|
|
|
NSArray *clientsData = [clientsStringData componentsSeparatedByString:@","];
|
|
|
|
|
|
|
|
|
|
|
|
long clientIndex;
|
|
|
|
|
|
|
|
NSMenu *clientMenu;
|
|
|
|
NSMenu *clientMenu;
|
|
|
|
NSMenu *copyMenu;
|
|
|
|
NSMenu *copyMenu;
|
|
|
|
NSMenuItem *copyMenuItem;
|
|
|
|
NSMenuItem *copyMenuItem;
|
|
|
@ -543,13 +543,22 @@
|
|
|
|
unsigned long clientsCount = [clientsData count] / 4;
|
|
|
|
unsigned long clientsCount = [clientsData count] / 4;
|
|
|
|
[menuClientsCount setTitle:[NSString stringWithFormat:@"%lu Active Client%@", clientsCount, (clientsCount > 1 ? @"s" : @"")]];
|
|
|
|
[menuClientsCount setTitle:[NSString stringWithFormat:@"%lu Active Client%@", clientsCount, (clientsCount > 1 ? @"s" : @"")]];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Clear the old client data
|
|
|
|
|
|
|
|
unsigned long clientIndex;
|
|
|
|
|
|
|
|
unsigned long firstItem = [menuClients indexOfItem:menuClientsSeparator];
|
|
|
|
|
|
|
|
if ([menuClients numberOfItems] > firstItem) {
|
|
|
|
|
|
|
|
for (clientIndex = ([menuClients numberOfItems] - 1); clientIndex > (firstItem + 1); clientIndex--) {
|
|
|
|
|
|
|
|
[menuClients removeItemAtIndex:clientIndex];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (clientIndex = 0; clientIndex < [clientsData count]; clientIndex+=4) {
|
|
|
|
for (clientIndex = 0; clientIndex < [clientsData count]; clientIndex+=4) {
|
|
|
|
NSLog(@"Client: %@ IP: %@ MAC: %@ Connections: %@",
|
|
|
|
/*NSLog(@"Client: %@ IP: %@ MAC: %@ Connections: %@",
|
|
|
|
[clientsData objectAtIndex:clientIndex],
|
|
|
|
[clientsData objectAtIndex:clientIndex],
|
|
|
|
[clientsData objectAtIndex:clientIndex+1],
|
|
|
|
[clientsData objectAtIndex:clientIndex+1],
|
|
|
|
[clientsData objectAtIndex:clientIndex+2],
|
|
|
|
[clientsData objectAtIndex:clientIndex+2],
|
|
|
|
[clientsData objectAtIndex:clientIndex+3]);
|
|
|
|
[clientsData objectAtIndex:clientIndex+3]);
|
|
|
|
|
|
|
|
*/
|
|
|
|
clientMenu = [[NSMenu alloc] init];
|
|
|
|
clientMenu = [[NSMenu alloc] init];
|
|
|
|
|
|
|
|
|
|
|
|
// Hostname
|
|
|
|
// Hostname
|
|
|
@ -594,6 +603,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
[menuClients addItem:clientItem];
|
|
|
|
[menuClients addItem:clientItem];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[_appMenu popUpStatusItemMenu:AppMenu];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (IBAction) copyParentMenuTitle:(id)sender
|
|
|
|
- (IBAction) copyParentMenuTitle:(id)sender
|
|
|
@ -608,19 +619,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
double floatSize = theSize;
|
|
|
|
double floatSize = theSize;
|
|
|
|
if (theSize<1023)
|
|
|
|
if (theSize<1023)
|
|
|
|
return([NSString stringWithFormat:@"%qx bytes",theSize]);
|
|
|
|
return([NSString stringWithFormat:@"%qxB",theSize]);
|
|
|
|
floatSize = floatSize / 1024;
|
|
|
|
floatSize = floatSize / 1024;
|
|
|
|
if (floatSize<1023)
|
|
|
|
if (floatSize<1023)
|
|
|
|
return([NSString stringWithFormat:@"%1.1f KiB",floatSize]);
|
|
|
|
return([NSString stringWithFormat:@"%1.1fKiB",floatSize]);
|
|
|
|
floatSize = floatSize / 1024;
|
|
|
|
floatSize = floatSize / 1024;
|
|
|
|
if (floatSize<1023)
|
|
|
|
if (floatSize<1023)
|
|
|
|
return([NSString stringWithFormat:@"%1.1f MiB",floatSize]);
|
|
|
|
return([NSString stringWithFormat:@"%1.1fMiB",floatSize]);
|
|
|
|
floatSize = floatSize / 1024;
|
|
|
|
floatSize = floatSize / 1024;
|
|
|
|
if (floatSize<1023)
|
|
|
|
if (floatSize<1023)
|
|
|
|
return([NSString stringWithFormat:@"%1.1f GiB",floatSize]);
|
|
|
|
return([NSString stringWithFormat:@"%1.1fGiB",floatSize]);
|
|
|
|
floatSize = floatSize / 1024;
|
|
|
|
floatSize = floatSize / 1024;
|
|
|
|
|
|
|
|
|
|
|
|
return([NSString stringWithFormat:@"%1.1f TiB",floatSize]);
|
|
|
|
return([NSString stringWithFormat:@"%1.1fTiB",floatSize]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|