|
@@ -321,46 +321,47 @@ public class TsiCpuPacket extends AbstractTsiPacket {
|
|
|
|
|
|
int loop = 0;
|
|
|
for (int ii = INDEX_STATUS_DATA; loop < this.count; ii += SIZE_STATUS_DATA, loop++) {
|
|
|
-
|
|
|
byte[] status = new byte[SIZE_STATUS_DATA];
|
|
|
System.arraycopy(this.buf, ii, status, 0, SIZE_STATUS_DATA);
|
|
|
|
|
|
- int dirAdd = (int)(status[INDEX_STATUS_DIR_ADD] & 0x0F);
|
|
|
+ int dirAdd = status[INDEX_STATUS_DIR_ADD] & 0x0F;
|
|
|
if (dirAdd == 0) {
|
|
|
// 원천 노드 정보
|
|
|
nodeStatus.add(status);
|
|
|
}
|
|
|
else {
|
|
|
// 추가 노드 정보
|
|
|
- int directionCode = (int)status[INDEX_STATUS_DIRECTION];
|
|
|
- int direction = directionCode/10;
|
|
|
- int addNodeIdx = directionCode%10;
|
|
|
+ int originDirCode = status[INDEX_STATUS_DIRECTION]; // 원천방향코드
|
|
|
+ int direction = originDirCode/10; // 인천공항 노드 확인용
|
|
|
+ int addNodeIdx = originDirCode%10; // 인천공항 노드 확인용
|
|
|
if (addNodeIdx > 4) {
|
|
|
// 인천공항 연등지 인 경우 2개 이상이기 때문에 연등지1 = 15, 연등지2=16, ....
|
|
|
- dirAdd = addNodeIdx - 4;
|
|
|
- directionCode = direction * 10; // 15,16,17,18,19=10, 25,26,27,28,29=20, ....
|
|
|
+ // 즉, 일의 자리 5,6,7,8,9로 설정하고 1,2,3,4,5로 된다. 십의자리는 *10을 해서 원천방향코드가 된다.
|
|
|
+ dirAdd = addNodeIdx - 4; // 인천공항이 아닌경우는 위에서 구한 dirAdd 을 그대로 사용한다(1,2 만 가능)
|
|
|
+ originDirCode = direction * 10; // 15,16,17,18,19=10, 25,26,27,28,29=20, ....
|
|
|
}
|
|
|
status[INDEX_STATUS_DIR_ADD] = (byte) (status[INDEX_STATUS_DIR_ADD] & 0xF0); // 방향추가정보를 0 으로 초기화
|
|
|
- TsiNodeAddDetailVo detailVo = tsiNodeAddVo.getAddNodeMap().get(directionCode * 1000 + dirAdd);
|
|
|
- if (detailVo != null) {
|
|
|
- //detailVo.getNodeObj();
|
|
|
- for (int dirIdx = 0; dirIdx < TsiNodeAddDetailVo.MAX_NODE_ADD; dirIdx++) {
|
|
|
- if (detailVo.getAddDirCode()[dirIdx] != 0x00) {
|
|
|
- List<byte[]> list = addStatus.get(detailVo.getNodeId());
|
|
|
- if (list == null) {
|
|
|
- list = new ArrayList<>();
|
|
|
- addStatus.put(detailVo.getNodeId(), list);
|
|
|
- }
|
|
|
- if (dirIdx == 0) {
|
|
|
- status[INDEX_STATUS_DIRECTION] = detailVo.getAddDirCode()[dirIdx];
|
|
|
- list.add(status);
|
|
|
- }
|
|
|
- else {
|
|
|
- byte[] status2 = new byte[SIZE_STATUS_DATA];
|
|
|
- System.arraycopy(status, 0, status2, 0, SIZE_STATUS_DATA);
|
|
|
- status2[INDEX_STATUS_DIRECTION] = detailVo.getAddDirCode()[dirIdx];
|
|
|
- list.add(status2);
|
|
|
- }
|
|
|
+ TsiNodeAddDetailVo detailVo = tsiNodeAddVo.getAddNodeMap().get(originDirCode * 1000 + dirAdd);
|
|
|
+ if (detailVo != null && detailVo.getAddDirCode() != null) {
|
|
|
+ for (int dirIdx = 0; dirIdx < detailVo.getAddDirCode().length; dirIdx++) {
|
|
|
+// if (detailVo.getAddDirCode()[dirIdx] == (byte)0x00) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+ // 연등지 방향코드를 배열에 가지고 있기 때문에
|
|
|
+ List<byte[]> list = addStatus.get(detailVo.getNodeId());
|
|
|
+ if (list == null) {
|
|
|
+ list = new ArrayList<>();
|
|
|
+ addStatus.put(detailVo.getNodeId(), list);
|
|
|
+ }
|
|
|
+ if (dirIdx == 0) {
|
|
|
+ status[INDEX_STATUS_DIRECTION] = detailVo.getAddDirCode()[dirIdx];
|
|
|
+ list.add(status);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ byte[] status2 = new byte[SIZE_STATUS_DATA];
|
|
|
+ System.arraycopy(status, 0, status2, 0, SIZE_STATUS_DATA);
|
|
|
+ status2[INDEX_STATUS_DIRECTION] = detailVo.getAddDirCode()[dirIdx];
|
|
|
+ list.add(status2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -377,7 +378,7 @@ public class TsiCpuPacket extends AbstractTsiPacket {
|
|
|
}
|
|
|
makeAddNodeCvimPaket(this, this.nodeData);
|
|
|
|
|
|
- if (addStatus.size() == 0) {
|
|
|
+ if (addStatus.isEmpty()) {
|
|
|
// 연등지 정보가 설정된게 없을까???
|
|
|
return true;
|
|
|
}
|