BLE 0.1.3

BLE 0.1.3

测试已测试
Lang语言 SwiftSwift
许可 MIT
发布最新发布2020年4月
SPM支持 SPMLicense

Ondrej Rafaj 维护。




BLE 0.1.3

BLE

Version License Platform

围绕 CoreBluetooth 的 Swift 包装器。该库允许您连接到 BLE 设备,读取和写入数据。

用法

要运行示例项目,请克隆仓库,并首先从 Example 目录运行 `pod install`。

private let ble: BLE = BLE()

// Enable debug mode
self.ble.debugMode = true

// Set delegate
self.ble.delegate = self

// Scan for all devices
self.ble.startScanning(10) // Scan for 10 seconds

// Scan for some UUIDs only
self.ble.startScanning(10, serviceUUIDs: ["713D0000-503E-4C75-BA94-3148F18D941E"]) // Scan for 10 seconds

// Write three values to one service
var buffer: [UInt8] = [1, 0, 100]
let data: NSData = NSData(bytes: buffer, length: 3)
try! self.ble?.write(data, characteristicsUUID: "713D0003-503E-4C75-BA94-3148F18D941E")

示例应用程序

Screenshot 1

需求

需要在设备上运行,而非模拟器。

安装

BLE可以通过CocoaPods获取。要安装它,只需将以下行添加到您的Podfile

pod "BLE"

作者

Ondrej Rafaj, [email protected]

许可证

BLE 在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。