| | |
| | | package com.dji.sample.manage.service; |
| | | |
| | | import com.dji.sample.common.model.PaginationData; |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.component.mqtt.model.CommonTopicResponse; |
| | | import com.dji.sample.component.websocket.config.ConcurrentWebSocketSession; |
| | | import com.dji.sample.manage.model.dto.DeviceDTO; |
| | | import com.dji.sample.manage.model.dto.DeviceFirmwareUpgradeDTO; |
| | | import com.dji.sample.manage.model.dto.TopologyDeviceDTO; |
| | | import com.dji.sample.manage.model.enums.DeviceModeCodeEnum; |
| | | import com.dji.sample.manage.model.enums.DeviceSetPropertyEnum; |
| | | import com.dji.sample.manage.model.enums.DockModeCodeEnum; |
| | | import com.dji.sample.manage.model.param.DeviceQueryParam; |
| | | import com.dji.sample.manage.model.receiver.StatusGatewayReceiver; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import org.springframework.messaging.Message; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * The device goes offline. |
| | | * @param gatewaySn |
| | | * @param gateway |
| | | * @return Whether the offline is successful. |
| | | */ |
| | | Boolean deviceOffline(String gatewaySn); |
| | | Boolean deviceOffline(StatusGatewayReceiver gateway); |
| | | |
| | | /** |
| | | * The aircraft goes offline. |
| | |
| | | |
| | | /** |
| | | * Obtain device data according to different query conditions. |
| | | * 根据不同的查询条件获取设备数据。 |
| | | * @param param query parameters |
| | | * @return |
| | | */ |
| | |
| | | * @param workspaceId |
| | | * @return |
| | | */ |
| | | List<DeviceDTO> getDevicesTopoForWeb(String workspaceId); |
| | | List<DeviceDTO> getDevicesTopoForWeb(String workspaceId,String reserveId); |
| | | |
| | | /** |
| | | * Set the remote controller and payloads information of the drone. |
| | |
| | | * @param sessions The collection of connection objects on the pilot side. |
| | | * @param sn |
| | | */ |
| | | void pushDeviceOnlineTopo(Collection<ConcurrentWebSocketSession> sessions, String sn); |
| | | void pushDeviceOnlineTopo(Collection<ConcurrentWebSocketSession> sessions, String sn, String gatewaySn); |
| | | |
| | | /** |
| | | * Query the information of the device according to the sn of the device. |
| | |
| | | * it also broadcasts a push of device online, offline and topology update to PILOT via websocket, |
| | | * and PILOT will get the device topology list again after receiving the push. |
| | | * @param workspaceId |
| | | * @param gatewaySn |
| | | * @param sn |
| | | */ |
| | | void pushDeviceOfflineTopo(String workspaceId, String gatewaySn); |
| | | void pushDeviceOfflineTopo(String workspaceId, String sn); |
| | | |
| | | /** |
| | | * When the server receives the request of any device online, offline and topology update in the same workspace, |
| | |
| | | * @param deviceSn |
| | | * @param gatewaySn |
| | | */ |
| | | void pushDeviceOnlineTopo(String workspaceId, String deviceSn, String gatewaySn); |
| | | void pushDeviceOnlineTopo(String workspaceId, String gatewaySn, String deviceSn); |
| | | |
| | | /** |
| | | * Handle messages from the osd topic. |
| | | * @param topic osd |
| | | * @param payload |
| | | * @param message osd |
| | | */ |
| | | void handleOSD(String topic, byte[] payload); |
| | | void handleOSD(Message<?> message); |
| | | |
| | | } |
| | | /** |
| | | * Update the device information. |
| | | * @param deviceDTO |
| | | * @return |
| | | */ |
| | | Boolean updateDevice(DeviceDTO deviceDTO); |
| | | |
| | | /** |
| | | * Bind devices to organizations and people. |
| | | * @param device |
| | | */ |
| | | Boolean bindDevice(DeviceDTO device); |
| | | |
| | | /** |
| | | * Get the binding devices list in one workspace. |
| | | * @param workspaceId |
| | | * @param page |
| | | * @param pageSize |
| | | * @param domain |
| | | * @return |
| | | */ |
| | | PaginationData<DeviceDTO> getBoundDevicesWithDomain(String workspaceId, Long page, Long pageSize, Integer domain); |
| | | |
| | | /** |
| | | * Unbind device base on device's sn. |
| | | * @param deviceSn |
| | | */ |
| | | void unbindDevice(String deviceSn); |
| | | |
| | | /** |
| | | * Get device information based on device's sn. |
| | | * 根据设备码获取设备信息 |
| | | * @param sn device's sn |
| | | * @return device |
| | | */ |
| | | Optional<DeviceDTO> getDeviceBySn(String sn); |
| | | |
| | | /** |
| | | * Create job for device firmware updates. |
| | | * @param workspaceId |
| | | * @param upgradeDTOS |
| | | * @return |
| | | */ |
| | | ResponseResult createDeviceOtaJob(String workspaceId, List<DeviceFirmwareUpgradeDTO> upgradeDTOS); |
| | | |
| | | /** |
| | | * Set the property parameters of the drone. |
| | | * @param workspaceId |
| | | * @param dockSn |
| | | * @param propertyEnum |
| | | * @param param |
| | | */ |
| | | void devicePropertySet(String workspaceId, String dockSn, DeviceSetPropertyEnum propertyEnum, JsonNode param); |
| | | |
| | | /** |
| | | * Set one property parameters of the drone. |
| | | * @param topic |
| | | * @param propertyEnum |
| | | * @param value |
| | | */ |
| | | void deviceOnePropertySet(String topic, DeviceSetPropertyEnum propertyEnum, Map.Entry<String, Object> value); |
| | | |
| | | /** |
| | | * Check the working status of the dock. |
| | | * @param dockSn |
| | | * @return |
| | | */ |
| | | DockModeCodeEnum getDockMode(String dockSn); |
| | | |
| | | /** |
| | | * Query the working status of the aircraft. |
| | | * 查询飞行器的工作状态 |
| | | * @param deviceSn |
| | | * @return |
| | | */ |
| | | DeviceModeCodeEnum getDeviceMode(String deviceSn); |
| | | |
| | | /** |
| | | * Check if the dock is in drc mode. |
| | | * @param dockSn |
| | | * @return |
| | | */ |
| | | Boolean checkDockDrcMode(String dockSn); |
| | | |
| | | /** |
| | | * Check if the device has flight control. |
| | | * @param gatewaySn |
| | | * @return |
| | | */ |
| | | Boolean checkAuthorityFlight(String gatewaySn); |
| | | |
| | | } |