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

int frontrot_get_conf ( ROT rot,
token_t  token,
char *  val 
)

Get data from rotator state in alpha form.

Parameters:
rotnon-null
tokenTOK_... specifying which data to get
valresult non-null
Returns:
RIG_OK or < 0 if error

Definition at line 215 of file rot_conf.c.

References rot::caps, rot_state::max_az, rot_state::max_el, rot_state::min_az, rot_state::min_el, hamlib_port_t::parm, hamlib_port_t::pathname, hamlib_port_t::post_write_delay, hamlib_port_t::retry, hamlib_port_t::rig, RIG_EINVAL, RIG_HANDSHAKE_HARDWARE, RIG_HANDSHAKE_NONE, RIG_HANDSHAKE_XONXOFF, RIG_OK, RIG_PARITY_EVEN, RIG_PARITY_NONE, RIG_PARITY_ODD, RIG_PORT_SERIAL, rot_state::rotport, hamlib_port_t::serial, rot::state, hamlib_port_t::timeout, TOK_DATA_BITS, TOK_HANDSHAKE, TOK_MAX_AZ, TOK_MAX_EL, TOK_MIN_AZ, TOK_MIN_EL, TOK_PARITY, TOK_PATHNAME, TOK_POST_WRITE_DELAY, TOK_RETRY, TOK_SERIAL_SPEED, TOK_STOP_BITS, TOK_TIMEOUT, TOK_WRITE_DELAY, and hamlib_port_t::write_delay.

Referenced by rot_get_conf().

{
      const struct rot_caps *caps;
      struct rot_state *rs;
      const char *s;

      caps = rot->caps;
      rs = &rot->state;

      switch(token) {
      case TOK_PATHNAME:
            strcpy(val, rs->rotport.pathname);
            break;
      case TOK_WRITE_DELAY:
            sprintf(val, "%d", rs->rotport.write_delay);
            break;
      case TOK_POST_WRITE_DELAY:
            sprintf(val, "%d", rs->rotport.post_write_delay);
            break;
      case TOK_TIMEOUT:
            sprintf(val, "%d", rs->rotport.timeout);
            break;
      case TOK_RETRY:
            sprintf(val, "%d", rs->rotport.retry);
            break;
      case TOK_SERIAL_SPEED:
            if (rs->rotport.type.rig != RIG_PORT_SERIAL)
                  return -RIG_EINVAL;
            sprintf(val, "%d", rs->rotport.parm.serial.rate);
            break;
      case TOK_DATA_BITS:
            if (rs->rotport.type.rig != RIG_PORT_SERIAL)
                  return -RIG_EINVAL;
            sprintf(val, "%d", rs->rotport.parm.serial.data_bits);
            break;
      case TOK_STOP_BITS:
            if (rs->rotport.type.rig != RIG_PORT_SERIAL)
                  return -RIG_EINVAL;
            sprintf(val, "%d", rs->rotport.parm.serial.stop_bits);
            break;
      case TOK_PARITY:
            if (rs->rotport.type.rig != RIG_PORT_SERIAL)
                  return -RIG_EINVAL;
            switch (rs->rotport.parm.serial.parity) {
            case RIG_PARITY_NONE: s = "None"; break;
            case RIG_PARITY_ODD: s = "Odd"; break;
            case RIG_PARITY_EVEN: s = "Even"; break;
            default: return -RIG_EINVAL;
            }
            strcpy(val, s);
            break;
      case TOK_HANDSHAKE:
            if (rs->rotport.type.rig != RIG_PORT_SERIAL)
                  return -RIG_EINVAL;
            switch (rs->rotport.parm.serial.handshake) {
            case RIG_HANDSHAKE_NONE: s = "None"; break;
            case RIG_HANDSHAKE_XONXOFF: s = "XONXOFF"; break;
            case RIG_HANDSHAKE_HARDWARE: s = "Hardware"; break;
            default: return -RIG_EINVAL;
            }
            strcpy(val, s);
            break;
      case TOK_MIN_AZ:
            sprintf(val, "%f", rs->min_az);
            break;
      case TOK_MAX_AZ:
            sprintf(val, "%f", rs->max_az);
            break;
      case TOK_MIN_EL:
            sprintf(val, "%f", rs->min_el);
            break;
      case TOK_MAX_EL:
            sprintf(val, "%f", rs->max_el);
            break;
      default:
            return -RIG_EINVAL;
      }
      return RIG_OK;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index