diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java b/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java index 8baaea3b..e0368470 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java @@ -224,7 +224,7 @@ public void deviceUpdate(DeviceStatusData deviceStatusData) { String deviceUri = getOnem2mDeviceUri(deviceStatusData.get_uri()); Device device = deviceSearchById(deviceUri); DeviceSubscriptionObject deviceSubscriptionObject = deviceSubscriptionStore.retrieve(deviceStatusData.get_commandId()); - + String response; if(deviceSubscriptionObject != null && deviceSubscriptionObject.get_commandId().equals(deviceStatusData.get_commandId()) && deviceSubscriptionObject.getDeviceStatus().equals(deviceStatusData.getCon())){ logger.debug(LogPrint.LogMethodNamePrint() + "Device Data Update"); device.setDeviceStatus(deviceStatusData.getCon()); @@ -232,11 +232,14 @@ public void deviceUpdate(DeviceStatusData deviceStatusData) { /** * Device Subscription 해제 요청 */ - String response = deviceSubscriptionRelease(deviceUri + (ClientProfile.actionDeviceCommand(device.getDeviceUri()) ? ClientProfile.SI_CONTAINER_ACTION : ClientProfile.SI_CONTAINER_POWER) + ClientProfile.SI_CONTAINER_STATUS); - deviceSubscriptionObject.setReleaseResult(response); - deviceSubscriptionStore.update(deviceSubscriptionObject); + response = deviceSubscriptionRelease(deviceUri + (ClientProfile.actionDeviceCommand(device.getDeviceUri()) ? ClientProfile.SI_CONTAINER_ACTION : ClientProfile.SI_CONTAINER_POWER) + ClientProfile.SI_CONTAINER_STATUS); } else { logger.debug(LogPrint.LogMethodNamePrint() + "The state or command of the device is different."); + response = "Status not same."; + } + if (deviceSubscriptionObject != null) { + deviceSubscriptionObject.setReleaseResult(response); + deviceSubscriptionStore.update(deviceSubscriptionObject); } } } diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceSubscriptionObject.java b/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceSubscriptionObject.java index 84774ec3..6a4a376f 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceSubscriptionObject.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceSubscriptionObject.java @@ -82,6 +82,8 @@ public String toString() { "_id='" + _id + '\'' + ", _commandId='" + _commandId + '\'' + ", deviceStatus='" + deviceStatus + '\'' + + ", subscriptionResult='" + subscriptionResult + '\'' + + ", releaseResult='" + releaseResult + '\'' + '}'; } }