|
@@ -8,6 +8,7 @@ package com.example.backend.dds;/*
|
|
|
import DDS.*;
|
|
|
import OpenDDS.DCPS.*;
|
|
|
import OpenDDS.DCPS.transport.*;
|
|
|
+import com.example.backend.model.MessageStatus;
|
|
|
import com.example.backend.model.Position;
|
|
|
import org.omg.CORBA.StringSeqHolder;
|
|
|
import Messenger.*;
|
|
@@ -34,6 +35,7 @@ public class DataReaderListenerImpl extends DDS._DataReaderListenerLocalBase {
|
|
|
public Map<String, Position> radarPositionMap = new ConcurrentHashMap<>();
|
|
|
public Map<String, List<String>> coopTeamMap = new ConcurrentHashMap<>();
|
|
|
public final Map<String, List<com.example.backend.model.Message>> messageList = new ConcurrentHashMap<>();
|
|
|
+ public Map<String, MessageStatus> messageStatusMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
private void initialize_counts() {
|
|
|
if (counts.size() > 0) {
|
|
@@ -110,7 +112,7 @@ public class DataReaderListenerImpl extends DDS._DataReaderListenerLocalBase {
|
|
|
String[] countList = messageList[0].split(" ");
|
|
|
int count = Integer.parseInt(countList[0]);
|
|
|
int radarCount = Integer.parseInt(countList[1]);
|
|
|
- //侦察
|
|
|
+ //干扰平台
|
|
|
for(int i=1;i<=count;i++){
|
|
|
String[] s = messageList[i].split(" ");
|
|
|
Position p = new Position();
|
|
@@ -122,13 +124,14 @@ public class DataReaderListenerImpl extends DDS._DataReaderListenerLocalBase {
|
|
|
p.z = Double.parseDouble(s[6]);
|
|
|
positionMap.put(s[0],p);
|
|
|
}
|
|
|
- //雷达
|
|
|
+ //雷达平台
|
|
|
for(int i=count+1;i<=radarCount+count;i++){
|
|
|
String[] s = messageList[i].split(" ");
|
|
|
Position p = new Position();
|
|
|
- p.coopID = "未知";
|
|
|
- p.jaming = "未知";
|
|
|
- p.isReal = "未知";
|
|
|
+ p.radar = s[0];
|
|
|
+ p.collaborationNumber = s[1];
|
|
|
+ p.interferenceStrategy = s[2];
|
|
|
+ p.isReal = s[3];
|
|
|
p.x = Double.parseDouble(s[4]);
|
|
|
p.y = Double.parseDouble(s[5]);
|
|
|
p.z = Double.parseDouble(s[6]);
|
|
@@ -195,7 +198,8 @@ public class DataReaderListenerImpl extends DDS._DataReaderListenerLocalBase {
|
|
|
String[] messageList = message.split("\n");
|
|
|
String[] countList = messageList[0].split(" ");
|
|
|
if(Integer.parseInt(countList[2])<=versionID)return;//旧版本或重复
|
|
|
- for(int i=1;i<=Integer.parseInt(countList[0]);i++){
|
|
|
+ int start = Integer.parseInt(countList[0]);
|
|
|
+ for(int i=1+start; i<messageList.length; i++){
|
|
|
String[] s = messageList[i].split(" ");
|
|
|
String coopID = s[0];
|
|
|
List<String> list = new ArrayList<>();
|
|
@@ -206,6 +210,32 @@ public class DataReaderListenerImpl extends DDS._DataReaderListenerLocalBase {
|
|
|
}
|
|
|
isTeam = 1;
|
|
|
}
|
|
|
+ if(mh.value.subject.equals("9")){
|
|
|
+ // 收到分组状态参数控制
|
|
|
+ String message = mh.value.text;
|
|
|
+ String[] s = message.split(" ");
|
|
|
+ MessageStatus m = new MessageStatus();
|
|
|
+ m.startUp = s[1];
|
|
|
+ m.quite = s[2];
|
|
|
+ m.mode = s[3];
|
|
|
+ messageStatusMap.put(s[0],m);
|
|
|
+ }
|
|
|
+ if(mh.value.subject.equals("10")){
|
|
|
+ // 收到分组状态参数初始化
|
|
|
+ String message = mh.value.text;
|
|
|
+ String[] messageList = message.split("\n");
|
|
|
+ String[] countList = messageList[0].split(" ");
|
|
|
+ int start = Integer.parseInt(countList[0]);
|
|
|
+ for(int i=1+start;i<messageList.length;i++){
|
|
|
+ String[] s = messageList[i].split(" ");
|
|
|
+ String platformID = s[0];
|
|
|
+ MessageStatus m = new MessageStatus();
|
|
|
+ m.startUp = s[1];
|
|
|
+ m.quite = s[2];
|
|
|
+ m.mode = s[3];
|
|
|
+ messageStatusMap.put(platformID,m);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (invalid_count == true) {
|
|
|
System.out.println("ERROR: Invalid message.count (" + mh.value.count + ")");
|
|
|
}
|
|
@@ -272,6 +302,7 @@ public class DataReaderListenerImpl extends DDS._DataReaderListenerLocalBase {
|
|
|
this.radarPositionMap.clear();
|
|
|
this.coopTeamMap.clear();
|
|
|
this.messageList.clear();
|
|
|
+ this.messageStatusMap.clear();
|
|
|
this.isInit = 0;
|
|
|
this.isRecall = 0;
|
|
|
this.isTeam = 0;
|