Simple, block-based, lightweight library over CoreBluetooth
What is LGBluetooth?
LGBluetooth is a simple, block-based, lightweight library over CoreBluetooth. Will clean up your Core Bluetooth related code.
Reasons of using LGBluetooth:
As we know CoreBluetooth is very hard to use – The methods of objects in Core bluetooth are messy
For example connectPeripheral:options: is written in CBCentralManager, discoverCharacteristics:forService is written in Peripheral, writeValue:forCharacteristic:type, readValueForCharacteristic are also in Peripheral.
This messy code makes CoreBluetooth development really painfull. For example if you need to read characteristic value, you need to call “connect” on central object, wait for Central delegate callback, After that call “discover services”, wait peripheral delegate callback, “discover characteristic” which you planned and wait for delegate callback, “readValue” and again wait for delegate callback. What will happen if your program will make 2 connections at once? Handling such cases makes messy code, and raises hundred of bugs.
Don’t worry, now you can forgot about that hell – LGBluetooth uses blocks for callbacks, you can start using modern code and hierarchical calls.