fix设备状态查询接口
This commit is contained in:
parent
f0096af3e2
commit
e87cd8cd91
@ -82,7 +82,7 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen
|
|||||||
deviceService.offline(device.getDeviceId());
|
deviceService.offline(device.getDeviceId());
|
||||||
}
|
}
|
||||||
RequestMessage msg = new RequestMessage();
|
RequestMessage msg = new RequestMessage();
|
||||||
msg.setKey(DeferredResultHolder.CALLBACK_CMD_DEVICESTATUS + device.getDeviceId() + channelId);
|
msg.setKey(DeferredResultHolder.CALLBACK_CMD_DEVICESTATUS + device.getDeviceId());
|
||||||
msg.setData(json);
|
msg.setData(json);
|
||||||
deferredResultHolder.invokeAllResult(msg);
|
deferredResultHolder.invokeAllResult(msg);
|
||||||
}
|
}
|
||||||
|
@ -339,9 +339,14 @@ public class DeviceQuery {
|
|||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("设备状态查询API调用");
|
logger.debug("设备状态查询API调用");
|
||||||
}
|
}
|
||||||
Device device = storager.queryVideoDevice(deviceId);
|
|
||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
String key = DeferredResultHolder.CALLBACK_CMD_DEVICESTATUS + deviceId;
|
String key = DeferredResultHolder.CALLBACK_CMD_DEVICESTATUS + deviceId;
|
||||||
|
Device device = storager.queryVideoDevice(deviceId);
|
||||||
|
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(2*1000L);
|
||||||
|
if(device == null) {
|
||||||
|
result.setResult(new ResponseEntity(String.format("设备%s不存在", deviceId),HttpStatus.OK));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
cmder.deviceStatusQuery(device, event -> {
|
cmder.deviceStatusQuery(device, event -> {
|
||||||
RequestMessage msg = new RequestMessage();
|
RequestMessage msg = new RequestMessage();
|
||||||
msg.setId(uuid);
|
msg.setId(uuid);
|
||||||
@ -349,7 +354,7 @@ public class DeviceQuery {
|
|||||||
msg.setData(String.format("获取设备状态失败,错误码: %s, %s", event.statusCode, event.msg));
|
msg.setData(String.format("获取设备状态失败,错误码: %s, %s", event.statusCode, event.msg));
|
||||||
resultHolder.invokeResult(msg);
|
resultHolder.invokeResult(msg);
|
||||||
});
|
});
|
||||||
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(2*1000L);
|
|
||||||
result.onTimeout(()->{
|
result.onTimeout(()->{
|
||||||
logger.warn(String.format("获取设备状态超时"));
|
logger.warn(String.format("获取设备状态超时"));
|
||||||
// 释放rtpserver
|
// 释放rtpserver
|
||||||
|
Loading…
Reference in New Issue
Block a user