//------------------------------------------------------------------------------ // reset() -- Reset parameters //------------------------------------------------------------------------------ void RfSensor::reset() { BaseClass::reset(); // --- // Do we need to find the track manager? // --- if (getTrackManager() == 0 && getTrackManagerName() != 0 && getOwnship() != 0) { // We have a name of the track manager, but not the track manager itself const char* name = *getTrackManagerName(); // Get the named track manager from the onboard computer OnboardComputer* obc = getOwnship()->getOnboardComputer(); if (obc != 0) { setTrackManager( obc->getTrackManagerByName(name) ); } if (getTrackManager() == 0) { // The assigned track manager was not found! std::cerr << "RfSensor::reset() ERROR -- track manager, " << name << ", was not found!" << std::endl; setTrackManagerName(0); } } scanning = false; scanBar = 0; if (nRanges > 0 && ranges != 0) { rngIdx = 1; if (initRngIdx >= 1 && initRngIdx <= nRanges) { rngIdx = initRngIdx; } setRange( ranges[rngIdx-1] ); } }
//------------------------------------------------------------------------------ // updateData() -- update background data here //------------------------------------------------------------------------------ void IrSensor::updateData(const double dt) { BaseClass::updateData(dt); // --- // Do we need to find the track manager? // --- if (getTrackManager() == nullptr && getTrackManagerName() != nullptr && getOwnship() != nullptr) { // We have a name of the track manager, but not the track manager itself const char* name = *getTrackManagerName(); // Get the named track manager from the onboard computer OnboardComputer* obc = getOwnship()->getOnboardComputer(); if (obc != nullptr) { setTrackManager( obc->getTrackManagerByName(name) ); } if (getTrackManager() == nullptr) { // The assigned track manager was not found! if (isMessageEnabled(MSG_ERROR)) { std::cerr << "IrSensor::reset() ERROR -- track manager, " << name << ", was not found!" << std::endl; } setTrackManagerName(nullptr); } } }
//------------------------------------------------------------------------------ // reset() -- Reset parameters //------------------------------------------------------------------------------ void Datalink::reset() { clearQueues(); // --- // Do we need to find the track manager? // --- if (getTrackManager() == 0 && getTrackManagerName() != 0) { // We have a name of the track manager, but not the track manager itself const char* name = *getTrackManagerName(); // Get the named track manager from the onboard computer Player* ownship = dynamic_cast<Player*>( findContainerByType(typeid(Player)) ); if (ownship != 0) { OnboardComputer* obc = ownship->getOnboardComputer(); if (obc != 0) { setTrackManager(obc->getTrackManagerByName(name)); } } if (getTrackManager() == 0) { // The assigned track manager was not found! //if (isMessageEnabled(MSG_ERROR)) { //std::cerr << "Datalink ERROR -- track manager, " << name << ", was not found!" << std::endl; //} } } // --- // Do we need to find the comm radio? // --- if (getRadio() == 0 && getRadioName() != 0) { // We have a name of the radio, but not the radio itself const char* name = *getRadioName(); // Get the named radio from the component list of radios Player* ownship = dynamic_cast<Player*>( findContainerByType(typeid(Player)) ); if (ownship != 0) { CommRadio* cr = dynamic_cast<CommRadio*>(ownship->getRadioByName(name)); setRadio(cr); } CommRadio* rad = getRadio(); if (rad == 0) { // The assigned radio was not found! if (isMessageEnabled(MSG_ERROR)) { std::cerr << "Datalink ERROR -- radio, " << name << ", was not found!" << std::endl; } } else { rad->setDatalink(this); rad->setReceiverEnabledFlag(true); rad->setTransmitterEnableFlag(true); } } BaseClass::reset(); }