Example #1
0
void FCDProPlusInput::set_center_freq(double freq)
{
	freq += freq*(((double) m_settings.m_LOppmTenths)/10000000.0);

	if (fcdAppSetFreq(m_dev, freq) == FCD_MODE_NONE)
	{
		qDebug("No FCD HID found for frquency change");
	}
}
Example #2
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]);
Example #3
0
int main(int argc, char* argv[])
{
	int stat;
	int freq = 0;
	int corr = 0;

	/* getopt infrastructure */
	int next_option;
	const char* const short_options = "sf:c:h";
	const struct option long_options[] =
	{
		{ "status", 0, NULL, 's' },
		{ "frequency", 1, NULL, 'f' },
		{ "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' :
				print_status();
				exit(EXIT_SUCCESS);
			case 'f' :
				freq = atoi(optarg);
				break;
			case 'c' :
				corr = atoi(optarg);
				break;
			case '?' :
				print_help();
				exit(1);
			default :
				abort();
		}	
	}

	/* 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 %d.\n", freq);
		return EXIT_SUCCESS;
	}

	return EXIT_SUCCESS;


}