Control Pillbox

Function table: supportSmartPillbox

Description

Control smart pillbox unlock, light on, or light off.

Param Type Description
operate Int 1: unlock; 2: light on; 3: light off
color Int 1: red; 2: green; 3: blue; 4: white; required when operate=2 (light on)

Example

Swift

let unlock = IDOPillboxControlParamModel(operate: 1)
Cmds.controlPillbox(unlock).send { rs in
    if case .success(let obj) = rs {
        // success
    } else {
        // failure
    }
}

let lightOn = IDOPillboxControlParamModel(operate: 2, color: 2)
Cmds.controlPillbox(lightOn).send { rs in
    if case .success(let obj) = rs {
        // success
    } else {
        // failure
    }
}

let lightOff = IDOPillboxControlParamModel(operate: 3)
Cmds.controlPillbox(lightOff).send { rs in
    if case .success(let obj) = rs {
        // success
    } else {
        // failure
    }
}

Kotlin

val unlock = IDOPillboxControlParamModel(operate = 1)
Cmds.controlPillbox(unlock).send {
    if (it.error.code == 0) {
        // success
    } else {
        // failure
    }
}

val lightOn = IDOPillboxControlParamModel(operate = 2, color = 2)
Cmds.controlPillbox(lightOn).send {
    if (it.error.code == 0) {
        // success
    } else {
        // failure
    }
}

val lightOff = IDOPillboxControlParamModel(operate = 3)
Cmds.controlPillbox(lightOff).send {
    if (it.error.code == 0) {
        // success
    } else {
        // failure
    }
}
Copyright © 2023-2024 IDO. All rights reserved. all right reserved,powered by Gitbook修改日期: 2026-08-24 01:15:27

results matching ""

    No results matching ""