Skip to content

Commit

Permalink
Merge pull request #361 from pahnjy/develop
Browse files Browse the repository at this point in the history
DeviceSubscription 데이터 수정 #360
  • Loading branch information
pahnjy authored Feb 6, 2017
2 parents 7917524 + 04723a6 commit 4451ebd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public String deviceExecute(String deviceId,String deviceCommand, String session
/**
* Device 제어 후 제어 결과가 Success면 Device Subscription 요청
*/
if(resultMessage.getCode().equals(ClientProfile.RESPONSE_SUCCESS_ONEM2MCODE) && false) {
if(resultMessage.getCode().equals(ClientProfile.RESPONSE_SUCCESS_ONEM2MCODE)) {
// 디바이스 상태 저장.
device.setDeviceStatus(deviceCommand);
deviceStore.update(device);
Expand All @@ -127,7 +127,7 @@ public String deviceExecute(String deviceId,String deviceCommand, String session
/**
* Device Subscription 데이터 저장
*/
saveDeviceSubscriptionData(deviceControlMessage.get_commandId(), deviceControlMessage.getCon(), response);
saveDeviceSubscriptionData(deviceControlMessage.get_commandId(),device.getDeviceUri(), deviceControlMessage.getCon(), response);

/*
디바이스 해제는 Controller에서 상태 업데이트 후 해제.
Expand Down Expand Up @@ -311,8 +311,8 @@ public String getOnem2mDeviceUri(String uri){
return uri.substring(0, stringlength);
}

public void saveDeviceSubscriptionData(String deviceUri, String commandId, String result){
deviceSubscriptionStore.create(new DeviceSubscriptionObject(deviceUri, commandId, result));
public void saveDeviceSubscriptionData(String commandId, String deviceUri, String status, String result){
deviceSubscriptionStore.create(new DeviceSubscriptionObject(commandId, deviceUri, status, result));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class DeviceSubscriptionObject {

private String _commandId;

private String deviceUri;

private String deviceStatus;

private String subscriptionResult;
Expand All @@ -22,15 +24,17 @@ public class DeviceSubscriptionObject {
public DeviceSubscriptionObject() {
}

public DeviceSubscriptionObject(String _commandId, String deviceStatus, String subscriptionResult) {
public DeviceSubscriptionObject(String _commandId, String deviceUri, String deviceStatus, String subscriptionResult) {
this._commandId = _commandId;
this.deviceUri = deviceUri;
this.deviceStatus = deviceStatus;
this.subscriptionResult = subscriptionResult;
}

public DeviceSubscriptionObject(String _id, String _commandId, String deviceStatus, String subscriptionResult, String releaseResult) {
public DeviceSubscriptionObject(String _id, String _commandId, String deviceUri, String deviceStatus, String subscriptionResult, String releaseResult) {
this._id = _id;
this._commandId = _commandId;
this.deviceUri = deviceUri;
this.deviceStatus = deviceStatus;
this.subscriptionResult = subscriptionResult;
this.releaseResult = releaseResult;
Expand Down Expand Up @@ -76,11 +80,20 @@ public void setReleaseResult(String releaseResult) {
this.releaseResult = releaseResult;
}

public String getDeviceUri() {
return deviceUri;
}

public void setDeviceUri(String deviceUri) {
this.deviceUri = deviceUri;
}

@Override
public String toString() {
return "DeviceSubscriptionObject{" +
"_id='" + _id + '\'' +
", _commandId='" + _commandId + '\'' +
", deviceUri='" + deviceUri + '\'' +
", deviceStatus='" + deviceStatus + '\'' +
", subscriptionResult='" + subscriptionResult + '\'' +
", releaseResult='" + releaseResult + '\'' +
Expand Down

0 comments on commit 4451ebd

Please sign in to comment.