[dss-commits] r8854 - dss/trunk/core

dss-commits at forum.digitalstrom.org dss-commits at forum.digitalstrom.org
Tue Oct 20 10:20:57 CEST 2009


Author: pstaehlin
Date: 2009-10-20 10:20:57 +0200 (Tue, 20 Oct 2009)
New Revision: 8854

Modified:
   dss/trunk/core/model.cpp
Log:
Catch errors from bus while getting the dSMs DSID

Modified: dss/trunk/core/model.cpp
===================================================================
--- dss/trunk/core/model.cpp	2009-10-20 08:20:48 UTC (rev 8853)
+++ dss/trunk/core/model.cpp	2009-10-20 08:20:57 UTC (rev 8854)
@@ -881,9 +881,12 @@
       // bus-id, sw-version, hw-version, name, device-id
       int modulatorID = modulatorSpec.get<0>();
       log("Found modulator with id: " + intToString(modulatorID));
-      dsid_t modDSID = interface.getDSIDOfModulator(modulatorID);
-      if(modDSID == NullDSID) {
-        log("Could not get DSID of modulator with last known bus-id: " + intToString(modulatorID), lsFatal);
+      dsid_t modDSID;
+      try {
+        modDSID = interface.getDSIDOfModulator(modulatorID);
+      } catch(DS485ApiError& err) {
+        log("Could not get DSID of modulator with last known bus-id: " + intToString(modulatorID)
+            + ". Message: " + err.what(), lsFatal);
         scheduleRescan();
         continue;
       }
@@ -898,13 +901,16 @@
       // bus-id, sw-version, hw-version, name, device-id
       int modulatorID = modulatorSpec.get<0>();
       log("Found modulator with id: " + intToString(modulatorID));
-      dsid_t modDSID = interface.getDSIDOfModulator(modulatorID);
-      log("  DSID: " + modDSID.toString());
-      if(modDSID == NullDSID) {
-        log("Could not get DSID of modulator with last known bus-id: " + intToString(modulatorID), lsFatal);
+      dsid_t modDSID;
+      try {
+        modDSID = interface.getDSIDOfModulator(modulatorID);
+      } catch(DS485ApiError& err) {
+        log("Could not get DSID of modulator with last known bus-id: " + intToString(modulatorID)
+            + ". Message: " + err.what(), lsFatal);
         scheduleRescan();
         continue;
       }
+      log("  DSID: " + modDSID.toString());
       Modulator& modulator = allocateModulator(modDSID);
       modulator.setBusID(modulatorID);
       try {
@@ -936,13 +942,17 @@
       // bus-id, sw-version, hw-version, name, device-id
       int modulatorID = modulatorSpec.get<0>();
       log("Found modulator with id: " + intToString(modulatorID));
-      dsid_t modDSID = interface.getDSIDOfModulator(modulatorID);
-      log("  DSID: " + modDSID.toString());
-      if(modDSID == NullDSID) {
-        log("Could not get DSID of modulator with last known bus-id: " + intToString(modulatorID), lsFatal);
+      dsid_t modDSID;
+      try {
+        modDSID = interface.getDSIDOfModulator(modulatorID);
+      } catch(DS485ApiError& err) {
+        log("newModulator: Could not get DSID of modulator with last known bus-id: " 
+            + intToString(_modulatorBusID)
+            + ". Message: " + err.what(), lsFatal);
         scheduleRescan();
-        continue;
+        return;
       }
+      log("  DSID: " + modDSID.toString());
       Modulator& modulator = allocateModulator(modDSID);
       modulator.setBusID(modulatorID);
     }



More information about the dss-commits mailing list