Skip to content

Commit

Permalink
Device Subscription에 따른 로직 변경 iotoasis#291
Browse files Browse the repository at this point in the history
디아비스 요청 및 해제에 대한 결과 값 저장
  • Loading branch information
pahnjy01 committed Dec 21, 2016
1 parent e74a388 commit 04ab14c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,22 @@ 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());
deviceStore.update(device);
/**
* 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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public String toString() {
"_id='" + _id + '\'' +
", _commandId='" + _commandId + '\'' +
", deviceStatus='" + deviceStatus + '\'' +
", subscriptionResult='" + subscriptionResult + '\'' +
", releaseResult='" + releaseResult + '\'' +
'}';
}
}

0 comments on commit 04ab14c

Please sign in to comment.