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

static int tt565_get_mode ( RIG rig,
vfo_t  vfo,
rmode_t mode,
pbwidth_t width 
)

Get op. mode and bandwidth for selected vfo.

Parameters:
rigmust != NULL
vfo
modeReceives current mode setting, must be != NULL
widthReceives current bandwidth setting, must be != NULL
Returns:
RIG_OK or < 0
Remarks:
Confusion of VFO and Main/Sub TRx/Rx. See tt565_set_mode.

Definition at line 577 of file orion.c.

References EOM, rig_debug(), RIG_DEBUG_ERR, RIG_EPROTO, RIG_MODE_AM, RIG_MODE_CW, RIG_MODE_CWR, RIG_MODE_FM, RIG_MODE_LSB, RIG_MODE_RTTY, RIG_MODE_USB, RIG_OK, TT565_AM, TT565_CW, TT565_CWR, TT565_FM, TT565_LSB, TT565_RTTY, tt565_transaction(), TT565_USB, and which_receiver().

{
      int cmd_len, resp_len, retval;
      char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE];
      char ttmode, ttreceiver;

      ttreceiver = which_receiver(rig, vfo);

      /* Query mode */
      cmd_len = sprintf(cmdbuf, "?R%cM" EOM, ttreceiver);
      resp_len = sizeof(respbuf);  
      retval = tt565_transaction (rig, cmdbuf, cmd_len, respbuf, &resp_len);

      if (retval != RIG_OK)
            return retval;

      if (respbuf[1] != 'R' || respbuf[3] != 'M' || resp_len <= 4) {
            rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n",
                              __FUNCTION__, respbuf);
            return -RIG_EPROTO;
      }

      ttmode = respbuf[4];

      switch (ttmode) {
            case TT565_USB:   *mode = RIG_MODE_USB; break;
            case TT565_LSB:   *mode = RIG_MODE_LSB; break;
            case TT565_CW:    *mode = RIG_MODE_CW;  break;
            case TT565_CWR:   *mode = RIG_MODE_CWR;  break;
            case TT565_AM:    *mode = RIG_MODE_AM;  break;
            case TT565_FM:    *mode = RIG_MODE_FM;  break;
            case TT565_RTTY:  *mode = RIG_MODE_RTTY;  break;
            default:
                  rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode '%c'\n",
                              __FUNCTION__, ttmode);
                  return -RIG_EPROTO;
      }
    /* Orion may need some time to "recover" from ?RxM before ?RxF */
    usleep(80000);      // try 80 ms
      /* Query passband width (filter) */
      cmd_len = sprintf(cmdbuf, "?R%cF" EOM, ttreceiver);
      resp_len = sizeof(respbuf); 
      retval = tt565_transaction (rig, cmdbuf, cmd_len, respbuf, &resp_len);

      if (retval != RIG_OK)
            return retval;

      if (respbuf[1] != 'R' || respbuf[3] != 'F' || resp_len <= 4) {
            rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n",
                              __FUNCTION__, respbuf);
            return -RIG_EPROTO;
      }

      *width = atoi(respbuf+4);

      return RIG_OK;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index