|
@@ -71,8 +71,6 @@ public class BridgeService extends IntentService {
|
|
|
private final IBinder lBinder = new LocalServiceBinder();
|
|
|
private BridgeServer bridgeServer = null ;
|
|
|
|
|
|
- private ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
|
|
|
-
|
|
|
// Message Handler MSG TYPEs
|
|
|
public static final int MSG_RESULT = 1 ;
|
|
|
public static final int MSG_STRING = 2;
|
|
@@ -99,8 +97,7 @@ public class BridgeService extends IntentService {
|
|
|
public BridgeService() {
|
|
|
super(BridgeService.class.getName());
|
|
|
}
|
|
|
-
|
|
|
- private BridgeService getService() {
|
|
|
+ public BridgeService getService() {
|
|
|
return this ;
|
|
|
}
|
|
|
public BridgeServer getBridgeServer() {
|
|
@@ -110,15 +107,17 @@ public class BridgeService extends IntentService {
|
|
|
@Override
|
|
|
public void onCreate() {
|
|
|
super.onCreate();
|
|
|
-
|
|
|
Log.d(TAG, "onCreate()");
|
|
|
+
|
|
|
// start first time only
|
|
|
bridgeServer = new BridgeServer(this);
|
|
|
|
|
|
- scheduledTaskInit();
|
|
|
+ // start Scheduled Tasks for pairwised devices
|
|
|
+ startScheduledTaskForPairwised();
|
|
|
|
|
|
- // TODO : should remove this test function after connected to Light Control Service of Wallpad
|
|
|
- bindLightServiceForTest();
|
|
|
+ // start Light Control Service Client and ScheduledTask
|
|
|
+ bindLightControlService();
|
|
|
+ startScheduledTaskForLightControl();
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -301,20 +300,42 @@ public class BridgeService extends IntentService {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- private ILightControlService lightControlBinder = null ; // Light Control Service Binder for test
|
|
|
- private void bindLightServiceForTest() {
|
|
|
+ private ILightControlService lightControlBinder = null ; // Light Control Service Binder
|
|
|
+ private LightControlServiceConnection lightConn = new LightControlServiceConnection();
|
|
|
+ public void bindLightControlService() {
|
|
|
+
|
|
|
+ Log.d(TAG, "SecheduledTaskInit : bindLightControlService() called.");
|
|
|
|
|
|
// Light Control Service Remote Bind
|
|
|
- LightControlServiceConnection lightConn = new LightControlServiceConnection();
|
|
|
Intent lIntent = new Intent();
|
|
|
- lIntent.setClassName("org.iotivity.bridge.homeserver", "org.iotivity.bridge.homeserver.BridgeService");
|
|
|
+ //lIntent.setClassName("org.iotivity.bridge.homeserver", "org.iotivity.bridge.homeserver.BridgeService"); // self test for Light Control Service
|
|
|
+ lIntent.setClassName("kr.co.icontrols.ocfservice", "kr.co.icontrols.ocfservice.LightControlService");
|
|
|
lIntent.setAction(ILightControlService.class.getName());
|
|
|
bindService(lIntent, lightConn, Context.BIND_AUTO_CREATE);
|
|
|
+ Log.d(TAG, "bind Light Control Service with Remote Connection");
|
|
|
+ }
|
|
|
+
|
|
|
+ public void unbindLightControlService() {
|
|
|
+ // Light Control Service Remote Unbind
|
|
|
+ if (lightControlBinder != null) {
|
|
|
+ try {
|
|
|
+ lightControlBinder.unregisterLightControlServiceCallback(lightCallback);
|
|
|
+ Log.d(TAG, "unregister Light Control Service with Remote Client Callback");
|
|
|
+ if(lightConn!=null) unbindService(lightConn);
|
|
|
+ Log.d(TAG, "unbind Light Control Service with Remote Connection");
|
|
|
+ } catch (RemoteException ex) {
|
|
|
+ Log.e(TAG, "unregister Callback", ex);
|
|
|
+ // There is nothing special we need to do if the service
|
|
|
+ // has crashed.
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class LightControlServiceConnection implements ServiceConnection {
|
|
|
|
|
|
public static final String ECO_NAME = "rs-485" ;
|
|
|
+ public static final String ONLINE = "on-line" ;
|
|
|
+ public static final String OFFLINE = "off-line" ;
|
|
|
|
|
|
@Override
|
|
|
public void onServiceConnected(ComponentName name, IBinder service) {
|
|
@@ -322,91 +343,14 @@ public class BridgeService extends IntentService {
|
|
|
Log.d(TAG, "onServiceConnected ComponentName=" + name + ", IBinder=" + service.toString());
|
|
|
if (service instanceof ILightControlService.Stub) {
|
|
|
|
|
|
- lightControlBinder = ILightControlService.Stub.asInterface(service);
|
|
|
-
|
|
|
try {
|
|
|
+ lightControlBinder = ILightControlService.Stub.asInterface(service);
|
|
|
lightControlBinder.registerLightControlServiceCallback(lightCallback);
|
|
|
|
|
|
- String devices = lightControlBinder.retrieveAllDevices();
|
|
|
- Log.d(TAG, "Light Control retrieveAllDevices() : "+ devices);
|
|
|
- if(devices != null) {
|
|
|
- JSONArray array = new JSONArray(devices);
|
|
|
-
|
|
|
- for (int index = 0 ; index < array.length(); index++) {
|
|
|
- JSONObject devs = array.getJSONObject(index);
|
|
|
- Iterator<String> it_devs = devs.keys();
|
|
|
- String n = null, sn = null, rt = null, state = null ;
|
|
|
-
|
|
|
- while (it_devs.hasNext()) {
|
|
|
- String key = it_devs.next();
|
|
|
- Object value = devs.get(key);
|
|
|
- if (key.equals("n") && value instanceof String) {
|
|
|
- n = (String)value;
|
|
|
- Log.d(TAG, "Light Device : n = " + n);
|
|
|
- } else if (key.equals("sn") && value instanceof String) {
|
|
|
- sn = (String)value;
|
|
|
- Log.d(TAG, "Light Device : sn = " + sn);
|
|
|
- } else if (key.equals("rt") && value instanceof JSONArray) {
|
|
|
- Log.d(TAG, "Light Device : rt(org) = " + ((JSONArray)value).toString());
|
|
|
- rt = ((JSONArray)value).getString(0);
|
|
|
- Log.d(TAG, "Light Device : rt = " + rt);
|
|
|
- } else if (key.equals("state") && value instanceof String) {
|
|
|
- state = (String)value;
|
|
|
- Log.d(TAG, "Light Device : state = " + state);
|
|
|
- }
|
|
|
- }
|
|
|
- // add device on ocf platform
|
|
|
- VirtualOCFDevice device = bridgeServer.addVirtualOCFDevice(n, sn, rt, ECO_NAME);
|
|
|
- if(device==null) continue;
|
|
|
-
|
|
|
- String resources = lightControlBinder.retrieveAllResources(sn);
|
|
|
- Log.d(TAG, "Light Control retrieveAllResources() : " + resources);
|
|
|
- if(resources!=null) {
|
|
|
- JSONArray resArr = new JSONArray(resources);
|
|
|
- for (int loop = 0 ; loop < resArr.length(); loop++) {
|
|
|
- JSONObject res = resArr.getJSONObject(loop);
|
|
|
- Iterator<String> rKeys = res.keys();
|
|
|
- String rName = null, rUri = null, rRT = null, rIF = null ;
|
|
|
-
|
|
|
- while (rKeys.hasNext()) {
|
|
|
- String rKey = rKeys.next();
|
|
|
- Object rValue = res.get(rKey);
|
|
|
- if (rKey.equals("n") && rValue instanceof String) {
|
|
|
- rName = (String)rValue;
|
|
|
- Log.d(TAG, "Light Resource : n = " + rName);
|
|
|
- } else if (rKey.equals("uri") && rValue instanceof String) {
|
|
|
- rUri = (String)rValue;
|
|
|
- Log.d(TAG, "Light Resource : uri = " + rUri);
|
|
|
- } else if (rKey.equals("rt") && rValue instanceof JSONArray) {
|
|
|
- Log.d(TAG, "Light Resource : rt(org) = " + ((JSONArray)rValue).toString());
|
|
|
- rRT = ((JSONArray)rValue).getString(0);
|
|
|
- Log.d(TAG, "Light Resource : rt = " + rRT);
|
|
|
- } else if (rKey.equals("if") && rValue instanceof String) {
|
|
|
- rIF = (String)rValue;
|
|
|
- Log.d(TAG, "Light Resource : if = " + rIF);
|
|
|
- }
|
|
|
- }
|
|
|
- // add resource on the device
|
|
|
- bridgeServer.addVirtualDeviceResource(device, rName, rUri, rRT, rIF);
|
|
|
-
|
|
|
- // get resource properties
|
|
|
- String properites = lightControlBinder.doGetResourceProperties(sn, rUri);
|
|
|
- Log.d(TAG, "Light Control doGetResourceProperties("+sn+", "+rUri+") : " + properites);
|
|
|
-
|
|
|
- JSONObject props = new JSONObject(properites);
|
|
|
- Iterator<String> pKeys = props.keys();
|
|
|
- while(pKeys.hasNext()) {
|
|
|
- String pKey = pKeys.next();
|
|
|
- Object pValue = props.get(pKey);
|
|
|
- // update properties state
|
|
|
- device.addProperty(rUri, pKey, pValue);
|
|
|
- }
|
|
|
+ // Discover All Light Control Devices
|
|
|
+ discoverAllLightControlDevices();
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (RemoteException | JSONException ex) {
|
|
|
+ } catch (RemoteException ex) {
|
|
|
Log.e(TAG, "Register Callback", ex);
|
|
|
// In this case the service has crashed before we could even
|
|
|
// do anything with it; we can count on soon being
|
|
@@ -449,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);
|
|
@@ -467,7 +415,7 @@ public class BridgeService extends IntentService {
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
- * The IBridgeService is defined through IDL
|
|
|
+ * The ILightControlService is defined through IDL
|
|
|
*/
|
|
|
private final ILightControlServiceImpl lightBinder = new ILightControlServiceImpl() ;
|
|
|
class ILightControlServiceImpl extends ILightControlService.Stub {
|
|
@@ -599,6 +547,114 @@ public class BridgeService extends IntentService {
|
|
|
return null ;
|
|
|
}
|
|
|
|
|
|
+ public void discoverAllLightControlDevices() {
|
|
|
+
|
|
|
+ Log.d(TAG, "SecheduledTaskInit : doRetrieveLightControlAllDevices() called.");
|
|
|
+ try {
|
|
|
+ String devices = lightControlBinder.retrieveAllDevices();
|
|
|
+ Log.d(TAG, "Light Control retrieveAllDevices() : "+ devices);
|
|
|
+ if(devices != null) {
|
|
|
+ JSONArray array = new JSONArray(devices);
|
|
|
+
|
|
|
+ for (int index = 0 ; index < array.length(); index++) {
|
|
|
+ JSONObject devs = array.getJSONObject(index);
|
|
|
+ Iterator<String> it_devs = devs.keys();
|
|
|
+ String n = null, sn = null, rt = null, state = null ;
|
|
|
+
|
|
|
+ while (it_devs.hasNext()) {
|
|
|
+ String key = it_devs.next();
|
|
|
+ Object value = devs.get(key);
|
|
|
+ if (key.equals("n") && value instanceof String) {
|
|
|
+ n = (String)value;
|
|
|
+ Log.d(TAG, "Light Device : n = " + n);
|
|
|
+ } else if (key.equals("sn") && value instanceof String) {
|
|
|
+ sn = (String)value;
|
|
|
+ Log.d(TAG, "Light Device : sn = " + sn);
|
|
|
+ } else if (key.equals("rt") && value instanceof JSONArray) {
|
|
|
+ Log.d(TAG, "Light Device : rt(org) = " + ((JSONArray)value).toString());
|
|
|
+ rt = ((JSONArray)value).getString(0);
|
|
|
+ Log.d(TAG, "Light Device : rt = " + rt);
|
|
|
+ } else if (key.equals("state") && value instanceof String) {
|
|
|
+ state = (String)value;
|
|
|
+ Log.d(TAG, "Light Device : state = " + state);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ VirtualOCFDevice device = null ;
|
|
|
+ if(bridgeServer.existVirtualOCFDevice(sn)) { // exist Virtual OCF Device
|
|
|
+ if(LightControlServiceConnection.OFFLINE.equalsIgnoreCase(state)) {
|
|
|
+ device = bridgeServer.getVirtualOCFDevice(sn);
|
|
|
+ bridgeServer.disconnectVirtualDevice(device.getVODIndex()); // TODO : neet do check this logic properly
|
|
|
+ Log.d(TAG, "Light Device ("+n+") : state was changed to " + state + ", so existing VOD was diconnected.");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if(LightControlServiceConnection.OFFLINE.equalsIgnoreCase(state)) {
|
|
|
+ Log.d(TAG, "Light Device ("+n+") : state is " + state + ", so VOD will not be added.");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ // add device on ocf platform
|
|
|
+ device = bridgeServer.addVirtualOCFDevice(n, sn, rt, LightControlServiceConnection.ECO_NAME);
|
|
|
+ if(device==null) continue;
|
|
|
+
|
|
|
+ String resources = lightControlBinder.retrieveAllResources(sn);
|
|
|
+ Log.d(TAG, "Light Control retrieveAllResources() : " + resources);
|
|
|
+ if(resources!=null) {
|
|
|
+ JSONArray resArr = new JSONArray(resources);
|
|
|
+ for (int loop = 0 ; loop < resArr.length(); loop++) {
|
|
|
+ JSONObject res = resArr.getJSONObject(loop);
|
|
|
+ Iterator<String> rKeys = res.keys();
|
|
|
+ String rName = null, rUri = null, rRT = null, rIF = null ;
|
|
|
+
|
|
|
+ while (rKeys.hasNext()) {
|
|
|
+ String rKey = rKeys.next();
|
|
|
+ Object rValue = res.get(rKey);
|
|
|
+ if (rKey.equals("n") && rValue instanceof String) {
|
|
|
+ rName = (String)rValue;
|
|
|
+ Log.d(TAG, "Light Resource : n = " + rName);
|
|
|
+ } else if (rKey.equals("uri") && rValue instanceof String) {
|
|
|
+ rUri = (String)rValue;
|
|
|
+ Log.d(TAG, "Light Resource : uri = " + rUri);
|
|
|
+ } else if (rKey.equals("rt") && rValue instanceof JSONArray) {
|
|
|
+ Log.d(TAG, "Light Resource : rt(org) = " + ((JSONArray)rValue).toString());
|
|
|
+ rRT = ((JSONArray)rValue).getString(0);
|
|
|
+ Log.d(TAG, "Light Resource : rt = " + rRT);
|
|
|
+ } else if (rKey.equals("if") && rValue instanceof String) {
|
|
|
+ rIF = (String)rValue;
|
|
|
+ Log.d(TAG, "Light Resource : if = " + rIF);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // add resource on the device
|
|
|
+ bridgeServer.addVirtualDeviceResource(device, rName, rUri, rRT, rIF);
|
|
|
+
|
|
|
+ // get resource properties
|
|
|
+ String properites = lightControlBinder.doGetResourceProperties(sn, rUri);
|
|
|
+ Log.d(TAG, "Light Control doGetResourceProperties("+sn+", "+rUri+") : " + properites);
|
|
|
+
|
|
|
+ JSONObject props = new JSONObject(properites);
|
|
|
+ Iterator<String> pKeys = props.keys();
|
|
|
+ while(pKeys.hasNext()) {
|
|
|
+ String pKey = pKeys.next();
|
|
|
+ Object pValue = props.get(pKey);
|
|
|
+ // update properties state
|
|
|
+ device.addProperty(rUri, pKey, pValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (RemoteException | JSONException ex) {
|
|
|
+ Log.e(TAG, "Register Callback", ex);
|
|
|
+ // In this case the service has crashed before we could even
|
|
|
+ // do anything with it; we can count on soon being
|
|
|
+ // disconnected (and then reconnected if it can be restarted)
|
|
|
+ // so there is no need to do anything here.
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void doGetLightControlResources() {
|
|
|
|
|
|
Log.d(TAG, "SecheduledTaskInit : doGetLightControlResources() called.");
|
|
@@ -611,19 +667,21 @@ public class BridgeService extends IntentService {
|
|
|
for (OCFDevice.Resource resource : vod.getResources()) {
|
|
|
try {
|
|
|
// doGetProperties with Light Control Service
|
|
|
+ String prev_props = bridgeServer.getVirtualOCFDeviceProperties(device_sn, resource.getResourceUri());
|
|
|
String properies = lightBinder.doGetResourceProperties(device_sn, resource.getResourceUri());
|
|
|
bridgeServer.addOrUpdateVirtualOCFDeviceProperties(device_sn, resource.getResourceUri(), properies);
|
|
|
|
|
|
+ /*Log.d(TAG,"(1) prev_props : " +prev_props + ", cur_props : " +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());
|
|
|
- OCMain.notifyObservers(ocResource);
|
|
|
+ if(!bridgeServer.compareVirtualOCFDeviceProperties(device_sn, resource.getResourceUri(), properies)) {
|
|
|
+ Log.d(TAG,"(2) prev_props : " +prev_props + ", cur_props : " +properies );
|
|
|
+ //bridgeServer.addOrUpdateVirtualOCFDeviceProperties(device_sn, resource.getResourceUri(), properies);
|
|
|
+ OCResource ocResource = vod.getOCResource(resource.getResourceUri());
|
|
|
+ if (ocResource != null) {
|
|
|
+ OCMain.notifyObservers(ocResource);
|
|
|
+ }
|
|
|
}*/
|
|
|
+
|
|
|
} catch (RemoteException e) {
|
|
|
Log.e(TAG, "Light Control Service Remote Error : ", e);
|
|
|
}
|
|
@@ -713,6 +771,8 @@ public class BridgeService extends IntentService {
|
|
|
// Unregister all callbacks.
|
|
|
rBinder.killCallbacks();
|
|
|
|
|
|
+ Toast.makeText(getApplicationContext(), getString(R.string.killBridgeMessage), Toast.LENGTH_LONG).show();
|
|
|
+
|
|
|
// Bridge Service and Application Process Kill
|
|
|
// android.os.Process.killProcess(Process.myPid());
|
|
|
// or below action
|
|
@@ -781,13 +841,18 @@ public class BridgeService extends IntentService {
|
|
|
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
|
|
|
}
|
|
|
|
|
|
- public void scheduledTaskInit () {
|
|
|
+
|
|
|
+ private ScheduledExecutorService executorPairwised = null ;
|
|
|
+ private ScheduledExecutorService executorLightControl = null;
|
|
|
+ public void startScheduledTaskForPairwised () {
|
|
|
|
|
|
/* How to use ExecuterService like followings
|
|
|
* executorService.schedule(Classname::someTask, delayInSeconds, TimeUnit.SECONDS); // once after a delay
|
|
|
* executorService.scheduleAtFixedRate(Classname::someTask, 0, delayInSeconds, TimeUnit.SECONDS); // at fixed time interval
|
|
|
*/
|
|
|
- executorService.scheduleAtFixedRate(new Runnable() {
|
|
|
+ if(executorPairwised != null && executorPairwised.isShutdown() == false ) { executorPairwised.shutdown();}
|
|
|
+ executorPairwised = Executors.newSingleThreadScheduledExecutor();
|
|
|
+ executorPairwised.scheduleAtFixedRate(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
// load pair-wised device UUIDs from Bridge Credentials
|
|
@@ -805,17 +870,38 @@ public class BridgeService extends IntentService {
|
|
|
Log.d(TAG, "DeviceDiscovery ScheduledTask per 90sec was called.");
|
|
|
}
|
|
|
}
|
|
|
- }, 10, 90, TimeUnit.SECONDS); //90 sec interval after 10sec delay
|
|
|
+ }, 10, 90, TimeUnit.SECONDS); // 90 sec interval after 10sec delay
|
|
|
+ }
|
|
|
+
|
|
|
+ public void stopScheduledTaskForPairwised() {
|
|
|
+ if(executorPairwised!=null ) { executorPairwised.shutdown(); }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void startScheduledTaskForLightControl () {
|
|
|
|
|
|
- executorService.scheduleAtFixedRate(new Runnable() {
|
|
|
+ /* How to use ExecuterService like followings
|
|
|
+ * executorService.schedule(Classname::someTask, delayInSeconds, TimeUnit.SECONDS); // once after a delay
|
|
|
+ * executorService.scheduleAtFixedRate(Classname::someTask, 0, delayInSeconds, TimeUnit.SECONDS); // at fixed time interval
|
|
|
+ */
|
|
|
+ if(executorLightControl != null && executorLightControl.isShutdown() == false ) { executorLightControl.shutdown();}
|
|
|
+ executorLightControl = Executors.newSingleThreadScheduledExecutor();
|
|
|
+ executorLightControl.scheduleAtFixedRate(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
// Getting Properites of Light Control Service for resource monitoring
|
|
|
- Log.d(TAG, "LightControl Resources Retrieve ScheduledTask per 180sec was called.");
|
|
|
+ Log.d(TAG, "LightControl ScheduledTask per 180sec was called.");
|
|
|
+ if(lightControlBinder==null) {
|
|
|
+ bindLightControlService();
|
|
|
+ }
|
|
|
+ discoverAllLightControlDevices();
|
|
|
doGetLightControlResources();
|
|
|
}
|
|
|
- }, 30, 180, TimeUnit.SECONDS); // 30sec interval after 30sec delay
|
|
|
+ }, 30, 180, TimeUnit.SECONDS); // 180sec interval after 30sec delay
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ public void stopScheduledTaskForLightControl() {
|
|
|
+ if(executorLightControl !=null) { executorLightControl.shutdown(); }
|
|
|
}
|
|
|
|
|
|
public void loadPairwisedDeviceUUIDs() {
|