Beispiel #1
0
void FCDProInput::set_gain6(int index)
{
	if ((index < 0) || (index >= FCDProConstants::fcdpro_if_gain6_nb_values()))
	{
		return;
	}

	quint8 cmd_value = FCDProConstants::if_gains6[index].value;

	if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_GAIN6, &cmd_value, 1) != FCD_MODE_APP)
	{
		qWarning() << "FCDProPlusInput::set_gain6: failed to set at " << cmd_value;
	}
}
Beispiel #2
0
void FCDProInput::set_biasCurrent(int index)
{
	if ((index < 0) || (index >= FCDProConstants::fcdpro_bias_current_nb_values()))
	{
		return;
	}

	quint8 cmd_value = FCDProConstants::bias_currents[index].value;

	if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_BIAS_CURRENT, &cmd_value, 1) != FCD_MODE_APP)
	{
		qWarning() << "FCDProPlusInput::set_biasCurrent: failed to set at " << cmd_value;
	}
}
Beispiel #3
0
void FCDProInput::set_rcFilter(int index)
{
	if ((index < 0) || (index >= FCDProConstants::fcdpro_if_rc_filter_nb_values()))
	{
		return;
	}

	quint8 cmd_value = FCDProConstants::if_rc_filters[index].value;

	if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_IF_RC_FILTER, &cmd_value, 1) != FCD_MODE_APP)
	{
		qWarning() << "FCDProPlusInput::set_rcFilter: failed to set at " << cmd_value;
	}
}
Beispiel #4
0
void FCDProInput::set_band(int index)
{
	if ((index < 0) || (index >= FCDProConstants::fcdpro_band_nb_values()))
	{
		return;
	}

	quint8 cmd_value = FCDProConstants::bands[index].value;

	if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_BAND, &cmd_value, 1) != FCD_MODE_APP)
	{
		qWarning() << "FCDProPlusInput::set_band: failed to set at " << cmd_value;
	}
}
Beispiel #5
0
void FCDProInput::set_mixerGain(int index)
{
	if ((index < 0) || (index >= FCDProConstants::fcdpro_mixer_gain_nb_values()))
	{
		return;
	}

	quint8 cmd_value = FCDProConstants::mixer_gains[index].value;

	if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_MIXER_GAIN, &cmd_value, 1) != FCD_MODE_APP)
	{
		qWarning() << "FCDProPlusInput::set_mixerGain: failed to set at " << cmd_value;
	}
}
Beispiel #6
0
void FCDProInput::set_lnaEnhance(int index)
{
	if ((index < 0) || (index >= FCDProConstants::fcdpro_lna_enhance_nb_values()))
	{
		return;
	}

	quint8 cmd_value = FCDProConstants::lna_enhances[index].value;

	if (fcdAppSetParam(m_dev, FCDPRO_HID_CMD_SET_LNA_ENHANCE, &cmd_value, 1) != FCD_MODE_APP)
	{
		qWarning() << "FCDProPlusInput::set_lnaEnhance: failed to set at " << cmd_value;
	}
}
Beispiel #7
0
void FCDProPlusInput::set_rf_filter(int filterIndex)
{
	if ((filterIndex < 0) || (filterIndex >= FCDProPlusConstants::fcdproplus_rf_filter_nb_values()))
	{
		return;
	}

	quint8 cmd_value = FCDProPlusConstants::rf_filters[filterIndex].value;

	if (fcdAppSetParam(m_dev, FCDPROPLUS_HID_CMD_SET_RF_FILTER, &cmd_value, 1) != FCD_MODE_APP)
	{
		qWarning() << "FCDProPlusInput::set_rf_filter: failed to set at " << cmd_value;
	}
}
Beispiel #8
0
void FCDProPlusInput::set_if_gain(int gain)
{
	if (gain < 0)
	{
		return;
	}

	quint8 cmd_value = gain;

	if (fcdAppSetParam(m_dev, FCDPROPLUS_HID_CMD_SET_IF_GAIN, &cmd_value, 1) != FCD_MODE_APP)
	{
		qWarning() << "FCDProPlusInput::set_if_gain: failed to set at " << cmd_value;
	}
}
Beispiel #9
0
int main(int argc, char* argv[])
{
    int stat;
    int freq = 0;
    double freqf = 0;
    int gain = -999;
    int corr = 0;
    int dolist = 0;
    int dostatus = 0;

    /* getopt infrastructure */
    int next_option;
    const char* const short_options = "slg:f:c:i:h";
    const struct option long_options[] =
    {
        { "status", 0, NULL, 's' },
        { "list", 0, NULL, 'l' },
        { "frequency", 1, NULL, 'f' },
        { "index", 1, NULL, 'i' },
        { "gain", 1, NULL, 'g' },
        { "correction", 1, NULL, 'c' },
        { "help", 0, NULL, 'h' }
    };


    /* save program name */
    program_name = argv[0];

    if (argc == 1)
    {
        print_help();
        exit(EXIT_SUCCESS);
    }

    while(1)
    {
        /* call getopt */
        next_option = getopt_long(argc, argv, short_options, long_options, NULL);

        /* end of the options */
        if (next_option == -1)
            break;

        switch (next_option)
        {
            case 'h' :
                print_help();
                exit(EXIT_SUCCESS);
            case 's' :
                dostatus=1;
                break;
            case 'l' :
                dolist=1;
                break;
            case 'f' :
                freqf = atof(optarg);
                break;
            case 'g' :
                gain = atoi(optarg);
                break;
            case 'i' :
                whichdongle = atoi(optarg);
                break;
            case 'c' :
                corr = atoi(optarg);
                break;
            case '?' :
                print_help();
                exit(1);
            default :
                abort();
        }	
    }

    if (freqf>0) {
        /* MHz -> Hz */
        freq = (int)(freqf * 1.0e6f);

        /* calculate frequency */
        freq *= 1.0 + corr / 1000000.0;

        /* set it */
        stat = fcdAppSetFreq(freq);
        if (stat == FCD_MODE_NONE)
        {
            printf("No FCD Detected.\n");
            return 1;
        }
        else if (stat == FCD_MODE_BL)
        {
            printf("FCD in bootloader mode.\n");
            return 1;
        }
        else	
        {
            printf("Freq set to %.6f MHz.\n", freq/1e6);
        }
    }

    if (gain>-999) {
        unsigned char b=0;
#ifdef FCDPP
        b = gain ? 1 : 0;
#else
        while (b<sizeof(lnagainvalues)/sizeof(lnagainvalues[0]) && gain>lnagainvalues[b]+1) b++;
#endif
        stat = fcdAppSetParam(FCD_CMD_APP_SET_LNA_GAIN,&b,1);
        if (stat == FCD_MODE_NONE) { printf("No FCD Detected.\n"); return 1; }
        else if (stat == FCD_MODE_BL) { printf("FCD in bootloader mode.\n"); return 1; }
#ifdef FCDPP
        else printf("LNA gain %s.\n", b ? "enabled" : "disabled");
#else
        else printf("LNA gain set to %g dB.\n",lnagainvalues[b]);
Beispiel #10
0
void FCDProPlusInput::set_mixer_gain(bool on)
{
	quint8 cmd = on ? 1 : 0;

	fcdAppSetParam(m_dev, FCDPROPLUS_HID_CMD_SET_MIXER_GAIN, &cmd, 1);
}
Beispiel #11
0
void FCDProPlusInput::set_bias_t(bool on)
{
	quint8 cmd = on ? 1 : 0;

	fcdAppSetParam(m_dev, FCDPROPLUS_HID_CMD_SET_BIAS_TEE, &cmd, 1);
}