Question

I am working on an iOS core Bluetooth application, i can connect the bluetooth device use iphone4S , but i dont know how to communication with the device. i want to read information form the device.

i also see this sources code https://github.com/sergiomtzlosa/CoreBluetooth-Demo/

and this article How to read information from core bluetooth device

but i dont understand how to transfer data.

can some one help me? thank you

Was it helpful?

Solution

To use CoreBluetooth, first your device must support Bluetooth Low Energy in Bluetooth 4.0. You can't connect to the device through iOS's UI for LE, you will have to develop your own UI for it because your application need to connect to only the devices with the services that you are interested in.

After that, you can subscribe to notification of the device when a characteristic value is updated, and then read the value using CoreBluetooth API. If the device has a characteristic that can be written to, then your application can write to the characteristic using CoreBluetooth API.

That's the general idea, hope that answers your question.

Edit: check out these samples:

  1. Heart Rate Monitor
  2. Temperature Sensor

OTHER TIPS

A very similiar question has been asked and answered.

Read through the framework and find methods and callbacks with very descriptive names like:

- (void) centralManagerDidUpdateState:central
- (void) centralManager:central didDiscoverPeripheral

- (void) peripheral:peripheral didDiscoverServices:error
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top