1 /******************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
20 package com.tm.sample;
22 import java.util.ArrayList;
23 import java.util.HashMap;
24 import java.util.List;
26 import java.util.Vector;
28 import org.iotivity.base.OcException;
29 import org.iotivity.base.OcHeaderOption;
30 import org.iotivity.base.OcPlatform;
31 import org.iotivity.base.OcRepresentation;
32 import org.iotivity.base.OcResource;
33 import org.iotivity.base.OcResourceHandle;
34 import org.iotivity.service.tm.IConfigurationListener;
35 import org.iotivity.service.tm.IDiagnosticsListener;
36 import org.iotivity.service.tm.IFindCandidateResourceListener;
37 import org.iotivity.service.tm.OCStackResult;
38 import org.iotivity.service.tm.ThingsManager;
40 import android.app.Activity;
41 import android.app.Dialog;
42 import android.content.Context;
43 import android.os.Bundle;
44 import android.os.Handler;
45 import android.os.Message;
46 import android.util.Log;
47 import android.view.View;
48 import android.view.View.OnClickListener;
49 import android.widget.AdapterView;
50 import android.widget.AdapterView.OnItemClickListener;
51 import android.widget.ArrayAdapter;
52 import android.widget.Button;
53 import android.widget.EditText;
54 import android.widget.ListView;
55 import android.widget.Toast;
58 * Activity for Handling all Configuration Apis as per user's selection on the UI.
61 public class ConfigurationApiActivity extends Activity {
63 private class ResourceInformation {
64 OcResource resource = null;
65 OcResourceHandle resourceHandle = null;
68 private final String LOG_TAG = "[TMSample] "
72 private final String CONFIGURATION_COLLECTION_RESOURCE_URI = "/core/configuration/resourceset";
73 private final String CONFIGURATION_COLLECTION_RESOURCE_TYPE = "core.configuration.resourceset";
74 private final String DIAGNOSTIC_COLLECTION_RESOURCE_URI = "/core/diagnostics/resourceset";
75 private final String DIAGNOSTIC_COLLECTION_RESOURCE_TYPE = "core.diagnostics.resourceset";
76 private final String FACTORYSET_COLLECTION_RESOURCE_URI = "/core/factoryset/resourceset";
77 private final String FACTORYSET_COLLECTION_RESOURCE_TYPE = "core.factoryset.resourceset";
79 private final String CONFIGURATION_RESOURCE_URI = "/oic/con";
80 private final String DIAGNOSTIC_RESOURCE_URI = "/oic/diag";
81 private final String FACTORYSET_RESOURCE_URI = "/factorySet";
83 private ListView list;
84 private ArrayAdapter<String> configurationApis;
85 private ArrayList<String> configurationApisList;
87 private static int messageCount = 0;
88 private static EditText logs;
89 private static String logMessage = "";
90 private static Handler mHandler;
91 private static Message msg;
93 private ThingsManager thingsManager = null;
94 private Map<String, ResourceInformation> resourceList = null;
95 private Map<String, ResourceInformation> collectionList = null;
97 public boolean configurationResourceFlag = false;
98 public boolean factorySetResourceFlag = false;
99 public boolean diagnosticsResourceFlag = false;
101 public static Context mcontext;
102 public String region = "";
103 public boolean findGroupPressedFlag = false;
106 protected void onCreate(Bundle savedInstanceState) {
107 super.onCreate(savedInstanceState);
108 setContentView(R.layout.configapis);
111 thingsManager = new ThingsManager();
114 setResourceListener();
115 setConfigurationListener();
116 setDiagnosticsListener();
118 // Create API menu list
119 configurationApisList = new ArrayList<String>();
121 logs = (EditText) findViewById(R.id.EditText);
123 list = (ListView) findViewById(R.id.configApisList);
124 configurationApisList.add("Find All Groups");
125 configurationApisList.add("Find All Resources");
126 configurationApisList.add("Get a Configuration Resource");
127 configurationApisList.add("Update Attribute (Region)");
128 configurationApisList.add("Factory Reset");
129 configurationApisList.add("Reboot");
130 configurationApisList.add("Get Supported Configuration Units");
131 configurationApis = new ArrayAdapter<String>(this,
132 android.R.layout.simple_list_item_1, configurationApisList);
133 list.setAdapter(configurationApis);
135 // setting the Listener for calling the APIs as per User selection
136 list.setOnItemClickListener(new OnItemClickListener() {
139 public void onItemClick(AdapterView<?> parent, View view,
140 int position, long id) {
144 Vector<String> resourceTypes = new Vector<String>();
145 resourceTypes.add("core.configuration.resourceset");
146 findCandidateResources(resourceTypes);
152 resourceTypes.clear();
153 resourceTypes.add("core.diagnostics.resourceset");
154 findCandidateResources(resourceTypes);
158 resourceTypes.clear();
159 resourceTypes.add("core.factoryset.resourceset");
160 findCandidateResources(resourceTypes);
164 } else if (position == 1) { // Find All Resources
165 if (false == findGroupPressedFlag) {
166 displayToastMessage("Configuration collection resource does not exist!");
168 Vector<String> resourceTypes = new Vector<String>();
169 resourceTypes.add("oic.con");
170 findCandidateResources(resourceTypes);
176 resourceTypes.clear();
177 resourceTypes.add("oic.diag");
178 findCandidateResources(resourceTypes);
182 resourceTypes.clear();
183 resourceTypes.add("factorySet");
184 findCandidateResources(resourceTypes);
188 } else if (position == 2) { // Get Configuration
190 } else if (position == 3) { // Update Attribute (Region)
192 } else if (position == 4) { // Factory Reset
194 } else if (position == 5) { // Reboot
196 } else if (position == 6) { // Get Supported Configuration Units
197 String configurationUnits;
198 configurationUnits = getListOfSupportedConfigurationUnits();
199 Log.i(LOG_TAG, "Configuration Units:" + configurationUnits);
200 logMessage = configurationUnits;
202 logs.setText(logMessage);
208 resourceList = new HashMap<String, ResourceInformation>();
209 collectionList = new HashMap<String, ResourceInformation>();
212 createResourceCollection(CONFIGURATION_COLLECTION_RESOURCE_URI,
213 CONFIGURATION_COLLECTION_RESOURCE_TYPE);
214 createResourceCollection(DIAGNOSTIC_COLLECTION_RESOURCE_URI,
215 DIAGNOSTIC_COLLECTION_RESOURCE_TYPE);
216 createResourceCollection(FACTORYSET_COLLECTION_RESOURCE_URI,
217 FACTORYSET_COLLECTION_RESOURCE_TYPE);
218 } catch (OcException e) {
219 Log.e(LOG_TAG, "OcException occured! " + e.toString());
222 // handler for updating the UI i.e. LogMessage TextBox
223 mHandler = new Handler() {
225 public void handleMessage(Message msg) {
229 logs.setText(logMessage);
236 private void userInputDialog() {
238 ResourceInformation configurationCollection = collectionList
239 .get(CONFIGURATION_COLLECTION_RESOURCE_URI);
240 if (null == configurationCollection
241 || null == configurationCollection.resource) {
242 Log.e(LOG_TAG, "configuration collection resource doest not exist!");
243 displayToastMessage("Configuration collection resource does not exist!");
245 if (false == configurationResourceFlag) {
246 Log.e(LOG_TAG, "configuration resource doest not exist!");
247 displayToastMessage("Configuration resource does not exist!");
249 final Dialog dialog = new Dialog(mcontext);
250 dialog.setContentView(R.layout.userinputforregionvalue);
251 dialog.setTitle("Enter the Region Value");
253 dialog.setCancelable(false);
255 Button ok = (Button) dialog.findViewById(R.id.ok);
256 Button cancel = (Button) dialog.findViewById(R.id.cancel);
258 ok.setOnClickListener(new OnClickListener() {
260 public void onClick(View v) {
262 EditText regionValue = (EditText) dialog
263 .findViewById(R.id.region);
264 region = regionValue.getText().toString();
265 if (region.equalsIgnoreCase("")) {
266 String toastmessage = "Please enter the Region Value";
267 displayToastMessage(toastmessage);
270 updateConfiguration(region);
274 cancel.setOnClickListener(new OnClickListener() {
276 public void onClick(View v) {
284 public void onBackPressed() {
285 super.onBackPressed();
287 // unregistering resource from the platform
289 resourceList.clear();
291 collectionList.clear();
292 collectionList = null;
295 private void setResourceListener() {
297 .setFindCandidateResourceListener(new IFindCandidateResourceListener() {
300 synchronized public void onResourceCallback(
301 Vector<OcResource> resources) {
302 Log.i(LOG_TAG, "onResourceCallback: enter");
303 for (int i = 0; i < resources.size(); i++) {
304 OcResource resource = resources.get(i);
305 String uri = resource.getUri();
306 String host = resource.getHost();
308 // Display resource information
309 Log.i(LOG_TAG, "Resource URI:" + uri);
310 Log.i(LOG_TAG, "Resource HOST: " + host);
311 Log.i(LOG_TAG, "Resource types: ");
312 logMessage = logMessage + "Resource URI : " + uri
314 logMessage = logMessage + "Resource Host : " + host
317 List<String> resourcetypes = resource
319 for (int j = 0; j < resourcetypes.size(); j++) {
320 Log.i(LOG_TAG, resourcetypes.get(j));
321 logMessage = logMessage + "ResourceType "
323 + resourcetypes.get(j) + "\n";
326 Log.i(LOG_TAG, "Interface types: ");
327 List<String> interfacetypes = resource
328 .getResourceInterfaces();
329 for (int j = 0; j < interfacetypes.size(); j++) {
330 Log.i(LOG_TAG, interfacetypes.get(j));
331 logMessage = logMessage + "interfacetype "
333 + interfacetypes.get(j) + "\n";
337 if (true == uri.contains("/resourceset")) {
338 collectionFound(resource);
340 resourceFound(resource);
342 } catch (OcException e) {
344 "OcExcepion occured! " + e.toString());
347 if (messageCount == 3) {
348 msg = Message.obtain();
350 mHandler.sendMessage(msg);
356 private void setConfigurationListener() {
357 thingsManager.setConfigurationListener(new IConfigurationListener() {
359 public void onBootStrapCallback(
360 Vector<OcHeaderOption> headerOptions, OcRepresentation rep,
362 Log.i(LOG_TAG, "onBootStrapCallback: enter");
366 public void onUpdateConfigurationsCallback(
367 Vector<OcHeaderOption> headerOptions, OcRepresentation rep,
369 Log.i(LOG_TAG, "onUpdateConfigurationsCallback: enter");
370 Log.i(LOG_TAG, "Resource URI: " + rep.getUri());
371 if (rep.hasAttribute("loc")) {
372 logMessage = logMessage + "Location : "
373 + rep.getValueString("loc") + "\n";
375 if (rep.hasAttribute("st")) {
376 logMessage = logMessage + "System Time : "
377 + rep.getValueString("loc") + "\n";
379 if (rep.hasAttribute("c")) {
380 logMessage = logMessage + "Currency : "
381 + rep.getValueString("c") + "\n";
383 if (rep.hasAttribute("r")) {
384 logMessage = logMessage + "Region : "
385 + rep.getValueString("r") + "\n";
391 public void onGetConfigurationsCallback(
392 Vector<OcHeaderOption> headerOptions, OcRepresentation rep,
394 Log.i(LOG_TAG, "onGetConfigurationsCallback: enter");
395 Log.i(LOG_TAG, "Resource URI: " + rep.getUri());
396 logMessage = logMessage + "Resource URI : " + rep.getUri()
399 if (rep.hasAttribute("loc")) {
400 logMessage = logMessage + "Location : "
401 + rep.getValueString("loc") + "\n";
403 if (rep.hasAttribute("st")) {
404 logMessage = logMessage + "System Time : "
405 + rep.getValueString("st") + "\n";
407 if (rep.hasAttribute("c")) {
408 logMessage = logMessage + "Currency : "
409 + rep.getValueString("c") + "\n";
411 if (rep.hasAttribute("r")) {
412 logMessage = logMessage + "Region : "
413 + rep.getValueString("r") + "\n";
416 msg = Message.obtain();
418 mHandler.sendMessage(msg);
423 private void setDiagnosticsListener() {
424 thingsManager.setDiagnosticsListener(new IDiagnosticsListener() {
427 public void onRebootCallback(Vector<OcHeaderOption> headerOptions,
428 OcRepresentation rep, int errorValue) {
429 Log.i(LOG_TAG, "onRebootCallback: enter");
433 public void onFactoryResetCallback(
434 Vector<OcHeaderOption> headerOptions, OcRepresentation rep,
436 Log.i(LOG_TAG, "onFactoryResetCallback: enter");
442 * This method find the resources available in network.
444 private void findCandidateResources(Vector<String> resourceTypes) {
445 OCStackResult result = thingsManager.findCandidateResources(
447 if (OCStackResult.OC_STACK_OK != result) {
448 Log.e(LOG_TAG, "Error while calling findCandidateResources");
449 String toastmessage = "findCandidateResources API returned error! ["
451 displayToastMessage(toastmessage);
453 if (messageCount == 1)
454 logMessage = logMessage + "API RESULT : " + result.toString()
459 * This method gets the configuration data from con-server.
461 private void getConfiguration() {
462 Log.i(LOG_TAG, "There are " + resourceList.size()
463 + " servers present in network");
464 ResourceInformation configurationCollection = collectionList
465 .get(CONFIGURATION_COLLECTION_RESOURCE_URI);
466 if (null == configurationCollection
467 || null == configurationCollection.resource) {
468 Log.e(LOG_TAG, "configuration collection resource doest not exist!");
469 displayToastMessage("Configuration collection resource does not exist!");
472 if (false == configurationResourceFlag) {
474 Log.e(LOG_TAG, "configuration resource doest not exist!");
475 displayToastMessage("Configuration resource does not exist!");
480 Vector<String> configs = new Vector<String>();
483 OCStackResult result = OCStackResult.OC_STACK_ERROR;
485 result = thingsManager.getConfigurations(
486 configurationCollection.resource, configs);
487 } catch (OcException e) {
491 if (OCStackResult.OC_STACK_OK != result) {
492 Log.e(LOG_TAG, "getConfigurations failed!");
493 String toastmessage = "getConfigurations API returned error! ["
495 displayToastMessage(toastmessage);
497 logMessage = "API RESULT : " + result.toString() + "\n";
498 msg = Message.obtain();
500 mHandler.sendMessage(msg);
504 * This method update the configuration resource region attribute to given
509 private void updateConfiguration(String region) {
510 ResourceInformation configurationCollection = collectionList
511 .get(CONFIGURATION_COLLECTION_RESOURCE_URI);
513 Map<String, String> configurations = new HashMap<String, String>();
516 configurations.put(name, region);
517 } catch (Exception e) {
518 Log.e(LOG_TAG, "Exception occured! " + e.toString());
521 OCStackResult result = OCStackResult.OC_STACK_ERROR;
523 result = thingsManager.updateConfigurations(
524 configurationCollection.resource, configurations);
525 } catch (OcException e) {
528 if (OCStackResult.OC_STACK_OK != result) {
529 Log.e(LOG_TAG, "updateConfigurations failed!");
530 String toastmessage = "updateConfigurations API returned error! ["
532 displayToastMessage(toastmessage);
534 logMessage = "API RESULT : " + result.toString() + "\n";
535 logMessage = logMessage + "Updating region to " + region;
536 msg = Message.obtain();
538 mHandler.sendMessage(msg);
542 * This method send request to reset all the configuration attribute values
545 private void factoryReset() {
546 ResourceInformation diagnosticsCollection = collectionList
547 .get(DIAGNOSTIC_COLLECTION_RESOURCE_URI);
548 if (null == diagnosticsCollection
549 || null == diagnosticsCollection.resource) {
550 Log.e(LOG_TAG, "Diagnostic collection doest not exist!");
551 displayToastMessage("Diagnostic collection does not exist!");
555 if (false == diagnosticsResourceFlag) {
556 Log.e(LOG_TAG, "Diagnostic resource doest not exist!");
557 displayToastMessage("Diagnostic resource does not exist!");
561 OCStackResult result = OCStackResult.values()[30];
564 result = thingsManager.factoryReset(diagnosticsCollection.resource);
565 } catch (OcException e) {
569 if (OCStackResult.OC_STACK_OK != result) {
570 Log.e(LOG_TAG, "factoryReset failed!");
571 String toastmessage = "factoryReset API returned error! [" + result
573 displayToastMessage(toastmessage);
576 logMessage = "API RESULT : " + result.toString() + "\n";
577 msg = Message.obtain();
579 mHandler.sendMessage(msg);
583 * This method send request to reboot server.
585 private void reboot() {
586 ResourceInformation diagnosticsCollection = collectionList
587 .get(DIAGNOSTIC_COLLECTION_RESOURCE_URI);
588 if (null == diagnosticsCollection
589 || null == diagnosticsCollection.resource) {
590 Log.e(LOG_TAG, "Diagnostic collection doest not exist!");
591 displayToastMessage("Diagnostic collection does not exist!");
594 if (false == diagnosticsResourceFlag) {
595 Log.e(LOG_TAG, "Diagnostic resource doest not exist!");
596 displayToastMessage("Diagnostic resource does not exist!");
600 OCStackResult result = OCStackResult.OC_STACK_ERROR;
602 result = thingsManager.reboot(diagnosticsCollection.resource);
603 } catch (OcException e) {
607 if (OCStackResult.OC_STACK_OK != result) {
608 Log.e(LOG_TAG, "reboot failed!");
609 String toastmessage = "reboot API returned error! [" + result + "]";
610 displayToastMessage(toastmessage);
612 logMessage = "API RESULT : " + result.toString() + "\n";
613 msg = Message.obtain();
615 mHandler.sendMessage(msg);
619 * This method is for getting list of all supported configuration values.
620 * Response will be in JSON format (key-value pair).
622 private String getListOfSupportedConfigurationUnits() {
623 return thingsManager.getListOfSupportedConfigurationUnits();
626 private void displayToastMessage(String message) {
627 Toast toast = Toast.makeText(this, message, Toast.LENGTH_SHORT);
631 private void collectionFound(OcResource resource) {
632 String uri = resource.getUri();
633 ResourceInformation resourceInfo = collectionList.get(uri);
634 if (null == resourceInfo) {
635 Log.e(LOG_TAG, "Collection is not created!");
639 if (null != resourceInfo.resource) {
640 Log.e(LOG_TAG, "Collection resource already updated!");
644 resourceInfo.resource = resource;
645 if (3 == messageCount) {
646 findGroupPressedFlag = true;
651 * This callback will be invoked when the interested resource discovered in
654 private void resourceFound(OcResource resource) throws OcException {
655 String uri = resource.getUri();
656 String host = resource.getHost();
658 // Check if the resource already exist in the map table
659 ResourceInformation resourceInfo = resourceList.get(uri + host);
660 if (null != resourceInfo) {
661 Log.e(LOG_TAG, "Resource already exists!");
666 resourceInfo = new ResourceInformation();
667 resourceInfo.resource = resource;
668 if (uri.equalsIgnoreCase("/oic/con")) {
669 ResourceInformation collectionResource = collectionList
670 .get(CONFIGURATION_COLLECTION_RESOURCE_URI);
671 if (null == collectionResource
672 || null == collectionResource.resourceHandle) {
673 Log.e(LOG_TAG, "Invalid Configuration collection!");
677 ResourceInformation resourceInfoCollection;
678 resourceInfoCollection = collectionList
679 .get(CONFIGURATION_COLLECTION_RESOURCE_URI);
680 OcResourceHandle handle;
681 handle = resourceInfoCollection.resourceHandle;
682 resourceInfo.resourceHandle = handle;
683 resourceInfo.resourceHandle = thingsManager.bindResourceToGroup(
686 resourceList.put(uri + host, resourceInfo);
687 configurationResourceFlag = true;
688 } else if (uri.equalsIgnoreCase("/oic/diag")) {
689 ResourceInformation diagnosticResource = collectionList
690 .get(DIAGNOSTIC_COLLECTION_RESOURCE_URI);
691 if (null == diagnosticResource
692 || null == diagnosticResource.resourceHandle) {
693 Log.e(LOG_TAG, "Invalid Configuration collection!");
697 ResourceInformation resourceInfoCollection;
698 resourceInfoCollection = collectionList
699 .get(DIAGNOSTIC_COLLECTION_RESOURCE_URI);
700 OcResourceHandle handle;
701 handle = resourceInfoCollection.resourceHandle;
702 resourceInfo.resourceHandle = handle;
703 resourceInfo.resourceHandle = thingsManager.bindResourceToGroup(
706 resourceList.put(uri + host, resourceInfo);
707 diagnosticsResourceFlag = true;
708 } else if (uri.equalsIgnoreCase("/factorySet")) {
709 ResourceInformation factorysetResource = collectionList
710 .get(FACTORYSET_COLLECTION_RESOURCE_URI);
711 if (null == factorysetResource
712 || null == factorysetResource.resourceHandle) {
713 Log.e(LOG_TAG, "Invalid Configuration collection!");
717 ResourceInformation resourceInfoCollection;
718 resourceInfoCollection = collectionList
719 .get(FACTORYSET_COLLECTION_RESOURCE_URI);
720 OcResourceHandle handle;
721 handle = resourceInfoCollection.resourceHandle;
722 resourceInfo.resourceHandle = handle;
723 resourceInfo.resourceHandle = thingsManager.bindResourceToGroup(
726 resourceList.put(uri + host, resourceInfo);
727 factorySetResourceFlag = true;
729 Log.e(LOG_TAG, "Resource is of different type: " + uri);
734 private void createResourceCollection(String uri, String typename)
737 Map<String, OcResourceHandle> groupList = new HashMap<String, OcResourceHandle>();
739 Log.i(LOG_TAG, "createGroup: " + typename);
740 // Check if the resource collection is already created
741 if (null != collectionList.get(uri)) {
742 Log.e(LOG_TAG, "Collection is already exist!");
746 OcResourceHandle resourceHandle = null;
749 OCStackResult result = thingsManager.createGroup(typename);
750 if ((OCStackResult.OC_STACK_OK != result)) {
751 Log.e(LOG_TAG, "createGroup returned error: " + result.name());
754 Log.e(LOG_TAG, "createGroup returned: " + result.name());
756 groupList = thingsManager.getGroupList();
757 if (groupList.containsKey(typename)) {
758 resourceHandle = groupList.get(typename);
760 Log.e(LOG_TAG, "group does not contain groupResourceType: "
764 if (null == resourceHandle) {
765 Log.e(LOG_TAG, " createResourceCollection : resourceHandle is NULL");
768 // Add the collection resource to map table
769 ResourceInformation resourceInfo = new ResourceInformation();
770 resourceInfo.resourceHandle = resourceHandle;
771 collectionList.put(uri, resourceInfo);
772 Log.i(LOG_TAG, "size of collectionList : " + collectionList.size());
775 private void deleteResources() {
776 Log.i(LOG_TAG, "deleteResources: enter");
778 // unregister all resources
779 for (ResourceInformation resource : resourceList.values()) {
780 if (null != resource.resourceHandle) {
781 if (resource.resource.getUri().equalsIgnoreCase(
782 CONFIGURATION_RESOURCE_URI)) {
783 ResourceInformation collectionResource = collectionList
784 .get(CONFIGURATION_COLLECTION_RESOURCE_URI);
785 if (null != collectionResource
786 && null != collectionResource.resourceHandle) {
788 .unregisterResource(resource.resourceHandle);
789 Log.i(LOG_TAG, "unregistered resource"
790 + CONFIGURATION_COLLECTION_RESOURCE_URI);
793 } else if (resource.resource.getUri().equalsIgnoreCase(
794 DIAGNOSTIC_RESOURCE_URI)) {
795 ResourceInformation diagnosticResource = collectionList
796 .get(DIAGNOSTIC_COLLECTION_RESOURCE_URI);
797 if (null != diagnosticResource
798 && null != diagnosticResource.resourceHandle) {
800 .unregisterResource(resource.resourceHandle);
801 Log.i(LOG_TAG, "unregistered resource"
802 + CONFIGURATION_COLLECTION_RESOURCE_URI);
804 } else if (resource.resource.getUri().equalsIgnoreCase(
805 FACTORYSET_RESOURCE_URI)) {
806 ResourceInformation factorysetResource = collectionList
807 .get(FACTORYSET_COLLECTION_RESOURCE_URI);
808 if (null != factorysetResource
809 && null != factorysetResource.resourceHandle) {
811 .unregisterResource(resource.resourceHandle);
812 Log.i(LOG_TAG, "unregistered resource"
813 + CONFIGURATION_COLLECTION_RESOURCE_URI);
820 // delete all the groups
821 thingsManager.deleteGroup(CONFIGURATION_COLLECTION_RESOURCE_TYPE);
822 thingsManager.deleteGroup(DIAGNOSTIC_COLLECTION_RESOURCE_TYPE);
823 thingsManager.deleteGroup(FACTORYSET_COLLECTION_RESOURCE_TYPE);
824 } catch (OcException e) {
825 Log.e(LOG_TAG, "OcException occured! " + e.toString());