#一键寻车接口预留
This commit is contained in:
@@ -136,7 +136,6 @@ public class NettyDevice extends Connector {
|
|||||||
return finishId;
|
return finishId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public synchronized boolean cancelingTask() throws MqttException {
|
public synchronized boolean cancelingTask() throws MqttException {
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
WorkRecord workRecord = workRecordMapper.selectById(task.getRouteId());
|
WorkRecord workRecord = workRecordMapper.selectById(task.getRouteId());
|
||||||
@@ -214,7 +213,7 @@ public class NettyDevice extends Connector {
|
|||||||
|
|
||||||
// 配置左右轮增益系数
|
// 配置左右轮增益系数
|
||||||
public void sendWheelGainCoefficientsCommand(double leftForwardGain, double leftBackwardGain,
|
public void sendWheelGainCoefficientsCommand(double leftForwardGain, double leftBackwardGain,
|
||||||
double rightForwardGain, double rightBackwardGain) {
|
double rightForwardGain, double rightBackwardGain) {
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(39);
|
ByteBuffer buffer = ByteBuffer.allocate(39);
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN);
|
buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||||
|
|
||||||
@@ -294,7 +293,6 @@ public class NettyDevice extends Connector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void startTask() {
|
public void startTask() {
|
||||||
try {
|
try {
|
||||||
if (executingTask)
|
if (executingTask)
|
||||||
@@ -414,8 +412,19 @@ public class NettyDevice extends Connector {
|
|||||||
GlobalMemory.customMqttDeviceMonitor.publish(
|
GlobalMemory.customMqttDeviceMonitor.publish(
|
||||||
mqttClientId,
|
mqttClientId,
|
||||||
String.format(MqttTopic.MOWER_OTA_UPGRADE_SET, deviceId),
|
String.format(MqttTopic.MOWER_OTA_UPGRADE_SET, deviceId),
|
||||||
JsonUtils.toJsonString(payload)
|
JsonUtils.toJsonString(payload));
|
||||||
);
|
}
|
||||||
|
|
||||||
|
public void searchDevice(String deviceId) throws MqttException {
|
||||||
|
Map<String, Object> payload = new HashMap<>();
|
||||||
|
payload.put("action", "search_device");
|
||||||
|
payload.put("timestamp", System.currentTimeMillis());
|
||||||
|
payload.put("message_id", "search_device_" + System.currentTimeMillis());
|
||||||
|
|
||||||
|
GlobalMemory.customMqttDeviceMonitor.publish(
|
||||||
|
mqttClientId,
|
||||||
|
String.format(MqttTopic.MOWER_SEARCH_DEVICE_SET, deviceId),
|
||||||
|
JsonUtils.toJsonString(payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,15 @@ package com.maibu.mqtt;
|
|||||||
|
|
||||||
public class MqttTopic {
|
public class MqttTopic {
|
||||||
|
|
||||||
/** 通用设备主题,建议使用 MOWER_* 系列主题 */
|
/** 通用设备主题,建议使用 MOWER_* 系列主题 */
|
||||||
public static final String DEVICE_STATUS_TOPIC = "device/%s/realTimeMessage";
|
public static final String DEVICE_STATUS_TOPIC = "device/%s/realTimeMessage";
|
||||||
|
|
||||||
public static final String DEVICE_LOCATION_TOPIC = "device/%s/locationMessage";
|
public static final String DEVICE_LOCATION_TOPIC = "device/%s/locationMessage";
|
||||||
/** 通用设备主题,建议使用 MOWER_* 系列主题 */
|
/** 通用设备主题,建议使用 MOWER_* 系列主题 */
|
||||||
public static final String DEVICE_TASK_STATUS_TOPIC = "task/%s/status";
|
public static final String DEVICE_TASK_STATUS_TOPIC = "task/%s/status";
|
||||||
/** 通用设备主题,建议使用 MOWER_* 系列主题 */
|
/** 通用设备主题,建议使用 MOWER_* 系列主题 */
|
||||||
public static final String DEVICE_TASK_ARRIVE_TOPIC = "task/%s/arrive";
|
public static final String DEVICE_TASK_ARRIVE_TOPIC = "task/%s/arrive";
|
||||||
/** 通用设备主题,建议使用 MOWER_* 系列主题 */
|
/** 通用设备主题,建议使用 MOWER_* 系列主题 */
|
||||||
public static final String DEVICE_ERROR_PUSH_TOPIC = "device/%s/error";
|
public static final String DEVICE_ERROR_PUSH_TOPIC = "device/%s/error";
|
||||||
public static final String DEVICE_ROUTE_PUSH_TOPIC = "device/%s/route/post";
|
public static final String DEVICE_ROUTE_PUSH_TOPIC = "device/%s/route/post";
|
||||||
|
|
||||||
@@ -73,6 +73,9 @@ public class MqttTopic {
|
|||||||
/** OTA 升级结果上报(设备->平台) */
|
/** OTA 升级结果上报(设备->平台) */
|
||||||
public static final String MOWER_OTA_RESULT_POST = "mower/+/ota/result/post";
|
public static final String MOWER_OTA_RESULT_POST = "mower/+/ota/result/post";
|
||||||
|
|
||||||
|
/** 寻车指令(平台->设备) */
|
||||||
|
public static final String MOWER_SEARCH_DEVICE_SET = "mower/%s/action/search/set";
|
||||||
|
|
||||||
// ==================== 设备信息 ====================
|
// ==================== 设备信息 ====================
|
||||||
// /** 查询设备信息(平台->设备) */
|
// /** 查询设备信息(平台->设备) */
|
||||||
// public static final String MOWER_INFO_DEVICE_GET =
|
// public static final String MOWER_INFO_DEVICE_GET =
|
||||||
|
|||||||
@@ -44,5 +44,4 @@ public class NettyDeviceController extends BaseController {
|
|||||||
nettyDeviceService.sendCommand(command);
|
nettyDeviceService.sendCommand(command);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -18,11 +19,13 @@ import org.springframework.web.bind.annotation.RequestPart;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import com.maibu.core.business.DeviceRunParam;
|
||||||
import com.maibu.core.business.device.NettyDevice;
|
import com.maibu.core.business.device.NettyDevice;
|
||||||
import com.maibu.core.business.dto.WebRouteStatusMessageDTO;
|
import com.maibu.core.business.dto.WebRouteStatusMessageDTO;
|
||||||
import com.maibu.core.business.inter.WebsocketMesDispather;
|
import com.maibu.core.business.inter.WebsocketMesDispather;
|
||||||
import com.maibu.core.business.path.LatAndLngEntity;
|
import com.maibu.core.business.path.LatAndLngEntity;
|
||||||
import com.maibu.core.controller.BaseController;
|
import com.maibu.core.controller.BaseController;
|
||||||
|
import com.maibu.core.domain.AjaxResult;
|
||||||
import com.maibu.core.domain.R;
|
import com.maibu.core.domain.R;
|
||||||
import com.maibu.core.enums.MesType;
|
import com.maibu.core.enums.MesType;
|
||||||
import com.maibu.memory.DeviceSessionManager;
|
import com.maibu.memory.DeviceSessionManager;
|
||||||
@@ -245,4 +248,12 @@ public class HostComputerController extends BaseController {
|
|||||||
String.format("%.6f", minLng), String.format("%.6f", maxLng));
|
String.format("%.6f", minLng), String.format("%.6f", maxLng));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/searchDevice")
|
||||||
|
public AjaxResult searchDevice(@RequestParam String deviceId) throws Exception {
|
||||||
|
hostComputerService.searchDevice(deviceId);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,25 @@
|
|||||||
package com.maibu.service.impl;
|
package com.maibu.service.impl;
|
||||||
|
|
||||||
import com.maibu.core.business.WorkRecord;
|
|
||||||
import com.maibu.memory.GlobalMemory;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.maibu.core.business.device.NettyDevice;
|
||||||
|
import com.maibu.memory.DeviceSessionManager;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class HostComputerService {
|
public class HostComputerService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WorkRecordService workRecordService;
|
private DeviceSessionManager deviceSessionManager;
|
||||||
|
|
||||||
|
public void searchDevice(String deviceId) throws Exception {
|
||||||
|
NettyDevice device = deviceSessionManager.getDevice(deviceId);
|
||||||
|
if (device != null && device.getOnlineStatus() == 1) {
|
||||||
|
device.searchDevice(deviceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user