Expanded ROT_TYPE definitions in rotator.h

Set dummy rotor to ROT_TYPE_AZEL
Set rotorez rotor type to ROT_TYPE_AZ and added get_info()



git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2830 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.11
Nate Bargmann, N0NB 2010-02-14 22:06:40 +00:00
rodzic 6763e8e750
commit 786e53ce50
4 zmienionych plików z 49 dodań i 21 usunięć

Wyświetl plik

@ -214,6 +214,7 @@ static int dummy_rot_move(ROT *rot, int direction, int speed)
struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: Direction = %d, Speed = %d\n", __func__, direction, speed);
switch(direction) { switch(direction) {
case ROT_MOVE_UP: case ROT_MOVE_UP:
@ -255,7 +256,7 @@ const struct rot_caps dummy_rot_caps = {
.version = "0.2", .version = "0.2",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_BETA, .status = RIG_STATUS_BETA,
.rot_type = ROT_TYPE_OTHER, .rot_type = ROT_TYPE_AZEL,
.port_type = RIG_PORT_NONE, .port_type = RIG_PORT_NONE,
.min_az = -180., .min_az = -180.,

Wyświetl plik

@ -90,16 +90,18 @@ typedef float azimuth_t;
typedef int rot_reset_t; typedef int rot_reset_t;
/*! \def ROT_FLAG_AZIMUTH /** \brief Rotator type flags */
* \brief A macro that returns the azimuth flag. typedef enum {
*/ ROT_FLAG_AZIMUTH = (1<<1), /*!< Azimuth */
/*! \def ROT_FLAG_ELEVATION ROT_FLAG_ELEVATION = (1<<2) /*!< Elevation */
* \brief A macro that returns the elevation flag. } rot_type_t;
*/
#define ROT_FLAG_AZIMUTH (1<<1)
#define ROT_FLAG_ELEVATION (1<<2)
#define ROT_TYPE_OTHER 0 #define ROT_TYPE_MASK (ROT_FLAG_AZIMUTH|ROT_FLAG_ELEVATION)
#define ROT_TYPE_OTHER 0
#define ROT_TYPE_AZIMUTH ROT_FLAG_AZIMUTH
#define ROT_TYPE_ELEVATION ROT_FLAG_ELEVATION
#define ROT_TYPE_AZEL (ROT_FLAG_AZIMUTH|ROT_FLAG_ELEVATION)
/*! \def ROT_MOVE_UP /*! \def ROT_MOVE_UP

Wyświetl plik

@ -87,7 +87,7 @@ static const struct confparams rotorez_cfg_params[] = {
/* ************************************* /* *************************************
* *
* Seperate model capabilities * Separate model capabilities
* *
* ************************************* * *************************************
*/ */
@ -132,6 +132,7 @@ const struct rot_caps rotorez_rot_caps = {
.get_position = rotorez_rot_get_position, .get_position = rotorez_rot_get_position,
.stop = rotorez_rot_stop, .stop = rotorez_rot_stop,
.set_conf = rotorez_rot_set_conf, .set_conf = rotorez_rot_set_conf,
.get_info = rotorez_rot_get_info,
}; };
@ -175,6 +176,8 @@ const struct rot_caps rotorcard_rot_caps = {
.get_position = rotorez_rot_get_position, .get_position = rotorez_rot_get_position,
.stop = rotorez_rot_stop, .stop = rotorez_rot_stop,
.set_conf = rotorez_rot_set_conf, .set_conf = rotorez_rot_set_conf,
.get_info = rotorez_rot_get_info,
}; };
@ -213,6 +216,7 @@ const struct rot_caps dcu_rot_caps = {
.rot_init = rotorez_rot_init, .rot_init = rotorez_rot_init,
.rot_cleanup = rotorez_rot_cleanup, .rot_cleanup = rotorez_rot_cleanup,
.set_position = rotorez_rot_set_position, .set_position = rotorez_rot_set_position,
.get_info = rotorez_rot_get_info,
}; };
@ -236,12 +240,12 @@ static int rotorez_rot_init(ROT *rot) {
if (!rot) if (!rot)
return -RIG_EINVAL; return -RIG_EINVAL;
priv = (struct rotorez_rot_priv_data*) priv = (struct rotorez_rot_priv_data *)
malloc(sizeof(struct rotorez_rot_priv_data)); malloc(sizeof(struct rotorez_rot_priv_data));
if (!priv) if (!priv)
return -RIG_ENOMEM; return -RIG_ENOMEM;
rot->state.priv = (void*)priv; rot->state.priv = (void *)priv;
rot->state.rotport.type.rig = RIG_PORT_SERIAL; rot->state.rotport.type.rig = RIG_PORT_SERIAL;
@ -468,6 +472,25 @@ static int rotorez_rot_set_conf(ROT *rot, token_t token, const char *val) {
} }
/*
* Get Info
* returns the model name string
*/
static const char *rotorez_rot_get_info(ROT *rot)
{
const struct rot_caps *rc;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rot)
return (const char *)-RIG_EINVAL;
rc = rot->caps;
return rc->model_name;
}
/* /*
* Send command string to rotor * Send command string to rotor
*/ */

Wyświetl plik

@ -64,5 +64,7 @@ static int rotorez_rot_stop(ROT *rot);
static int rotorez_rot_set_conf(ROT *rot, token_t token, const char *val); static int rotorez_rot_set_conf(ROT *rot, token_t token, const char *val);
static const char *rotorez_rot_get_info(ROT *rot);
#endif /* _ROT_ROTOREZ_H */ #endif /* _ROT_ROTOREZ_H */