|
|
@ -37,7 +37,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
[wrt_client getConnectionStatus];
|
|
|
|
[wrt_client getConnectionStatus];
|
|
|
|
NSLog(@"Status %@ wan port: %@", ([wrt_client wrtReachable] ? @"Up" : @"Down"), [wrt_client getWanPort]);
|
|
|
|
NSLog(@"Status %@ wan port: %@", ([wrt_client wrtReachable] ? @"Up" : @"Down"), [wrt_client getWanPort]);
|
|
|
|
_readTimer = [NSTimer scheduledTimerWithTimeInterval:[[NSUserDefaults standardUserDefaults] integerForKey:@"refreshTime"]+1 target:self selector:@selector(updateThroughput:) userInfo:nil repeats:YES];
|
|
|
|
_readTimer = [NSTimer scheduledTimerWithTimeInterval:refreshTime+1 target:self selector:@selector(updateThroughput:) userInfo:nil repeats:YES];
|
|
|
|
|
|
|
|
|
|
|
|
[_readTimer fire];
|
|
|
|
[_readTimer fire];
|
|
|
|
|
|
|
|
|
|
|
@ -213,16 +213,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
- (void) showBandwidthViewer:(id)sender
|
|
|
|
- (void) showBandwidthViewer:(id)sender
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// NSString *urlAddress = [NSString stringWithFormat:@"https://%@:%d/graph_if.svg?ppp1",
|
|
|
|
//NSURLRequest *request = [[wrt_client requestForBandwidthViewerForInterface:[wrt_client getWanPort]] retain];
|
|
|
|
// [[NSUserDefaults standardUserDefaults] stringForKey:@"hostname"],
|
|
|
|
NSString *urlAddress = [NSString stringWithFormat:@"%@://%@:%@@%@:%d/graph_if.svg?%@",
|
|
|
|
// [[NSUserDefaults standardUserDefaults] integerForKey:@"port"]];
|
|
|
|
protocol,
|
|
|
|
// NSLog(@"%@", urlAddress);
|
|
|
|
username,
|
|
|
|
//
|
|
|
|
password,
|
|
|
|
[BandwidthViewer makeKeyAndOrderFront:nil];
|
|
|
|
hostname,
|
|
|
|
|
|
|
|
port,
|
|
|
|
|
|
|
|
[wrt_client getWanPort]];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSLog(@"Building request form %@", urlAddress);
|
|
|
|
|
|
|
|
|
|
|
|
NSURLRequest *request = [[wrt_client requestForBandwidthViewerForInterface:[wrt_client getWanPort]] retain];
|
|
|
|
NSURL *url = [NSURL URLWithString:urlAddress];
|
|
|
|
|
|
|
|
|
|
|
|
[ [BandwidthViewerWebView mainFrame] loadRequest: request ];
|
|
|
|
NSURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: url];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[ [BandwidthViewerWebView mainFrame] loadRequest: [request autorelease] ];
|
|
|
|
|
|
|
|
[BandwidthViewer makeKeyAndOrderFront:nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) hideBandwidthViewer:(id)sender
|
|
|
|
- (void) hideBandwidthViewer:(id)sender
|
|
|
@ -280,12 +287,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
//WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
//WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
|
|
|
|
|
|
|
|
//[wrtr doRequest:self requestSelector:@selector(configSaveRequestCallback:) uri:@"Status_Router.live.asp"];
|
|
|
|
|
|
|
|
[self configSaveRequestCallback:nil];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-(void)configSaveRequestCallback:(NSData *)data
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// TODO check that the request is actually successful
|
|
|
|
// TODO check that the request is actually successful
|
|
|
|
|
|
|
|
|
|
|
|
hostname = [configFieldHostname stringValue];
|
|
|
|
hostname = [configFieldHostname stringValue];
|
|
|
@ -301,6 +302,12 @@
|
|
|
|
refreshTime = [configFieldRefresh integerValue];
|
|
|
|
refreshTime = [configFieldRefresh integerValue];
|
|
|
|
[defaults setInteger:refreshTime forKey:@"refreshTime"];
|
|
|
|
[defaults setInteger:refreshTime forKey:@"refreshTime"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[_readTimer invalidate];
|
|
|
|
|
|
|
|
_readTimer = nil;
|
|
|
|
|
|
|
|
_readTimer = [NSTimer scheduledTimerWithTimeInterval:refreshTime+1 target:self selector:@selector(updateThroughput:) userInfo:nil repeats:YES];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[_readTimer fire];
|
|
|
|
|
|
|
|
|
|
|
|
useBytes = ([configFieldUseBytes state] == 1 ? true: false);
|
|
|
|
useBytes = ([configFieldUseBytes state] == 1 ? true: false);
|
|
|
|
[defaults setBool:useBytes forKey:@"useBytes"];
|
|
|
|
[defaults setBool:useBytes forKey:@"useBytes"];
|
|
|
|
|
|
|
|
|
|
|
@ -318,8 +325,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
[defaults synchronize];
|
|
|
|
[defaults synchronize];
|
|
|
|
|
|
|
|
|
|
|
|
//[self doUpdateStatus:data];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self hideConfigPanel:nil];
|
|
|
|
[self hideConfigPanel:nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -347,6 +352,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
- (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]];
|
|
|
@ -377,8 +384,6 @@
|
|
|
|
_lastDateThroughput = [NSDate timeIntervalSinceReferenceDate];
|
|
|
|
_lastDateThroughput = [NSDate timeIntervalSinceReferenceDate];
|
|
|
|
_lastInThroughput = ifIn;
|
|
|
|
_lastInThroughput = ifIn;
|
|
|
|
_lastOutThroughput = ifOut;
|
|
|
|
_lastOutThroughput = ifOut;
|
|
|
|
|
|
|
|
|
|
|
|
NSLog(@"In %llu Out %llu", ifIn, ifOut);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-(void)doUpdateStatus:(NSData *)data
|
|
|
|
-(void)doUpdateStatus:(NSData *)data
|
|
|
@ -403,6 +408,8 @@
|
|
|
|
[menuLoad setTitle:load];
|
|
|
|
[menuLoad setTitle:load];
|
|
|
|
[menuLoad setHidden:false];
|
|
|
|
[menuLoad setHidden:false];
|
|
|
|
[menuConnections setTitle:[NSString stringWithFormat:@"Connections: %@", ipconn]];
|
|
|
|
[menuConnections setTitle:[NSString stringWithFormat:@"Connections: %@", ipconn]];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[wrt_client getStatusUpdate:@"Status_Internet.live.asp" delegate:self callback:@selector(wanRequestCallback:)];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) refreshMenu:(id)sender
|
|
|
|
- (void) refreshMenu:(id)sender
|
|
|
@ -421,6 +428,7 @@
|
|
|
|
//WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
//WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
|
|
|
|
|
|
|
|
//[wrtr doRequest:self requestSelector:@selector(wanRequestCallback:) uri:@"Status_Internet.live.asp"];
|
|
|
|
//[wrtr doRequest:self requestSelector:@selector(wanRequestCallback:) uri:@"Status_Internet.live.asp"];
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) wanRequestCallback:(NSData *)data
|
|
|
|
- (void) wanRequestCallback:(NSData *)data
|
|
|
@ -498,7 +506,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
- (void) refreshClientsMenu:(id)sender
|
|
|
|
- (void) refreshClientsMenu:(id)sender
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[self updateThroughput:nil];
|
|
|
|
//[self updateThroughput:nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (NSString *) stringFromFileSize:(unsigned long long)theSize
|
|
|
|
- (NSString *) stringFromFileSize:(unsigned long long)theSize
|
|
|
|