[dss-commits] r8855 - in dss/trunk: core unix webservices

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


Author: skohler
Date: 2009-10-20 12:57:50 +0200 (Tue, 20 Oct 2009)
New Revision: 8855

Modified:
   dss/trunk/core/model.cpp
   dss/trunk/core/model.h
   dss/trunk/core/structuremanipulator.cpp
   dss/trunk/core/webserver.cpp
   dss/trunk/unix/ds485proxy.cpp
   dss/trunk/webservices/model_soap.cpp
Log:
Zone::getZoneID renamed to Zone::getID. Relates to #98

Modified: dss/trunk/core/model.cpp
===================================================================
--- dss/trunk/core/model.cpp	2009-10-20 08:20:57 UTC (rev 8854)
+++ dss/trunk/core/model.cpp	2009-10-20 10:57:50 UTC (rev 8855)
@@ -489,7 +489,7 @@
       return result;
     } else {
       Zone& zone = get(0).getDevice().getApartment().getZone(_zoneName);
-      return getByZone(zone.getZoneID());
+      return getByZone(zone.getID());
     }
   } // getByZone(name)
 
@@ -710,7 +710,7 @@
   } // start
 
   void Apartment::addDefaultGroupsToZone(Zone& _zone) {
-    int zoneID = _zone.getZoneID();
+    int zoneID = _zone.getID();
 
     Group* grp = new Group(GroupIDBroadcast, zoneID, *this);
     grp->setName("broadcast");
@@ -815,7 +815,7 @@
               dev.addToGroup(groupID);
               if(zone.getGroup(groupID) == NULL) {
                 log("     Adding new group to zone");
-                zone.addGroup(new Group(groupID, zone.getZoneID(), *this));
+                zone.addGroup(new Group(groupID, zone.getID(), *this));
               }
               Group* pGroup = zone.getGroup(groupID);
               pGroup->setIsPresent(true);
@@ -1238,7 +1238,7 @@
 
   void ZoneToXML(const Zone* _pZone, AutoPtr<Element>& _parentNode, AutoPtr<Document>& _pDocument) {
     AutoPtr<Element> pZoneNode = _pDocument->createElement("zone");
-    pZoneNode->setAttribute("id", intToString(_pZone->getZoneID()));
+    pZoneNode->setAttribute("id", intToString(_pZone->getID()));
     if(!_pZone->getName().empty()) {
       AutoPtr<Element> pNameNode = _pDocument->createElement("name");
       AutoPtr<Text> txtNode = _pDocument->createTextNode(_pZone->getName());
@@ -1375,7 +1375,7 @@
 
   Zone& Apartment::getZone(const int _id) {
     foreach(Zone* zone, m_Zones) {
-      if(zone->getZoneID() == _id) {
+      if(zone->getID() == _id) {
         return *zone;
       }
     }
@@ -1469,7 +1469,7 @@
     }
 
     foreach(Zone* zone, m_Zones) {
-  		if(zone->getZoneID() == _zoneID) {
+  		if(zone->getID() == _zoneID) {
   			return *zone;
   		}
   	}
@@ -1821,9 +1821,9 @@
     return NULL;
   } // getGroup
 
-  int Zone::getZoneID() const {
+  int Zone::getID() const {
     return m_ZoneID;
-  } // getZoneID
+  } // getID
 
   void Zone::setZoneID(const int _value) {
     m_ZoneID = _value;

Modified: dss/trunk/core/model.h
===================================================================
--- dss/trunk/core/model.h	2009-10-20 08:20:57 UTC (rev 8854)
+++ dss/trunk/core/model.h	2009-10-20 10:57:50 UTC (rev 8855)
@@ -691,7 +691,7 @@
     void removeGroup(UserGroup* _group);
 
     /** Returns the zones id */
-    int getZoneID() const;
+    int getID() const;
     /** Sets the zones id */
     void setZoneID(const int _value);
 
@@ -963,7 +963,7 @@
   template<>
   struct hash<const dss::Zone*>  {
     size_t operator()(const dss::Zone* x) const  {
-      return x->getZoneID();
+      return x->getID();
     }
   };
 }

Modified: dss/trunk/core/structuremanipulator.cpp
===================================================================
--- dss/trunk/core/structuremanipulator.cpp	2009-10-20 08:20:57 UTC (rev 8854)
+++ dss/trunk/core/structuremanipulator.cpp	2009-10-20 10:57:50 UTC (rev 8855)
@@ -18,7 +18,7 @@
     if(!_modulator.isPresent()) {
       throw std::runtime_error("Need modulator to be present");
     }
-    m_Interface.createZone(_modulator.getBusID(), _zone.getZoneID());
+    m_Interface.createZone(_modulator.getBusID(), _zone.getID());
     _zone.addToModulator(_modulator);
     _zone.setIsPresent(true);
   } // createZone
@@ -32,8 +32,8 @@
     if(!_zone.registeredOnModulator(targetModulator)) {
       createZone(targetModulator, _zone);
     }
-    m_Interface.setZoneID(targetModulator.getBusID(), _device.getShortAddress(), _zone.getZoneID());
-    _device.setZoneID(_zone.getZoneID());
+    m_Interface.setZoneID(targetModulator.getBusID(), _device.getShortAddress(), _zone.getID());
+    _device.setZoneID(_zone.getID());
     DeviceReference ref(_device, m_Apartment);
     _zone.addDevice(ref);
 
@@ -54,7 +54,7 @@
     if(presentDevicesInZoneOfModulator.length() != 0) {
       throw std::runtime_error("cannot delete zone if there are still devices present");
     }
-    m_Interface.removeZone(_modulator.getBusID(), _zone.getZoneID());
+    m_Interface.removeZone(_modulator.getBusID(), _zone.getID());
     _zone.removeFromModulator(_modulator);
     if(_zone.getModulators().empty()) {
       _zone.setIsPresent(false);

Modified: dss/trunk/core/webserver.cpp
===================================================================
--- dss/trunk/core/webserver.cpp	2009-10-20 08:20:57 UTC (rev 8854)
+++ dss/trunk/core/webserver.cpp	2009-10-20 10:57:50 UTC (rev 8855)
@@ -568,10 +568,10 @@
 
   string ToJSONValue(Zone& _zone, bool _includeDevices = true) {
     std::stringstream sstream;
-    sstream << "{ \"id\": " << _zone.getZoneID() << ",";
+    sstream << "{ \"id\": " << _zone.getID() << ",";
     string name = _zone.getName();
     if(name.size() == 0) {
-      name = string("Zone ") + intToString(_zone.getZoneID());
+      name = string("Zone ") + intToString(_zone.getID());
     }
     sstream << ToJSONValue("name") << ": " << ToJSONValue(name) << ", ";
     sstream << ToJSONValue("isPresent") << ": " << ToJSONValue(_zone.isPresent());
@@ -629,7 +629,7 @@
         ipZone != e; ++ipZone)
     {
       Zone* pZone = *ipZone;
-      if(pZone->getZoneID() == 0) {
+      if(pZone->getID() == 0) {
         // zone 0 holds all devices, so we're going to skip it
         continue;
       }

Modified: dss/trunk/unix/ds485proxy.cpp
===================================================================
--- dss/trunk/unix/ds485proxy.cpp	2009-10-20 08:20:57 UTC (rev 8854)
+++ dss/trunk/unix/ds485proxy.cpp	2009-10-20 10:57:50 UTC (rev 8855)
@@ -77,12 +77,12 @@
     Set singleDevices;
 
     if(OptimizerDebug) {
-      Logger::getInstance()->log("Finding fit for zone " + intToString(_zone.getZoneID()));
+      Logger::getInstance()->log("Finding fit for zone " + intToString(_zone.getID()));
     }
 
 
     if(_zone.getDevices().length() == _set.length()) {
-      Logger::getInstance()->log(string("Optimization: Set contains all devices of zone ") + intToString(_zone.getZoneID()));
+      Logger::getInstance()->log(string("Optimization: Set contains all devices of zone ") + intToString(_zone.getID()));
         std::bitset<63> possibleGroups;
         possibleGroups.set();
         for(int iDevice = 0; iDevice < _set.length(); iDevice++) {
@@ -314,7 +314,7 @@
       toZone = 0;
       log("sendCommand(Zone,GroupID): Only one zone present, sending frame to broadcast zone");
     } else {
-      toZone = _zone.getZoneID();
+      toZone = _zone.getID();
     }
     if(_cmd == cmdTurnOn) {
       frame.getPayload().add<uint8_t>(FunctionGroupCallScene);
@@ -322,21 +322,21 @@
       frame.getPayload().add<uint16_t>(_groupID);
       frame.getPayload().add<uint16_t>(SceneMax);
       sendFrame(frame);
-      log("turn on: zone " + intToString(_zone.getZoneID()) + " group: " + intToString(_groupID));
+      log("turn on: zone " + intToString(_zone.getID()) + " group: " + intToString(_groupID));
     } else if(_cmd == cmdTurnOff) {
       frame.getPayload().add<uint8_t>(FunctionGroupCallScene);
       frame.getPayload().add<uint16_t>(toZone);
       frame.getPayload().add<uint16_t>(_groupID);
       frame.getPayload().add<uint16_t>(SceneMin);
       sendFrame(frame);
-      log("turn off: zone " + intToString(_zone.getZoneID()) + " group: " + intToString(_groupID));
+      log("turn off: zone " + intToString(_zone.getID()) + " group: " + intToString(_groupID));
     } else if(_cmd == cmdCallScene) {
       frame.getPayload().add<uint8_t>(FunctionGroupCallScene);
       frame.getPayload().add<uint16_t>(toZone);
       frame.getPayload().add<uint16_t>(_groupID);
       frame.getPayload().add<uint16_t>(_param);
       sendFrame(frame);
-      log("call scene: zone " + intToString(_zone.getZoneID()) + " group: " + intToString(_groupID));
+      log("call scene: zone " + intToString(_zone.getID()) + " group: " + intToString(_groupID));
     } else if(_cmd == cmdSaveScene) {
       frame.getPayload().add<uint8_t>(FunctionGroupSaveScene);
       frame.getPayload().add<uint16_t>(toZone);

Modified: dss/trunk/webservices/model_soap.cpp
===================================================================
--- dss/trunk/webservices/model_soap.cpp	2009-10-20 08:20:57 UTC (rev 8854)
+++ dss/trunk/webservices/model_soap.cpp	2009-10-20 10:57:50 UTC (rev 8855)
@@ -337,7 +337,7 @@
   }
   dss::Apartment& apt = dss::DSS::getInstance()->getApartment();
   try {
-    zoneID = apt.getZone(_zoneName).getZoneID();
+    zoneID = apt.getZone(_zoneName).getID();
   } catch(dss::ItemNotFoundException& _ex) {
     return soap_receiver_fault(soap, "Could not find zone", NULL);
   }
@@ -356,7 +356,7 @@
 //  zoneIDs.__size = numZones;
   //zoneIDs.__ptr = (long unsigned int*)soap_malloc(soap, numZones * sizeof(long unsigned int));
   for(int iZoneID = 0; iZoneID < numZones; iZoneID++) {
-    zoneIDs.push_back(zones[iZoneID]->getZoneID());
+    zoneIDs.push_back(zones[iZoneID]->getID());
   }
 
   return SOAP_OK;



More information about the dss-commits mailing list