Menu

Hamlib Retrieve Supported Rigs

Help
2023-12-19
2023-12-19
  • John William Gardner

    Hello Hamlib community!

    I have posted here once about an issue with rig numbering (which has been fixed with the help here). As stated prior, I am using Hamlib in C on Debian Stretch.

    I was wondering if there was an existing method that could return a list of all supported models. I looked into riglist.h and noticed how there was a method referenced in the comments called "foreach_opened_rig". However, I couldn't find any reference to it. Am I looking in the wrong place?

    I should note that I also looked into the discussion archives and found this nice post (https://sourceforge.net/p/hamlib/mailman/message/8188949/). However, was having a little trouble converting the rig model and code parsing lines from Python to C.

    EDIT: So, after some digging, I was able to find where "foreach_opened_rig" resides. However, I am still having a little trouble trying to utilize it. I have provided my simple demo code. I include stdio.h and hamlib/rig.h at the top.

    Code:
    void print_rig_info(RIG rig) {
    printf("Rig Model: %s\n", rig_get_info(rig)->rig_model);
    }
    int main() {
    foreach_opened_rig((int (
    )(RIG *, rig_ptr_t))print_rig_info, NULL);
    return 0;
    }

    The errors I am getting are:
    * hamlib-pull-radios.c:5:48: error: request for member ‘rig_model’ in something not a structure or union
    * hamlib-pull-radios.c:9:5: warning: implicit declaration of function ‘foreach_opened_rig’

    Any ideas?

    Thanks!
    William Gardner KI5SZM

     

    Last edit: John William Gardner 2023-12-19
    • Michael Black

      Michael Black - 2023-12-19

      Take a look at testrigopen.c -- does more then just show the model but that part is all extra code.

      Mike W9MDB

      On Monday, December 18, 2023 at 11:52:24 PM CST, John William Gardner william-gardner@users.sourceforge.net wrote:

      Hello Hamlib community!

      I have posted here once about an issue with rig numbering (which has been fixed with the help here). As stated prior, I am using Hamlib in C on Debian Stretch.

      I was wondering if there was an existing method that could return a list of all supported models. I looked into riglist.h and noticed how there was a method referenced in the comments called "foreach_opened_rig". However, I couldn't find any reference to it. Am I looking in the wrong place?

      I should note that I also looked into the discussion archives and found this nice post (https://sourceforge.net/p/hamlib/mailman/message/8188949/). However, was having a little trouble converting the rig model and code parsing lines from Python to C.

      Any ideas?

      Thanks!
      William Gardner KI5SZM


      Hamlib Retrieve Supported Rigs


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/hamlib/discussion/25919/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
      • John William Gardner

        Thanks! Just saw your message after making an update to mine, but the information you have given will help much. I will take a look into that tomorrow and keep you posted on what I find.

        William Gardner KI5SZM

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.