From 04ab14caddecb37b36683af80bb4d3a30f3bc2d4 Mon Sep 17 00:00:00 2001 From: pahnjy Date: Wed, 21 Dec 2016 10:04:21 +0900 Subject: [PATCH] =?UTF-8?q?Device=20Subscription=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=A5=B8=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD=20#291=20?= =?UTF-8?q?=EB=94=94=EC=95=84=EB=B9=84=EC=8A=A4=20=EC=9A=94=EC=B2=AD=20?= =?UTF-8?q?=EB=B0=8F=20=ED=95=B4=EC=A0=9C=EC=97=90=20=EB=8C=80=ED=95=9C=20?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=20=EA=B0=92=20=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../icbms/so/device/logic/DeviceManagerLogic.java | 11 +++++++---- .../device/store/mongo/DeviceSubscriptionObject.java | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) 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 + '\'' + '}'; } }