[dss-commits] r8852 - dss/trunk/core
dss-commits at forum.digitalstrom.org
dss-commits at forum.digitalstrom.org
Mon Oct 19 13:39:23 CEST 2009
Author: pstaehlin
Date: 2009-10-19 13:39:23 +0200 (Mon, 19 Oct 2009)
New Revision: 8852
Modified:
dss/trunk/core/model.cpp
Log:
Raise more events when the model changes
Modified: dss/trunk/core/model.cpp
===================================================================
--- dss/trunk/core/model.cpp 2009-10-19 11:39:02 UTC (rev 8851)
+++ dss/trunk/core/model.cpp 2009-10-19 11:39:23 UTC (rev 8852)
@@ -923,6 +923,8 @@
devices.perform(action);
}
}
+ boost::shared_ptr<Event> modulatorReadyEvent(new Event("datamodel_changed"));
+ getDSS().getEventQueue().pushEvent(modulatorReadyEvent);
} // initializeFromBus
void Apartment::newModulator(int _modulatorBusID) {
@@ -951,8 +953,16 @@
} // lostModulator
void Apartment::modulatorReady(int _modulatorBusID) {
- log("Modulator with id: " + intToString(_modulatorBusID) + " is ready");
+ log("Modulator with id: " + intToString(_modulatorBusID) + " is ready", lsInfo);
initializeFromBus();
+ try {
+ Modulator& mod = getModulatorByBusID(_modulatorBusID);
+ boost::shared_ptr<Event> modulatorReadyEvent(new Event("modulator_ready"));
+ modulatorReadyEvent->setProperty("modulator", mod.getDSID().toString());
+ getDSS().getEventQueue().pushEvent(modulatorReadyEvent);
+ } catch(ItemNotFoundException&) {
+ Logger::getInstance()->log("modulatorReady: Could not get DSID of modulator", lsFatal);
+ }
} // modulatorReady
void Apartment::handleModelEvents() {
@@ -1044,6 +1054,11 @@
}
void Apartment::execute() {
+ {
+ boost::shared_ptr<Event> runningEvent(new Event("running"));
+ getDSS().getEventQueue().pushEvent(runningEvent);
+ }
+
// load devices/modulators/etc. from a config-file
std::string configFileName = DSS::getInstance()->getPropertySystem().getStringValue(getConfigPropertyBasePath() + "configfile");
if(!fileExists(configFileName)) {
@@ -1051,7 +1066,13 @@
} else {
readConfigurationFromXML(configFileName);
}
+
+ {
+ boost::shared_ptr<Event> configReadEvent(new Event("config_read"));
+ getDSS().getEventQueue().pushEvent(configReadEvent);
+ }
+
DS485Interface& interface = DSS::getInstance()->getDS485Interface();
log("Apartment::execute: Waiting for interface to get ready", lsInfo);
@@ -1060,6 +1081,11 @@
sleepMS(1000);
}
+ {
+ boost::shared_ptr<Event> readyEvent(new Event("interface_ready"));
+ getDSS().getEventQueue().pushEvent(readyEvent);
+ }
+
log("Apartment::execute: Interface is ready, enumerating model", lsInfo);
initializeFromBus();
@@ -1574,6 +1600,13 @@
log(" Adding to Group: " + intToString(iGroup));
dev.addToGroup(iGroup);
}
+
+ {
+ boost::shared_ptr<Event> readyEvent(new Event("new_device"));
+ readyEvent->setProperty("device", dsid.toString());
+ readyEvent->setProperty("zone", intToString(_zoneID));
+ getDSS().getEventQueue().pushEvent(readyEvent);
+ }
} // onAddDevice
void Apartment::onDSLinkInterrupt(const int _modID, const int _devID, const int _priority) {
More information about the dss-commits
mailing list