/[xlog]/xlog/src/hamlib-utils.c
ViewVC logotype

Diff of /xlog/src/hamlib-utils.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.29 by pa4tu, Tue Apr 5 07:19:08 2005 UTC revision 1.30 by pa4tu, Mon May 16 08:01:13 2005 UTC
# Line 46  struct rig_id { Line 46  struct rig_id {
46          const gchar *modelname;          const gchar *modelname;
47  };  };
48    
 static const struct rig_id rig_id_list[] = {  
         {1504, "WR-3100"},  
         {352, "OptoScan535"},  
         {304, "IC-275"},  
         {336, "IC-R10"},  
         {320, "IC-736"},  
         {208, "TS-811"},  
         {224, "TS-680S"},  
         {2401, "EKD-500"},  
         {1601, "TT-550"},  
         {1505, "WR-3150"},  
         {401, "IC-PCR1000"},  
         {353, "OptoScan456"},  
         {337, "IC-R71"},  
         {321, "IC-737"},  
         {209, "TS-850"},  
         {225, "TS-140S"},  
         {113, "FT-900"},  
         {1, "Dummy"},  
         {1602, "TT-538 Jupiter"},  
         {1506, "WR-3500"},  
         {802, "BC245xlt"},  
         {402, "IC-PCR100"},  
         {354, "IC ID-1"},  
         {306, "IC-471"},  
         {338, "IC-R72"},  
         {226, "TM-D700"},  
         {210, "TS-870S"},  
         {114, "FT-920"},  
         {1603, "RX-320"},  
         {1507, "WR-3700"},  
         {803, "BC895xlt"},  
         {307, "IC-475"},  
         {339, "IC-R75"},  
         {323, "IC-746"},  
         {355, "IC-703"},  
         {227, "TM-V7"},  
         {211, "TS-940S"},  
         {115, "FT-890"},  
         {1604, "RX-340"},  
         {1204, "WJ-8888"},  
         {340, "IC-R7000"},  
         {356, "IC-7800"},  
         {324, "IC-751"},  
         {228, "TS-480"},  
         {116, "FT-990"},  
         {2501, "Elektor 3/04"},  
         {2101, "4937 DI5 tuner module"},  
         {1701, "DX-77"},  
         {1605, "RX-350"},  
         {501, "AR8200"},  
         {341, "IC-R7100"},  
         {357, "IC-756PROIII"},  
         {309, "IC-706"},  
         {213, "TS-950SDX"},  
         {117, "FRG-100"},  
         {101, "FT-847"},  
         {2502, "DRT1"},  
         {2102, "4702 DT5 tuner module"},  
         {902, "R-8A"},  
         {502, "AR8000"},  
         {342, "ICR-8500"},  
         {358, "IC-R20"},  
         {326, "IC-756"},  
         {310, "IC-706MkII"},  
         {214, "TS-2000"},  
         {118, "FRG-9600"},  
         {1607, "TT-516 Argonaut V"},  
         {903, "R-8B"},  
         {503, "AR7030"},  
         {343, "IC-R9000"},  
         {327, "IC-756PRO"},  
         {311, "IC-706MkIIG"},  
         {215, "R-5000"},  
         {119, "FRG-8800"},  
         {103, "FT-1000D"},  
         {1608, "TT-565 Orion"},  
         {504, "AR5000"},  
         {344, "IC-910"},  
         {312, "IC-707"},  
         {328, "IC-761"},  
         {216, "TS-570S"},  
         {104, "MARK-V FT-1000MP"},  
         {120, "FT-817"},  
         {2601, "SW/FM radio"},  
         {2201, "DSP-10"},  
         {1801, "505DSP"},  
         {505, "AR3030"},  
         {345, "IC-78"},  
         {329, "IC-765"},  
         {313, "IC-718"},  
         {217, "TH-D7A"},  
         {201, "TS-50S"},  
         {105, "FT-747GX"},  
         {121, "FT-100"},  
         {1402, "TRP8000"},  
         {506, "AR3000A"},  
         {330, "IC-775"},  
         {346, "IC-746PRO"},  
         {314, "IC-725"},  
         {202, "TS-440"},  
         {122, "FT-857"},  
         {106, "FT-757GX"},  
         {331, "IC-781"},  
         {347, "IC-756PROII"},  
         {315, "IC-726"},  
         {203, "TS-450S"},  
         {123, "FT-897"},  
         {107, "FT-757GXII"},  
         {1004, "HF-235"},  
         {316, "IC-728"},  
         {220, "TH-F7E"},  
         {204, "TS-570D"},  
         {124, "FT-1000MP"},  
         {2301, "SDR-1000"},  
         {1901, "RPC rig"},  
         {1501, "WR-1000"},  
         {221, "K2"},  
         {205, "TS-690S"},  
         {125, "MARK-V Field FT-1000MP"},  
         {1502, "WR-1500"},  
         {606, "NRD-535D"},  
         {334, "IC-821H"},  
         {206, "TS-711"},  
         {222, "TS-930"},  
         {126, "VR-5000"},  
         {110, "FT-736R"},  
         {1503, "WR-1550"},  
         {1103, "RA6790/GM"},  
         {607, "NRD-545 DSP"},  
         {351, "Omni VI Plus"},  
         {303, "IC-271"},  
         {335, "IC-970"},  
         {319, "IC-735"},  
         {223, "TH-G71"},  
         {207, "TS-790"},  
         {0, NULL}, /* end marker */  
 };  
   
49  typedef struct  typedef struct
50  {  {
51          gchar **xpmdata;          gchar **xpmdata;
# Line 213  gint svalue[10]; Line 74  gint svalue[10];
74  gint hamlibtimer = -1;  gint hamlibtimer = -1;
75  RIG *myrig;  RIG *myrig;
76  GdkPixmap *pixmap = NULL;  GdkPixmap *pixmap = NULL;
77    GList *rigs = NULL;
78    
79  /* load xpm data from s-meter pixmaps */  /* load xpm data from s-meter pixmaps */
80  void  void
# Line 284  static gint set_conf(RIG *my_rig, gchar Line 146  static gint set_conf(RIG *my_rig, gchar
146    
147  /* open rig and report errors, start timer when polling */  /* open rig and report errors, start timer when polling */
148  gboolean  gboolean
149  start_hamlib (gchar * radio, gchar * device, gint debugmode, gint timervalue)  start_hamlib (gint rigid, gchar *device, gint debugmode, gint timervalue)
150  {  {
151          gint rigid, retcode;          gint retcode;
152          gchar *temp;          gchar *temp;
153    
154          rig_set_debug (debugmode);          rig_set_debug (debugmode);
155          rigid = get_rigid (radio);          myrig = rig_init (rigid);
156          if (rigid != -1)          if (g_ascii_strcasecmp (preferences.rigconf, "?"))
157          {          {
158                  myrig = rig_init (rigid);                  retcode = set_conf(myrig, preferences.rigconf);
159                  if (g_ascii_strcasecmp (preferences.rigconf, "?"))                  if (retcode != RIG_OK)
160                  {                  {
161                          retcode = set_conf(myrig, preferences.rigconf);                          temp = g_strdup_printf
162                          if (retcode != RIG_OK)                                  (_("Hamlib config parameter error: %s"), rigerror (retcode));
                                 {  
                                         temp = g_strdup_printf (_("Hamlib config parameter error: %s"),  
                                                 rigerror (retcode));  
                                         update_statusbar (temp);  
                                 }  
                 }  
                 strncpy (myrig->state.rigport.pathname, device, FILPATHLEN);  
                 retcode = rig_open (myrig);  
                 if (retcode != RIG_OK)  
                 {  
                         temp = g_strdup_printf (_  
                                                 ("An error occured while opening port %s: %s"),  
                                                 myrig->state.rigport.pathname,  
                                                 rigerror (retcode));  
163                          update_statusbar (temp);                          update_statusbar (temp);
                         return FALSE;  
                 }  
                 else  
                 {  
                         if (timervalue == 0)  
                                 hamlibtimer = -1;  
                         else  
                                 hamlibtimer = g_timeout_add (timervalue,  
                                         (GSourceFunc)poll_riginfo, NULL);  
164                  }                  }
165          }          }
166          else          strncpy (myrig->state.rigport.pathname, device, FILPATHLEN);
167            retcode = rig_open (myrig);
168            if (retcode != RIG_OK)
169          {          {
170                  update_statusbar (_("Hamlib error: get_rigid failed"));                  temp = g_strdup_printf
171                            (_("An error occured while opening port %s: %s"),
172                                    myrig->state.rigport.pathname, rigerror (retcode));
173                    update_statusbar (temp);
174                  return FALSE;                  return FALSE;
175          }          }
176            else
177            {
178                    if (timervalue == 0)
179                            hamlibtimer = -1;
180                    else
181                            hamlibtimer = g_timeout_add
182                                    (timervalue, (GSourceFunc)poll_riginfo, NULL);
183            }
184          return TRUE;          return TRUE;
185  }  }
186    
187  /* sort function for creating the list of rigs */  /* Append a new entry in the driver list. It is called by rig_list_foreach */
188  static gint sortcaps (gconstpointer a, gconstpointer b)  static gint
189    riglist_make_list (const struct rig_caps *caps, gpointer data)
190  {  {
191          gchar *amodel = (gchar *)a;          rigs = g_list_append (rigs, (gpointer) caps);
192          gchar *bmodel = (gchar *)b;          return 1;               /* !=0, we want them all ! */
   
         return (g_ascii_strcasecmp(amodel, bmodel));  
193  }  }
194    
195  /* Return a list with pointers of available drivers from hamlib */  /* Return a list with pointers of available drivers from hamlib */
196  GList *  GList *
197  riglist_get_list (void)  rig_get_list (void)
198  {  {
199          gint i;          gint status;
         GList *rigs = NULL;  
200    
201          for (i = 0; rig_id_list[i].modelname != NULL; i++)          rig_load_all_backends ();
202                  rigs = g_list_insert_sorted          status = rig_list_foreach (riglist_make_list, NULL);
                         (rigs, (gpointer)rig_id_list[i].modelname, sortcaps);  
203          return rigs;          return rigs;
204  }  }
205    
 /* lookup hamlib rigid associated with model name */  
 gint  
 get_rigid (gchar * rig)  
 {  
         guint i;  
   
         for (i = 0; rig_id_list[i].modelname != NULL; i++)  
                 if (!strcmp (rig_id_list[i].modelname, rig))  
                         return (rig_id_list[i].modelnr);  
         return -1;  
 }  
   
206  /* return string with mode */  /* return string with mode */
207  gchar *  gchar *
208  rigmode (gint mode)  rigmode (gint mode)

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26