|
@@ -393,16 +393,20 @@ public class BridgeService extends IntentService {
|
|
|
String tid = obj.getString("tid"); // Transaction Id
|
|
|
String sn = obj.getString("sn"); // Serial Number (Virtual Device Id)
|
|
|
String uri = obj.getString("uri"); // Resource URI
|
|
|
- String res_type = obj.getString("res_type"); // GET, POST, PUT
|
|
|
+ String res_type = obj.getString("res_type"); // GET, POST, PUT, OBSERVE
|
|
|
String res_data = obj.getString("res_data"); // Properties
|
|
|
|
|
|
// Update Properties of the resource from result
|
|
|
bridgeServer.addOrUpdateVirtualOCFDeviceProperties(sn, uri, res_data);
|
|
|
|
|
|
// TODO : need to check // notify to Observers for changed properties's value
|
|
|
- /*VirtualOCFDevice vod = bridgeServer.getVirtualOCFDevice(sn);
|
|
|
- OCResource ocResource = OCCoreRes.getResourceByUri(uri, vod.getVODIndex());
|
|
|
- OCMain.notifyObservers(ocResource);*/
|
|
|
+ VirtualOCFDevice vod = bridgeServer.getVirtualOCFDevice(sn);
|
|
|
+ if(vod != null) {
|
|
|
+ OCResource ocResource = vod.getOCResource(uri);
|
|
|
+ if(ocResource != null) {
|
|
|
+ OCMain.notifyObservers(ocResource);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} catch (JSONException e) {
|
|
|
Log.e(TAG, "Light Control Service Remote Error : ", e);
|
|
@@ -667,15 +671,11 @@ public class BridgeService extends IntentService {
|
|
|
bridgeServer.addOrUpdateVirtualOCFDeviceProperties(device_sn, resource.getResourceUri(), properies);
|
|
|
|
|
|
// TODO : need to check // notify to Observers for changed properties's value
|
|
|
- /*Log.d(TAG, "OCCoreRes.getResourceByUri() before : " + vod.getDeviceName() +
|
|
|
- ", " +resource.getResourceUri()+", "+ vod.getVODIndex());
|
|
|
- //OCDeviceInfo info = OCCoreRes.getDeviceInfo(vod.getVODIndex());
|
|
|
- OCResource ocResource = OCCoreRes.getResourceByUri(resource.getResourceUri(), vod.getVODIndex());
|
|
|
- if(ocResource != null && ocResource.getNumObservers() > 0) {
|
|
|
- Log.d(TAG, "OCCoreRes.getResourceByUri() after : " + ocResource.getName() +
|
|
|
- ", " +ocResource.getUri() +", "+ ocResource.getNumObservers());
|
|
|
+ OCResource ocResource = vod.getOCResource(resource.getResourceUri());
|
|
|
+ if(ocResource != null) {
|
|
|
OCMain.notifyObservers(ocResource);
|
|
|
- }*/
|
|
|
+ }
|
|
|
+
|
|
|
} catch (RemoteException e) {
|
|
|
Log.e(TAG, "Light Control Service Remote Error : ", e);
|
|
|
}
|