Hey I have the problem that a friend of mine build a device that should be connected with the iphone. But now I am building the app and have the problem that I would like to compare the uuid from the peripheral with the my chosen uuid. If I call the function didDiscoverServices I get stuff like: Service found with UUID: Device Information Service found with UUID: Battery
But I cannot compare it with: if ([service.UUID isEqual:[CBUUID UUIDWithString:@"Battery"]]) {....} cause the string isn't a uuid. What could I do now? Is there any other possibility compare the service? (service.description is also a random number)
UUID of Battery is 0x180F according to the doc: https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
So you have to write: [service.UUID isEqual:[CBUUID UUIDWithString:@"0x180F"]]
or the UUID your friend put.
You have to understand that UUID in Bluetooth Low Energy are 16-bits OR 128 bits (for custom). Reading the doc https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/PerformingCommonPeripheralRoleTasks/PerformingCommonPeripheralRoleTasks.html or at least the one of UUIDWithString
should help you to understand.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments