BLEManager-iOS icon indicating copy to clipboard operation
BLEManager-iOS copied to clipboard

Detect Bluetooth Action

Open nicoaureliovillanueva opened this issue 6 years ago • 1 comments

Hi @hasan-iqvis! AMAZING WORK! i have a question what function i can use to detect the actions from bluetooth. I have this paramaters

<CBCharacteristic: 0x1c42a87c0, UUID = FFE1, properties = 0x12, value = <01>, notifying = NO>

I hope you can help me on this.

Thanks!

nicoaureliovillanueva avatar Mar 07 '18 02:03 nicoaureliovillanueva

Hi nicoaureliovillanueva! Thanks for reaching out.

<CBCharacteristic: 0x1c42a87c0, UUID = FFE1, properties = 0x12, value = <01>, notifying = NO>

To Detect Bluetooth action You have to do following steps 1- After paring the Bluetooth device & discovering the Service of above Characteristic you have to discover the Characteristic by using the following method

/* Discover Specific Characteristics of any Service.*/
func discoverCharacteristicsByUUIDs(charUUIds:NSArray,peripheral:CBPeripheral,service:CBService)

2- You will get callback of discovered Characteristic in the following method

/* To get discovered Characteristics from respective Service*/
func postDiscoverdCharacteristices(discoveredCharacteristics:NSArray)

3- To get action from Bluetooth you need to read the value of above CBCharacteristic by using following method

/* Read value for any Characteristic.*/
func readCharacteristicValue(peripheral:CBPeripheral,char:CBCharacteristic)

4- When you read the Characteristic value you will get the callback in the following method

/* Read characteristic value from char object  */
func postReadCharacteristicValue(peripheral:CBPeripheral, char:CBCharacteristic)

5- To post action or value to Bluetooth device you can use following method

// Wrie value for any Characteristic.
func writeCharacteristicValue(peripheral:CBPeripheral, data:Data, char:CBCharacteristic, type:CBCharacteristicWriteType)

Further, you can see the demo of BLEManager-iOS.

waseemiqvis avatar Mar 07 '18 06:03 waseemiqvis