diff --git a/MAC/APL/StationCU/src/StationControl/StationControl.cc b/MAC/APL/StationCU/src/StationControl/StationControl.cc index d2b4141d0494e67b7af7328b0bee8e5ad1df9f76..f5c463f9d3b4cfe6deadc78859a716bab66115de 100644 --- a/MAC/APL/StationCU/src/StationControl/StationControl.cc +++ b/MAC/APL/StationCU/src/StationControl/StationControl.cc @@ -700,7 +700,7 @@ GCFEvent::TResult StationControl::operational_state(GCFEvent& event, GCFPortInte // In the claim state station-wide changes are activated. if (event.signal == CONTROL_CLAIM) { - if (itsClaimSequence == 0) { + if (itsStartingObs != theObs) { itsStartingObs = theObs; TRAN(StationControl::startObservation_state); queueTaskEvent(event, port); @@ -788,6 +788,12 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor */ switch (event.signal) { + case F_ENTRY: { + itsClaimSequence = 1; + itsClaimTimerPort->setTimer(0.0); + } + break; + case CONTROL_CLAIM: { // defer the setup to the timer eventa // NOTE: StationControl can receive multiple CLAIM requests. Example: @@ -795,10 +801,19 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor // * Station receives PREPARE (due to state sync errors?) // * Station will replay PREPARE -> CLAIM // So we ONLY start the ClaimTimer if the ClaimSequence was not yet started - if (itsClaimSequence == 0) { - itsClaimSequence++; - itsClaimTimerPort->setTimer(0.0); - } + CONTROLCommonEvent ObsEvent(event); // we just need the name + uint16 instanceNr = getInstanceNr(ObsEvent.cntlrName); + OTDBtreeIDType treeID = getObservationNr(ObsEvent.cntlrName); + string cntlrName = controllerName(CNTLRTYPE_STATIONCTRL, + instanceNr, treeID); + CTState CTS; + ObsIter theObs = itsObsMap.find(cntlrName); + + if (theObs != itsStartingObs) { + // CLAIM is for a different observation + LOG_DEBUG_STR("Postponing event " << eventName(event) << " till operational state"); + return (GCFEvent::NEXT_STATE); + } } break; @@ -952,7 +967,6 @@ GCFEvent::TResult StationControl::startObservation_state(GCFEvent& event, GCFPor } break; - case F_ENTRY: case F_EXIT: break;