Browse Source

fix:测试方法添加模拟点击手柄按钮

master
白凤吉 4 days ago
parent
commit
fa6d1606fa
  1. 22
      src/main/java/com/iflytop/handacid/app/controller/TestController.java

22
src/main/java/com/iflytop/handacid/app/controller/TestController.java

@ -3,6 +3,10 @@ package com.iflytop.handacid.app.controller;
import com.iflytop.handacid.app.common.enums.ChannelCode;
import com.iflytop.handacid.app.core.state.DeviceState;
import com.iflytop.handacid.common.result.Result;
import com.iflytop.handacid.hardware.service.AppEventBusService;
import com.iflytop.handacid.hardware.type.A8kPacket;
import com.iflytop.handacid.hardware.type.CmdId;
import com.iflytop.handacid.hardware.type.appevent.A8kHardwareReport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
@ -21,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
public class TestController {
private final DeviceState deviceState;
private final AppEventBusService eventBus;
@Operation(summary = "启动虚拟模式")
@PostMapping("/virtual")
@ -36,9 +41,20 @@ public class TestController {
return Result.success();
}
@Operation(summary = "设置模拟环境湿度")
@PostMapping("/set-humidity")
public Result<?> setHumidity(ChannelCode heatModule, double humidity) {
@Operation(summary = "模拟点击手柄加液按钮")
@PostMapping("/click-add")
public Result<?> clickAdd() {
A8kPacket packet = A8kPacket.createPacket(0, A8kPacket.PACKET_TYPE_EVENT, CmdId.event_ble_gamepad_liquid_acid.index, new Integer[]{});
eventBus.pushEvent(new A8kHardwareReport(packet));
return Result.success();
}
@Operation(summary = "模拟点击手柄预充按钮")
@PostMapping("/click-pre")
public Result<?> clickPre() {
A8kPacket packet = A8kPacket.createPacket(0, A8kPacket.PACKET_TYPE_EVENT, CmdId.event_ble_gamepad_liquid_acid_prefilling.index, new Integer[]{});
eventBus.pushEvent(new A8kHardwareReport(packet));
return Result.success();
}
}
Loading…
Cancel
Save