SiltaBluetooth 用于在 Apple iOS 环境中开发低功耗蓝牙 (BLE) 应用。
其主要功能是控制、监控和跟踪任何 BLE 设备或模块。
可用的 iOS (8.0 及更高版本)
1) 您可以通过 CocoaPods 安装我们的 SDK。
pod 'SiltaBluetooth', '~> 0.2.0'
2) 或者,您可以简单地下载 "SiltaBluetooth.framework"。
Swift
首先,您需要拥有 SiltaManager。
let silta = SiltaBluetooth.getIManager()
然后,委派 SDK。
silta?.delegate = self
您现在可以开始 App 开发了。
打包单个 BLE 设备的信息。
public class Bluetooth : NSObject {
public var manufacturer: String?
public var UUID: String?
public var powerLevel: NSNumber?
public var RSSI: NSNumber?
public var name: String?
public var live: Bool!
public func accuracy() -> Int
override public func isEqual(object: AnyObject?) -> Bool
override public var hash: Int { get }
}
命令
public enum ICommand {
case Buzzer
}
控制 BLE 设备的函数。
public protocol ISiltaBluetoothManager : NSObjectProtocol {
public var delegate: SiltaBluetoothDelegate? { get set } //SiltaBluetoothDelegate
public func start() //Enable the bluetooth scanning.
public func stop() //Stop scanning.
public func fireCommand(command: SiltaBluetooth.ICommand, ble: SiltaBluetooth.Bluetooth) //Give commands to Bluetooth devices.
}
控制、监控和跟踪任何 BLE 设备或模块的函数。
@objc public protocol SiltaBluetoothDelegate : NSObjectProtocol {
optional public func bluetoothDeviceListBeenRenewed(bles: [SiltaBluetooth.Bluetooth]) //Device list updated.
optional public func bluetoothExecuteCommandSuccess(ble: SiltaBluetooth.Bluetooth) //Commands executed successfully.
optional public func bluetoothExecuteCommandFailure(ble: SiltaBluetooth.Bluetooth)
optional public func bluetoothDisabled() //BLE devices not enabled.
optional public func bluetoothUnauthorized() //BLE devices not authorized to use.
optional public func bluetoothUnsupported() //No BLE devices connected.
}