kopia lustrzana https://github.com/Hamlib/Hamlib
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-79ac388436b8Hamlib-1.2.11
rodzic
7adf24115f
commit
18c31c61ad
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Hamlib Dummy backend - main file
|
* Hamlib Dummy backend - main file
|
||||||
* Copyright (c) 2001-2009 by Stephane Fillod
|
* 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 $
|
||||||
*
|
*
|
||||||
|
@ -1287,6 +1288,35 @@ static int dummy_send_morse(RIG *rig, vfo_t vfo, const char *msg)
|
||||||
return RIG_OK;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1465,6 +1495,8 @@ const struct rig_caps dummy_caps = {
|
||||||
.get_channel = dummy_get_channel,
|
.get_channel = dummy_get_channel,
|
||||||
.set_trn = dummy_set_trn,
|
.set_trn = dummy_set_trn,
|
||||||
.get_trn = dummy_get_trn,
|
.get_trn = dummy_get_trn,
|
||||||
|
.power2mW = dummy_power2mW,
|
||||||
|
.mW2power = dummy_mW2power,
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_INITRIG_BACKEND(dummy)
|
DECLARE_INITRIG_BACKEND(dummy)
|
||||||
|
|
Ładowanie…
Reference in New Issue