优化通道刷新
This commit is contained in:
@@ -44,6 +44,12 @@ public class CatalogDataCatch {
|
||||
return catalogData.getChannelList();
|
||||
}
|
||||
|
||||
public int getTotal(String key) {
|
||||
CatalogData catalogData = data.get(key);
|
||||
if (catalogData == null) return 0;
|
||||
return catalogData.getTotal();
|
||||
}
|
||||
|
||||
public void del(String key) {
|
||||
data.remove(key);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import javax.sip.*;
|
||||
import javax.sip.address.SipURI;
|
||||
import javax.sip.header.HeaderAddress;
|
||||
import javax.sip.header.ToHeader;
|
||||
import javax.sip.message.Response;
|
||||
import java.text.ParseException;
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -103,6 +104,18 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
|
||||
if (!StringUtils.isEmpty(getText(rootElement,"PTZCmd")) && !parentPlatform.getServerGBId().equals(targetGBId)) {
|
||||
String cmdString = getText(rootElement,"PTZCmd");
|
||||
Device deviceForPlatform = storager.queryVideoDeviceByPlatformIdAndChannelId(parentPlatform.getServerGBId(), channelId);
|
||||
if (deviceForPlatform == null) {
|
||||
try {
|
||||
responseAck(evt, Response.NOT_FOUND);
|
||||
return;
|
||||
} catch (SipException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
cmder.fronEndCmd(deviceForPlatform, channelId, cmdString, eventResult -> {
|
||||
// 失败的回复
|
||||
try {
|
||||
|
||||
@@ -115,16 +115,15 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||
continue;
|
||||
}
|
||||
//by brewswang
|
||||
if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Longitude"))) {//如果包含位置信息,就更新一下位置
|
||||
processNotifyMobilePosition(evt, itemDevice);
|
||||
}
|
||||
|
||||
// if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Longitude"))) {//如果包含位置信息,就更新一下位置
|
||||
// processNotifyMobilePosition(evt, itemDevice);
|
||||
// }
|
||||
DeviceChannel deviceChannel = XmlUtil.channelContentHander(itemDevice);
|
||||
deviceChannel.setDeviceId(device.getDeviceId());
|
||||
logger.debug("收到来自设备【{}】的通道: {}【{}】", device.getDeviceId(), deviceChannel.getName(), deviceChannel.getChannelId());
|
||||
|
||||
channelList.add(deviceChannel);
|
||||
}
|
||||
|
||||
logger.debug("收到来自设备【{}】的通道: {}个,{}/{}", device.getDeviceId(), channelList.size(), catalogDataCatch.get(key) == null ? 0 :catalogDataCatch.get(key).size(), sumNum);
|
||||
catalogDataCatch.put(key, sumNum, device, channelList);
|
||||
if (catalogDataCatch.get(key).size() == sumNum) {
|
||||
// 数据已经完整接收
|
||||
@@ -230,4 +229,9 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String getChannelSyncProgress(String deviceId) {
|
||||
String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId;
|
||||
return catalogDataCatch.get(key) == null ? "0/0" : catalogDataCatch.get(key).size() + "/" + catalogDataCatch.getTotal(key);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user