Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I broadcast multiple ibeacon signals from only one bluetooth? and how

I want to simulate multiple ibeacon signal using my ipad's bluetooth, is it possible

like image 749
Jhondoe Avatar asked Feb 04 '14 05:02

Jhondoe


People also ask

What is the range of a Bluetooth beacon?

Most Bluetooth beacons can reliably transmit up to approximately 30 meters without any physical obstructions. A typical operating range is around 2 to 5 meters, depending on the transmit power. The higher the range, the higher the battery consumption.

Does iBeacon require Bluetooth?

Yes, Android requires Bluetooth permission to scan for bluetooth beacons but iOS does not require the same permission to detect iBeacon. The requirement for Android to have Bluetooth permission to scan for beacons is true regardless of the library you use. It is an OS platform restriction.

What can you do with a Bluetooth beacon?

If you want to stick your Bluetooth devices to walls or still objects, you'll use beacons. Traditional use cases for this setup are: occupancy monitoring, environmental monitoring, proximity notifications, indoor wayfinding, loyalty programs.

Is iBeacon one way transmission?

iBeacon enables only one-way transmission - it can't technically receive anything nor track anything. Only the installed app (not the iBeacon transmitter) can analyze the data and for example track users position with their consent as they walk around the shop.


1 Answers

You cannot make multiple transmissions go out simultaneously, but you can simulate this by switching between two or more transmitters with a timer. iOS devices normally send out 10 advertising packets per second when transmitting as an iBeacon. But receivers only expect that packets be received at a minimum of once every second for normal operations.

Try setting up a timer to switch back and forth between two iBeacon transmitters (turn one off then the other on). Like this:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        // Override point for customization after application launch.
        NSLog(@"We are going to simulate advertising multiple iBeacons simultaneously!");
        CLBeaconRegion *iBeacon1 = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6"]  major:15555 minor:35001 identifier:@"iBeacon1"];
        CLBeaconRegion *iBeacon2 = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6"]  major:15555 minor:35002 identifier:@"iBeacon2"];

        iBeacons = [[NSMutableArray alloc] init];
        [iBeacons addObject: iBeacon1];
        [iBeacons addObject: iBeacon2];
        measuredPower = [NSNumber numberWithInt:-59];
        currentIBeaconNumber = 0;
        self.peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)];
        [self rotateAdvertising];
        return YES;
    }

    - (void) configureAdvertisingForIBeaconNumber: (int) iBeaconNumber {
        if(self.peripheralManager.state!=CBCentralManagerStatePoweredOn) {
            NSLog(@"Core Bluetooth is off");
            return;
        }
        [self.peripheralManager stopAdvertising];
        NSLog(@"Transmitting as iBeacon number %d", currentIBeaconNumber);
        NSDictionary *peripheralData;
        peripheralData = [[iBeacons objectAtIndex:iBeaconNumber] peripheralDataWithMeasuredPower:measuredPower];
        [self.peripheralManager startAdvertising:peripheralData];
    }

    - (void) rotateAdvertising {
        [self configureAdvertisingForIBeaconNumber:currentIBeaconNumber];
        currentIBeaconNumber = (currentIBeaconNumber + 1) % iBeacons.count;
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW,  1000* NSEC_PER_MSEC), dispatch_get_main_queue(),                ^{
            [self rotateAdvertising];
        });
    }

I tested this and it works -- a second iOS device ranged both iBeacons.

If I tried to switch between the two identifiers more than once per second, the receiving iOS device would periodically lose track of one of the beacons. Because this code is only switching once per second, the receiver will have gaps of a little over one second when it won't be receiving one of the two iBeacon transmissions. This may or may not cause some unexpected side effects on ranging/monitoring on the receiver side. But you can try it and see.

like image 95
davidgyoung Avatar answered Sep 28 '22 02:09

davidgyoung