vendredi 24 juin 2016

How to allow device to support allocations for both RX_DIGITIZER and RX_DIGITIZER_CHANNELIZER?

I'm using CentOS 6.6 (64-bit) and RH 1.10.2

I have a waveform that requires a FRONTEND::TUNER device that is of type RX_DIGITIZER. I also have a 1.10.2 based device that is a RX_DIGITIZER_CHANNELIZER. This device has all the functionality that the waveform needs, but the waveform will not use it because of the different tuner type.

I see that it is not picked because FrontendTunerDevice<TunerStatusStructType>::allocateCapacity() (in fe_tuner_device.cpp) that my device inherits looks for an exact match on tuner_type.

I'm not seeing any elegant ways around this. Here are the two not so elegant ways I can see around it.

I can either completely override allocateCapacity and duplicate 95% of its logic, but explicitly accept both tuner types.

Or I can override allocateCapacity and modify the capabilities before passing to the superclass method. In pseudo-code:

CORBA::Boolean MyDevice::allocateCapacity(const CF::Properties & capacities)
{
   if ( capacities ask for RX_DITIGIZER ) {
      CF::Properties caps = capacities;
      change type to RX_DITIGIZER_CHANNELIZER
      return super::allocateCapacity(caps);
   } else {
      return super::allocateCapacity(capacities);
   }
}

Is there a better way?

Aucun commentaire:

Enregistrer un commentaire