Skip to content

Commit

Permalink
added some fields
Browse files Browse the repository at this point in the history
  • Loading branch information
unixpickle committed Feb 7, 2013
1 parent 854e30e commit 159b630
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
4 changes: 4 additions & 0 deletions JamWiFi.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "JamWiFi/JamWiFi-Prefix.pch";
INFOPLIST_FILE = "JamWiFi/JamWiFi-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx10.7;
WRAPPER_EXTENSION = app;
};
name = Debug;
Expand All @@ -402,7 +404,9 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "JamWiFi/JamWiFi-Prefix.pch";
INFOPLIST_FILE = "JamWiFi/JamWiFi-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx10.7;
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
2 changes: 2 additions & 0 deletions JamWiFi/ANListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@
- (void)disassociateButton:(id)sender;
- (void)jamButton:(id)sender;

- (NSString *)securityTypeString:(CWNetwork *)network;

@end
31 changes: 28 additions & 3 deletions JamWiFi/ANListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,27 @@ - (id)initWithFrame:(NSRect)frame {
NSTableColumn * channelColumn = [[NSTableColumn alloc] initWithIdentifier:@"channel"];
[[channelColumn headerCell] setStringValue:@"CH"];
[channelColumn setWidth:40];
[channelColumn setEditable:NO];
[channelColumn setEditable:YES];
[networksTable addTableColumn:channelColumn];

NSTableColumn * essidColumn = [[NSTableColumn alloc] initWithIdentifier:@"essid"];
[[essidColumn headerCell] setStringValue:@"ESSID"];
[essidColumn setWidth:200];
[essidColumn setEditable:NO];
[essidColumn setEditable:YES];
[networksTable addTableColumn:essidColumn];

NSTableColumn * bssidColumn = [[NSTableColumn alloc] initWithIdentifier:@"bssid"];
[[bssidColumn headerCell] setStringValue:@"BSSID"];
[bssidColumn setWidth:120];
[bssidColumn setEditable:NO];
[bssidColumn setEditable:YES];
[networksTable addTableColumn:bssidColumn];

NSTableColumn * encColumn = [[NSTableColumn alloc] initWithIdentifier:@"enc"];
[[encColumn headerCell] setStringValue:@"Security"];
[encColumn setWidth:60];
[encColumn setEditable:YES];
[networksTable addTableColumn:encColumn];

[networksScrollView setDocumentView:networksTable];
[networksScrollView setBorderType:NSBezelBorder];
[networksScrollView setHasVerticalScroller:YES];
Expand Down Expand Up @@ -137,16 +143,23 @@ - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {

- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
CWNetwork * network = [networks objectAtIndex:row];

if ([[tableColumn identifier] isEqualToString:@"channel"]) {
return [NSNumber numberWithInt:(int)network.wlanChannel.channelNumber];
} else if ([[tableColumn identifier] isEqualToString:@"essid"]) {
return network.ssid;
} else if ([[tableColumn identifier] isEqualToString:@"bssid"]) {
return network.bssid;
} else if ([[tableColumn identifier] isEqualToString:@"enc"]) {
return [self securityTypeString:network];
}
return nil;
}

- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
return;
}

- (void)tableViewSelectionDidChange:(NSNotification *)notification {
if ([[networksTable selectedRowIndexes] count] > 0) {
[jamButton setEnabled:YES];
Expand All @@ -155,6 +168,18 @@ - (void)tableViewSelectionDidChange:(NSNotification *)notification {
}
}

- (NSString *)securityTypeString:(CWNetwork *)network {
if ([network supportsSecurity:kCWSecurityDynamicWEP]) {
return @"WEP";
} else if ([network supportsSecurity:kCWSecurityModeOpen]) {
return @"Open";
} else if ([network supportsSecurity:kCWSecurityEnterprise]) {
return @"Enterprise";
} else {
return @"WPA";
}
}

#pragma mark - Private -

- (void)handleScanError {
Expand Down
2 changes: 1 addition & 1 deletion JamWiFi/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) {
myStatus = AuthorizationExecuteWithPrivileges(myAuthorizationRef, myToolPath, myFlags, myArguments,
NULL);
AuthorizationFree(myAuthorizationRef, kAuthorizationFlagDefaults);
return 0;
exit(0);
}
return NSApplicationMain(argc, (const char **)argv);
}
Expand Down

0 comments on commit 159b630

Please sign in to comment.