Introduction

Hot to read and write data to a bluetooth low energy device.

Remarks

Some important points

- intel CPU usually use little endian.
- The ARM architecture was little-endian before version 3 when it became big-endian.

Scan for SERVICE UUID

func SearchBLE(){
    cb_manager.scanForPeripherals(withServices:[service_uuid], options: nil)
    StopSearchBLE()
}

How to discover SERVICE UUID without documentation

func centralManager(_ central: CBCentralManager, didConnect peripheral:             
CBPeripheral) {
        peripheral.delegate = self
        peripheral.discoverServices(nil)
}

func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
    for service in peripheral.services! {
        print("Service: \\(service)\\n error: \\(error)")
    }
}