|
@@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
@Slf4j
|
|
|
public class ControlDeviceService {
|
|
@@ -35,15 +36,117 @@ public class ControlDeviceService {
|
|
|
}
|
|
|
return _instance;
|
|
|
}
|
|
|
+ public ConcurrentHashMap<Integer, Integer> rxSenseMap = null;
|
|
|
+ public ConcurrentHashMap<Integer, Integer> txPowerMap = null;
|
|
|
|
|
|
public ControlDeviceService() {
|
|
|
+ this.rxSenseMap = new ConcurrentHashMap<>();
|
|
|
+ this.txPowerMap = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
+ this.rxSenseMap.put(0x85, 81);
|
|
|
+ this.rxSenseMap.put(0xA0, 80);
|
|
|
+ this.rxSenseMap.put(0xA4, 79);
|
|
|
+ this.rxSenseMap.put(0xA8, 78);
|
|
|
+ this.rxSenseMap.put(0xAC, 77);
|
|
|
+ this.rxSenseMap.put(0xAF, 76);
|
|
|
+ this.rxSenseMap.put(0xB2, 75);
|
|
|
+ this.rxSenseMap.put(0xB5, 74);
|
|
|
+ this.rxSenseMap.put(0xB8, 73);
|
|
|
+ this.rxSenseMap.put(0xBB, 72);
|
|
|
+ this.rxSenseMap.put(0xBE, 71);
|
|
|
+ this.rxSenseMap.put(0xC1, 70);
|
|
|
+ this.rxSenseMap.put(0xC4, 69);
|
|
|
+ this.rxSenseMap.put(0xC7, 68);
|
|
|
+ this.rxSenseMap.put(0xCC, 67);
|
|
|
+ this.rxSenseMap.put(0xCF, 66);
|
|
|
+ this.rxSenseMap.put(0xD3, 65);
|
|
|
+ this.rxSenseMap.put(0xD7, 64);
|
|
|
+ this.rxSenseMap.put(0xDB, 63);
|
|
|
+ this.rxSenseMap.put(0xDF, 62);
|
|
|
+ this.rxSenseMap.put(0xE2, 61);
|
|
|
+ this.rxSenseMap.put(0xE5, 60);
|
|
|
+ this.rxSenseMap.put(0xE8, 59);
|
|
|
+
|
|
|
+ this.txPowerMap.put(0xFF, 93);
|
|
|
+ this.txPowerMap.put(0xDF, 93);
|
|
|
+ this.txPowerMap.put(0xC8, 93);
|
|
|
+ this.txPowerMap.put(0xB7, 93);
|
|
|
+ this.txPowerMap.put(0xA7, 93);
|
|
|
+ this.txPowerMap.put(0x9A, 93);
|
|
|
+ this.txPowerMap.put(0x8F, 93);
|
|
|
+ this.txPowerMap.put(0x85, 93);
|
|
|
+ this.txPowerMap.put(0x7C, 92);
|
|
|
+ this.txPowerMap.put(0x75, 92);
|
|
|
+ this.txPowerMap.put(0x6E, 91);
|
|
|
+ this.txPowerMap.put(0x68, 91);
|
|
|
+ this.txPowerMap.put(0x62, 90);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* AI_Publication 메시지로 수신한 데이터중 RSE 상태정보에 대한 데이터 Decoding
|
|
|
* decoding 한 RSE 상태정보를 데이터베이스에 업데이트 한다.
|
|
|
+ * IT Telecom/AIR Point
|
|
|
*/
|
|
|
- public boolean decoding_ControlDevice_Status(TbRseCtlr obj, ControlDevice controlDevice) {
|
|
|
+ public boolean decoding_ControlDevice_Status_ITTelecom(TbRseCtlr obj, ControlDevice controlDevice) {
|
|
|
+ try {
|
|
|
+ StatusOfDeviceInfo deviceInfo = new StatusOfDeviceInfo();
|
|
|
+ ByteArrayInputStream deviceStream = new ByteArrayInputStream(controlDevice.getVpbdControlDeviceData().value);
|
|
|
+ deviceInfo.decode(deviceStream);
|
|
|
+ log.info("ControlDeviceService.decoding_ControlDevice_Status: controlDevice{}, deviceInfo: {}", controlDevice.toString(), deviceInfo.toString());
|
|
|
+
|
|
|
+ obj.getStts().initNormal(); // 상태정보 업데이트
|
|
|
+ byte devStts[] = deviceInfo.getStatusInfo().value;
|
|
|
+ if (devStts != null && devStts.length >= 3) {
|
|
|
+ int temperature = ((devStts[0] & 0x80) != 0 ? (devStts[0] & 0x80) * -1 : devStts[0]);
|
|
|
+ int humidity = devStts[1];
|
|
|
+ int frontDoor = ((devStts[2] & 0x01) != 0 ? 1 : 0);
|
|
|
+ int backDoor = ((devStts[2] & 0x02) != 0 ? 1 : 0);
|
|
|
+ int fan = ((devStts[2] & 0x04) != 0 ? 1 : 0);
|
|
|
+ int heater = ((devStts[2] & 0x08) != 0 ? 1 : 0);
|
|
|
+ int rtu = ((devStts[2] & 0x10) != 0 ? 1 : 0);
|
|
|
+ obj.getStts().setStts(frontDoor, backDoor, fan, heater, rtu, temperature, humidity);
|
|
|
+ log.info("{}, STTS: {}/{}/{}/{}/{}/{}/{}", obj.getRSE_CTLR_NMBR(), temperature, humidity, frontDoor, backDoor, fan, heater, rtu);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 현장 데이터가 들어오는것 보고 아래 내용과 확인하여 상태정보 자세히 업데이트 해야함
|
|
|
+ if (deviceInfo.getDataOfBeaconInfoList() != null) {
|
|
|
+ StatusOfDeviceInfo.DataOfBeaconInfoList beacon = deviceInfo.getDataOfBeaconInfoList();
|
|
|
+ List<BeaconInfo> bList = beacon.getBeaconInfo();
|
|
|
+ int beaconCount = bList.size();
|
|
|
+ for (int ii = 0; ii < bList.size(); ii++) {
|
|
|
+ BeaconInfo bInfo = bList.get(ii);
|
|
|
+
|
|
|
+ String beaconId = String.format("%04X0%08X0", bInfo.getBeaconID().getManufacturerid().value.longValue(), bInfo.getBeaconID().getIndividualid().value.longValue());
|
|
|
+ int updateVer = bInfo.getUpdateVer().intValue();
|
|
|
+ int workMode = bInfo.getWorkMode().intValue();
|
|
|
+ int roadStationType = bInfo.getRoadStationType().intValue();
|
|
|
+ int status = bInfo.getStatus().intValue();
|
|
|
+
|
|
|
+ int beaconState = ((status & 0xFF000000) > 0) ? 1 : 0;
|
|
|
+ int outputPutGain = status & 0x0FF;
|
|
|
+ int txPowerSt = ((status >> 8) & 0x0FF);
|
|
|
+ int rxSenseSt = ((status >>16) & 0x0FF);
|
|
|
+ Integer txPowerVal = ControlDeviceService.getInstance().txPowerMap.get(txPowerSt);
|
|
|
+ Integer rxSenseVal = ControlDeviceService.getInstance().rxSenseMap.get(rxSenseSt);
|
|
|
+ int txPower = txPowerVal == null ? 0 : txPowerVal;
|
|
|
+ int rxSense = rxSenseVal == null ? 0 : rxSenseVal;
|
|
|
+
|
|
|
+ log.info("{}, BEACON({}): {}/{}/{}/{}/{}/{}/{}/{}/{}", obj.getRSE_CTLR_NMBR(), ii, beaconId, updateVer, workMode, roadStationType, status, beaconState, outputPutGain, txPower, rxSense);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ DbmsDataProcess dbmsDataProcess = (DbmsDataProcess) AppUtils.getBean(DbmsDataProcess.class);
|
|
|
+ dbmsDataProcess.add(new DbmsData(DbmsDataType.DBMS_DATA_CTLR_STTS, false, obj.getStts()));
|
|
|
+
|
|
|
+ log.info("ControlDeviceService.decoding_ControlDevice_Status: {}", obj.getStts().toString());
|
|
|
+ }
|
|
|
+ catch(Exception e) {
|
|
|
+ log.error("ControlDeviceService.decoding_ControlDevice_Status: {}", e.toString());
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean decoding_ControlDevice_Status_AirPoint(TbRseCtlr obj, ControlDevice controlDevice) {
|
|
|
try {
|
|
|
StatusOfDeviceInfo deviceInfo = new StatusOfDeviceInfo();
|
|
|
ByteArrayInputStream deviceStream = new ByteArrayInputStream(controlDevice.getVpbdControlDeviceData().value);
|
|
@@ -70,6 +173,7 @@ public class ControlDeviceService {
|
|
|
//String stationId = deviceInfo.getRoadStationID().value.toString();
|
|
|
//String stts = deviceInfo.getStatusInfo().value.toString();
|
|
|
//String roadStationID = new String(deviceInfo.getRoadStationID().value);
|
|
|
+ // FOR AIR POINT
|
|
|
String statusInfo = new String(deviceInfo.getStatusInfo().value);
|
|
|
String CNTL_DEVC_STTS = "0";
|
|
|
try {
|
|
@@ -88,7 +192,6 @@ public class ControlDeviceService {
|
|
|
|
|
|
// 현장 데이터가 들어오는것 보고 아래 내용과 확인하여 상태정보 자세히 업데이트 해야함
|
|
|
// AIR POINT 개발자: 상태정보는 일체형인 경우 하나만 사용, 본체, 안테나 같이 사용함
|
|
|
-
|
|
|
if (deviceInfo.getDataOfBeaconInfoList() != null) {
|
|
|
StatusOfDeviceInfo.DataOfBeaconInfoList beacon = deviceInfo.getDataOfBeaconInfoList();
|
|
|
List<BeaconInfo> bList = beacon.getBeaconInfo();
|