diff --git a/MAC/APL/StationCU/src/HardwareMonitor/ECMonitor.cc b/MAC/APL/StationCU/src/HardwareMonitor/ECMonitor.cc index 37a4ace390422986eaaa99fd48baa73dcf3a17d7..e28ed89b9ca5207fb50bde273a57a1ec90e9b62e 100644 --- a/MAC/APL/StationCU/src/HardwareMonitor/ECMonitor.cc +++ b/MAC/APL/StationCU/src/HardwareMonitor/ECMonitor.cc @@ -67,7 +67,8 @@ ECMonitor::ECMonitor(const string& cntlrName) : itsTimerPort (0), itsECPort (0), itsPollInterval (10), - itsNrCabs (4) + itsNrCabs (4), + itsStation (0) { LOG_TRACE_OBJ_STR (cntlrName << " construction"); @@ -197,15 +198,21 @@ GCFEvent::TResult ECMonitor::connect2EC(GCFEvent& event, GCFPortInterface& port) case F_ENTRY: // update PVSS itsOwnPropertySet->setValue(PN_FSM_CURRENT_ACTION, GCFPVString("EC:connecting")); - itsTimerPort->setTimer(2.0); // give database some time + itsTimerPort->cancelAllTimers(); + itsTimerPort->setTimer(3.0); // give database some time break; case F_CONNECTED: if (&port == itsECPort) { - LOG_DEBUG ("Connected with ECPort, going to get the status"); + LOG_DEBUG ("Connected with ECPort, going to get the status"); // itsOwnPropertySet->setValue(PN_FSM_ERROR, GCFPVString("")); - itsOwnPropertySet->setValue(PN_HWM_EC_CONNECTED,GCFPVBool(true)); - TRAN(ECMonitor::createPropertySets); // go to next state. + itsOwnPropertySet->setValue(PN_HWM_EC_CONNECTED,GCFPVBool(true)); + if (itsStation) { // After a reconnect, itsStation already exists + TRAN(ECMonitor::askSettings); + } + else { + TRAN(ECMonitor::createPropertySets); // go to next state. + } } break; @@ -251,27 +258,27 @@ GCFEvent::TResult ECMonitor::createPropertySets(GCFEvent& event, GCFPortInterfac switch (event.signal) { case F_ENTRY: { - itsOwnPropertySet->setValue(PN_FSM_CURRENT_ACTION,GCFPVString("EC:create PropertySets")); - // resize vectors. - itsCabs.resize (itsNrCabs, 0); - - string PSname(createPropertySetName(PSN_STATION_INFO, getName())); - itsStation = new RTDBPropertySet(PSname, PST_STATION_INFO, PSAT_WO | PSAT_CW, this); - itsStation->setConfirmation(false); - - string cabNameMask(createPropertySetName(PSN_CABINET, getName())); - for (int cab = 0; cab < itsNrCabs; cab++) { - if ((cab > (itsNrSystemCabs - 1)) && (cab != (itsNrCabs - 1))) { - itsCabs[cab] = 0; - } - else { - // allocate RCU PS - string PSname(formatString(cabNameMask.c_str(), cab)); - itsCabs[cab] = new RTDBPropertySet(PSname, PST_CABINET, PSAT_WO | PSAT_CW, this); - itsCabs[cab]->setConfirmation(false); - } - } - itsTimerPort->setTimer(5.0); // give database some time to finish the job + itsOwnPropertySet->setValue(PN_FSM_CURRENT_ACTION,GCFPVString("EC:create PropertySets")); + // resize vectors. + itsCabs.resize (itsNrCabs, 0); + + string PSname(createPropertySetName(PSN_STATION_INFO, getName())); + itsStation = new RTDBPropertySet(PSname, PST_STATION_INFO, PSAT_WO | PSAT_CW, this); + itsStation->setConfirmation(false); + + string cabNameMask(createPropertySetName(PSN_CABINET, getName())); + for (int cab = 0; cab < itsNrCabs; cab++) { + if ((cab > (itsNrSystemCabs - 1)) && (cab != (itsNrCabs - 1))) { + itsCabs[cab] = 0; + } + else { + // allocate RCU PS + string PSname(formatString(cabNameMask.c_str(), cab)); + itsCabs[cab] = new RTDBPropertySet(PSname, PST_CABINET, PSAT_WO | PSAT_CW, this); + itsCabs[cab]->setConfirmation(false); + } + } + itsTimerPort->setTimer(5.0); // give database some time to finish the job } break; @@ -352,7 +359,7 @@ GCFEvent::TResult ECMonitor::askSettings(GCFEvent& event, GCFPortInterface& port LOG_DEBUG_STR("EC_CMD_ACK: " << ack); sts_settings settings; memcpy(&settings, &ack.payload, ack.payloadSize); - + // move the information to the database. string infoStr; double value;