Skip to content

Commit

Permalink
Fixed issue jbeuckm#40
Browse files Browse the repository at this point in the history
  • Loading branch information
WillDent committed Sep 9, 2015
1 parent 7c66a77 commit 0e120e9
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions Classes/OrgBeuckmanTibeaconsModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ - (void) locationManager:(CLLocationManager *)manager didStartMonitoringForRegio
{
NSLog(@"[INFO] Did start monitoring region: %@", region.identifier);
[self.locationManager requestStateForRegion:region];

if([region isKindOfClass: [CLBeaconRegion class]]) {
[self fireEvent:@"didStartMonitoringForRegion" withObject:[self detailsForBeaconRegion:(CLBeaconRegion *)region]];
}
}


Expand All @@ -206,26 +207,38 @@ -(void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionS
NSLog(@"[INFO] State UNKNOWN region: %@", region.identifier);
}

if([region isKindOfClass: [CLBeaconRegion class]]) {
NSMutableDictionary *event = [NSMutableDictionary dictionaryWithDictionary:[self detailsForBeaconRegion:(CLBeaconRegion *)region]];
[event setObject:[self decodeRegionState:state] forKey:@"regionState"];

[self fireEvent:@"determinedRegionState" withObject:event];
}

}

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {

NSLog(@"[INFO] Entered region %@", region.identifier);

[self fireEvent:@"enteredRegion" withObject:[self detailsForBeaconRegion:(CLBeaconRegion *)region]];

if([region isKindOfClass: [CLBeaconRegion class]]) {
NSLog(@"[INFO] Entered region and determined region type is beacon");
[self fireEvent:@"enteredRegion" withObject:[self detailsForBeaconRegion:(CLBeaconRegion *)region]];

}



}

-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {

NSLog(@"[INFO] exited region %@", region.identifier);

[self fireEvent:@"exitedRegion" withObject:[self detailsForBeaconRegion:(CLBeaconRegion *)region]];
if([region isKindOfClass: [CLBeaconRegion class]]) {
NSLog(@"[INFO] Entered region and determined region type is beacon");
[self fireEvent:@"exitedRegion" withObject:[self detailsForBeaconRegion:(CLBeaconRegion *)region]];

}

}


Expand Down

0 comments on commit 0e120e9

Please sign in to comment.