Skip to content
Browse files

First commit

  • Loading branch information...
0 parents commit d8f99d12ccb749eb4d86bec1c5f9f6680a938e4a @dhmspector committed Dec 5, 2009
Showing with 9,247 additions and 0 deletions.
  1. +20 −0 Classes/CoreLocationTestAppDelegate.h
  2. +37 −0 Classes/CoreLocationTestAppDelegate.m
  3. +13 −0 Classes/FlipsideView.h
  4. +32 −0 Classes/FlipsideView.m
  5. +25 −0 Classes/FlipsideViewController.h
  6. +54 −0 Classes/FlipsideViewController.m
  7. +14 −0 Classes/MainView.h
  8. +32 −0 Classes/MainView.m
  9. +70 −0 Classes/MainViewController.h
  10. +371 −0 Classes/MainViewController.m
  11. +122 −0 Classes/Reachability/Reachability.h
  12. +585 −0 Classes/Reachability/Reachability.m
  13. +536 −0 FlipsideView.xib
  14. BIN Graphics/01-refresh.png
  15. BIN Graphics/103-map.png
  16. BIN Graphics/71-compass.png
  17. BIN Graphics/74-location.png
  18. BIN Graphics/Airport.png
  19. BIN Graphics/WWAN5.png
  20. BIN Graphics/map-marker.png
  21. BIN Graphics/red.png
  22. BIN Graphics/stop-32.png
  23. BIN Graphics/tack.png
  24. BIN Graphics/tack_small.png
  25. BIN Graphics/target.png
  26. BIN Graphics/target_small.png
  27. +1,224 −0 MainView.xib
  28. +183 −0 MainWindow.xib
  29. 0 README
  30. +34 −0 SensorToy-Info.plist
  31. BIN SensorToy.png
  32. +392 −0 SensorToy.xcodeproj/project.pbxproj
  33. +487 −0 SensorToy.xcodeproj/spector.pbxuser
  34. +1,491 −0 SensorToy.xcodeproj/spector.perspectivev3
  35. +14 −0 SensorToy_Prefix.pch
  36. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/categories.pbxbtree
  37. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/cdecls.pbxbtree
  38. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/decls.pbxbtree
  39. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/files.pbxbtree
  40. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/imports.pbxbtree
  41. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/pbxindex.header
  42. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/protocols.pbxbtree
  43. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/refs.pbxbtree
  44. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/strings.pbxstrings/control
  45. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/strings.pbxstrings/strings
  46. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/subclasses.pbxbtree
  47. BIN build/CoreLocationTest.build/CoreLocationTest.pbxindex/symbols0.pbxsymbols
  48. BIN ...nTest.build/Debug-iphonesimulator/CoreLocationTest.build/CoreLocationTest-all-target-headers.hmap
  49. BIN ...tionTest.build/Debug-iphonesimulator/CoreLocationTest.build/CoreLocationTest-generated-files.hmap
  50. BIN ...nTest.build/Debug-iphonesimulator/CoreLocationTest.build/CoreLocationTest-own-target-headers.hmap
  51. BIN ...tionTest.build/Debug-iphonesimulator/CoreLocationTest.build/CoreLocationTest-project-headers.hmap
  52. +15 −0 build/CoreLocationTest.build/Debug-iphonesimulator/CoreLocationTest.build/CoreLocationTest.dep
  53. BIN build/CoreLocationTest.build/Debug-iphonesimulator/CoreLocationTest.build/CoreLocationTest.hmap
  54. +15 −0 build/CoreLocationTest.build/Debug-iphonesimulator/CoreLocationTest.build/CoreLocationTest~.dep
  55. +6 −0 ...ld/Debug-iphonesimulator/CoreLocationTest.build/Objects-normal/i386/CoreLocationTest.LinkFileList
  56. BIN ...ld/Debug-iphonesimulator/CoreLocationTest.build/Objects-normal/i386/CoreLocationTestAppDelegate.o
  57. BIN ...ocationTest.build/Debug-iphonesimulator/CoreLocationTest.build/Objects-normal/i386/FlipsideView.o
  58. BIN ...t.build/Debug-iphonesimulator/CoreLocationTest.build/Objects-normal/i386/FlipsideViewController.o
  59. BIN ...oreLocationTest.build/Debug-iphonesimulator/CoreLocationTest.build/Objects-normal/i386/MainView.o
  60. BIN ...nTest.build/Debug-iphonesimulator/CoreLocationTest.build/Objects-normal/i386/MainViewController.o
  61. BIN build/CoreLocationTest.build/Debug-iphonesimulator/CoreLocationTest.build/Objects-normal/i386/main.o
  62. +15 −0 build/CoreLocationTest.build/Debug-iphonesimulator/CoreLocationTest.build/SensorToy.dep
  63. +408 −0 build/CoreLocationTest.build/Debug-iphonesimulator/CoreLocationTest.build/build-state.dat
  64. +364 −0 build/CoreLocationTest.build/Debug-iphonesimulator/CoreLocationTest.build/build-state~.dat
  65. +20 −0 build/Debug-iphoneos/SensorToy.app.dSYM/Contents/Info.plist
  66. BIN build/Debug-iphoneos/SensorToy.app.dSYM/Contents/Resources/DWARF/SensorToy
  67. BIN build/Debug-iphoneos/SensorToy.app/01-refresh.png
  68. BIN build/Debug-iphoneos/SensorToy.app/103-map.png
  69. BIN build/Debug-iphoneos/SensorToy.app/71-compass.png
  70. BIN build/Debug-iphoneos/SensorToy.app/74-location.png
  71. +1 −0 build/Debug-iphoneos/SensorToy.app/CodeResources
  72. BIN build/Debug-iphoneos/SensorToy.app/FlipsideView.nib
  73. BIN build/Debug-iphoneos/SensorToy.app/Info.plist
  74. BIN build/Debug-iphoneos/SensorToy.app/MainView.nib
  75. BIN build/Debug-iphoneos/SensorToy.app/MainWindow.nib
  76. +1 −0 build/Debug-iphoneos/SensorToy.app/PkgInfo
  77. +25 −0 build/Debug-iphoneos/SensorToy.app/ResourceRules.plist
  78. BIN build/Debug-iphoneos/SensorToy.app/SensorToy.png
  79. +84 −0 build/Debug-iphoneos/SensorToy.app/_CodeSignature/CodeResources
  80. BIN build/Debug-iphoneos/SensorToy.app/embedded.mobileprovision
  81. BIN build/Debug-iphoneos/SensorToy.app/map-marker.png
  82. BIN build/Debug-iphoneos/SensorToy.app/tack.png
  83. BIN build/Debug-iphoneos/SensorToy.app/tack_small.png
  84. BIN build/Debug-iphoneos/SensorToy.app/target.png
  85. BIN build/Debug-iphoneos/SensorToy.app/target_small.png
  86. +18 −0 build/Debug-iphonesimulator/CoreLocationTest.app.dSYM/Contents/Info.plist
  87. BIN build/Debug-iphonesimulator/CoreLocationTest.app.dSYM/Contents/Resources/DWARF/CoreLocationTest
  88. BIN build/Debug-iphonesimulator/CoreLocationTest.app/CoreLocationTest
  89. BIN build/Debug-iphonesimulator/CoreLocationTest.app/FlipsideView.nib
  90. BIN build/Debug-iphonesimulator/CoreLocationTest.app/Info.plist
  91. BIN build/Debug-iphonesimulator/CoreLocationTest.app/MainView.nib
  92. BIN build/Debug-iphonesimulator/CoreLocationTest.app/MainWindow.nib
  93. +1 −0 build/Debug-iphonesimulator/CoreLocationTest.app/PkgInfo
  94. +18 −0 build/Debug-iphonesimulator/SensorToy.app.dSYM/Contents/Info.plist
  95. BIN build/Debug-iphonesimulator/SensorToy.app.dSYM/Contents/Resources/DWARF/SensorToy
  96. BIN build/Debug-iphonesimulator/SensorToy.app/FlipsideView.nib
  97. BIN build/Debug-iphonesimulator/SensorToy.app/Info.plist
  98. BIN build/Debug-iphonesimulator/SensorToy.app/MainView.nib
  99. BIN build/Debug-iphonesimulator/SensorToy.app/MainWindow.nib
  100. +1 −0 build/Debug-iphonesimulator/SensorToy.app/PkgInfo
  101. BIN build/Debug-iphonesimulator/SensorToy.app/SensorToy
  102. BIN ...SensorToy.build/Debug-iphoneos/SensorToy.build/Objects-normal/armv6/CoreLocationTestAppDelegate.o
  103. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/Objects-normal/armv6/FlipsideView.o
  104. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/Objects-normal/armv6/FlipsideViewController.o
  105. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/Objects-normal/armv6/MainView.o
  106. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/Objects-normal/armv6/MainViewController.o
  107. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/Objects-normal/armv6/Reachability.o
  108. +7 −0 build/SensorToy.build/Debug-iphoneos/SensorToy.build/Objects-normal/armv6/SensorToy.LinkFileList
  109. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/Objects-normal/armv6/main.o
  110. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/SensorToy-all-target-headers.hmap
  111. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/SensorToy-generated-files.hmap
  112. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/SensorToy-own-target-headers.hmap
  113. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/SensorToy-project-headers.hmap
  114. +48 −0 build/SensorToy.build/Debug-iphoneos/SensorToy.build/SensorToy.dep
  115. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/SensorToy.hmap
  116. BIN build/SensorToy.build/Debug-iphoneos/SensorToy.build/SensorToy.xcent
  117. +18 −0 build/SensorToy.build/Debug-iphoneos/SensorToy.build/SensorToy~.dep
  118. +1,105 −0 build/SensorToy.build/Debug-iphoneos/SensorToy.build/build-state.dat
  119. +474 −0 build/SensorToy.build/Debug-iphoneos/SensorToy.build/build-state~.dat
  120. BIN ...Toy.build/Debug-iphonesimulator/SensorToy.build/Objects-normal/i386/CoreLocationTestAppDelegate.o
  121. BIN build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/Objects-normal/i386/FlipsideView.o
  122. BIN ...ensorToy.build/Debug-iphonesimulator/SensorToy.build/Objects-normal/i386/FlipsideViewController.o
  123. BIN build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/Objects-normal/i386/MainView.o
  124. BIN build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/Objects-normal/i386/MainViewController.o
  125. +6 −0 .../SensorToy.build/Debug-iphonesimulator/SensorToy.build/Objects-normal/i386/SensorToy.LinkFileList
  126. BIN build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/Objects-normal/i386/main.o
  127. BIN build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/SensorToy-all-target-headers.hmap
  128. BIN build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/SensorToy-generated-files.hmap
  129. BIN build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/SensorToy-own-target-headers.hmap
  130. BIN build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/SensorToy-project-headers.hmap
  131. +15 −0 build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/SensorToy.dep
  132. BIN build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/SensorToy.hmap
  133. +15 −0 build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/SensorToy~.dep
  134. +407 −0 build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/build-state.dat
  135. +407 −0 build/SensorToy.build/Debug-iphonesimulator/SensorToy.build/build-state~.dat
  136. BIN build/SensorToy.build/SensorToy.pbxindex/categories.pbxbtree
  137. BIN build/SensorToy.build/SensorToy.pbxindex/cdecls.pbxbtree
  138. BIN build/SensorToy.build/SensorToy.pbxindex/decls.pbxbtree
  139. BIN build/SensorToy.build/SensorToy.pbxindex/files.pbxbtree
  140. BIN build/SensorToy.build/SensorToy.pbxindex/imports.pbxbtree
  141. BIN build/SensorToy.build/SensorToy.pbxindex/pbxindex.header
  142. BIN build/SensorToy.build/SensorToy.pbxindex/protocols.pbxbtree
  143. BIN build/SensorToy.build/SensorToy.pbxindex/refs.pbxbtree
  144. BIN build/SensorToy.build/SensorToy.pbxindex/strings.pbxstrings/control
  145. BIN build/SensorToy.build/SensorToy.pbxindex/strings.pbxstrings/strings
  146. BIN build/SensorToy.build/SensorToy.pbxindex/subclasses.pbxbtree
  147. BIN build/SensorToy.build/SensorToy.pbxindex/symbols0.pbxsymbols
  148. +17 −0 main.m
20 Classes/CoreLocationTestAppDelegate.h
@@ -0,0 +1,20 @@
+//
+// CoreLocationTestAppDelegate.h
+// CoreLocationTest
+//
+// Created by David HM Spector on 12/3/09.
+// Copyright Zeitgeist Information Systems 2009. All rights reserved.
+//
+
+@class MainViewController;
+
+@interface CoreLocationTestAppDelegate : NSObject <UIApplicationDelegate> {
+ UIWindow *window;
+ MainViewController *mainViewController;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) MainViewController *mainViewController;
+
+@end
+
37 Classes/CoreLocationTestAppDelegate.m
@@ -0,0 +1,37 @@
+//
+// CoreLocationTestAppDelegate.m
+// CoreLocationTest
+//
+// Created by David HM Spector on 12/3/09.
+// Copyright Zeitgeist Information Systems 2009. All rights reserved.
+//
+
+#import "CoreLocationTestAppDelegate.h"
+#import "MainViewController.h"
+
+@implementation CoreLocationTestAppDelegate
+
+
+@synthesize window;
+@synthesize mainViewController;
+
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+
+ MainViewController *aController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil];
+ self.mainViewController = aController;
+ [aController release];
+
+ mainViewController.view.frame = [UIScreen mainScreen].applicationFrame;
+ [window addSubview:[mainViewController view]];
+ [window makeKeyAndVisible];
+}
+
+
+- (void)dealloc {
+ [mainViewController release];
+ [window release];
+ [super dealloc];
+}
+
+@end
13 Classes/FlipsideView.h
@@ -0,0 +1,13 @@
+//
+// FlipsideView.h
+// CoreLocationTest
+//
+// Created by David HM Spector on 12/3/09.
+// Copyright Zeitgeist Information Systems 2009. All rights reserved.
+//
+
+@interface FlipsideView : UIView {
+
+}
+
+@end
32 Classes/FlipsideView.m
@@ -0,0 +1,32 @@
+//
+// FlipsideView.m
+// CoreLocationTest
+//
+// Created by David HM Spector on 12/3/09.
+// Copyright Zeitgeist Information Systems 2009. All rights reserved.
+//
+
+#import "FlipsideView.h"
+
+@implementation FlipsideView
+
+
+- (id)initWithFrame:(CGRect)frame {
+ if (self = [super initWithFrame:frame]) {
+ // Initialization code
+ }
+ return self;
+}
+
+
+- (void)drawRect:(CGRect)rect {
+ // Drawing code
+}
+
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+
+@end
25 Classes/FlipsideViewController.h
@@ -0,0 +1,25 @@
+//
+// FlipsideViewController.h
+// CoreLocationTest
+//
+// Created by David HM Spector on 12/3/09.
+// Copyright Zeitgeist Information Systems 2009. All rights reserved.
+//
+
+@protocol FlipsideViewControllerDelegate;
+
+
+@interface FlipsideViewController : UIViewController {
+ id <FlipsideViewControllerDelegate> delegate;
+}
+
+@property (nonatomic, assign) id <FlipsideViewControllerDelegate> delegate;
+- (IBAction)done;
+
+@end
+
+
+@protocol FlipsideViewControllerDelegate
+- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller;
+@end
+
54 Classes/FlipsideViewController.m
@@ -0,0 +1,54 @@
+//
+// FlipsideViewController.m
+// CoreLocationTest
+//
+// Created by David HM Spector on 12/3/09.
+// Copyright Zeitgeist Information Systems 2009. All rights reserved.
+//
+
+#import "FlipsideViewController.h"
+
+
+@implementation FlipsideViewController
+
+@synthesize delegate;
+
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor];
+}
+
+
+- (IBAction)done {
+ [self.delegate flipsideViewControllerDidFinish:self];
+}
+
+
+/*
+ // Override to allow orientations other than the default portrait orientation.
+ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ // Return YES for supported orientations
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+ }
+ */
+
+- (void)didReceiveMemoryWarning {
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc that aren't in use.
+}
+
+- (void)viewDidUnload {
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+
+@end
14 Classes/MainView.h
@@ -0,0 +1,14 @@
+//
+// MainView.h
+// CoreLocationTest
+//
+// Created by David HM Spector on 12/3/09.
+// Copyright Zeitgeist Information Systems 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+
+@interface MainView : UIView {
+}
+@end
32 Classes/MainView.m
@@ -0,0 +1,32 @@
+//
+// MainView.m
+// CoreLocationTest
+//
+// Created by David HM Spector on 12/3/09.
+// Copyright Zeitgeist Information Systems 2009. All rights reserved.
+//
+
+#import "MainView.h"
+
+@implementation MainView
+
+
+- (id)initWithFrame:(CGRect)frame {
+ if (self = [super initWithFrame:frame]) {
+ // Initialization code
+ }
+ return self;
+}
+
+
+- (void)drawRect:(CGRect)rect {
+ // Drawing code
+}
+
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+
+@end
70 Classes/MainViewController.h
@@ -0,0 +1,70 @@
+//
+// MainViewController.h
+// CoreLocationTest
+//
+// Created by David HM Spector on 12/3/09.
+// Copyright Zeitgeist Information Systems 2009. All rights reserved.
+//
+
+#import "FlipsideViewController.h"
+#import <MapKit/MapKit.h>
+#import <MapKit/MKAnnotation.h>
+#import <MapKit/MKReverseGeocoder.h>
+#import <CoreLocation/CoreLocation.h>
+#import "Reachability.h" // Apple's "reachability code"
+
+#define kOne32ndCompassDivision 11.25
+
+@interface MainViewController : UIViewController <FlipsideViewControllerDelegate, MKReverseGeocoderDelegate, MKMapViewDelegate, UIAccelerometerDelegate, CLLocationManagerDelegate> {
+ // the MapKit parts
+ IBOutlet UILabel *currentLocation;
+ IBOutlet UILabel *currentElevation;
+ IBOutlet UILabel *currentHeading;
+ IBOutlet UILabel *currentSpeed;
+ IBOutlet UISwitch *coreLocationSwitch;
+ IBOutlet UILabel *lastUpdateTime;
+ IBOutlet UILabel *whichNetwork;
+ IBOutlet UIButton *showInfo;
+ IBOutlet MKMapView *mapView;
+
+ // The Accelerometers Parts
+ IBOutlet UILabel *xLabel;
+ IBOutlet UILabel *yLabel;
+ IBOutlet UILabel *zLabel;
+ IBOutlet UIProgressView *xBar;
+ IBOutlet UIProgressView *yBar;
+ IBOutlet UIProgressView *zBar;
+
+ NetworkStatus remoteHostStatus;
+ NetworkStatus internetConnectionStatus;
+ NetworkStatus localWiFiConnectionStatus;
+
+
+ MKPlacemark *mPlacemark;
+ MKReverseGeocoder *geoCoder;
+ UIAccelerometer *accelerometer;
+ CLLocationManager *locationManager;
+ NSDateFormatter *dateFormatter;
+
+ BOOL loc_service_active;
+
+}
+
+/*
+@property (nonatomic, retain) UILabel *currentLocation;
+@property (nonatomic, retain) UILabel *currentElevation;
+ @property (nonatomic, retain) UILabel *currentHeading;
+ @property (nonatomic, retain) UILabel *currentSpeed;
+ @property (nonatomic, retain) UILabel *lastUpdateTime;
+@property (nonatomic, retain) UISwitch *coreLocationSwitch;
+@property (nonatomic, retain) MKMapView *mapView;
+@property (nonatomic, retain) MKPlacemark *mPlacemark;
+@property (nonatomic, retain) MKReverseGeocoder *geoCoder;
+*/
+
+- (IBAction)toggleCoreLocation;
+- (IBAction) showUserLocation;
+- (IBAction) toggleMapType;
+
+
+@end
371 Classes/MainViewController.m
@@ -0,0 +1,371 @@
+//
+// MainViewController.m
+// CoreLocationTest
+//
+// Created by David HM Spector on 12/3/09.
+// Copyright Zeitgeist Information Systems 2009. All rights reserved.
+//
+
+#import "MainViewController.h"
+#import "MainView.h"
+
+
+@implementation MainViewController
+//@synthesize currentLocation, currentElevation, currentHeading, coreLocationSwitch, mapView, mPlacemark, geoCoder;
+
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
+ if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
+ // Custom initialization
+ }
+ return self;
+}
+
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ // First, determine what we can about network reacability
+ [[Reachability sharedReachability] setHostName:@"www.apple.com"];
+ remoteHostStatus = [[Reachability sharedReachability] remoteHostStatus];
+ internetConnectionStatus = [[Reachability sharedReachability] internetConnectionStatus];
+ localWiFiConnectionStatus = [[Reachability sharedReachability] localWiFiConnectionStatus];
+ switch (internetConnectionStatus) {
+ case ReachableViaCarrierDataNetwork:
+ whichNetwork.text = @"Cellular";
+ break;
+ case ReachableViaWiFiNetwork:
+ whichNetwork.text = @"WiFi";
+ break;
+ case NotReachable:
+ default:
+ whichNetwork.text = @"None";
+ break;
+ }
+
+ // The sensors
+ accelerometer = [UIAccelerometer sharedAccelerometer];
+ accelerometer.updateInterval = 0.1;
+ accelerometer.delegate = self;
+
+ // Core Location
+ locationManager = [[CLLocationManager alloc] init];
+ locationManager.delegate = self;
+ locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
+ [locationManager startUpdatingLocation];
+ loc_service_active = YES;
+
+ if ([locationManager headingAvailable])
+ [locationManager startUpdatingHeading];
+ else
+ currentHeading.text = @"N/A";
+
+ // The map
+ mapView.delegate = self;
+ mapView.zoomEnabled = YES;
+ mapView.scrollEnabled = YES;
+ mapView.showsUserLocation = YES;
+ mapView.mapType = MKMapTypeHybrid;
+ // this causes the map to follow the user around
+ //[mapView.userLocation addObserver:self forKeyPath:@"location" options:0 context:NULL];
+
+ /*Region and Zoom */
+ MKCoordinateRegion region;
+ MKCoordinateSpan span;
+ span.latitudeDelta = 0.2;
+ span.longitudeDelta = 0.2;
+
+ CLLocationCoordinate2D location = mapView.userLocation.coordinate;
+
+ location.latitude = 40.814849;
+ location.longitude = -73.622732;
+ region.span = span;
+ region.center = location;
+
+ [mapView setRegion:region animated:YES];
+ [mapView regionThatFits:region];
+
+ /*Geocoder Stuff*/
+ // geoCoder=[[MKReverseGeocoder alloc] initWithCoordinate:location];
+ // geoCoder.delegate = self;
+ // [geoCoder start];
+
+
+ dateFormatter = [[NSDateFormatter alloc] init];
+ [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
+ [dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
+
+}
+
+
+
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+
+
+- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller {
+ [self dismissModalViewControllerAnimated:YES];
+}
+
+
+- (IBAction)showInfo {
+
+ FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
+ controller.delegate = self;
+
+ controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
+ [self presentModalViewController:controller animated:YES];
+
+ [controller release];
+}
+
+
+
+
+- (void)didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc that aren't in use.
+}
+
+- (void)viewDidUnload {
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+
+- (void)dealloc {
+ // release all our UI bits
+ [currentLocation release];
+ [currentElevation release];
+ [currentHeading release];
+ [coreLocationSwitch release];
+ [mapView release];
+
+ [xLabel release];
+ [yLabel release];
+ [zLabel release];
+
+ [xBar release];
+ [yBar release];
+ [zBar release];
+
+
+ // deactivate and release the sensors, map and geocoder
+ accelerometer.delegate = nil;
+ [accelerometer release];
+
+ mapView.delegate = nil;
+ [mapView release];
+
+ // geoCoder.delegate = nil;
+ // [geoCoder release];
+
+ locationManager.delegate = nil;
+ [locationManager release];
+
+ [dateFormatter release];
+
+ //...and finally:
+ [super dealloc];
+}
+
+#pragma mark MapKit Delegate Methods
+
+// this causes the map to track the user... this *will* interfere with the
+// user's pinch/zoom control of the map. You have been warned.
+- (void) observeValueForKeyPath:(NSString *)keyPath
+ ofObject:(id)Oobject
+ change:(NSDictionary *)change
+ context:(void *)context
+{
+ mapView.centerCoordinate = mapView.userLocation.location.coordinate;
+}
+
+
+
+- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder
+ didFailWithError:(NSError *)error
+{
+ NSLog(@"Reverse Geocoder Errored");
+}
+
+- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
+{
+ NSLog(@"Reverse Geocoder completed");
+ mPlacemark = placemark;
+ [mapView addAnnotation:placemark];
+}
+
+- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
+{
+ MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
+ annView.animatesDrop = TRUE;
+ return annView;
+}
+
+
+#pragma mark UIAccelerometer Delegate Methods
+
+- (void)accelerometer:(UIAccelerometer *)meter didAccelerate:(UIAcceleration *)acceleration {
+ xLabel.text = [NSString stringWithFormat:@"%.5f", acceleration.x];
+ xBar.progress = ABS(acceleration.x);
+
+ yLabel.text = [NSString stringWithFormat:@"%.5f", acceleration.y];
+ yBar.progress = ABS(acceleration.y);
+
+ zLabel.text = [NSString stringWithFormat:@"%.5f", acceleration.z];
+ zBar.progress = ABS(acceleration.z);
+
+}
+
+
+#pragma mark ---- Location Manager Delegate Methods ----
+- (void) locationManager:(CLLocationManager *)manager
+ didUpdateToLocation:(CLLocation *)newLocation
+ fromLocation:(CLLocation *)oldLocation
+{
+ NSLog(@"Location: %@", [newLocation description]);
+ currentLocation.text = [NSString stringWithFormat:@"%3.2f, %3.2f", newLocation.coordinate.latitude, newLocation.coordinate.longitude];
+ currentElevation.text = [NSString stringWithFormat:@"%3.2f", newLocation.altitude];
+ currentSpeed.text = newLocation.speed < 0 ? @" - " : [NSString stringWithFormat:@"@%3.2f m/s", newLocation.speed];
+ lastUpdateTime.text = [NSString stringWithFormat:@"%@", [dateFormatter stringFromDate:newLocation.timestamp]];
+}
+
+
+- (void)locationManager:(CLLocationManager *)manager
+ didFailWithError:(NSError *)error
+{
+ NSLog(@"Error: %@", [error description]);
+}
+
+- (void)locationManager:(CLLocationManager *)manager
+ didUpdateHeading:(CLHeading *)newHeading
+{
+
+ float heading = [newHeading trueHeading];
+ NSString *ordinalPoint = nil;
+
+ // we're going to use show the 16 common cardinal and intercadinal compass points; the idea is we
+ // split the difference between intercardinal points. For example between north and east is northeast.
+ // Between North and NorthEast and NorthEast and East two two more divisions, NorthNorthEast and EastNorthEast.
+ // North -> East = 90 deg; North -> NorthEast and NorthEast -> East = 45deg, North -> NorthNorthEasy -- 22.5deg.
+ //
+ // In order to have a smooth transition between the intercardinal points, you need to plit the distance yet again,
+ // making an 11.25 degree split. In essesnce you are declaring north to be 11.5 deg to the left or right of true north;
+ // ditto to the other 3 cardinal points; To be able to get all of the 16 common compass points to display you need to
+ // do the same for each of N, NNE, NE, ENE, E ESE, SE SSE, S, SSW, SW, WSW W, WNW, NW NNW
+
+ //NB North is a special case since the way we're normalizing it, it lies left of 359.99deg as well as < 11.25deg
+
+ if (heading > 337.5 + kOne32ndCompassDivision && heading < 359.99 || heading > 0.00 && heading < kOne32ndCompassDivision)
+ ordinalPoint = @"(N)";
+ else if (heading > kOne32ndCompassDivision && heading < (22.5 - kOne32ndCompassDivision))
+ ordinalPoint = @"(NNE)";
+ else if (heading > (22.5 - kOne32ndCompassDivision) && heading < (45 + kOne32ndCompassDivision))
+ ordinalPoint = @"(NE)";
+ else if (heading > (45.0 - kOne32ndCompassDivision) && heading < (67.5 + kOne32ndCompassDivision))
+ ordinalPoint = @"(ENE)";
+
+ else if (heading > (90.0 - kOne32ndCompassDivision) && heading < (90.0 + kOne32ndCompassDivision))
+ ordinalPoint = @"(E)";
+ else if (heading > (112.5 - kOne32ndCompassDivision) && heading < (112.5 + kOne32ndCompassDivision))
+ ordinalPoint = @"(ESE)";
+ else if (heading > (135.0 - kOne32ndCompassDivision) && heading < (135.0 + kOne32ndCompassDivision))
+ ordinalPoint = @"(SSE)";
+ else if (heading > (157.5 - kOne32ndCompassDivision) && heading < (157.5 + kOne32ndCompassDivision))
+ ordinalPoint = @"(SSE)";
+
+ else if (heading > (180.0 - kOne32ndCompassDivision) && heading < (180.0 + kOne32ndCompassDivision))
+ ordinalPoint = @"(S)";
+ else if (heading > (202.6 - kOne32ndCompassDivision) && heading < (202.5 + kOne32ndCompassDivision))
+ ordinalPoint = @"(SSW)";
+ else if (heading > (202.5 - kOne32ndCompassDivision) && heading < (225.0 + kOne32ndCompassDivision))
+ ordinalPoint = @"(SE)";
+ else if (heading > (202.5 - kOne32ndCompassDivision) && heading < (247.7 + kOne32ndCompassDivision))
+ ordinalPoint = @"(WSW)";
+
+ else if (heading > (270.0 - kOne32ndCompassDivision) && heading < (270.0 + kOne32ndCompassDivision))
+ ordinalPoint = @"(W)";
+ else if (heading > (292/5 - kOne32ndCompassDivision) && heading < (292.5 + kOne32ndCompassDivision))
+ ordinalPoint = @"(NWN)";
+ else if (heading > (315.0 - kOne32ndCompassDivision) && heading < (315.0 + kOne32ndCompassDivision))
+ ordinalPoint = @"(NW)";
+ else if (heading > (337.5 - kOne32ndCompassDivision) && heading < (337.5 + kOne32ndCompassDivision))
+ ordinalPoint = @"(NNW)";
+
+
+ // NSLog(@"Heading: %f", [newHeading magneticHeading]);
+
+ currentHeading.text = heading < 0 ? @" - " : [NSString stringWithFormat:@"%3.1fº %@", heading, ordinalPoint];
+
+
+ // This will rotate the map as the compass heading changes. We need to put the map inside another view for
+ // to and deal with clipping regions I think for it to work sensibly, right now it spins the mapview on top
+ // of the main view which is both wrong and really ugly.
+
+ // [mapView setTransform:CGAffineTransformMakeRotation(-1 * newHeading.magneticHeading * 3.14159 / 180)];
+
+}
+
+
+
+#pragma mark Action Methods
+- (IBAction)toggleCoreLocation
+{
+ if (loc_service_active)
+ {
+ if ([locationManager headingAvailable])
+ [locationManager stopUpdatingHeading];
+
+ [locationManager stopUpdatingLocation];
+ [currentLocation setTextColor:[UIColor redColor]];
+ [currentElevation setTextColor:[UIColor redColor]];
+ [currentSpeed setTextColor:[UIColor redColor]];
+ [currentHeading setTextColor:[UIColor redColor]];
+ loc_service_active = NO;
+ NSLog(@"Stop updating Location");
+
+ }
+ else
+ {
+ if ([locationManager headingAvailable])
+ [locationManager startUpdatingHeading];
+
+ [locationManager startUpdatingLocation];
+ [currentLocation setTextColor:[UIColor whiteColor]];
+ [currentElevation setTextColor:[UIColor whiteColor]];
+ [currentSpeed setTextColor:[UIColor whiteColor]];
+ [currentHeading setTextColor:[UIColor whiteColor]];
+ loc_service_active = YES;
+ NSLog(@"Start updating Location");
+ }
+}
+
+
+- (IBAction) showUserLocation
+{
+ MKUserLocation *annotation = mapView.userLocation;
+ CLLocation *location = annotation.location;
+ if (nil == location)
+ return;
+
+ CLLocationDistance distance = MAX(4 * location.horizontalAccuracy, 500); // meters
+ MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(location.coordinate, distance, distance);
+
+ [mapView setRegion:region animated:YES];
+ [locationManager startUpdatingLocation];
+}
+
+- (IBAction) toggleMapType
+{
+ if (mapView.mapType == MKMapTypeHybrid)
+ mapView.mapType = MKMapTypeStandard;
+ else
+ mapView.mapType = MKMapTypeHybrid;
+}
+
+@end
122 Classes/Reachability/Reachability.h
@@ -0,0 +1,122 @@
+/*
+
+File: Reachability.h
+Abstract: SystemConfiguration framework wrapper.
+
+Version: 1.5
+
+Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
+("Apple") in consideration of your agreement to the following terms, and your
+use, installation, modification or redistribution of this Apple software
+constitutes acceptance of these terms. If you do not agree with these terms,
+please do not use, install, modify or redistribute this Apple software.
+
+In consideration of your agreement to abide by the following terms, and subject
+to these terms, Apple grants you a personal, non-exclusive license, under
+Apple's copyrights in this original Apple software (the "Apple Software"), to
+use, reproduce, modify and redistribute the Apple Software, with or without
+modifications, in source and/or binary forms; provided that if you redistribute
+the Apple Software in its entirety and without modifications, you must retain
+this notice and the following text and disclaimers in all such redistributions
+of the Apple Software.
+Neither the name, trademarks, service marks or logos of Apple Inc. may be used
+to endorse or promote products derived from the Apple Software without specific
+prior written permission from Apple. Except as expressly stated in this notice,
+no other rights or licenses, express or implied, are granted by Apple herein,
+including but not limited to any patent rights that may be infringed by your
+derivative works or by other works in which the Apple Software may be
+incorporated.
+
+The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
+DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
+CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Copyright (C) 2008 Apple Inc. All Rights Reserved.
+
+*/
+
+#import <UIKit/UIKit.h>
+#import <SystemConfiguration/SystemConfiguration.h>
+
+@class Reachability;
+
+@interface Reachability : NSObject {
+
+@private
+ BOOL _networkStatusNotificationsEnabled;
+
+ NSString *_hostName;
+ NSString *_address;
+
+ NSMutableDictionary *_reachabilityQueries;
+}
+
+/*
+ An enumeration that defines the return values of the network state
+ of the device.
+ */
+typedef enum {
+ NotReachable = 0,
+ ReachableViaCarrierDataNetwork,
+ ReachableViaWiFiNetwork
+} NetworkStatus;
+
+
+// Set to YES to register for changes in network status. Otherwise reachability queries
+// will be handled synchronously.
+@property BOOL networkStatusNotificationsEnabled;
+// The remote host whose reachability will be queried.
+// Either this or 'addressName' must be set.
+@property (nonatomic, retain) NSString *hostName;
+// The IP address of the remote host whose reachability will be queried.
+// Either this or 'hostName' must be set.
+@property (nonatomic, retain) NSString *address;
+// A cache of ReachabilityQuery objects, which encapsulate a SCNetworkReachabilityRef, a host or address, and a run loop. The keys are host names or addresses.
+@property (nonatomic, assign) NSMutableDictionary *reachabilityQueries;
+
+// This class is intended to be used as a singleton.
++ (Reachability *)sharedReachability;
+
+// Is self.hostName is not nil, determines its reachability.
+// If self.hostName is nil and self.address is not nil, determines the reachability of self.address.
+- (NetworkStatus)remoteHostStatus;
+// Is the device able to communicate with Internet hosts? If so, through which network interface?
+- (NetworkStatus)internetConnectionStatus;
+// Is the device able to communicate with hosts on the local WiFi network? (Typically these are Bonjour hosts).
+- (NetworkStatus)localWiFiConnectionStatus;
+
+/*
+ When reachability change notifications are posted, the callback method 'ReachabilityCallback' is called
+ and posts a notification that the client application can observe to learn about changes.
+ */
+static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info);
+
+@end
+
+@interface ReachabilityQuery : NSObject
+{
+@private
+ SCNetworkReachabilityRef _reachabilityRef;
+ CFMutableArrayRef _runLoops;
+ NSString *_hostNameOrAddress;
+}
+// Keep around each network reachability query object so that we can
+// register for updates from those objects.
+@property (nonatomic) SCNetworkReachabilityRef reachabilityRef;
+@property (nonatomic, retain) NSString *hostNameOrAddress;
+@property (nonatomic) CFMutableArrayRef runLoops;
+
+- (void)scheduleOnRunLoop:(NSRunLoop *)inRunLoop;
+
+@end
+
585 Classes/Reachability/Reachability.m
@@ -0,0 +1,585 @@
+/*
+
+File: Reachability.m
+Abstract: SystemConfiguration framework wrapper.
+
+Version: 1.5
+
+Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
+("Apple") in consideration of your agreement to the following terms, and your
+use, installation, modification or redistribution of this Apple software
+constitutes acceptance of these terms. If you do not agree with these terms,
+please do not use, install, modify or redistribute this Apple software.
+
+In consideration of your agreement to abide by the following terms, and subject
+to these terms, Apple grants you a personal, non-exclusive license, under
+Apple's copyrights in this original Apple software (the "Apple Software"), to
+use, reproduce, modify and redistribute the Apple Software, with or without
+modifications, in source and/or binary forms; provided that if you redistribute
+the Apple Software in its entirety and without modifications, you must retain
+this notice and the following text and disclaimers in all such redistributions
+of the Apple Software.
+Neither the name, trademarks, service marks or logos of Apple Inc. may be used
+to endorse or promote products derived from the Apple Software without specific
+prior written permission from Apple. Except as expressly stated in this notice,
+no other rights or licenses, express or implied, are granted by Apple herein,
+including but not limited to any patent rights that may be infringed by your
+derivative works or by other works in which the Apple Software may be
+incorporated.
+
+The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
+DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
+CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Copyright (C) 2008 Apple Inc. All Rights Reserved.
+
+*/
+
+#import <sys/socket.h>
+#import <netinet/in.h>
+#import <netinet6/in6.h>
+#import <arpa/inet.h>
+#import <ifaddrs.h>
+#include <netdb.h>
+
+#import "Reachability.h"
+#import <SystemConfiguration/SCNetworkReachability.h>
+
+static NSString *kLinkLocalAddressKey = @"169.254.0.0";
+static NSString *kDefaultRouteKey = @"0.0.0.0";
+
+static Reachability *_sharedReachability;
+
+// A class extension that declares internal methods for this class.
+@interface Reachability()
+- (BOOL)isAdHocWiFiNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags;
+- (BOOL)isNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags;
+- (BOOL)isReachableWithoutRequiringConnection:(SCNetworkReachabilityFlags)flags;
+- (SCNetworkReachabilityRef)reachabilityRefForHostName:(NSString *)hostName;
+- (SCNetworkReachabilityRef)reachabilityRefForAddress:(NSString *)address;
+- (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)outAddress;
+- (void)stopListeningForReachabilityChanges;
+@end
+
+@implementation Reachability
+
+@synthesize networkStatusNotificationsEnabled = _networkStatusNotificationsEnabled;
+@synthesize hostName = _hostName;
+@synthesize address = _address;
+@synthesize reachabilityQueries = _reachabilityQueries;
+
++ (Reachability *)sharedReachability
+{
+ if (!_sharedReachability) {
+ _sharedReachability = [[Reachability alloc] init];
+ // Clients of Reachability will typically call [[Reachability sharedReachability] setHostName:]
+ // before calling one of the status methods.
+ _sharedReachability.hostName = nil;
+ _sharedReachability.address = nil;
+ _sharedReachability.networkStatusNotificationsEnabled = NO;
+ _sharedReachability.reachabilityQueries = [[NSMutableDictionary alloc] init];
+ }
+ return _sharedReachability;
+}
+
+- (void) dealloc
+{
+ [self stopListeningForReachabilityChanges];
+
+ [_sharedReachability.reachabilityQueries release];
+ [_sharedReachability release];
+ [super dealloc];
+}
+
+- (BOOL)isReachableWithoutRequiringConnection:(SCNetworkReachabilityFlags)flags
+{
+ // kSCNetworkReachabilityFlagsReachable indicates that the specified nodename or address can
+ // be reached using the current network configuration.
+ BOOL isReachable = flags & kSCNetworkReachabilityFlagsReachable;
+
+ // This flag indicates that the specified nodename or address can
+ // be reached using the current network configuration, but a
+ // connection must first be established.
+ //
+ // If the flag is false, we don't have a connection. But because CFNetwork
+ // automatically attempts to bring up a WWAN connection, if the WWAN reachability
+ // flag is present, a connection is not required.
+ BOOL noConnectionRequired = !(flags & kSCNetworkReachabilityFlagsConnectionRequired);
+ if ((flags & kSCNetworkReachabilityFlagsIsWWAN)) {
+ noConnectionRequired = YES;
+ }
+
+ return (isReachable && noConnectionRequired) ? YES : NO;
+}
+
+// Returns whether or not the current host name is reachable with the current network configuration.
+- (BOOL)isHostReachable:(NSString *)host
+{
+ if (!host || ![host length]) {
+ return NO;
+ }
+
+ SCNetworkReachabilityFlags flags;
+ SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [host UTF8String]);
+ BOOL gotFlags = SCNetworkReachabilityGetFlags(reachability, &flags);
+
+ CFRelease(reachability);
+
+ if (!gotFlags) {
+ return NO;
+ }
+
+ return [self isReachableWithoutRequiringConnection:flags];
+}
+
+// This returns YES if the address 169.254.0.0 is reachable without requiring a connection.
+- (BOOL)isAdHocWiFiNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags
+{
+ // Look in the cache of reachability queries for one that matches this query.
+ ReachabilityQuery *query = [self.reachabilityQueries objectForKey:kLinkLocalAddressKey];
+ SCNetworkReachabilityRef adHocWiFiNetworkReachability = query.reachabilityRef;
+
+ // If a cached reachability query was not found, create one.
+ if (!adHocWiFiNetworkReachability) {
+
+ // Build a sockaddr_in that we can pass to the address reachability query.
+ struct sockaddr_in sin;
+
+ bzero(&sin, sizeof(sin));
+ sin.sin_len = sizeof(sin);
+ sin.sin_family = AF_INET;
+ // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
+ sin.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
+
+ adHocWiFiNetworkReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin);
+
+ query = [[[ReachabilityQuery alloc] init] autorelease];
+ query.hostNameOrAddress = kLinkLocalAddressKey;
+ query.reachabilityRef = adHocWiFiNetworkReachability;
+
+ // Add the reachability query to the cache.
+ [self.reachabilityQueries setObject:query forKey:kLinkLocalAddressKey];
+ }
+
+ // If necessary, register for notifcations for the SCNetworkReachabilityRef on the current run loop.
+ // If an existing SCNetworkReachabilityRef was found in the cache, we can reuse it and register
+ // to receive notifications from it in the current run loop, which may be different than the run loop
+ // that was previously used when registering the SCNetworkReachabilityRef for notifications.
+ // -scheduleOnRunLoop: will schedule only if network status notifications are enabled in the Reachability instance.
+ // By default, they are not enabled.
+ [query scheduleOnRunLoop:[NSRunLoop currentRunLoop]];
+
+ SCNetworkReachabilityFlags addressReachabilityFlags;
+ BOOL gotFlags = SCNetworkReachabilityGetFlags(adHocWiFiNetworkReachability, &addressReachabilityFlags);
+ if (!gotFlags) {
+ // There was an error getting the reachability flags.
+ return NO;
+ }
+
+ // Callers of this method might want to use the reachability flags, so if an 'out' parameter
+ // was passed in, assign the reachability flags to it.
+ if (outFlags) {
+ *outFlags = addressReachabilityFlags;
+ }
+
+ return [self isReachableWithoutRequiringConnection:addressReachabilityFlags];
+}
+
+// ReachabilityCallback is registered as the callback for network state changes in startListeningForReachabilityChanges.
+static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ // Post a notification to notify the client that the network reachability changed.
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"kNetworkReachabilityChangedNotification" object:nil];
+
+ [pool release];
+}
+
+// Perform a reachability query for the address 0.0.0.0. If that address is reachable without
+// requiring a connection, a network interface is available. We'll have to do more work to
+// determine which network interface is available.
+- (BOOL)isNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags
+{
+ ReachabilityQuery *query = [self.reachabilityQueries objectForKey:kDefaultRouteKey];
+ SCNetworkReachabilityRef defaultRouteReachability = query.reachabilityRef;
+
+ // If a cached reachability query was not found, create one.
+ if (!defaultRouteReachability) {
+
+ struct sockaddr_in zeroAddress;
+ bzero(&zeroAddress, sizeof(zeroAddress));
+ zeroAddress.sin_len = sizeof(zeroAddress);
+ zeroAddress.sin_family = AF_INET;
+
+ defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
+
+ ReachabilityQuery *query = [[[ReachabilityQuery alloc] init] autorelease];
+ query.hostNameOrAddress = kDefaultRouteKey;
+ query.reachabilityRef = defaultRouteReachability;
+
+ [self.reachabilityQueries setObject:query forKey:kDefaultRouteKey];
+ }
+
+ // If necessary, register for notifcations for the SCNetworkReachabilityRef on the current run loop.
+ // If an existing SCNetworkReachabilityRef was found in the cache, we can reuse it and register
+ // to receive notifications from it in the current run loop, which may be different than the run loop
+ // that was previously used when registering the SCNetworkReachabilityRef for notifications.
+ // -scheduleOnRunLoop: will schedule only if network status notifications are enabled in the Reachability instance.
+ // By default, they are not enabled.
+ [query scheduleOnRunLoop:[NSRunLoop currentRunLoop]];
+
+ SCNetworkReachabilityFlags flags;
+ BOOL gotFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
+ if (!gotFlags) {
+ return NO;
+ }
+
+ BOOL isReachable = [self isReachableWithoutRequiringConnection:flags];
+
+ // Callers of this method might want to use the reachability flags, so if an 'out' parameter
+ // was passed in, assign the reachability flags to it.
+ if (outFlags) {
+ *outFlags = flags;
+ }
+
+ return isReachable;
+}
+
+// Be a good citizen and unregister for network state changes when the application terminates.
+- (void)stopListeningForReachabilityChanges
+{
+ // Walk through the cache that holds SCNetworkReachabilityRefs for reachability
+ // queries to particular hosts or addresses.
+ NSEnumerator *enumerator = [self.reachabilityQueries objectEnumerator];
+ ReachabilityQuery *reachabilityQuery;
+
+ while (reachabilityQuery = [enumerator nextObject]) {
+
+ CFArrayRef runLoops = reachabilityQuery.runLoops;
+ NSUInteger runLoopCounter, maxRunLoops = CFArrayGetCount(runLoops);
+
+ for (runLoopCounter = 0; runLoopCounter < maxRunLoops; runLoopCounter++) {
+ CFRunLoopRef nextRunLoop = (CFRunLoopRef)CFArrayGetValueAtIndex(runLoops, runLoopCounter);
+
+ SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityQuery.reachabilityRef, nextRunLoop, kCFRunLoopDefaultMode);
+ }
+
+ CFArrayRemoveAllValues(reachabilityQuery.runLoops);
+ }
+}
+
+/*
+ Create a SCNetworkReachabilityRef for hostName, which lets us determine if hostName
+ is currently reachable, and lets us register to receive notifications when the
+ reachability of hostName changes.
+ */
+- (SCNetworkReachabilityRef)reachabilityRefForHostName:(NSString *)hostName
+{
+ if (!hostName || ![hostName length]) {
+ return NULL;
+ }
+
+ // Look in the cache for an existing SCNetworkReachabilityRef for hostName.
+ ReachabilityQuery *cachedQuery = [self.reachabilityQueries objectForKey:hostName];
+ SCNetworkReachabilityRef reachabilityRefForHostName = cachedQuery.reachabilityRef;
+
+ if (reachabilityRefForHostName) {
+ return reachabilityRefForHostName;
+ }
+
+ // Didn't find an existing SCNetworkReachabilityRef for hostName, so create one ...
+ reachabilityRefForHostName = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [hostName UTF8String]);
+
+ NSAssert1(reachabilityRefForHostName != NULL, @"Failed to create SCNetworkReachabilityRef for host: %@", hostName);
+
+ ReachabilityQuery *query = [[[ReachabilityQuery alloc] init] autorelease];
+ query.hostNameOrAddress = hostName;
+ query.reachabilityRef = reachabilityRefForHostName;
+
+ // If necessary, register for notifcations for the SCNetworkReachabilityRef on the current run loop.
+ // If an existing SCNetworkReachabilityRef was found in the cache, we can reuse it and register
+ // to receive notifications from it in the current run loop, which may be different than the run loop
+ // that was previously used when registering the SCNetworkReachabilityRef for notifications.
+ // -scheduleOnRunLoop: will schedule only if network status notifications are enabled in the Reachability instance.
+ // By default, they are not enabled.
+ [query scheduleOnRunLoop:[NSRunLoop currentRunLoop]];
+
+ // ... and add it to the cache.
+ [self.reachabilityQueries setObject:query forKey:hostName];
+ return reachabilityRefForHostName;
+}
+
+/*
+ Create a SCNetworkReachabilityRef for the IP address in addressString, which lets us determine if
+ the address is currently reachable, and lets us register to receive notifications when the
+ reachability of the address changes.
+ */
+- (SCNetworkReachabilityRef)reachabilityRefForAddress:(NSString *)addressString
+{
+ if (!addressString || ![addressString length]) {
+ return NULL;
+ }
+
+ struct sockaddr_in address;
+
+ BOOL gotAddress = [self addressFromString:addressString address:&address];
+ if (!gotAddress) {
+ // The attempt to convert addressString to a sockaddr_in failed.
+ NSAssert1(gotAddress != NO, @"Failed to convert an IP address string to a sockaddr_in: %@", addressString);
+ return NULL;
+ }
+
+ // Look in the cache for an existing SCNetworkReachabilityRef for addressString.
+ ReachabilityQuery *cachedQuery = [self.reachabilityQueries objectForKey:addressString];
+ SCNetworkReachabilityRef reachabilityRefForAddress = cachedQuery.reachabilityRef;
+
+ if (reachabilityRefForAddress) {
+ return reachabilityRefForAddress;
+ }
+
+ // Didn't find an existing SCNetworkReachabilityRef for addressString, so create one.
+ reachabilityRefForAddress = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (struct sockaddr *)&address);
+
+ NSAssert1(reachabilityRefForAddress != NULL, @"Failed to create SCNetworkReachabilityRef for address: %@", addressString);
+
+ ReachabilityQuery *query = [[[ReachabilityQuery alloc] init] autorelease];
+ query.hostNameOrAddress = addressString;
+ query.reachabilityRef = reachabilityRefForAddress;
+
+ // If necessary, register for notifcations for the SCNetworkReachabilityRef on the current run loop.
+ // If an existing SCNetworkReachabilityRef was found in the cache, we can reuse it and register
+ // to receive notifications from it in the current run loop, which may be different than the run loop
+ // that was previously used when registering the SCNetworkReachabilityRef for notifications.
+ // -scheduleOnRunLoop: will schedule only if network status notifications are enabled in the Reachability instance.
+ // By default, they are not enabled.
+ [query scheduleOnRunLoop:[NSRunLoop currentRunLoop]];
+
+ // ... and add it to the cache.
+ [self.reachabilityQueries setObject:query forKey:addressString];
+ return reachabilityRefForAddress;
+}
+
+- (NetworkStatus)remoteHostStatus
+{
+ /*
+ If the current host name or address is reachable, determine which network interface it is reachable through.
+ If the host is reachable and the reachability flags include kSCNetworkReachabilityFlagsIsWWAN, it
+ is reachable through the carrier data network. If the host is reachable and the reachability
+ flags do not include kSCNetworkReachabilityFlagsIsWWAN, it is reachable through the WiFi network.
+ */
+
+ SCNetworkReachabilityRef reachabilityRef = nil;
+ if (self.hostName) {
+ reachabilityRef = [self reachabilityRefForHostName:self.hostName];
+
+ } else if (self.address) {
+ reachabilityRef = [self reachabilityRefForAddress:self.address];
+
+ } else {
+ NSAssert(self.hostName != nil && self.address != nil, @"No hostName or address specified. Cannot determine reachability.");
+ return NotReachable;
+ }
+
+ if (!reachabilityRef) {
+ return NotReachable;
+ }
+
+ SCNetworkReachabilityFlags reachabilityFlags;
+ BOOL gotFlags = SCNetworkReachabilityGetFlags(reachabilityRef, &reachabilityFlags);
+ if (!gotFlags) {
+ return NotReachable;
+ }
+
+ BOOL reachable = [self isReachableWithoutRequiringConnection:reachabilityFlags];
+
+ if (!reachable) {
+ return NotReachable;
+ }
+ if (reachabilityFlags & ReachableViaCarrierDataNetwork) {
+ return ReachableViaCarrierDataNetwork;
+ }
+
+ return ReachableViaWiFiNetwork;
+}
+
+- (NetworkStatus)internetConnectionStatus
+{
+ /*
+ To determine if the device has an Internet connection, query the address
+ 0.0.0.0. If it's reachable without requiring a connection, first check
+ for the kSCNetworkReachabilityFlagsIsDirect flag, which tell us if the connection
+ is to an ad-hoc WiFi network. If it is not, the device can access the Internet.
+ The next thing to determine is how the device can access the Internet, which
+ can either be through the carrier data network (EDGE or other service) or through
+ a WiFi connection.
+
+ Note: Knowing that the device has an Internet connection is not the same as
+ knowing if the device can reach a particular host. To know that, use
+ -[Reachability remoteHostStatus].
+ */
+
+ SCNetworkReachabilityFlags defaultRouteFlags;
+ BOOL defaultRouteIsAvailable = [self isNetworkAvailableFlags:&defaultRouteFlags];
+ if (defaultRouteIsAvailable) {
+
+ if (defaultRouteFlags & kSCNetworkReachabilityFlagsIsDirect) {
+
+ // The connection is to an ad-hoc WiFi network, so Internet access is not available.
+ return NotReachable;
+ }
+ else if (defaultRouteFlags & ReachableViaCarrierDataNetwork) {
+ return ReachableViaCarrierDataNetwork;
+ }
+
+ return ReachableViaWiFiNetwork;
+ }
+
+ return NotReachable;
+}
+
+- (NetworkStatus)localWiFiConnectionStatus
+{
+ SCNetworkReachabilityFlags selfAssignedAddressFlags;
+
+ /*
+ To determine if the WiFi connection is to a local ad-hoc network,
+ check the availability of the address 169.254.x.x. That's an address
+ in the self-assigned range, and the device will have a self-assigned IP
+ when it's connected to a ad-hoc WiFi network. So to test if the device
+ has a self-assigned IP, look for the kSCNetworkReachabilityFlagsIsDirect flag
+ in the address query. If it's present, we know that the WiFi connection
+ is to an ad-hoc network.
+ */
+ // This returns YES if the address 169.254.0.0 is reachable without requiring a connection.
+ BOOL hasLinkLocalNetworkAccess = [self isAdHocWiFiNetworkAvailableFlags:&selfAssignedAddressFlags];
+
+ if (hasLinkLocalNetworkAccess && (selfAssignedAddressFlags & kSCNetworkReachabilityFlagsIsDirect)) {
+ return ReachableViaWiFiNetwork;
+ }
+
+ return NotReachable;
+}
+
+// Convert an IP address from an NSString to a sockaddr_in * that can be used to create
+// the reachability request.
+- (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)address
+{
+ if (!IPAddress || ![IPAddress length]) {
+ return NO;
+ }
+
+ memset((char *) address, sizeof(struct sockaddr_in), 0);
+ address->sin_family = AF_INET;
+ address->sin_len = sizeof(struct sockaddr_in);
+
+ int conversionResult = inet_aton([IPAddress UTF8String], &address->sin_addr);
+ if (conversionResult == 0) {
+ NSAssert1(conversionResult != 1, @"Failed to convert the IP address string into a sockaddr_in: %@", IPAddress);
+ return NO;
+ }
+
+ return YES;
+}
+
+@end
+
+@interface ReachabilityQuery ()
+- (CFRunLoopRef)startListeningForReachabilityChanges:(SCNetworkReachabilityRef)reachability onRunLoop:(CFRunLoopRef)runLoop;
+@end
+
+@implementation ReachabilityQuery
+
+@synthesize reachabilityRef = _reachabilityRef;
+@synthesize runLoops = _runLoops;
+@synthesize hostNameOrAddress = _hostNameOrAddress;
+
+- (id)init
+{
+ self = [super init];
+ if (self != nil) {
+ self.runLoops = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ CFRelease(self.runLoops);
+ [super dealloc];
+}
+
+- (BOOL)isScheduledOnRunLoop:(CFRunLoopRef)runLoop
+{
+ NSUInteger runLoopCounter, maxRunLoops = CFArrayGetCount(self.runLoops);
+
+ for (runLoopCounter = 0; runLoopCounter < maxRunLoops; runLoopCounter++) {
+ CFRunLoopRef nextRunLoop = (CFRunLoopRef)CFArrayGetValueAtIndex(self.runLoops, runLoopCounter);
+
+ if (nextRunLoop == runLoop) {
+ return YES;
+ }
+ }
+
+ return NO;
+}
+
+- (void)scheduleOnRunLoop:(NSRunLoop *)inRunLoop
+{
+ // Only register for network state changes if the client has specifically enabled them.
+ if ([[Reachability sharedReachability] networkStatusNotificationsEnabled] == NO) {
+ return;
+ }
+
+ if (!inRunLoop) {
+ return;
+ }
+
+ CFRunLoopRef runLoop = [inRunLoop getCFRunLoop];
+
+ // Notifications of status changes for each reachability query can be scheduled on multiple run loops.
+ // To support that, register for notifications for each runLoop.
+ // -isScheduledOnRunLoop: iterates over all of the run loops that have previously been used
+ // to register for notifications. If one is found that matches the passed in runLoop argument, there's
+ // no need to register for notifications again. If one is not found, register for notifications
+ // using the current runLoop.
+ if (![self isScheduledOnRunLoop:runLoop]) {
+
+ CFRunLoopRef notificationRunLoop = [self startListeningForReachabilityChanges:self.reachabilityRef onRunLoop:runLoop];
+ if (notificationRunLoop) {
+ CFArrayAppendValue(self.runLoops, notificationRunLoop);
+ }
+ }
+}
+
+// Register to receive changes to the 'reachability' query so that we can update the
+// user interface when the network state changes.
+- (CFRunLoopRef)startListeningForReachabilityChanges:(SCNetworkReachabilityRef)reachability onRunLoop:(CFRunLoopRef)runLoop
+{
+ if (!reachability) {
+ return NULL;
+ }
+
+ if (!runLoop) {
+ return NULL;
+ }
+
+ SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL};
+ SCNetworkReachabilitySetCallback(reachability, ReachabilityCallback, &context);
+ SCNetworkReachabilityScheduleWithRunLoop(reachability, runLoop, kCFRunLoopDefaultMode);
+
+ return runLoop;
+}
+
+
+@end
536 FlipsideView.xib
@@ -0,0 +1,536 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">784</int>
+ <string key="IBDocument.SystemVersion">10C540</string>
+ <string key="IBDocument.InterfaceBuilderVersion">740</string>
+ <string key="IBDocument.AppKitVersion">1038.25</string>
+ <string key="IBDocument.HIToolboxVersion">458.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">62</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ </object>
+ <object class="IBProxyObject" id="340535442">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ </object>
+ <object class="IBUIView" id="249263867">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUINavigationBar" id="871675769">
+ <reference key="NSNextResponder" ref="249263867"/>
+ <int key="NSvFlags">290</int>
+ <string key="NSFrameSize">{320, 44}</string>
+ <reference key="NSSuperview" ref="249263867"/>
+ <reference key="NSWindow"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <int key="IBUIBarStyle">1</int>
+ <object class="NSArray" key="IBUIItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUINavigationItem" id="553200710">
+ <reference key="IBUINavigationBar" ref="871675769"/>
+ <string key="IBUITitle"/>
+ <object class="IBUIBarButtonItem" key="IBUILeftBarButtonItem" id="854562692">
+ <int key="IBUIStyle">1</int>
+ <int key="IBUISystemItemIdentifier">0</int>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="IBUILabel" id="707927972">
+ <reference key="NSNextResponder" ref="249263867"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{35, 77}, {265, 43}}</string>
+ <reference key="NSSuperview" ref="249263867"/>
+ <reference key="NSWindow"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="IBUIText">SensorToy</string>
+ <object class="NSFont" key="IBUIFont">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">36</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MSAxIDEAA</bytes>
+ </object>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">10</float>
+ <int key="IBUITextAlignment">1</int>
+ </object>
+ <object class="IBUILabel" id="437636799">
+ <reference key="NSNextResponder" ref="249263867"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 173}, {280, 21}}</string>
+ <reference key="NSSuperview" ref="249263867"/>
+ <reference key="NSWindow"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="IBUIText">David HM Spector</string>
+ <object class="NSColor" key="IBUITextColor" id="284496235">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC44MDAwMDAwMTE5IDEgMC40MDAwMDAwMDYAA</bytes>
+ </object>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">10</float>
+ <int key="IBUITextAlignment">1</int>
+ </object>
+ <object class="IBUILabel" id="231140085">
+ <reference key="NSNextResponder" ref="249263867"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{20, 202}, {280, 21}}</string>
+ <reference key="NSSuperview" ref="249263867"/>
+ <reference key="NSWindow"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="IBUIText">Zeitgeist Information Systems, LLC</string>
+ <reference key="IBUITextColor" ref="284496235"/>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <float key="IBUIMinimumFontSize">10</float>
+ <int key="IBUITextAlignment">1</int>
+ </object>
+ </object>
+ <string key="NSFrameSize">{320, 460}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC4yNQA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
+ <int key="IBUIStatusBarStyle">2</int>
+ </object>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="249263867"/>
+ </object>
+ <int key="connectionID">41</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">done</string>
+ <reference key="source" ref="854562692"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">45</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="340535442"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">40</int>
+ <reference key="object" ref="249263867"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="871675769"/>
+ <reference ref="707927972"/>
+ <reference ref="437636799"/>
+ <reference ref="231140085"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">42</int>
+ <reference key="object" ref="871675769"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="553200710"/>
+ </object>
+ <reference key="parent" ref="249263867"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">43</int>
+ <reference key="object" ref="553200710"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="854562692"/>
+ </object>
+ <reference key="parent" ref="871675769"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">44</int>
+ <reference key="object" ref="854562692"/>
+ <reference key="parent" ref="553200710"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">46</int>
+ <reference key="object" ref="707927972"/>
+ <reference key="parent" ref="249263867"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">47</int>
+ <reference key="object" ref="437636799"/>
+ <reference key="parent" ref="249263867"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">48</int>
+ <reference key="object" ref="231140085"/>
+ <reference key="parent" ref="249263867"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>40.CustomClassName</string>
+ <string>40.IBEditorWindowLastContentRect</string>
+ <string>40.IBPluginDependency</string>
+ <string>42.IBPluginDependency</string>
+ <string>43.IBPluginDependency</string>
+ <string>44.IBPluginDependency</string>
+ <string>46.IBPluginDependency</string>
+ <string>47.IBPluginDependency</string>
+ <string>48.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>FlipsideViewController</string>
+ <string>UIResponder</string>
+ <string>FlipsideView</string>
+ <string>{{1185, 538}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">48</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">FlipsideView</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/FlipsideView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">FlipsideViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">done</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">delegate</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/FlipsideViewController.h</string>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSError.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSNetServices.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSPort.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSStream.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSXMLParser.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="637794336">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIBarButtonItem</string>
+ <string key="superclassName">UIBarItem</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIBarButtonItem.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIBarItem</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIBarItem.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UILabel</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UILabel.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UINavigationBar</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="674639532">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UINavigationBar.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UINavigationItem</string>
+ <string key="superclassName">NSObject</string>
+ <reference key="sourceIdentifier" ref="674639532"/>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIResponder</string>
+ <string key="superclassName">NSObject</string>
+ <reference key="sourceIdentifier" ref="637794336"/>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UISearchBar</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UISearchDisplayController</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIView</string>
+ <string key="superclassName">UIResponder</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <string key="superclassName">UIResponder</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3100" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">SensorToy.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">3.1</string>
+ </data>
+</archive>
BIN Graphics/01-refresh.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/103-map.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/71-compass.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/74-location.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/Airport.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/WWAN5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/map-marker.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/red.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/stop-32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/tack.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/tack_small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/target.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Graphics/target_small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,224 MainView.xib
@@ -0,0 +1,1224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">