Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use core bluetooth framework get data?

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

like image 512
user1068895_CHU Avatar asked Jul 25 '12 15:07

user1068895_CHU


1 Answers

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
like image 67
yuklai Avatar answered Sep 28 '22 13:09

yuklai