I am looking for a unique id accessible for a bluetooth low energy device from iOS.
I have 10 devices and i placed it in 10 different places. I exactly need to know to which device i am communicating irrespective of the iOS device i am using to connect.
In the iOS core bluetooth, a new UUID is assigned by iOS for my device. I am not able to uniquely identify the device.
I have used the MAC address of the peripheral to generate a unique name in SCAN RESP. I guess you could also use this approach and maybe also put it in the advertisement data or in a message. (My peripheral was based on TI's 2540 SoC.)
To my knowledge MAC/BDADDR is not accessible via CoreBluetooth, but I noticed that the "Device Information Service" profile (0x180A) contains a "System ID" attribute (0x2A23) which encodes the device's unique MAC/BDADDR address. I don't know if it is mandatory for a BLE device to expose this service, however.
Use Major and Minor properties in CLBeacon. Both are 4 char hex values.
They are located in advertisement data with UUID.
More info:
https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLBeacon_class/Reference/Reference.html#//apple_ref/occ/instp/CLBeacon/major
Related
I hope my type of question does not violate question type rules!
I'm coding a Bluetooth iOS app to control a peripheral (Bluetooth speaker) and I'd like the app to only identify a set of unique Bluetooth modules (brand).
Since I first want to identify if the speaker is part of the brand, I cannot rely on picking up certain types of services since any other speaker could also have them. Neither can I rely on the identifier name, since it's very superficial and prone to change.
The closest I've come to is the first 16-code of the UUID 32 hexadecimal digits, organization unique identifier (OUI). For example in the image below, is it good practice to use D42A8779-F905-BA72-80AA of the D42A8779-F905-BA72-80AA-3186A18D4453 as a brand peripheral identifier?
If not, what could I possibly rely on?
The identifier of CBPeripheral is unique to the iOS device that scanned it. It's not sent by the bluetooth peripheral itself https://developer.apple.com/documentation/corebluetooth/cbpeer/1620687-identifier
Surely if you're looking to do something other than just audio, one of the service UUIDs will be unique to that device?
You might also be able to identify by looking in the advertisement data, specifically the manufacturer data: https://developer.apple.com/documentation/corebluetooth/cbadvertisementdatamanufacturerdatakey
This is part of the CBCentralManagerDelegate didDiscover callback https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate/1518937-centralmanager
Is there a way to find out what type of device it is that I have scanned?
After iOS 7?
For instance, APPLE, DELL, LENOVO, ect.
Thanks
You can check to see if the device you have connected to implements the Device Information service. If it does then you can read the Manufacturer Name characteristic.
There is no way of determining this information without actually connecting to the peripheral.
This would only be possible if the product developer included this in the advertisement data or within a GATT service.
You can observe advertisement data when CBCentralManager discovers peripherals, see documentation here.
Information like this might be found under the CBAdvertisementDataManufacturerDataKey dictionary key.
My current project use bluetooth printer and i use EAAccessory framework for connect with the external device(printer). the problem is when i discover the bluetooth device, i get the all the devices paired with the iOS device. i need filter printers from the paired devices.
I really do not think this is possible. If you want exact information on the actual type of the bluetooth device connected, such as whether it is a printer or a wireless headset, the EAAccessory framework will not be able to deduce this for you nor is it really EAAccessory's job. All the EAAccessory framework will give you is very basic metadata information on the currently connected devices, generally speaking you can use some combination of the meta data, such as [name, protocol string] OR [manufacturer, name] to identify what you have connected to.
If you need any richer metadata like what you are asking, you need to directly ask the device yourself, which means the device should have some API's available for you to communicate with it. From my personal experience though, the information returned and boxed into an EAAccessory framework is more than enough for me to understand the device I am connecting to, specific type information will than be deduced off of that in code. If you want dynamic reader type info, that is tough and you will need to query the device for that info yourself once establishing a logical session.
I'm trying to figure out how to send a simple text string from a BlueGiga BLE112 bluetooth module to an iOS device using BGScript. Is this possible? If so, what steps do I need to take to get this to work. Any help will be greatly appreciated.
One way would be to create a custom GATT service with a characteristic containing your string. Then the iOS device could connect and read it. There is also the standard Device Information service which contains various string characteristics such as manufacturer name, serial no., device id etc. Maybe you could use that if it is suitable for your application. Your BGSript code among other things could set the value of the characteristic at run time if it is not constant. You can create the service using Bluegiga's Profile Development Kit. Documentation can be found here BLE112 Documentation and Software.
Is there a way to uniquely identify a BTLE device (something like hardware ID)? I have 2 hardware BTLE devices and 2 soft BTLE devices (using CBCentralManager). All these devices are sending same UUID.
I want to identify the exact BTLE device when all the devices are lying near me. Any clue?
The devices should have unique Bluetooth addresses. If they don't then you wouldn't be able to properly connect to them without them interfering with each other. However, with BTLE it's possible for a device to have a randomized address for privacy (but those conform to a particular pattern so you can detect if you get that kind of address). The address is 6 bytes and is usually displayed in hex (ex A1-B2-C3-D4-E5-F6). The first 2 bytes usually indicate the manufacturer.
UPDATE: My answer is valid for most BLE usage, but as the question is tagged ios you may want to look at this other answer about getting a unique id on ios as a possible way to get the bluetooth address