Logo Search packages:      
Sourcecode: hamlib version File versions  Download package

int HAMLIB_API rig_power2mW ( RIG rig,
unsigned int *  mwpower,
float  power,
freq_t  freq,
rmode_t  mode 

conversion utility from relative range to absolute in mW

rig The rig handle
mwpower The location where to store the converted power in mW
power The relative power
freq The frequency where the conversion should take place
mode The mode where the conversion should take place
Converts a power value expressed in a range on a [0.0 .. 1.0] relative scale to the real transmit power in milli Watts the radio would emit. The freq and mode where the conversion should take place must be also provided since the relative power is peculiar to a specific freq and mode range of the radio.

RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
See also:

Definition at line 2215 of file rig.c.

References caps, freq_range_list::high_power, rig_caps::power2mW, RIG_ECONF, RIG_EINVAL, rig_get_range(), RIG_OK, state, and rig_state::tx_range_list.

      const freq_range_t *txrange;

      if (!rig || !rig->caps || !mwpower || power<0.0 || power>1.0)
            return -RIG_EINVAL;

      if (rig->caps->power2mW != NULL)
            return rig->caps->power2mW(rig, mwpower, power, freq, mode);

      txrange = rig_get_range(rig->state.tx_range_list, freq, mode);
      if (!txrange) {
             * freq is not on the tx range!
            return -RIG_ECONF; /* could be RIG_EINVAL ? */
      *mwpower = (unsigned int)(power * txrange->high_power);
      return RIG_OK;

Generated by  Doxygen 1.6.0   Back to index