[dss-commits] r8776 - in dss/trunk: core unix
dss-commits at forum.digitalstrom.org
dss-commits at forum.digitalstrom.org
Mon Sep 21 17:27:49 CEST 2009
Author: pstaehlin
Date: 2009-09-21 17:27:49 +0200 (Mon, 21 Sep 2009)
New Revision: 8776
Modified:
dss/trunk/core/model.cpp
dss/trunk/core/model.h
dss/trunk/unix/ds485proxy.cpp
Log:
Send an event to the model if we've got a stable bus
Modified: dss/trunk/core/model.cpp
===================================================================
--- dss/trunk/core/model.cpp 2009-09-21 14:51:08 UTC (rev 8775)
+++ dss/trunk/core/model.cpp 2009-09-21 15:27:49 UTC (rev 8776)
@@ -888,7 +888,7 @@
void Apartment::lostModulator(int _modulatorBusID) {
initializeFromBus();
- }
+ } // lostModulator
void Apartment::modulatorReady(int _modulatorBusID) {
log("Modulator with id: " + intToString(_modulatorBusID) + " is ready");
@@ -951,6 +951,9 @@
modulatorReady(event.getParameter(0));
}
break;
+ case ModelEvent::etBusReady:
+ log("Got bus ready event.", lsInfo);
+ initializeFromBus();
default:
assert(false);
break;
Modified: dss/trunk/core/model.h
===================================================================
--- dss/trunk/core/model.h 2009-09-21 14:51:08 UTC (rev 8775)
+++ dss/trunk/core/model.h 2009-09-21 15:27:49 UTC (rev 8776)
@@ -727,7 +727,8 @@
etDSLinkInterrupt, /**< An interrupt has occured */
etNewModulator, /**< A new modulator has joined the bus */
etLostModulator, /**< We've lost a modulator on the bus */
- etModulatorReady /**< A modulator has completed its scanning cycle and is now ready */
+ etModulatorReady, /**< A modulator has completed its scanning cycle and is now ready */
+ etBusReady /**< The bus transitioned into ready state */
} EventType;
private:
EventType m_EventType;
Modified: dss/trunk/unix/ds485proxy.cpp
===================================================================
--- dss/trunk/unix/ds485proxy.cpp 2009-09-21 14:51:08 UTC (rev 8775)
+++ dss/trunk/unix/ds485proxy.cpp 2009-09-21 15:27:49 UTC (rev 8776)
@@ -1177,8 +1177,18 @@
void DS485Proxy::execute() {
signalEvent();
+
+ aControllerState lastState = m_DS485Controller.getState();
while(!m_Terminated) {
+ aControllerState currentState = m_DS485Controller.getState();
+ if(currentState != lastState) {
+ if((currentState == csSlave) || (currentState == csMaster)) {
+ ModelEvent* pEvent = new ModelEvent(ModelEvent::etBusReady);
+ getDSS().getApartment().addModelEvent(pEvent);
+ }
+ lastState = currentState;
+ }
if(!m_IncomingFrames.empty() || m_PacketHere.waitFor(50)) {
while(!m_IncomingFrames.empty()) {
m_IncomingFramesGuard.lock();
More information about the dss-commits
mailing list