Beispiel #1
0
void Datalink::copyData(const Datalink& org, const bool cc)
{
   BaseClass::copyData(org);
   if (cc) initData();

   noRadioMaxRange = org.noRadioMaxRange;
   radioId = org.radioId;
   useRadioIdFlg = org.useRadioIdFlg;

   sendLocal = org.sendLocal;
   queueForNetwork = org.queueForNetwork;

   {
      const Basic::String* p = 0;
      if (org.radioName != 0) {
         p = org.radioName->clone();
      }
      setRadioName( p );
      setRadio(0);
   }

   {
      const Basic::String* p = 0;
      if (org.tmName != 0) {
         p = org.tmName->clone();
      }
      setTrackManagerName( p );
      setTrackManager(0);
   }
}
Beispiel #2
0
//------------------------------------------------------------------------------
// 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);
      }
   }
}
Beispiel #3
0
//------------------------------------------------------------------------------
// 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] );
    }
}
Beispiel #4
0
//------------------------------------------------------------------------------
// shutdownNotification() -- We're shutting down
//------------------------------------------------------------------------------
bool Datalink::shutdownNotification()
{
   clearQueues();
   setRadio(0);
   setTrackManager(0);
   setTrackManagerName(0);

   return BaseClass::shutdownNotification();
}
//------------------------------------------------------------------------------
// shutdownNotification()
//------------------------------------------------------------------------------
bool RfSensor::shutdownNotification()
{
   setTrackManager(nullptr);
   setMasterMode(nullptr);

   if (modes != nullptr) {
       modes->unref();
       modes = nullptr;
    }

   return BaseClass::shutdownNotification();
}
Beispiel #6
0
void Datalink::deleteData()
{
   if (inQueue != 0 && outQueue != 0) {
      clearQueues();
      delete inQueue;
      delete outQueue;
      inQueue = 0;
      outQueue = 0;
   }
   setRadio(0);
   setRadioName(0);
   setTrackManager(0);
}
Beispiel #7
0
//------------------------------------------------------------------------------
// 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();
}
Beispiel #8
0
void Datalink::deleteData()
{
   if (inQueue != nullptr && outQueue != nullptr) {
      clearQueues();
      delete inQueue;
      delete outQueue;
      inQueue = nullptr;
      outQueue = nullptr;
   }
   setRadio(nullptr);
   setRadioName(nullptr);
   setTrackManager(nullptr);
   setTrackManagerName(nullptr);
}
Beispiel #9
0
//------------------------------------------------------------------------------
// shutdownNotification()
//------------------------------------------------------------------------------
bool IrSensor::shutdownNotification()
{
   setTrackManager(nullptr);
   clearTracksAndQueues();
   return BaseClass::shutdownNotification();
}
Beispiel #10
0
void IrSensor::deleteData()
{
   setTrackManager(nullptr);
   setTrackManagerName(nullptr);
   clearTracksAndQueues();
}