-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
display wifi access points on the map
- Loading branch information
Showing
22 changed files
with
9,410 additions
and
704 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// SPWifiAnnotation.h | ||
// SpyPhone | ||
// | ||
// Created by Nicolas Seriot on 10/31/10. | ||
// Copyright 2010 IICT. All rights reserved. | ||
// | ||
|
||
#import <MapKit/MapKit.h> | ||
|
||
@protocol MKAnnotation; | ||
|
||
@interface SPWifiAnnotation : NSObject <MKAnnotation> { | ||
NSDictionary *accessPoint; | ||
CLLocationCoordinate2D coordinate; | ||
} | ||
|
||
@property (nonatomic, retain) NSDictionary *accessPoint; | ||
@property (nonatomic, readwrite) CLLocationCoordinate2D coordinate; | ||
|
||
+ (SPWifiAnnotation *)annotationWithAccessPoint:(NSDictionary *)d; | ||
|
||
- (NSString *)annotationViewIdentifier; | ||
|
||
- (NSString *)title; | ||
- (NSString *)subtitle; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// SPWifiAnnotation.m | ||
// SpyPhone | ||
// | ||
// Created by Nicolas Seriot on 10/31/10. | ||
// Copyright 2010 IICT. All rights reserved. | ||
// | ||
|
||
#import "SPWifiAnnotation.h" | ||
|
||
|
||
@implementation SPWifiAnnotation | ||
|
||
@synthesize coordinate; | ||
@synthesize accessPoint; | ||
|
||
- (NSString *)title { | ||
return [accessPoint valueForKey:@"SSID_STR"]; | ||
} | ||
|
||
- (NSString *)subtitle { | ||
NSDate *joined = [accessPoint valueForKey:@"lastJoined"]; | ||
NSDate *autoJoined = [accessPoint valueForKey:@"lastAutoJoined"]; | ||
|
||
NSDate *date = autoJoined ? autoJoined : joined; | ||
|
||
return [date description]; | ||
} | ||
|
||
+ (SPWifiAnnotation *)annotationWithAccessPoint:(NSDictionary *)ap { | ||
NSString *latitude = [ap valueForKeyPath:@"location.latitude"]; | ||
NSString *longitude = [ap valueForKeyPath:@"location.longitude"]; | ||
|
||
if(latitude == nil || longitude == nil) return nil; | ||
|
||
SPWifiAnnotation *annotation = [[SPWifiAnnotation alloc] init]; | ||
annotation.accessPoint = ap; | ||
annotation.coordinate = CLLocationCoordinate2DMake([latitude doubleValue], [longitude doubleValue]);; | ||
return [annotation autorelease]; | ||
} | ||
|
||
- (void)dealloc { | ||
[accessPoint release]; | ||
[super dealloc]; | ||
} | ||
|
||
- (NSString *)annotationViewIdentifier { | ||
return [accessPoint valueForKey:@"BSSID"]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// SPWifiMapVC.h | ||
// SpyPhone | ||
// | ||
// Created by Nicolas Seriot on 10/31/10. | ||
// Copyright 2010 IICT. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <MapKit/MapKit.h> | ||
|
||
@interface SPWifiMapVC : UIViewController { | ||
NSArray *annotations; | ||
|
||
IBOutlet MKMapView *mapView; | ||
} | ||
|
||
@property (nonatomic, retain) NSArray *annotations; | ||
|
||
//- (void)addAnnotation:(id <MKAnnotation>)annotation; | ||
|
||
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// | ||
// SPWifiMapVC.m | ||
// SpyPhone | ||
// | ||
// Created by Nicolas Seriot on 10/31/10. | ||
// Copyright 2010 IICT. All rights reserved. | ||
// | ||
|
||
#import "SPWifiMapVC.h" | ||
|
||
|
||
@implementation SPWifiMapVC | ||
|
||
@synthesize annotations; | ||
|
||
//- (void)setAnnotations:(NSArray *)someAnnotations { | ||
// [mapView removeAnnotations:mapView.annotations]; | ||
// | ||
// [annotations autorelease]; | ||
// annotations = [someAnnotations retain]; | ||
// | ||
// [mapView addAnnotations:annotations]; | ||
//} | ||
|
||
- (void)loadView { | ||
[super loadView]; | ||
|
||
self.title = @"Wifi Map"; | ||
} | ||
|
||
- (void)viewWillAppear:(BOOL)animated { | ||
[super viewWillAppear:animated]; | ||
|
||
[mapView removeAnnotations:annotations]; | ||
} | ||
|
||
- (void)viewDidAppear:(BOOL)animated { | ||
[super viewDidAppear:animated]; | ||
|
||
[mapView addAnnotations:annotations]; | ||
|
||
id <MKAnnotation>annotation = [annotations lastObject]; | ||
MKCoordinateSpan span = MKCoordinateSpanMake(0.03, 0.03); | ||
MKCoordinateRegion region = [mapView regionThatFits:MKCoordinateRegionMake(annotation.coordinate, span)]; | ||
|
||
[mapView setRegion:region animated:NO]; | ||
|
||
if([annotations count] == 1) [mapView selectAnnotation:[annotations lastObject] animated:YES]; | ||
} | ||
|
||
- (MKAnnotationView *)mapView:(MKMapView *)aMapView viewForAnnotation:(id <MKAnnotation>)annotation { | ||
|
||
if([annotation isKindOfClass:[MKUserLocation class]]) return nil; | ||
|
||
NSString *annID = @"SPWifiAnnotation"; | ||
MKAnnotationView *av = [aMapView dequeueReusableAnnotationViewWithIdentifier:annID]; | ||
|
||
if(av == nil) { | ||
av = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annID] autorelease]; | ||
av.canShowCallout = YES; | ||
} | ||
return av; | ||
} | ||
|
||
/* | ||
// Override to allow orientations other than the default portrait orientation. | ||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | ||
// Return YES for supported orientations | ||
return (interfaceOrientation == UIInterfaceOrientationPortrait); | ||
} | ||
*/ | ||
|
||
- (void)dealloc { | ||
[annotations release]; | ||
[super dealloc]; | ||
} | ||
|
||
@end |
Oops, something went wrong.