codeman
codeman

Reputation: 9038

Can't discover peripheral using service UUID

I'm trying to detect a cycling power meter I have. I used the app LightBlue to determine the power meter's service UUID, which is E9410100-B434-446B-B5CC-36592FC4C724.

But when I use CBCentralManager to discover devices with this UUID, nothing is discovered:

manager?.scanForPeripherals(withServices: [CBUUID(string: "E9410100-B434-446B-B5CC-36592FC4C724")], options: nil)

Is there a shortened version of this UUID I should be using?

Upvotes: 0

Views: 397

Answers (1)

Paulw11
Paulw11

Reputation: 114866

You don't search for a specific device's identifier (This is unique per iOS device anyway). Rather, you search for peripherals that are advertising the service in which you are interested.

In the case of cycling power, this is 0x1818

You want:

manager?.scanForPeripherals(withServices: [CBUUID(string: "1818")], options: nil)

Upvotes: 1

Related Questions