[dss-commits] r8848 - dss/trunk/core
dss-commits at forum.digitalstrom.org
dss-commits at forum.digitalstrom.org
Thu Oct 15 12:09:37 CEST 2009
Author: pstaehlin
Date: 2009-10-15 12:09:37 +0200 (Thu, 15 Oct 2009)
New Revision: 8848
Modified:
dss/trunk/core/model.cpp
dss/trunk/core/model.h
dss/trunk/core/webserver.cpp
Log:
Mark primary Zones in /apartment/getStructure
Closes #164
Modified: dss/trunk/core/model.cpp
===================================================================
--- dss/trunk/core/model.cpp 2009-10-15 10:09:23 UTC (rev 8847)
+++ dss/trunk/core/model.cpp 2009-10-15 10:09:37 UTC (rev 8848)
@@ -755,12 +755,17 @@
}
_modulator.setIsPresent(true);
+ bool firstZone = true;
vector<int> zoneIDs = interface.getZones(modulatorID);
foreach(int zoneID, zoneIDs) {
log(" Found zone with id: " + intToString(zoneID));
Zone& zone = allocateZone(zoneID);
zone.addToModulator(_modulator);
zone.setIsPresent(true);
+ if(firstZone) {
+ zone.setFirstZoneOnModulator(modulatorID);
+ firstZone = false;
+ }
vector<int> devices = interface.getDevicesInZone(modulatorID, zoneID);
foreach(int devID, devices) {
Modified: dss/trunk/core/model.h
===================================================================
--- dss/trunk/core/model.h 2009-10-15 10:09:23 UTC (rev 8847)
+++ dss/trunk/core/model.h 2009-10-15 10:09:37 UTC (rev 8848)
@@ -656,9 +656,11 @@
DeviceVector m_Devices;
std::vector<const Modulator*> m_Modulators;
std::vector<Group*> m_Groups;
+ int m_FirstZoneOnModulator;
public:
Zone(const int _id)
- : m_ZoneID(_id)
+ : m_ZoneID(_id),
+ m_FirstZoneOnModulator(-1)
{}
virtual ~Zone();
virtual Set getDevices() const;
@@ -693,6 +695,13 @@
/** Sets the zones id */
void setZoneID(const int _value);
+ /** Returns the ID of the modulator the zone is the first
+ * zone on.
+ * @return The modulator id, or -1
+ */
+ int getFirstZoneOnModulator() { return m_FirstZoneOnModulator; }
+ void setFirstZoneOnModulator(const int _value) { m_FirstZoneOnModulator = _value; }
+
/** Returns a list of the modulators the zone is registered with. */
std::vector<int> getModulators() const;
bool registeredOnModulator(const Modulator& _modulator) const;
Modified: dss/trunk/core/webserver.cpp
===================================================================
--- dss/trunk/core/webserver.cpp 2009-10-15 10:09:23 UTC (rev 8847)
+++ dss/trunk/core/webserver.cpp 2009-10-15 10:09:37 UTC (rev 8848)
@@ -574,9 +574,14 @@
name = string("Zone ") + intToString(_zone.getZoneID());
}
sstream << ToJSONValue("name") << ": " << ToJSONValue(name) << ", ";
- sstream << ToJSONValue("isPresent") << ": " << ToJSONValue(_zone.isPresent()) << ", ";
+ sstream << ToJSONValue("isPresent") << ": " << ToJSONValue(_zone.isPresent());
+ if(_zone.getFirstZoneOnModulator() != -1) {
+ sstream << ", " << ToJSONValue("firstZoneOnModulator")
+ << ": " << ToJSONValue(_zone.getFirstZoneOnModulator());
+ }
if(_includeDevices) {
+ sstream << ", ";
Set devices = _zone.getDevices();
sstream << ToJSONValue(devices, "devices");
sstream << "," << ToJSONValue("groups") << ": [";
More information about the dss-commits
mailing list