You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.5 KiB
66 lines
2.5 KiB
package com.iflytop.a800.controller;
|
|
import com.iflytop.a800.device.Device;
|
|
import com.iflytop.a800.task.StartResetTask;
|
|
import com.iflytop.uf.UfActuatorCmdExecutor;
|
|
import com.iflytop.uf.controller.UfApiControllerBase;
|
|
import com.iflytop.uf.controller.UfApiResponse;
|
|
import com.iflytop.uf.model.UfMdbRuntimeVariable;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
@Controller
|
|
public class DeviceController extends UfApiControllerBase {
|
|
@PostMapping("/api/device/status-get")
|
|
@ResponseBody
|
|
public UfApiResponse statusGet() {
|
|
Map<String,Object> status = new HashMap<>();
|
|
status.put("status", UfMdbRuntimeVariable.getString("DeviceStatus", "WAIT_FOR_TUBE_RACK"));
|
|
return this.success(status);
|
|
}
|
|
|
|
@PostMapping("/api/device/temperature-get")
|
|
@ResponseBody
|
|
public UfApiResponse temperatureGet() {
|
|
// String testCardWarehouseTempText = UfActuatorCmdExecutor.execute("TestCardWarehouse", "read_temperature");
|
|
// int testCardWarehouseTempInt = Integer.parseInt(testCardWarehouseTempText);
|
|
Double testCardWarehouseTemp = 0.0; //(double) testCardWarehouseTempInt / 100.0;
|
|
|
|
// String incubatorTempStr = UfActuatorCmdExecutor.execute("IncubatorTempCtrl", "read_temperature");
|
|
// int incubatorTempInt = Integer.parseInt(incubatorTempStr);
|
|
Double incubatorTemp = 0.0; // (double)incubatorTempInt / 10.0;
|
|
return this.success(Map.of(
|
|
"testCardBoxCase", testCardWarehouseTemp,
|
|
"incubatorTemp", incubatorTemp
|
|
));
|
|
}
|
|
|
|
@PostMapping("/api/device/id-chip-status-get")
|
|
@ResponseBody
|
|
public UfApiResponse idChipStatusGet() {
|
|
Map<String,Object> idChip = new HashMap<>();
|
|
idChip.put("status", UfMdbRuntimeVariable.getString("IdChipStatus", "NOT_INSERTED"));
|
|
return this.success(idChip);
|
|
}
|
|
|
|
@PostMapping("/api/device/start-reset")
|
|
@ResponseBody
|
|
public UfApiResponse startReset() {
|
|
var task = new StartResetTask();
|
|
task.start();
|
|
try {
|
|
task.join();
|
|
} catch (InterruptedException e) {
|
|
return this.error(e.getMessage());
|
|
}
|
|
return this.success();
|
|
}
|
|
|
|
@PostMapping("/api/device/trash-box-clean")
|
|
@ResponseBody
|
|
public UfApiResponse trashBoxClean() {
|
|
Device.getInstance().trashBox.clean();
|
|
return this.success();
|
|
}
|
|
}
|