IOS Core Bluetooth: Unique Identifier for scanning and connecting to bluz device


#1

Hi! I am trying to uniquely identify bluz devices locally on my iOS device using core bluetooth framework.

  • I cannot use “mac addresses”.as IOS CoreBluetooth framework doesnt retrieve it
  • I cannot use “device uuid” as IOS CB dynamically generates these uuids for every device
  • If i change the “device name” which i am using to connect to one device right now, it won’t work with the particle gateway & cloud.

it there a solution for this ??

Thanks.

NOTE: I need the device to work locally as well as with particle cloud and gateway.


#2

You can use the Particle device ID, it is guaranteed to be unique. Our app does this, so you can see how to do it here: https://github.com/bluzDK/iOS-app/blob/master/bluz-iOS-app/Libraries/BLEDeviceInfo.swift#L73


#3

Is there a way to uniquely identify the bluz before connecting to it ?

Thanks.


#4

You can change the advertised name. You are right that the gateway will no longer automatically connect, but it sounds like that isn’t what you are trying to do? If the bluz device were connected to the gateway, it wouldn’t advertise information anyway


#5

but what if the moment i disconnect from the device locally and turn the gateway on ? i’m sure this will not happen is what you are saying …

isn’t there any way around this… ?

Thanks


#6

The only way to do it would be to have the device change the advetising data. That is the only way to make a unique ID for each device and retrieve it without connecting.

What are you trying to do? So you want the device connected to the gateway but also detectable by an iOS app? Can you provide a little more details around your use case? Perhaps we can figure out a better way with your requirements.


#7

Two Use Cases:

APP ----> BLUZ (Local)
APP ----> PARTICLE CLOUD -----> GATEWAY ----> BLUZ (over the air)

BLUZ:- (What i want bluz to do is as follows)

  1. IF no gateway THEN advertise for local connection with the app.
  2. IF gateway is on THEN connect to gateway.

Simple Enough. Not Really :smiley:


#8

That actually is quite simple. When bluz boots, it advertises the name Bluz DK, by default. Wait X seconds and see if there is a connection, if not, then switch the advertising name to a unique value. Switch back to Bluz DK as often as you want to check for the presence of a gateway, wait X seconds, and switch back.

So you can treat advertising as Bluz DK as attempts to connect to the gateway, so just do that as often as you would like to attempt connections, and then switch back when you want.