|
|
|
@ -150,6 +150,13 @@ public class NettyServer { |
|
|
|
//发送消息 |
|
|
|
public void flushMsgToDevice(String uuid, String clientKey, boolean request, String xml) { |
|
|
|
if (tcpClientMap.containsKey(clientKey)) { |
|
|
|
if(clientKey.startsWith("areaPatrolServer")) { |
|
|
|
xml = xml.replace("<PatrolDevice>", "<PatrolHost>"); |
|
|
|
xml = xml.replace("</PatrolDevice>", "</PatrolHost>"); |
|
|
|
} else { |
|
|
|
xml = xml.replace("<PatrolHost>", "<PatrolDevice>"); |
|
|
|
xml = xml.replace("</PatrolHost>", "</PatrolDevice>"); |
|
|
|
} |
|
|
|
ByteBuf byteBuf = Unpooled.copiedBuffer(xml, CharsetUtil.UTF_8); |
|
|
|
int length = byteBuf.readableBytes(); |
|
|
|
ByteBuf allBuf = Unpooled.buffer(length + ConfigType.dataLength); |
|
|
|
@ -173,6 +180,13 @@ public class NettyServer { |
|
|
|
|
|
|
|
public void flushMsgToDeviceBroadcast(String uuid, String clientKey, boolean request, String xml) { |
|
|
|
for (Map.Entry<String, String> entry : tcpClientMap.entrySet()) { |
|
|
|
if(clientKey.startsWith("areaPatrolServer")) { |
|
|
|
xml = xml.replace("<PatrolDevice>", "<PatrolHost>"); |
|
|
|
xml = xml.replace("</PatrolDevice>", "</PatrolHost>"); |
|
|
|
} else { |
|
|
|
xml = xml.replace("<PatrolHost>", "<PatrolDevice>"); |
|
|
|
xml = xml.replace("</PatrolHost>", "</PatrolDevice>"); |
|
|
|
} |
|
|
|
ByteBuf byteBuf = Unpooled.copiedBuffer(xml, CharsetUtil.UTF_8); |
|
|
|
int length = byteBuf.readableBytes(); |
|
|
|
ByteBuf allBuf = Unpooled.buffer(length + ConfigType.dataLength); |
|
|
|
|