0
votes

Can somebody help me how to solve the issue.

My current beacon setup :

Beacon device - Estimote. UUID - same for the two beacons.

  1. I have placed each beacon in two rooms, rooms are 20-30 Meters away from each other
  2. I'm hitting webservice and updating something (when the proximity is near or immediate) when i enter a specific room (checking if major and minor of this room actually belongs to this room) 3.It also hits another webservice and updating something (when the proximity is far and unknown).

Problem with the current algorithm: 1. When i enter room 1 and if it is near or immediate, it hits webservice1. When this happens, room2 proximity will be far or unknown, then again webservice2 is hitting and also there are lot of fluctuation. Sometimes when i'm in room1, room2 beacon proximity shows as near. I don't this to happen

New Approach and Questions

  1. I would like to Monitor for specific region , say room1 when i'm near say 5 meters away, and start ranging the beacon only when proximity is near or immediate. and stop ranging when proximity is far or unknown or i'm more than 5 meters away
  2. When i move near to room2 (5 meters away) and if the proximity of room2 is near or immediate, it should start ranging room2 and stop ranging room1
  3. I would like to have clear approach or way to write algorithm to achieve the above. Calculation can be using the proximity or using some other idea (like combination of RSSI and proximity or something else)

It would be great if you can explain me in detail with example on how to achieve the new approach or you can tell me if there is any other better approach, but please explain with code.

My foremost concern is, it should't range room 2 beacon when i'm in room1 or just 5 meter away from room1 and vice versa.

2

2 Answers

0
votes

Have you thought about putting each beacon in its own region? So room 1 would be a region, and room 2 would be another region.

After that I would make use of locationManager:didEnterRegion: and locationManager:didExitRegion:. Within these, you can start and stop the ranging of your two beacon regions depending on which room you are in.

Please note, the Apple Docs state that:

When testing your region monitoring code in iOS Simulator or on a device, realize that region events may not happen immediately after a region boundary is crossed. To prevent spurious notifications, iOS doesn’t deliver region notifications until certain threshold conditions are met. Specifically, the user’s location must cross the region boundary, move away from the boundary by a minimum distance, and remain at that minimum distance for at least 20 seconds before the notifications are reported.

The specific threshold distances are determined by the hardware and the location technologies that are currently available. For example, if Wi-Fi is disabled, region monitoring is significantly less accurate. However, for testing purposes, you can assume that the minimum distance is approximately 200 meters.

EXAMPLE:

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
    if (region.identifier == YOUR ROOM 1 IDENTIFIER)
    {
       //Start ranging room 1
    }
    else
    {
       //Start ranging room 2
    }
}

- (void)locationManager:(CLLocationManager *)manager
    didExitRegion:(CLRegion *)region
{
    if (region.identifier == YOUR ROOM 1 IDENTIFIER)
    {
         //Stop ranging room 1
    }
    else
    {
         //Stop ranging room 2
    }
}
0
votes

The core problem is sending info to the server at inappropriate times. It really has nothing to do with starting ranging.

You cannot start ranging when proximity is relatively close -- you have to range in order to determine proximity.

Rather than an algorithm that starts and stops ranging, I suggest you simply leave it on all the time, and build a filter that decides when to make the server calls. Here's a starting point for the logic I would suggest:

Call the server if all the following are true:

  • beacon.accuracy < 3
  • all other beacons detected have beacon.accuracy > 3
  • no server call has been made for this beacon recently

EDIT: You can reduce the fluctuation on the accuracy reading by setting your beacon transmitter power as high as possible to maximize the signal to noise ratio.