Пример #1
0
void __fastcall TRigCtlMain::FormShow( TObject */*Sender*/ )
{
   TIniFile * t = new TIniFile( ".\\Configuration\\RigSelect.ini" );
   mfg = t->ReadString( "RigControl", "Manufacturer", "NoMfG" );
   model = t->ReadString( "RigControl", "Model", "NoMoDeL" );
   delete t;
   makeRPCObjects();
   XMPPInitialise( "RigCtl" );
   rig_load_all_backends();

   selected = -1;
   int status = rig_list_foreach( print_model_list, NULL );
   if ( status != RIG_OK )
   {
      char buff[ 1024 ];
      sprintf( buff, "rig_list_foreach: error = %s \n", rigerror( status ) );
      trace( buff );
   }
   RigCombo->Sorted = true;

   if ( selected != -1 )
   {
      RigCombo->ItemIndex = RigCombo->Items->IndexOfObject( ( TObject * ) selected );
      RigSelectButtonClick( this );
   }
   else
      RigCombo->ItemIndex = 0;
}
Пример #2
0
void __fastcall TTestRigMain::FormShow( TObject */*Sender*/ )
{
   StartupTimer->Enabled = true;
   TIniFile * t = new TIniFile( ".\\Configuration\\RigSelect.ini" );
   mfg = t->ReadString( "TestRig", "Manufacturer", "NoMfG" );
   model = t->ReadString( "TestRig", "Model", "NoMoDeL" );
   delete t;
   rig_load_all_backends();

   selected = -1;
   int status = rig_list_foreach( print_model_list, NULL );
   if ( status != RIG_OK )
   {
      return ;
   }
   RigCombo->Sorted = true;

   if ( selected != -1 )
   {
      RigCombo->ItemIndex = RigCombo->Items->IndexOfObject( ( TObject * ) selected );
      RigSelectButtonClick( this );
   }
   else
      RigCombo->ItemIndex = 0;
}
Пример #3
0
void rigControl::getRadioList()
{
    if(!radiolistLoaded)
    {
        capsList.clear();
        rig_load_all_backends();
        rig_list_foreach(collect,0);
        qSort(capsList.begin(),capsList.end(),model_Sort);
        radiolistLoaded=true;
    }
}
Пример #4
0
RigList &RigThread::enumerate() {
    if (RigThread::rigCaps.empty()) {
        rig_set_debug(RIG_DEBUG_ERR);
        rig_load_all_backends();
        
        rig_list_foreach(RigThread::add_hamlib_rig, 0);
        std::sort(RigThread::rigCaps.begin(), RigThread::rigCaps.end(), rigGreater());
        std::cout << "Loaded " << RigThread::rigCaps.size() << " rig models via hamlib." << std::endl;
    }
    return RigThread::rigCaps;
}
GSList *riglist_get_list(void)
{
	if (riglist == NULL) {
		rig_set_debug(RIG_DEBUG_NONE);
		rig_load_all_backends();
		rig_set_debug(RIG_DEBUG_ERR);

		rig_list_foreach(riglist_make_list, NULL);
	}

	return riglist;
}
Пример #6
0
int main(int argc, char *argv[])
{
    RIG *my_rig;        /* handle to rig (nstance) */
    freq_t freq;        /* frequency  */
    rmode_t rmode;      /* radio mode of operation */
    pbwidth_t width;
    vfo_t vfo;          /* vfo selection */
    int strength;       /* S-Meter level */
    int rit = 0;        /* RIT status */
    int xit = 0;        /* XIT status */
    int retcode;        /* generic return code from functions */

    rig_model_t myrig_model;


    printf("testrig: Hello, I am your main() !\n");

    /* Turn off backend debugging ouput */
    rig_set_debug_level(RIG_DEBUG_NONE);

    /*
     * allocate memory, setup & open port
     */

    if (argc < 2)
    {
        hamlib_port_t myport;
        /* may be overriden by backend probe */
        myport.type.rig = RIG_PORT_SERIAL;
        myport.parm.serial.rate = 9600;
        myport.parm.serial.data_bits = 8;
        myport.parm.serial.stop_bits = 1;
        myport.parm.serial.parity = RIG_PARITY_NONE;
        myport.parm.serial.handshake = RIG_HANDSHAKE_NONE;
        strncpy(myport.pathname, SERIAL_PORT, FILPATHLEN - 1);

        rig_load_all_backends();
        myrig_model = rig_probe(&myport);
    }
    else
    {
        myrig_model = atoi(argv[1]);
    }

    my_rig = rig_init(myrig_model);

    if (!my_rig)
    {
        fprintf(stderr, "Unknown rig num: %d\n", myrig_model);
        fprintf(stderr, "Please check riglist.h\n");
        exit(1); /* whoops! something went wrong (mem alloc?) */
    }

    strncpy(my_rig->state.rigport.pathname, SERIAL_PORT, FILPATHLEN - 1);

    retcode = rig_open(my_rig);

    if (retcode != RIG_OK)
    {
        printf("rig_open: error = %s\n", rigerror(retcode));
        exit(2);
    }

    printf("Port %s opened ok\n", SERIAL_PORT);

    /*
     * Below are examples of set/get routines.
     * Must add checking of functionality map prior to command execution -- FS
     *
     */

    /*
     * Example of setting rig paameters
     * and some error checking on the return code.
     */

    retcode = rig_set_vfo(my_rig, RIG_VFO_B);


    if (retcode != RIG_OK)
    {
        printf("rig_set_vfo: error = %s \n", rigerror(retcode));
    }


    /*
     * Lets try some frequencies and modes. Return code is not checked.
     * Examples of checking return code are further down.
     *
     */

    /* 10m FM Narrow */

    printf("\nSetting 10m FM Narrow...\n");

    retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 29620000); /* 10m */
    retcode = rig_set_mode(my_rig, RIG_VFO_CURR, RIG_MODE_FM,
                           rig_passband_narrow(my_rig, RIG_MODE_FM));

    if (retcode != RIG_OK)
    {
        printf("rig_set_freq: error = %s \n", rigerror(retcode));
    }

    rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
    rig_get_mode(my_rig, RIG_VFO_CURR, &rmode, &width);

    printf(" Freq: %.6f MHz, Mode: %s, Passband: %.3f kHz\n\n",
           freq / 1000000,
           rig_strrmode(rmode),
           width / 1000.0);

    sleep(1);       /* so you can see it -- FS */

    /* 15m USB */

    printf("Setting 15m USB...\n");

    retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 21235175); /* 15m  */
    retcode = rig_set_mode(my_rig,
                           RIG_VFO_CURR,
                           RIG_MODE_USB,
                           rig_passband_normal(my_rig, RIG_MODE_USB));

    if (retcode != RIG_OK)
    {
        printf("rig_set_freq: error = %s \n", rigerror(retcode));
    }

    rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
    rig_get_mode(my_rig, RIG_VFO_CURR, &rmode, &width);

    printf(" Freq: %.6f MHz, Mode: %s, Passband: %.3f kHz\n\n",
           freq / 1000000, rig_strrmode(rmode), width / 1000.0);
    sleep(1);

    /* 40m LSB */

    printf("Setting 40m LSB...\n");

    retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 7250100); /* 40m  */
    retcode = rig_set_mode(my_rig,
                           RIG_VFO_CURR,
                           RIG_MODE_LSB,
                           RIG_PASSBAND_NORMAL);

    if (retcode != RIG_OK)
    {
        printf("rig_set_freq: error = %s \n", rigerror(retcode));
    }

    rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
    rig_get_mode(my_rig, RIG_VFO_CURR, &rmode, &width);

    printf(" Freq: %.6f MHz, Mode: %s, Passband: %.3f kHz\n\n",
           freq / 1000000,
           rig_strrmode(rmode),
           width / 1000.0);
    sleep(1);

    /* 80m AM Narrow */

    printf("Setting 80m AM Narrow...\n");

    retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 3885000); /* 80m  */
    retcode = rig_set_mode(my_rig,
                           RIG_VFO_CURR,
                           RIG_MODE_AM,
                           rig_passband_narrow(my_rig, RIG_MODE_AM));

    if (retcode != RIG_OK)
    {
        printf("rig_set_freq: error = %s \n", rigerror(retcode));
    }

    rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
    rig_get_mode(my_rig, RIG_VFO_CURR, &rmode, &width);

    printf(" Freq: %.6f MHz, Mode: %s, Passband: %.3f kHz\n\n",
           freq / 1000000,
           rig_strrmode(rmode),
           width / 1000.0);

    sleep(1);

    /* 160m CW Normal */

    printf("Setting 160m CW...\n");

    retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 1875000); /* 160m  */
    retcode = rig_set_mode(my_rig,
                           RIG_VFO_CURR,
                           RIG_MODE_CW,
                           RIG_PASSBAND_NORMAL);

    if (retcode != RIG_OK)
    {
        printf("rig_set_freq: error = %s \n", rigerror(retcode));
    }

    rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
    rig_get_mode(my_rig, RIG_VFO_CURR, &rmode, &width);

    printf(" Freq: %.3f kHz, Mode: %s, Passband: %li Hz\n\n",
           freq / 1000,
           rig_strrmode(rmode),
           width);

    sleep(1);

    /* 160m CW Narrow -- The band is noisy tonight -- FS*/

    printf("Setting 160m CW Narrow...\n");

    retcode = rig_set_mode(my_rig,
                           RIG_VFO_CURR,
                           RIG_MODE_CW,
                           rig_passband_narrow(my_rig, RIG_MODE_CW));

    if (retcode != RIG_OK)
    {
        printf("rig_set_freq: error = %s \n", rigerror(retcode));
    }

    rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
    rig_get_mode(my_rig, RIG_VFO_CURR, &rmode, &width);

    printf(" Freq: %.3f kHz, Mode: %s, Passband: %li Hz\n\n",
           freq / 1000,
           rig_strrmode(rmode),
           width);

    sleep(1);

    /* AM Broadcast band */

    printf("Setting Medium Wave AM...\n");

    retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 770000); /* KAAM */
    retcode = rig_set_mode(my_rig,
                           RIG_VFO_CURR,
                           RIG_MODE_AM,
                           RIG_PASSBAND_NORMAL);

    if (retcode != RIG_OK)
    {
        printf("rig_set_freq: error = %s \n", rigerror(retcode));
    }

    rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
    rig_get_mode(my_rig, RIG_VFO_CURR, &rmode, &width);

    printf(" Freq: %.3f kHz, Mode: %s, Passband: %.3f kHz\n\n",
           freq / 1000,
           rig_strrmode(rmode),
           width / 1000.0);

    sleep(1);

    /* 20m USB on VFO_A */

    printf("Setting 20m on VFO A with two functions...\n");

    retcode = rig_set_vfo(my_rig, RIG_VFO_A);
    retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 14250375); /* cq de vk3fcs */

    if (retcode != RIG_OK)
    {
        printf("rig_set_freq: error = %s \n", rigerror(retcode));
    }

    rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
    rig_get_vfo(my_rig, &vfo);

    printf(" Freq: %.6f MHz, VFO: %s\n\n", freq / 1000000, rig_strvfo(vfo));

    sleep(1);

    /* 20m USB on VFO_A , with only 1 call */

    printf("Setting  20m on VFO A with one function...\n");
    retcode = rig_set_freq(my_rig, RIG_VFO_A, 14295125); /* cq de vk3fcs */

    if (retcode != RIG_OK)
    {
        printf("rig_set_freq: error = %s \n", rigerror(retcode));
    }

    rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
    rig_get_vfo(my_rig, &vfo);

    printf(" Freq: %.6f MHz, VFO: %s\n\n", freq / 1000000, rig_strvfo(vfo));

    sleep(1);


#if 0
    retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 145100000); /* 2m  */
    sleep(2);
    retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 435125000); /* 70cm  */
    sleep(2);
#endif

    printf("Setting rig Mode to LSB.\n");
    retcode = rig_set_mode(my_rig,
                           RIG_VFO_CURR,
                           RIG_MODE_LSB,
                           RIG_PASSBAND_NORMAL);

    if (retcode != RIG_OK)
    {
        printf("rig_set_mode: error = %s \n", rigerror(retcode));
    }

    sleep(1);

    printf("Setting rig PTT ON.\n");
    retcode = rig_set_ptt(my_rig, RIG_VFO_A, RIG_PTT_ON);  /* stand back ! */

    if (retcode != RIG_OK)
    {
        printf("rig_set_ptt: error = %s \n", rigerror(retcode));
    }

    sleep(1);

    printf("Setting rig PTT OFF.\n");
    retcode = rig_set_ptt(my_rig, RIG_VFO_A, RIG_PTT_OFF);  /* phew ! */

    if (retcode != RIG_OK)
    {
        printf("rig_set_ptt: error = %s \n", rigerror(retcode));
    }

    sleep(1);

    /*
     * Simple examples of getting rig information -- FS
     *
     */

    printf("\nGet various raw rig values:\n");
    retcode = rig_get_vfo(my_rig, &vfo); /* try to get vfo info */

    if (retcode == RIG_OK)
    {
        printf("rig_get_vfo: vfo = %i \n", vfo);
    }
    else
    {
        printf("rig_get_vfo: error =  %s \n", rigerror(retcode));
    }

    retcode = rig_get_freq(my_rig, RIG_VFO_CURR, &freq);

    if (retcode == RIG_OK)
    {
        printf("rig_get_freq: freq = %"PRIfreq"\n", freq);
    }
    else
    {
        printf("rig_get_freq: error =  %s \n", rigerror(retcode));
    }

    retcode = rig_get_mode(my_rig, RIG_VFO_CURR, &rmode, &width);

    if (retcode == RIG_OK)
    {
        printf("rig_get_mode: mode = %"PRIll"\n", rmode);
    }
    else
    {
        printf("rig_get_mode: error =  %s \n", rigerror(retcode));
    }

    retcode = rig_get_strength(my_rig, RIG_VFO_CURR, &strength);

    if (retcode == RIG_OK)
    {
        printf("rig_get_strength: strength = %i \n", strength);
    }
    else
    {
        printf("rig_get_strength: error =  %s \n", rigerror(retcode));
    }

    if (rig_has_set_func(my_rig, RIG_FUNC_RIT))
    {
        retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_RIT, 1);
        printf("rig_set_func: Setting RIT ON\n");
    }

    if (rig_has_get_func(my_rig, RIG_FUNC_RIT))
    {
        retcode = rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_RIT, &rit);
        printf("rig_get_func: RIT: %d\n", rit);
    }

    if (rig_has_set_func(my_rig, RIG_FUNC_XIT))
    {
        retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_XIT, 1);
        printf("rig_set_func: Setting XIT ON\n");
    }

    if (rig_has_get_func(my_rig, RIG_FUNC_XIT))
    {
        retcode = rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_XIT, &xit);
        printf("rig_get_func: XIT: %d\n", xit);
    }

    rig_close(my_rig); /* close port */
    rig_cleanup(my_rig); /* if you care about memory */

    printf("port %s closed ok \n", SERIAL_PORT);

    return 0;
}
Пример #7
0
int main(int argc, char *argv[])
{
    time_t gentime;
    int set_or_get;
    int i;
    char *pbuf, prntbuf[512];

    rig_load_all_backends();


    printf("<TABLE BORDER=1>");
    printf("<TR><TD>Model</TD><TD>Mfg</TD><TD>Vers.</TD><TD>Status</TD>"
           "<TD>Type</TD><TD>Freq. range</TD><TD>Parameters</TD>"
           "<TD>Capabilities</TD>"
           "<TD>Get func</TD>"
           "<TD>Set func</TD>"
           "<TD>Get level</TD>"
           "<TD>Set level</TD>"
           "<TD>Get parm</TD>"
           "<TD>Set parm</TD>"
           "</TR>\n");
    rig_list_foreach(print_caps_sum, NULL);
    printf("</TABLE>\n");

    printf("<P>");

    printf("<TABLE BORDER=1>\n");
    printf("<TR><TD>Model</TD><TD>PTT</TD><TD>DCD</TD><TD>Port</TD>"
           "<TD>Speed min</TD><TD>Speed max</TD>"
           "<TD>Parm.</TD><TD>Handshake</TD><TD>Write delay</TD>"
           "<TD>Post delay</TD><TD>Timeout</TD><TD>Retry</TD></TR>\n");
    rig_list_foreach(print_caps_parameters, NULL);
    printf("</TABLE>\n");

    printf("<P>");

    printf("<TABLE BORDER=1>\n");
    printf("<TR><TD>Model</TD><TD>Freq. range</TD></TR>\n");
    rig_list_foreach(print_caps_range, NULL);
    printf("</TABLE>\n");

    printf("<P>");

    printf("<TABLE BORDER=1>\n");
    printf("<TR><TD>Model</TD><TD>Target VFO</TD>"
           "<TD>Set freq</TD><TD>Get freq</TD>"
           "<TD>Set mode</TD><TD>Get mode</TD>"
           "<TD>Set VFO</TD><TD>Get VFO</TD>"
           "<TD>Set PTT</TD><TD>Get PTT</TD><TD>Get DCD</TD>"
           "<TD>Set rptr shift</TD><TD>Get rptr shift</TD>"
           "<TD>Set rptr offs</TD><TD>Get rptr offs</TD>"
           "<TD>Set split frq</TD><TD>Get split frq</TD>"
           "<TD>Set split</TD><TD>Get split</TD>"
           "<TD>Set ts</TD><TD>Get ts</TD>"
           "<TD>Set CTCSS</TD><TD>Get CTCSS</TD>"
           "<TD>Set DCS</TD><TD>Get DCS</TD>"
           "<TD>Set Power Stat</TD><TD>Get Power Stat</TD>"
           "<TD>Set trn</TD><TD>Get trn</TD>"
           "<TD>Decode</TD><TD>Get info</TD>"
           "</TR>\n");
    rig_list_foreach(print_caps_caps, NULL);
    printf("</TABLE>\n");

    printf("<P>");

    bitmap_func = 0;
    prntbuf[0] = '\0';
    pbuf = prntbuf;

    for (i = 0; i < RIG_SETTING_MAX; i++)
    {
        setting_t func = rig_idx2setting(i);
        const char *s = rig_strfunc(func);

        if (!s)
        {
            continue;
        }

        bitmap_func |= func;
        pbuf += sprintf(pbuf, "<TD>%s</TD>", s);
    }

    printf("Has set func");
    printf("<TABLE BORDER=1>\n");
    printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
    set_or_get = 1;
    rig_list_foreach(print_caps_func, &set_or_get);
    printf("</TABLE>\n");

    printf("<P>");

    printf("Has get func");
    printf("<TABLE BORDER=1>\n");
    printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
    set_or_get = 0;
    rig_list_foreach(print_caps_func, &set_or_get);
    printf("</TABLE>\n");

    printf("<P>");

    bitmap_level = 0;
    prntbuf[0] = '\0';
    pbuf = prntbuf;

    for (i = 0; i < RIG_SETTING_MAX; i++)
    {
        setting_t level = rig_idx2setting(i);
        const char *s = rig_strlevel(level);

        if (!s)
        {
            continue;
        }

        bitmap_level |= level;
        pbuf += sprintf(pbuf, "<TD>%s</TD>", s);
    }

    printf("Set level");
    printf("<TABLE BORDER=1>\n");
    printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
    set_or_get = 1;
    rig_list_foreach(print_caps_level, &set_or_get);
    printf("</TABLE>\n");

    printf("<P>");

    printf("Get level");
    printf("<TABLE BORDER=1>\n");
    printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
    set_or_get = 0;
    rig_list_foreach(print_caps_level, &set_or_get);
    printf("</TABLE>\n");

    printf("<P>");

    bitmap_parm = 0;
    prntbuf[0] = '\0';
    pbuf = prntbuf;

    for (i = 0; i < RIG_SETTING_MAX; i++)
    {
        setting_t parm = rig_idx2setting(i);
        const char *s = rig_strparm(parm);

        if (!s)
        {
            continue;
        }

        bitmap_parm |= parm;
        pbuf += sprintf(pbuf, "<TD>%s</TD>", s);
    }

    printf("Set parm");
    printf("<TABLE BORDER=1>\n");
    printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
    set_or_get = 1;
    rig_list_foreach(print_caps_parm, &set_or_get);
    printf("</TABLE>\n");

    printf("<P>");

    printf("Get parm");
    printf("<TABLE BORDER=1>\n");
    printf("<TR><TD>Model</TD>%s</TR>\n", prntbuf);
    set_or_get = 0;
    rig_list_foreach(print_caps_parm, &set_or_get);
    printf("</TABLE>\n");

    printf("<P>");

    time(&gentime);
    printf("Rigmatrix generated %s by %s\n", ctime(&gentime), getenv("USER"));

    printf("</body></html>\n");

    return 0;
}
Пример #8
0
int main(int argc, char *argv[]) {
    RIG *my_rig;
    char *rig_file, *info_buf, *mm;
    freq_t freq;
    value_t rawstrength, power, strength;
    float s_meter, rig_raw2val();
    int status, retcode, isz;
    unsigned int mwpower;
    rmode_t mode;
    pbwidth_t width;
    rig_model_t myrig_model;
    char portname[64];
    port_t myport;

    strncpy(portname, argv[2], 63);
    portname[63] = '\0';

    if ((strcmp(argv[2], "--help") == 0) || (argc < 2)) {
        printf("use like: ./%s <portname>\n", argv[0]);
        printf("example:  ./%s /dev/ttyS0\n", argv[0]);
        return 0;
    }

    /* Try to detect rig */
    /* may be overridden by backend probe */
    myport.type.rig = RIG_PORT_SERIAL;
    myport.parm.serial.rate = 9600;
    myport.parm.serial.data_bits = 8;
    myport.parm.serial.stop_bits = 1;
    myport.parm.serial.parity = RIG_PARITY_NONE;
    myport.parm.serial.handshake = RIG_HANDSHAKE_NONE;
    strncpy(myport.pathname, portname, FILPATHLEN);

    rig_load_all_backends();
    myrig_model = rig_probe(&myport);
    /* Set verbosity level - errors only */
    rig_set_debug(RIG_DEBUG_ERR);
    /* Instantiate a rig - your rig */
    /* my_rig = rig_init(RIG_MODEL_TT565); */
    my_rig = rig_init(myrig_model);
    /* Set up serial port, baud rate - serial device + baudrate */
    rig_file = "/dev/ttyUSB0";
    strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN - 1);
    my_rig->state.rigport.parm.serial.rate = 57600;
    my_rig->state.rigport.parm.serial.rate = 9600;
    /* Open my rig */
    retcode = rig_open(my_rig);
    printf("retcode of rig_open = %d \n", retcode);
    /* Give me ID info, e.g., firmware version. */
    info_buf = (char *)rig_get_info(my_rig);
    printf("Rig_info: '%s'\n", info_buf);

    /* Note: As a general practice, we should check to see if a given
     * function is within the rig's capabilities before calling it, but
     * we are simplifying here. Also, we should check each call's returned
     * status in case of error. (That's an inelegant way to catch an unsupported
     * operation.)
     */

    /* Main VFO frequency */
    status = rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
    printf("status of rig_get_freq = %d \n", status);
    printf("VFO freq. = %.1f Hz\n", freq);
    /* Current mode */
    status = rig_get_mode(my_rig, RIG_VFO_CURR, &mode, &width);
    printf("status of rig_get_mode = %d \n", status);
    switch(mode) {
        case RIG_MODE_USB: mm = "USB"; break;
        case RIG_MODE_LSB: mm = "LSB"; break;
        case RIG_MODE_CW:  mm = "CW"; break;
        case RIG_MODE_CWR: mm = "CWR"; break;
        case RIG_MODE_AM:  mm = "AM"; break;
        case RIG_MODE_FM:  mm = "FM"; break;
        case RIG_MODE_WFM: mm = "WFM"; break;
        case RIG_MODE_RTTY:mm = "RTTY"; break;
        default: mm = "unrecognized"; break; /* there are more possibilities! */
        }
    printf("Current mode = 0x%X = %s, width = %d\n", mode, mm, (int) width);
    /* rig power output */
    status = rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RFPOWER, &power);
    printf("RF Power relative setting = %.3f (0.0 - 1.0)\n", power.f);
    /* Convert power reading to watts */
    status = rig_power2mW(my_rig, &mwpower, power.f, freq, mode);
    printf("RF Power calibrated = %.1f Watts\n", mwpower/1000.);
    /* Raw and calibrated S-meter values */
    status = rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RAWSTR, &rawstrength);
    printf("Raw receive strength = %d\n", rawstrength.i);
    isz = my_rig->caps->str_cal.size;
    printf("isz = %d \n", isz);
    s_meter = rig_raw2val(rawstrength.i, &my_rig->caps->str_cal);
    printf("S-meter value = %.2f dB relative to S9\n", s_meter);
    /* now try using RIG_LEVEL_STRENGTH itself */
    status = rig_get_strength(my_rig, RIG_VFO_CURR, &strength);
    printf("status of rig_get_strength = %d \n", status);
    printf("LEVEL_STRENGTH returns %d\n", strength.i);
return 0;
}