forked from xiaozhi/xiaozhi-esp32
Iot: Use English description
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user