#if objc
- (NSObject*)createCircularRegion:(double)lat :(double)lon :(double)radius :(NSString*)identifier {
return [[CLCircularRegion alloc] initWithCenter:CLLocationCoordinate2DMake(lat, lon) radius:(CLLocationDistance)radius identifier:identifier];
}
@end
@interface B4ILocationManager (beacon)
@end
@implementation B4ILocationManager (beacon)
- (void)locationManager:(CLLocationManager *)manager
didExitRegion:(CLRegion *)region {
[B4IObjectWrapper raiseEvent:self :@"_regionexit:" :@[region]];
}
- (void)locationManager:(CLLocationManager *)manager
didEnterRegion:(CLRegion *)region {
[B4IObjectWrapper raiseEvent:self :@"_regionenter:" :@[region]];
}
- (void)locationManager:(CLLocationManager *)manager
monitoringDidFailForRegion:(CLRegion *)region
withError:(NSError *)error {
NSLog(@"Error: %@", error);
[B4IObjectWrapper raiseEvent:self :@"_statechanged:" :@[@(3)]];
}
- (void)locationManager:(CLLocationManager *)manager
didStartMonitoringForRegion:(CLRegion *)region {
NSLog(@"Start monitoring: %@", region);
}
- (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)State forRegion:(CLRegion *)region {
NSLog(@"didDetermineState: %@", @(State));
[B4IObjectWrapper raiseEvent:self :@"_statechanged:" :@[@(State)]];
}
#End If