PlutoconSDK 1.0.7

PlutoconSDK 1.0.7

DongHyuk Kim 维护。



  • dhhyuk

PlutoconSDK

Plutocon SDK for iOS

Version License Platform

示例

要运行示例项目,请克隆存储库,然后首先从 Example 目录中运行 pod install

需求

Xcode >= 9.0

iOS 部署目标 >= 10.0

安装

PlutoconSDK 可以通过 CocoaPods 使用。要安装它,只需将以下行添加到您的 Podfile 中

pod 'PlutoconSDK'

示例用法

Plutocons 监控快速入门

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
    }
}

Plutocon 连接快速入门

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()

Plutocon 属性编辑快速入门

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 采用 MIT 许可证。更多信息请参阅 LICENSE 文件。