|
@@ -391,22 +391,28 @@ public class BridgeService extends IntentService {
|
|
JSONObject obj = new JSONObject(result_data);
|
|
JSONObject obj = new JSONObject(result_data);
|
|
if(obj != null) {
|
|
if(obj != null) {
|
|
String tid = obj.getString("tid"); // Transaction Id
|
|
String tid = obj.getString("tid"); // Transaction Id
|
|
- String sn = obj.getString("sn"); // Serial Number (Virtual Device Id)
|
|
|
|
- String uri = obj.getString("uri"); // Resource URI
|
|
|
|
|
|
+ final String sn = obj.getString("sn"); // Serial Number (Virtual Device Id)
|
|
|
|
+ final String uri = obj.getString("uri"); // Resource URI
|
|
String res_type = obj.getString("res_type"); // GET, POST, PUT, OBSERVE
|
|
String res_type = obj.getString("res_type"); // GET, POST, PUT, OBSERVE
|
|
String res_data = obj.getString("res_data"); // Properties
|
|
String res_data = obj.getString("res_data"); // Properties
|
|
|
|
|
|
// Update Properties of the resource from result
|
|
// Update Properties of the resource from result
|
|
bridgeServer.addOrUpdateVirtualOCFDeviceProperties(sn, uri, res_data);
|
|
bridgeServer.addOrUpdateVirtualOCFDeviceProperties(sn, uri, res_data);
|
|
|
|
|
|
- // TODO : need to check // notify to Observers for changed properties's value
|
|
|
|
- VirtualOCFDevice vod = bridgeServer.getVirtualOCFDevice(sn);
|
|
|
|
- if(vod != null) {
|
|
|
|
- OCResource ocResource = vod.getOCResource(uri);
|
|
|
|
- if(ocResource != null) {
|
|
|
|
- OCMain.notifyObservers(ocResource);
|
|
|
|
|
|
+ new Thread(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ // TODO : need to check // notify to Observers for changed properties's value
|
|
|
|
+ VirtualOCFDevice vod = bridgeServer.getVirtualOCFDevice(sn);
|
|
|
|
+ if(vod != null) {
|
|
|
|
+ OCResource ocResource = vod.getOCResource(uri);
|
|
|
|
+ if(ocResource != null) {
|
|
|
|
+ Log.d(TAG, "Resource Notify to Observers with received data from Light Control Service.");
|
|
|
|
+ OCMain.notifyObservers(ocResource);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }).start();
|
|
}
|
|
}
|
|
} catch (JSONException e) {
|
|
} catch (JSONException e) {
|
|
Log.e(TAG, "Light Control Service Remote Error : ", e);
|
|
Log.e(TAG, "Light Control Service Remote Error : ", e);
|