From 9b245477dad578ad1343ed36b7a0b261d58ae9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Fillod=2C=20F8CFE?= Date: Sun, 27 Jan 2002 14:55:30 +0000 Subject: [PATCH] token defines moved to token.h git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@924 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- src/conf.c | 11 +++++----- src/conf.h | 24 +++------------------- src/rig.c | 9 ++++---- src/rot_conf.c | 56 ++++++++++++++++++++++++++++++++++++++++++++------ src/rot_conf.h | 20 ++---------------- src/rotator.c | 7 ++++--- 6 files changed, 70 insertions(+), 57 deletions(-) diff --git a/src/conf.c b/src/conf.c index cbd2849e3..926be790e 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1,8 +1,8 @@ /* * Hamlib Interface - configuration interface - * Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton + * Copyright (c) 2000,2001,2002 by Stephane Fillod and Frank Singleton * - * $Id: conf.c,v 1.5 2001-12-26 23:45:38 fillods Exp $ + * $Id: conf.c,v 1.6 2002-01-27 14:55:30 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -33,6 +33,7 @@ #include #include "conf.h" +#include "token.h" /* @@ -40,7 +41,7 @@ * options available in the rig->state struct. */ static const struct confparams frontend_cfg_params[] = { - { TOK_RIG_PATHNAME, "rig_pathname", "Rig path name", + { TOK_PATHNAME, "rig_pathname", "Rig path name", "Path name to the device file of the rig", "/dev/rig", RIG_CONF_STRING, }, @@ -105,7 +106,7 @@ int frontend_set_conf(RIG *rig, token_t token, const char *val) rs = &rig->state; switch(token) { - case TOK_RIG_PATHNAME: + case TOK_PATHNAME: strcpy(rs->rigport.pathname, val); break; case TOK_WRITE_DELAY: @@ -195,7 +196,7 @@ int frontend_get_conf(RIG *rig, token_t token, char *val) rs = &rig->state; switch(token) { - case TOK_RIG_PATHNAME: + case TOK_PATHNAME: strcpy(val, rs->rigport.pathname); break; case TOK_WRITE_DELAY: diff --git a/src/conf.h b/src/conf.h index 0cdc6e426..e5735e786 100644 --- a/src/conf.h +++ b/src/conf.h @@ -1,8 +1,8 @@ /* * Hamlib Interface - configuration header - * Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton + * Copyright (c) 2000,2001,2002 by Stephane Fillod and Frank Singleton * - * $Id: conf.h,v 1.2 2001-12-26 23:45:57 fillods Exp $ + * $Id: conf.h,v 1.3 2002-01-27 14:55:30 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -24,27 +24,9 @@ #define _CONF_H 1 #include - +#include "token.h" int frontend_set_conf(RIG *rig, token_t token, const char *val); int frontend_get_conf(RIG *rig, token_t token, char *val); - -#define TOK_RIG_PATHNAME RIG_TOKEN_FRONTEND(10) -#define TOK_WRITE_DELAY RIG_TOKEN_FRONTEND(12) -#define TOK_POST_WRITE_DELAY RIG_TOKEN_FRONTEND(13) -#define TOK_TIMEOUT RIG_TOKEN_FRONTEND(14) -#define TOK_RETRY RIG_TOKEN_FRONTEND(15) -#define TOK_ITU_REGION RIG_TOKEN_FRONTEND(20) -#define TOK_VFO_COMP RIG_TOKEN_FRONTEND(25) - -#define TOK_SERIAL_SPEED RIG_TOKEN_FRONTEND(30) -#define TOK_DATA_BITS RIG_TOKEN_FRONTEND(31) -#define TOK_STOP_BITS RIG_TOKEN_FRONTEND(32) -#define TOK_PARITY RIG_TOKEN_FRONTEND(33) -#define TOK_HANDSHAKE RIG_TOKEN_FRONTEND(34) - -/* vfo_comp, rx_range_list/tx_range_list, filters, announces, has(func,lvl,..) */ - #endif /* _CONF_H */ - diff --git a/src/rig.c b/src/rig.c index 037b49898..1721d4318 100644 --- a/src/rig.c +++ b/src/rig.c @@ -12,7 +12,7 @@ * Hamlib Interface - main file * Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton * - * $Id: rig.c,v 1.54 2002-01-21 08:30:31 fillods Exp $ + * $Id: rig.c,v 1.55 2002-01-27 14:55:30 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -47,6 +47,7 @@ #include #include "event.h" #include "conf.h" +#include "token.h" /** * \brief Hamlib release number @@ -57,7 +58,7 @@ const char hamlib_version[] = "Hamlib version " VERSION; * \brief Hamlib copyright notice */ const char hamlib_copyright[] = - "Copyright (C) 2000, 2001 Stephane Fillod and Frank Singleton\n" + "Copyright (C) 2000, 2001, 2002 Stephane Fillod and Frank Singleton\n" "This is free software; see the source for copying conditions. " "There is NO\n warranty; not even for MERCHANTABILITY or FITNESS FOR A" "PARTICULAR PURPOSE."; @@ -3002,7 +3003,7 @@ int rig_set_conf(RIG *rig, token_t token, const char *val) if (!rig || !rig->caps) return -RIG_EINVAL; - if (RIG_IS_TOKEN_FRONTEND(token)) + if (IS_TOKEN_FRONTEND(token)) return frontend_set_conf(rig, token, val); if (rig->caps->set_conf == NULL) @@ -3030,7 +3031,7 @@ int rig_get_conf(RIG *rig, token_t token, char *val) if (!rig || !rig->caps || !val) return -RIG_EINVAL; - if (RIG_IS_TOKEN_FRONTEND(token)) + if (IS_TOKEN_FRONTEND(token)) return frontend_get_conf(rig, token, val); if (rig->caps->get_conf == NULL) diff --git a/src/rot_conf.c b/src/rot_conf.c index de0e19c0f..3c8c1ecea 100644 --- a/src/rot_conf.c +++ b/src/rot_conf.c @@ -1,8 +1,8 @@ /* - * Hamlib Interface - configuration interface - * Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton + * Hamlib Interface - rotator configuration interface + * Copyright (c) 2000,2001,2002 by Stephane Fillod and Frank Singleton * - * $Id: rot_conf.c,v 1.1 2001-12-27 21:46:25 fillods Exp $ + * $Id: rot_conf.c,v 1.2 2002-01-27 14:55:30 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -33,6 +33,7 @@ #include #include "rot_conf.h" +#include "token.h" /* @@ -40,7 +41,7 @@ * options available in the rot->state struct. */ static const struct confparams rotfrontend_cfg_params[] = { - { TOK_ROT_PATHNAME, "rot_pathname", "Rig path name", + { TOK_PATHNAME, "rot_pathname", "Rig path name", "Path name to the device file of the rotator", "/dev/rotator", RIG_CONF_STRING, }, @@ -80,6 +81,23 @@ static const struct confparams rotfrontend_cfg_params[] = { "None", RIG_CONF_COMBO, { c: {{ "None", "XONXOFF", "Hardware", NULL }} } }, + { TOK_MIN_AZ, "min_az", "Minimum azimuth", + "Minimum rotator azimuth in degrees", + "-180", RIG_CONF_NUMERIC, { n: { -360, 360, .001 } } + }, + { TOK_MAX_AZ, "max_az", "Maximum azimuth", + "Maximum rotator azimuth in degrees", + "180", RIG_CONF_NUMERIC, { n: { -360, 360, .001 } } + }, + { TOK_MIN_EL, "min_el", "Minimum elevation", + "Minimum rotator elevation in degrees", + "0", RIG_CONF_NUMERIC, { n: { -90, 180, .001 } } + }, + { TOK_MAX_EL, "max_el", "Maximum elevation", + "Maximum rotator elevation in degrees", + "90", RIG_CONF_NUMERIC, { n: { -90, 180, .001 } } + }, + { RIG_CONF_END, NULL, } }; @@ -97,7 +115,7 @@ int frontrot_set_conf(ROT *rot, token_t token, const char *val) rs = &rot->state; switch(token) { - case TOK_ROT_PATHNAME: + case TOK_PATHNAME: strcpy(rs->rotport.pathname, val); break; case TOK_WRITE_DELAY: @@ -143,6 +161,19 @@ int frontrot_set_conf(ROT *rot, token_t token, const char *val) return -RIG_EINVAL; break; + case TOK_MIN_AZ: + rs->min_az = atof(val); + break; + case TOK_MAX_AZ: + rs->max_az = atof(val); + break; + case TOK_MIN_EL: + rs->min_el = atof(val); + break; + case TOK_MAX_EL: + rs->max_el = atof(val); + break; + default: return -RIG_EINVAL; } @@ -163,7 +194,7 @@ int frontrot_get_conf(ROT *rot, token_t token, char *val) rs = &rot->state; switch(token) { - case TOK_ROT_PATHNAME: + case TOK_PATHNAME: strcpy(val, rs->rotport.pathname); break; case TOK_WRITE_DELAY: @@ -206,6 +237,19 @@ int frontrot_get_conf(ROT *rot, token_t token, char *val) 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; } diff --git a/src/rot_conf.h b/src/rot_conf.h index 4d6b913e5..d0c6161b1 100644 --- a/src/rot_conf.h +++ b/src/rot_conf.h @@ -1,8 +1,8 @@ /* * Hamlib Interface - configuration header - * Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton + * Copyright (c) 2000,2001,2002 by Stephane Fillod and Frank Singleton * - * $Id: rot_conf.h,v 1.1 2001-12-27 21:46:25 fillods Exp $ + * $Id: rot_conf.h,v 1.2 2002-01-27 14:55:30 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -25,24 +25,8 @@ #include - int frontrot_set_conf(ROT *rot, token_t token, const char *val); int frontrot_get_conf(ROT *rot, token_t token, char *val); -#define ROT_TOKEN_FRONTEND RIG_TOKEN_FRONTEND - -#define TOK_ROT_PATHNAME ROT_TOKEN_FRONTEND(10) -#define TOK_WRITE_DELAY ROT_TOKEN_FRONTEND(12) -#define TOK_POST_WRITE_DELAY ROT_TOKEN_FRONTEND(13) -#define TOK_TIMEOUT ROT_TOKEN_FRONTEND(14) -#define TOK_RETRY ROT_TOKEN_FRONTEND(15) - -#define TOK_SERIAL_SPEED ROT_TOKEN_FRONTEND(30) -#define TOK_DATA_BITS ROT_TOKEN_FRONTEND(31) -#define TOK_STOP_BITS ROT_TOKEN_FRONTEND(32) -#define TOK_PARITY ROT_TOKEN_FRONTEND(33) -#define TOK_HANDSHAKE ROT_TOKEN_FRONTEND(34) - #endif /* _ROT_CONF_H */ - diff --git a/src/rotator.c b/src/rotator.c index e26e13fb6..50d46072b 100644 --- a/src/rotator.c +++ b/src/rotator.c @@ -11,7 +11,7 @@ * Hamlib Interface - main file * Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton * - * $Id: rotator.c,v 1.5 2002-01-21 08:30:31 fillods Exp $ + * $Id: rotator.c,v 1.6 2002-01-27 14:55:30 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -45,6 +45,7 @@ #include #include #include "rot_conf.h" +#include "token.h" #define DEFAULT_SERIAL_PORT "/dev/rotator" @@ -414,7 +415,7 @@ int rot_set_conf(ROT *rot, token_t token, const char *val) if (!rot || !rot->caps) return -RIG_EINVAL; - if (RIG_IS_TOKEN_FRONTEND(token)) + if (IS_TOKEN_FRONTEND(token)) return frontrot_set_conf(rot, token, val); if (rot->caps->set_conf == NULL) @@ -442,7 +443,7 @@ int rot_get_conf(ROT *rot, token_t token, char *val) if (!rot || !rot->caps || !val) return -RIG_EINVAL; - if (RIG_IS_TOKEN_FRONTEND(token)) + if (IS_TOKEN_FRONTEND(token)) return frontrot_get_conf(rot, token, val); if (rot->caps->get_conf == NULL)