|
|
@ -14,44 +14,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
//- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
|
|
|
//- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
|
|
|
- (void) awakeFromNib
|
|
|
|
- (void) awakeFromNib
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NSLog(@"Spike debug start.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wrt_client = [[WRTStatusClient alloc] initWithHostname:@"router" port:80 username:@"spike" password:@"aaaassss"];
|
|
|
|
wrt_client = [[WRTStatusClient alloc] initWithHostname:@"router" port:80 username:@"spike" password:@"aaaassss"];
|
|
|
|
|
|
|
|
|
|
|
|
[wrt_client getStatusUpdate:@"graph_if.svg?vlan2" delegate: self];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSLog(@"Spike debug end.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Insert code here to initialize your application
|
|
|
|
// Insert code here to initialize your application
|
|
|
|
[self showMenubar];
|
|
|
|
[self showMenubar];
|
|
|
|
|
|
|
|
|
|
|
|
_wrtReachable = false;
|
|
|
|
_wrtReachable = false;
|
|
|
|
|
|
|
|
|
|
|
|
// initialize defaults
|
|
|
|
defaults = [NSUserDefaults standardUserDefaults];
|
|
|
|
NSString *hostname = [[NSUserDefaults standardUserDefaults] stringForKey:@"hostname"];
|
|
|
|
|
|
|
|
|
|
|
|
// check if the app is configured yet
|
|
|
|
if (hostname == nil) // App first run: set up user defaults.
|
|
|
|
if (![defaults boolForKey:@"configured"])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:nil];
|
|
|
|
[self initDefaults];
|
|
|
|
|
|
|
|
|
|
|
|
NSLog(@"Creating new user defaults");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// do any other initialization you want to do here - e.g. the starting default values.
|
|
|
|
|
|
|
|
//[[NSUserDefaults standardUserDefaults] setObject:@"192.168.1.1" foKey:@"hostname"];
|
|
|
|
|
|
|
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"showMenuIcon"];
|
|
|
|
|
|
|
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"useBytes"];
|
|
|
|
|
|
|
|
[[NSUserDefaults standardUserDefaults] setInteger:80 forKey:@"port"];
|
|
|
|
|
|
|
|
[[NSUserDefaults standardUserDefaults] setInteger:4 forKey:@"refreshTime"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// sync the defaults to disk
|
|
|
|
|
|
|
|
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
|
|
|
|
|
|
|
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Add modal alert "First launch" here...
|
|
|
|
|
|
|
|
[self showConfigPanel:nil];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
[self readDefaults];
|
|
|
|
NSLog(@"Using existing user defaults");
|
|
|
|
NSLog(@"Using existing user defaults");
|
|
|
|
|
|
|
|
|
|
|
|
//_readTimer = [NSTimer scheduledTimerWithTimeInterval:[[NSUserDefaults standardUserDefaults] integerForKey:@"refreshTime"] target:self selector:@selector(updateThroughput:) userInfo:nil repeats:YES];
|
|
|
|
//_readTimer = [NSTimer scheduledTimerWithTimeInterval:[[NSUserDefaults standardUserDefaults] integerForKey:@"refreshTime"] target:self selector:@selector(updateThroughput:) userInfo:nil repeats:YES];
|
|
|
@ -59,9 +38,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
[self updateThroughput];
|
|
|
|
[self updateThroughput];
|
|
|
|
|
|
|
|
|
|
|
|
WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
//WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
|
|
|
|
|
|
|
|
[wrtr doRequest:self requestSelector:@selector(doUpdateStatus:) uri:@"Status_Router.live.asp"];
|
|
|
|
//[wrtr doRequest:self requestSelector:@selector(doUpdateStatus:) uri:@"Status_Router.live.asp"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -75,6 +54,32 @@
|
|
|
|
[super dealloc];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void) initDefaults
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:nil];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSLog(@"Creating new user defaults");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// do any other initialization you want to do here - e.g. the starting default values.
|
|
|
|
|
|
|
|
//[[NSUserDefaults standardUserDefaults] setObject:@"192.168.1.1" foKey:@"hostname"];
|
|
|
|
|
|
|
|
[defaults setBool:YES forKey:@"showMenuIcon"];
|
|
|
|
|
|
|
|
[defaults setBool:YES forKey:@"useBytes"];
|
|
|
|
|
|
|
|
[defaults setInteger:80 forKey:@"port"];
|
|
|
|
|
|
|
|
[defaults setInteger:4 forKey:@"refreshTime"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// sync the defaults to disk
|
|
|
|
|
|
|
|
[defaults registerDefaults:appDefaults];
|
|
|
|
|
|
|
|
[defaults synchronize];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Add modal alert "First launch" here...
|
|
|
|
|
|
|
|
[self showConfigPanel:self];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void) readDefaults
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) terminate:(id)sender {
|
|
|
|
- (void) terminate:(id)sender {
|
|
|
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
|
[self dealloc];
|
|
|
|
[self dealloc];
|
|
|
@ -241,9 +246,9 @@
|
|
|
|
[configStateStatus startAnimation:nil];
|
|
|
|
[configStateStatus startAnimation:nil];
|
|
|
|
[configStateStatus setHidden:false];
|
|
|
|
[configStateStatus setHidden:false];
|
|
|
|
|
|
|
|
|
|
|
|
WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
//WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
|
|
|
|
|
|
|
|
[wrtr doRequest:self requestSelector:@selector(configSaveRequestCallback:) uri:@"Status_Router.live.asp"];
|
|
|
|
//[wrtr doRequest:self requestSelector:@selector(configSaveRequestCallback:) uri:@"Status_Router.live.asp"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-(NSString *)getKey:(NSString *)stringData key:(NSString *)key
|
|
|
|
-(NSString *)getKey:(NSString *)stringData key:(NSString *)key
|
|
|
@ -308,9 +313,9 @@
|
|
|
|
- (void) updateThroughput
|
|
|
|
- (void) updateThroughput
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
//WRTRequest *wrtr = [[WRTRequest alloc] init];
|
|
|
|
|
|
|
|
|
|
|
|
[wrtr doRequest:self requestSelector:@selector(throughputCallback:) uri:@"fetchif.cgi?ppp1"];
|
|
|
|
//[wrtr doRequest:self requestSelector:@selector(throughputCallback:) uri:@"fetchif.cgi?ppp1"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) throughputCallback:(NSData *)data
|
|
|
|
- (void) throughputCallback:(NSData *)data
|
|
|
@ -367,9 +372,9 @@
|
|
|
|
- (void) refreshWanMenu:(id)sender
|
|
|
|
- (void) refreshWanMenu:(id)sender
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NSLog(@"Refreshing Wan Menu");
|
|
|
|
NSLog(@"Refreshing Wan Menu");
|
|
|
|
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
|
|
|
|