Iot: Use English description

This commit is contained in:
Terrence
2025-05-19 10:06:05 +08:00
parent 425f46df4b
commit c3e488e744
4 changed files with 18 additions and 18 deletions

View File

@@ -32,21 +32,21 @@ private:
}
public:
Lamp() : Thing("Lamp", "一个测试用的灯"), power_(false) {
Lamp() : Thing("Lamp", "A test lamp"), power_(false) {
InitializeGpio();
// 定义设备的属性
properties_.AddBooleanProperty("power", "灯是否打开", [this]() -> bool {
properties_.AddBooleanProperty("power", "Whether the lamp is on", [this]() -> bool {
return power_;
});
// 定义设备可以被远程执行的指令
methods_.AddMethod("TurnOn", "打开灯", ParameterList(), [this](const ParameterList& parameters) {
methods_.AddMethod("turn_on", "Turn on the lamp", ParameterList(), [this](const ParameterList& parameters) {
power_ = true;
gpio_set_level(gpio_num_, 1);
});
methods_.AddMethod("TurnOff", "关闭灯", ParameterList(), [this](const ParameterList& parameters) {
methods_.AddMethod("turn_off", "Turn off the lamp", ParameterList(), [this](const ParameterList& parameters) {
power_ = false;
gpio_set_level(gpio_num_, 0);
});