Logo Search packages:      
Sourcecode: hamlib version File versions  Download package

static int tt565_get_freq ( RIG rig,
vfo_t  vfo,
freq_t freq 
)

Get the frequency currently set in the specified VFO (A or B)

Parameters:
rigmust != NULL
vfoRIG_VFO_A or RIG_VFO_B
freqmust != NULL Performs query on physical rig

Definition at line 356 of file orion.c.

References EOM, rig_debug(), RIG_DEBUG_ERR, RIG_EPROTO, RIG_OK, tt565_transaction(), and which_vfo().

{
      int cmd_len, resp_len, retval;
      char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE];
      unsigned int binf;
#ifdef TT565_ASCII_FREQ
      /*  use ASCII mode */
      cmd_len = sprintf(cmdbuf, "?%cF" EOM,
                        which_vfo(rig, vfo));
#else
      /* Get freq with Orion binary mode short sequence. */
      cmd_len = sprintf(cmdbuf, "?%c" EOM,
                        which_vfo(rig, vfo));
#endif
      resp_len = sizeof(respbuf);   
      retval = tt565_transaction (rig, cmdbuf, cmd_len, respbuf, &resp_len);

      if (retval != RIG_OK)
            return retval;
#ifdef TT565_ASCII_FREQ
      respbuf[12] = '\0';
      sscanf(respbuf+3,"%8u",&binf);
      *freq = (freq_t) binf;
#else
    /* Test for valid binary mode return. */
      if (respbuf[1] != which_vfo(rig,vfo) || resp_len <= 5) {
            rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n",
                              __FUNCTION__, respbuf);
            return -RIG_EPROTO;
      }
    /* Convert binary to integer, endedness independent */
      binf = (unsigned char)respbuf[2]<<24 | (unsigned char)respbuf[3]<<16
            | (unsigned char)respbuf[4]<<8  | (unsigned char)respbuf[5];
      *freq = (freq_t) binf;
#endif
      return RIG_OK;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index