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 9, 2016
1 parent 0436e71 commit 418cdb2
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,20 @@ public List<Device> searchDeviceList() {
@Override
public void deviceUpdate(DeviceStatusData deviceStatusData) {
//
logger.debug(LogPrint.LogMethodNamePrint() + "Device Update Start!!! DeviceStatusData = " + deviceStatusData.toString());
if(!deviceStatusData.get_uri().isEmpty()){
String deviceUri = getOnem2mDeviceUri(deviceStatusData.get_uri());
Device device = deviceSearchById(deviceUri);
DeviceSubscriptionObject deviceSubscriptionObject = deviceSubscriptionStore.retrieve(deviceStatusData.get_commandId());

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);
deviceSubscriptionRelease(deviceUri + (ClientProfile.actionDeviceCommand(device.getDeviceUri()) ? ClientProfile.SI_CONTAINER_ACTION : ClientProfile.SI_CONTAINER_POWER) + ClientProfile.SI_CONTAINER_STATUS);
deviceSubscriptionStore.delete(deviceSubscriptionObject.get_id());
} else {
logger.debug(LogPrint.LogMethodNamePrint() + "The state or command of the device is different.");
}
}
}
Expand Down

0 comments on commit 418cdb2

Please sign in to comment.