The Good Giant
The Good Giant

Reputation: 1780

iBeacon & XCode - Discovering with CoreLocation and Connecting with CoreBluetooth

I have a little hw with a BLE module that communicates with an iOS device.

I would like to perform a discovery using iBeacon (so using iBeacon advertisement packets) and - obviously - connection (and data exchange) using CoreBluetooth, but there are some issues.

Before describing the issues, I have to tell you that I need to provide these information in discovery phase:

  1. Serial number (needed for internal purposes) - 6 characters and 10 numbers.

  2. A "hw version" to specify what type of product it is (each product uses a different protocol).

The problem I have is basically how to perform the discovery phase and then connect to a particular discovered object:

A. In the iBeacon adv packet, I should use UUID field for serial number and major/minor field for the hw version, but if I do so, the devices will be basically not discoverable (iBeacon SDK for iOS needs to know the UUID to look for before starting the monitoring phase, so it cannot be different for every device).

B. In iOS, the iBeacon features are available through CoreLocation libraries, the standard BLE features are instead available through CoreBluetooth. If I use an iBeacon advertisement packet, the objects discovered by CoreBluetooth libraries do not see any information of the package (so, the problem is: "How do I know which is the object with serial XYZ?").

Upvotes: 2

Views: 799

Answers (2)

The Good Giant
The Good Giant

Reputation: 1780

I realized that a possible solution for my problem would be advertising both iBeacon and standard BLE packages, in a "round robin way" let's say.

I tried it (I advertised for 500msec the iBeacon Package and for 500msec the standard BLE one) and Standard BLE seems to be ok.

I still need to investigate more about how iBeacon discovery reacts to this, but as said it could be a solution.

Upvotes: 2

davidgyoung
davidgyoung

Reputation: 64916

OPTION 1: If you want to use an iBeacon advertisement, forget about encoding any info directly in the ProximityUUID. As you mention, you need to know this up front in iOS. Instead, make a lookup table to convert the iBeacon identifiers to Hardware Number / Serial Number. Like this:

Proximity UUID                       Major Minor  HW/N  S/N
2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 10001 10001  0001  abcdef0000000001
2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 10001 10002  0001  abcdef0000000002

This system would let you have 65536*65536 different serial numbers for a single UUID. You would need to store this table server-side and have a web service to look up the Hardware Number and Serial Number based on the UUID/Major/Minor.

My company offers a cloud service at http://www.proximitykit.com that lets you do exactly this. You can even use our web service API to programmatically add items to your lookup table. (It will probably be big.)

OPTION 2: Since you need CoreBluetooth after a connection is established, you might consider using CoreBluetooth for the whole thing. Your advertisement would be identical for all hardware types, but after connecting, the first data transfer to iOS from the device would contain the hardware number and serial number. You could then adjust the communication as needed based on the hardware number.

Upvotes: 0

Related Questions