Skip to content

Commit

Permalink
Merge pull request #307 from pahnjy/develop
Browse files Browse the repository at this point in the history
Device Subscription에 따른 로직 변경 #291
  • Loading branch information
pahnjy authored Dec 21, 2016
2 parents e74a388 + 04ab14c commit 950e965
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 950e965

Please sign in to comment.