Added backend functions for power2mW and mW2power frontend support.

Backend pretends to be a 100W radio.



git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2826 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.11
Nate Bargmann, N0NB 2010-02-06 15:28:25 +00:00
rodzic 7adf24115f
commit 18c31c61ad
1 zmienionych plików z 56 dodań i 24 usunięć

Wyświetl plik

@ -1,8 +1,9 @@
/*
* Hamlib Dummy backend - main file
* Copyright (c) 2001-2009 by Stephane Fillod
* Copyright (c) 2010 by Nate Bargmann
*
* $Id: dummy.c,v 1.44 2009-02-06 17:27:54 fillods Exp $
* $Id: dummy.c,v 1.44 2009-02-06 17:27:54 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -1287,6 +1288,35 @@ static int dummy_send_morse(RIG *rig, vfo_t vfo, const char *msg)
return RIG_OK;
}
static int dummy_power2mW(RIG * rig, unsigned int *mwpower, float power,
freq_t freq, rmode_t mode)
{
rig_debug(RIG_DEBUG_TRACE, "%s: passed power = %f\n", __func__, power);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, mode);
/* Pretend this is a 100W radio */
*mwpower = (power * 100000);
return RIG_OK;
}
static int dummy_mW2power(RIG * rig, float *power, unsigned int mwpower,
freq_t freq, rmode_t mode)
{
rig_debug(RIG_DEBUG_TRACE, "%s: passed mwpower = %i\n", __func__, mwpower);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, mode);
/* Pretend this is a 100W radio */
if (mwpower > 100000)
return -RIG_EINVAL;
*power = ((float)mwpower / 100000);
return RIG_OK;
}
/*
@ -1370,8 +1400,8 @@ const struct rig_caps dummy_caps = {
.attenuator = { 10, 20, 30, RIG_DBLST_END, },
.preamp = { 10, RIG_DBLST_END, },
.rx_range_list2 = { {.start=kHz(150),.end=MHz(1500),.modes=DUMMY_MODES,
.low_power=-1,.high_power=-1,RIG_VFO_A|RIG_VFO_B, RIG_ANT_1|RIG_ANT_2},
RIG_FRNG_END, },
.low_power=-1,.high_power=-1,RIG_VFO_A|RIG_VFO_B, RIG_ANT_1|RIG_ANT_2},
RIG_FRNG_END, },
.tx_range_list2 = { RIG_FRNG_END, },
.tuning_steps = { {DUMMY_MODES,1}, {DUMMY_MODES,RIG_TS_ANY}, RIG_TS_END, },
.filters = {
@ -1465,6 +1495,8 @@ const struct rig_caps dummy_caps = {
.get_channel = dummy_get_channel,
.set_trn = dummy_set_trn,
.get_trn = dummy_get_trn,
.power2mW = dummy_power2mW,
.mW2power = dummy_mW2power,
};
DECLARE_INITRIG_BACKEND(dummy)