A simple wrapper for CoreBluetooth to easily connect to Bluetooth LE devices and read/write it's values. It is not intended as a fully-featured library. You can consider it as a simple prototyping tool to get a connection to your device up and running quickly.
Take a look at the iOS demo in the Example directory to see how to use it. It shows how to turn on/off the LED of an Arduino 101.
QuickBLE has only a four methods to connect and manipulate the values of a connected peripheral:
This static function returns an initialized QuickBLE object and starts the service discovery / connection:
class func start(service: String, delegate: QuickBLEDelegate?) -> QuickBLEhelper = QuickBLE.start(service: "arduino", delegate: self)This function reads the value of the specified characteristic and calls the passed closure with the result:
func read<T:CharacteristicValue>(uuid: String, result: @escaping (_ value: T?) -> Void)helper.read(uuid: "led") { (value : Int8?) in
// evaluate value
}The following sets a value for the specified characteristic unique identifier:
func write<T:CharacteristicValue>(value: T, for uuid: String)helper.write(value: Int8(1), for: "led")Cancels the connection to the peripheral.
func stop()helper.stop()QuickBLE currently supports the following types for characteristic values:
StringInt8
This list can be easily expanded with additional types by implementing the following protocol:
public protocol CharacteristicValue {
static func getValue(fromData data: Data?) -> Self?
}- Based on Hello Bluetooth by Nebojsa Petrovic
QuickBLE is available under the MIT license. See the LICENSE file for more info.
The release notes can be found here.
