private void checkConnected() {
   ArrayList<ThingsData> discovered = new ArrayList<ThingsData>();
   ThingConstructor thingConstructor = new ThingConstructor();
   for (int i = 0; i < discoveredSensors.size(); i++) {
     HashMap<String, String> hashMap = discoveredSensors.get(i);
     String id = hashMap.get("ID");
     if (!ids.contains(id)) {
       mLogger.info("DeviceID:" + id + " was discovered");
       if (containsEmptyFields(hashMap)) {
         File file = new File(sensorsFolder + id + ".csv");
         if (file.exists() && !file.isDirectory()) {
           hashMap = ContextUtils.readSensorFile(hashMap, file);
           things.add(hashMap);
           ThingsData thing = thingConstructor.constructSendThing(hashMap);
           discovered.add(thing);
           mLogger.info(hashMap);
         }
       } else {
         ThingsData thing = thingConstructor.constructSendThing(hashMap);
         things.add(hashMap);
         discovered.add(thing);
         mLogger.info(hashMap);
       }
     }
   }
   if (discovered.size() > 0) {
     try {
       adaptationcm.publishThingInit(discovered);
     } catch (Exception e) {
       mLogger.error("Error publishing thing");
     }
   }
 }
 private void checkDisconnected() {
   List<String> removed = new ArrayList<String>();
   for (String id : ids) {
     if (!current.contains(id)) {
       mLogger.info("DeviceID:" + id + " was removed");
       removed.add(id);
     }
   }
   if (removed.size() > 0) {
     try {
       adaptationcm.removeThing(removed);
     } catch (Exception e) {
       mLogger.error("Error removing thing");
     }
   }
   for (String string : removed) {
     removeIdFromThings(string);
   }
 }