[dss-commits] digitalSTROM Server branch, master, updated. f82ce5a310973d67d123ca76ecfecc53aeb580ed

git version control dss-commits at forum.digitalstrom.org
Mon Dec 14 18:07:23 CET 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "digitalSTROM Server".

The branch, master has been updated
       via  f82ce5a310973d67d123ca76ecfecc53aeb580ed (commit)
       via  7f39d5001ef93019047dcd78ae5b478f763ef3fb (commit)
       via  d0dab8a6118f29cc73e6ac33e4bf49029bd5da4a (commit)
      from  5374fdc2df8e8d96869dad2f0530ff38660d053f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f82ce5a310973d67d123ca76ecfecc53aeb580ed
Author: Patrick Stählin <pstaehlin at futurelab.ch>
Date:   Mon Dec 14 18:06:14 2009 +0100

    Use getGroupsOfDevice to discover groups
    
    References #247

commit 7f39d5001ef93019047dcd78ae5b478f763ef3fb
Author: Patrick Stählin <pstaehlin at futurelab.ch>
Date:   Mon Dec 14 17:41:39 2009 +0100

    Assume a modulator knows all standard-groups
    
    References #247

commit d0dab8a6118f29cc73e6ac33e4bf49029bd5da4a
Author: Patrick Stählin <pstaehlin at futurelab.ch>
Date:   Mon Dec 14 17:34:29 2009 +0100

    Workaround a dSM issue
    
    Closes #246

-----------------------------------------------------------------------

Changes:
diff --git a/core/ds485const.h b/core/ds485const.h
index 0eb3752..c7f2ae6 100644
--- a/core/ds485const.h
+++ b/core/ds485const.h
@@ -168,7 +168,8 @@ namespace dss {
   const int GroupIDBlack = 8;
   const int GroupIDWhite = 9;
   const int GroupIDDisplay = 10;
-  const int GroupIDMax = GroupIDDisplay;
+  const int GroupIDStandardMax = GroupIDDisplay;
+  const int GroupIDMax = 64;
 
   const int FunctionIDDevice = 0;
   const int FunctionIDSwitch = 1;
diff --git a/core/model.cpp b/core/model.cpp
index ffd2970..0363839 100644
--- a/core/model.cpp
+++ b/core/model.cpp
@@ -835,6 +835,14 @@ namespace dss {
         dev.setModulatorID(modulatorID);
         dev.setZoneID(zoneID);
         dev.setFunctionID(functionID);
+
+        std::vector<int> groupIdperDevices = interface.getGroupsOfDevice(modulatorID, devID);
+        vector<int> groupIDsPerDevice = interface.getGroupsOfDevice(modulatorID,devID);
+        foreach(int groupID, groupIDsPerDevice) {
+          log(string("scanModulator: adding device ") + intToString(devID) + " to group " + intToString(groupID));
+          dev.addToGroup(groupID);
+        }
+
         DeviceReference devRef(dev, *this);
         zone.addDevice(devRef);
         _modulator.addDevice(devRef);
@@ -857,40 +865,18 @@ namespace dss {
           continue;
         }
         log("scanModulator:    Found group with id: " + intToString(groupID));
+        if(zone.getGroup(groupID) == NULL) {
+          log(" scanModulator:    Adding new group to zone");
+          zone.addGroup(new Group(groupID, zone.getID(), *this));
+        }
         try {
-          vector<int> devingroup = interface.getDevicesInGroup(modulatorID, zoneID, groupID);
-
-          foreach(int devID, devingroup) {
-            try {
-              log("scanModulator:     Adding device " + intToString(devID) + " to group " + intToString(groupID));
-              Device& dev = getDeviceByShortAddress(_modulator, devID);
-              dev.addToGroup(groupID);
-              if(zone.getGroup(groupID) == NULL) {
-                log(" scanModulator:    Adding new group to zone");
-                zone.addGroup(new Group(groupID, zone.getID(), *this));
-              }
-              Group* pGroup = zone.getGroup(groupID);
-              pGroup->setIsPresent(true);
-              try {
-                Group& group = getGroup(groupID);
-                group.setIsPresent(true);
-              } catch(ItemNotFoundException&) {
-                Group* pGroup = new Group(groupID, 0, *this);
-                getZone(0).addGroup(pGroup);
-                pGroup->setIsPresent(true);
-                log("scanModulator:     Adding new group to zone 0");
-                return false;
-              }
-            } catch(ItemNotFoundException& e) {
-              log("scanModulator: Could not find device with short-address " + intToString(devID) + " on modulator " + intToString(modulatorID), lsFatal);
-              return false;
-            }
-          }
-        } catch(DS485ApiError& e) {
-          log("scanModulator: Error getting devices from group " + intToString(groupID) +
-              " on zone " + intToString(zoneID) +
-              " on modulator " + intToString(modulatorID) +
-              ". Message: " + e.what(), lsFatal);
+          Group& group = getGroup(groupID);
+          group.setIsPresent(true);
+        } catch(ItemNotFoundException&) {
+          Group* pGroup = new Group(groupID, 0, *this);
+          getZone(0).addGroup(pGroup);
+          pGroup->setIsPresent(true);
+          log("scanModulator:     Adding new group to zone 0");
           return false;
         }
 
diff --git a/core/sim/dssim.cpp b/core/sim/dssim.cpp
index 6b62e8b..89a3860 100644
--- a/core/sim/dssim.cpp
+++ b/core/sim/dssim.cpp
@@ -845,6 +845,7 @@ namespace dss {
 
                 // format: (8,7,6,5,4,3,2,1) (16,15,14,13,12,11,10,9), etc...
                 unsigned char bytes[8];
+                memset(bytes, '\0', sizeof(bytes));
                 foreach(int groupID, groupsList) {
                   if(groupID != 0) {
                     int iBit = (groupID - 1) % 8;
diff --git a/unix/ds485proxy.cpp b/unix/ds485proxy.cpp
index 2e9a086..3eccae2 100644
--- a/unix/ds485proxy.cpp
+++ b/unix/ds485proxy.cpp
@@ -678,6 +678,10 @@ namespace dss {
           " with zone " + intToString(_zoneID));
     }
     checkResultCode(res);
+    // Every modulator should provide all standard-groups
+    if(res < GroupIDStandardMax) {
+      res = GroupIDStandardMax;
+    }
     return res;
   } // getGroupCount
 
@@ -696,11 +700,11 @@ namespace dss {
 
       int8_t res = int8_t(receiveSingleResult(cmdFrame, FunctionZoneGetGroupIdForInd));
       if(res < 0) {
-        log("GetGroups: Negative index received '" + intToString(res) + "' for index " + intToString(iGroup));
+        log("GetGroups: Negative index received '" + intToString(res) + "' for index " + intToString(iGroup), lsFatal);
       } else {
         result.push_back(res);
       }
-      checkResultCode(res);
+      //checkResultCode(res);
     }
 
     return result;
@@ -801,12 +805,14 @@ namespace dss {
       cmdFrame.getPayload().add<uint16_t>(iZone);
       log("GetZoneID");
       int16_t tempResult = int16_t(receiveSingleResult16(cmdFrame, FunctionModulatorGetZoneIdForInd));
-      if(tempResult < 0) {
+      // TODO: The following line is a workaround as described in #246
+      if((tempResult < 0) && (tempResult > -20)) {
         log("GetZones: Negative zone id " + intToString(tempResult) + " received. Modulator: " + intToString(_modulatorID) + " index: " + intToString(iZone), lsError);
+        // TODO: take this line outside the if-clause after the dSM-API has been reworked
+        checkResultCode(tempResult);
       } else {
         result.push_back(tempResult);
       }
-      checkResultCode(tempResult);
       log("received ZoneID: " + uintToString((unsigned int)tempResult));
     }
     return result;
@@ -1233,6 +1239,8 @@ namespace dss {
       return "Function Device Get Parameter Value";
     case  FunctionDeviceGetDSID:
       return "Function Device Get DSID";
+    case FunctionDeviceGetGroups:
+      return "Function Device Get Groups";
 
     case FunctionModulatorGetDSID:
       return "Function Modulator Get DSID";


hooks/post-receive
-- 
digitalSTROM Server


More information about the dss-commits mailing list