| | |
| | | return ResponseResult.success(devicesList); |
| | | } |
| | | |
| | | @GetMapping("/{device_sn}/subscribeTopic") |
| | | public ResponseResult<List<DeviceDTO>> testBinding(@PathVariable("device_sn") String deviceSn) { |
| | | deviceService.subscribeTopicOnline(deviceSn); |
| | | |
| | | return ResponseResult.success(); |
| | | } |
| | | |
| | | @GetMapping("/{device_sn}/unsubscribeTopic") |
| | | public ResponseResult<List<DeviceDTO>> testUnBinding(@PathVariable("device_sn") String deviceSn) { |
| | | deviceService.unsubscribeTopicOffline(deviceSn); |
| | | |
| | | return ResponseResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * After binding the device to the workspace, the device data can only be seen on the web. |
| | | * @param device |
| | |
| | | public ResponseResult getDevice(@PathVariable("workspace_id") String workspaceId, |
| | | @PathVariable("device_sn") String deviceSn) { |
| | | Optional<DeviceDTO> deviceOpt = deviceService.getDeviceBySn(deviceSn); |
| | | return deviceOpt.isEmpty() ? ResponseResult.error("device not found.") : ResponseResult.success(deviceOpt.get()); |
| | | return deviceOpt.isEmpty() ? ResponseResult.error("设备未找到") : ResponseResult.success(deviceOpt.get()); |
| | | } |
| | | |
| | | /** |
| | |
| | | deviceService.devicePropertySet(workspaceId, dockSn, propertyEnumOpt.get(), param.get(property)); |
| | | return ResponseResult.success(); |
| | | } |
| | | } |
| | | } |