}
mResourceObj.startMonitoring(mOnStateChangedListener);
+
+ if (mResourceObj.isMonitoring()) {
+ printLog("Monitoring started successfully");
+ }
}
};
@Override
public void execute() throws RcsException {
if (mResourceObj.isMonitoring()) {
+
mResourceObj.stopMonitoring();
- printLog("Stopped Resource Monitoring");
+
+ if (!mResourceObj.isMonitoring()) {
+ printLog("Monitoring stopped successfully");
+ }
+
} else {
printLog("Monitoring not started");
}
}
mResourceObj.startCaching(mOnCacheUpdatedListener);
+
+ if (mResourceObj.isCaching()) {
+ printLog("Caching started successfully");
+ }
+
}
};
private Item mStopCaching = new Item("9. Stop Caching") {
@Override
public void execute() throws RcsException {
- mResourceObj.stopCaching();
+ if (mResourceObj.isCaching()) {
+
+ mResourceObj.stopCaching();
+
+ if (!mResourceObj.isCaching()) {
+ printLog("Caching stopped successfully");
+ } else {
+ printLog("Stopping caching unsuccessful");
+ }
+
+ } else {
+ printLog("Caching not started");
+ }
}
+
};
@Override
protected void onDestroy() {
super.onDestroy();
- if (mDiscoveryTask != null)
- mDiscoveryTask.cancel();
- if (mResourceObj != null)
- mResourceObj.destroy();
+ if (mDiscoveryTask != null) mDiscoveryTask.cancel();
+ if (mResourceObj != null) mResourceObj.destroy();
}
private void initMenuList() {
super.handleMessage(msg);
ResourceClientActivity activity = mActivityRef.get();
- if (activity == null)
- return;
+ if (activity == null) return;
switch (msg.what) {
case MSG_ID_RESOURCE_DISCOVERED: