PlutoconSDK for iOS
To run the example project, clone the repo, and run pod install
from the Example directory first.
Xcode >= 9.0
iOS Deployment Target >= 10.0
PlutoconSDK is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'PlutoconSDK'
let plutoconManager = PlutoconManager(delegate: self)
extension ViewController: PlutoconManagerDelegate {
func plutoconManagerDidUpdateState(_ state: PlutoconManagerState) {
guard state == .poweredOn else {
return
}
/* The isMonitoring variable set you whether you want to receive only one callback for one device (default: isMonitoring = false) */
self.plutoconManager?.startScan(isMonitoring: true)
}
// Scan callback
func plutoconManager(_ manager: PlutoconManager, didDiscover plutocon: Plutocon, plutocons: [Plutocon]) {
// do something
}
}
let plutoconConnection = plutoconManager.connect(connectionDelegate: self, target: plutocon)
extension ViewController: PlutoconConnectionDelegate {
// Connection successful
func plutoconConnection(_ connection: PlutoconConnection, didConnect plutocon: Plutocon) {
}
// Connection failed
func plutoconConnection(_ connection: PlutoconConnection, didFailToConnect plutocon: Plutocon, error: Error?) {
}
// Disconnect
func plutoconConnection(_ connection: PlutoconConnection, didDisconnectPeripheral plutocon: Plutocon, error: Error?) {
}
}
// Read plutocon property
plutoconConnection.getBatteryVoltage()
plutoconConnection.getBroadcastingPower()
plutoconConnection.getAdvertisingInterval()
plutoconConnection.getUuid()
plutoconConnection.getLatitude()
plutoconConnection.getLongitude()
plutoconConnection.getSoftwareVersion()
plutoconConnection.getHardwareVersion()
plutoconConnection.getManufactureName()
plutoconConnection.getModelNumber()
// Disconnect from plutocon
plutoconConnection.disconnect()
plutoconConnection.editor()
.setUUID(uuid)
.setProperty(uuid: uuid, int: value)
.setProperty(uuid: uuid, string: value)
.setOperationCompletion(completion: { (_, isLast) in
// do something
})
.commit()
dhhyuk, [email protected]
PlutoconSDK is available under the MIT license. See the LICENSE file for more info.