|
|
@ -1,6 +1,8 @@ |
|
|
|
package com.iflytop.gd.hardware.command.command_handler; |
|
|
|
package com.iflytop.gd.hardware.command.command.handler; |
|
|
|
|
|
|
|
import com.iflytop.gd.common.cmd.DeviceCommand; |
|
|
|
import com.iflytop.gd.common.enums.cmd.CmdAction; |
|
|
|
import com.iflytop.gd.common.enums.cmd.CmdDirection; |
|
|
|
import com.iflytop.gd.hardware.command.CommandHandler; |
|
|
|
|
|
|
|
public class FanHandler extends CommandHandler { |
|
|
@ -14,28 +16,28 @@ public class FanHandler extends CommandHandler { |
|
|
|
@Override |
|
|
|
public boolean sendCommand(DeviceCommand command) { |
|
|
|
// 校验动作 |
|
|
|
checkAction(command.getAction()); |
|
|
|
// checkAction(command.getAction()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 发送命令 |
|
|
|
if (command.getAction().equals("open")) { |
|
|
|
if (command.getAction() == CmdAction.open) { |
|
|
|
|
|
|
|
// 校验参数 |
|
|
|
checkParams(command.getParams()); |
|
|
|
// checkParams(command.getParams()); |
|
|
|
// get 参数值 |
|
|
|
String speed = command.getParams().get("speed"); |
|
|
|
Double speed = command.getParam().getSpeed(); |
|
|
|
|
|
|
|
// 打开风扇 |
|
|
|
String direction = command.getParams().get("direction"); |
|
|
|
CmdDirection direction = command.getParam().getDirection(); |
|
|
|
|
|
|
|
// 组包 |
|
|
|
// 发送命令 |
|
|
|
HardwareService.sendPacket(); |
|
|
|
return true; |
|
|
|
} |
|
|
|
else if (command.getAction().equals("close")) { |
|
|
|
else if (command.getAction() == CmdAction.close) { |
|
|
|
// 关闭风扇 |
|
|
|
return true; |
|
|
|
} |