Merge branch 'master' of https://github.com/mdblack98/Hamlib into mdblack98-master

pull/117/head
Nate Bargmann 2019-06-26 09:25:53 -05:00
commit f723ea1e4b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: FB2C5130D55A8819
10 zmienionych plików z 139 dodań i 173 usunięć

Wyświetl plik

@ -0,0 +1,7 @@
hamlib - Copyright (C) 2019 The Hamlib Group
File: README.elecraft
Notes on Elecraft backends
2019-06-25 Initial prototype for KPA1500

Wyświetl plik

@ -164,7 +164,7 @@ static int kpa1500_cleanup(AMP *amp)
*
*/
#if 0
#if 0 // not implemented yet
/*
* Send command string to amplifier
*/

Wyświetl plik

@ -1,34 +0,0 @@
CC kpa.lo
kpa.c: In function kpa_get_freq:
kpa.c:150:12: warning: returning const char * from a function with return type int makes integer from pointer without a cast [-Wint-conversion]
return (const char *) - RIG_EINVAL;
^
kpa.c:153:3: error: rs undeclared (first use in this function)
rs = &amp->state;
^~
kpa.c:153:3: note: each undeclared identifier is reported only once for each function it appears in
kpa.c:156:45: warning: passing argument 3 of kpa_transaction makes integer from pointer without a cast [-Wint-conversion]
int retval = kpa_transaction(amp, "^FR;", reponsebuf, sizeof(reponsebuf));
^~~~~~~~~~
kpa.c:68:52: note: expected int but argument is of type char *
int kpa_transaction(AMP *amp, const char *cmd, int cmd_len, char *response,
~~~~^~~~~~~
kpa.c:156:57: warning: passing argument 4 of kpa_transaction makes pointer from integer without a cast [-Wint-conversion]
int retval = kpa_transaction(amp, "^FR;", reponsebuf, sizeof(reponsebuf));
^~~~~~~~~~~~~~~~~~
kpa.c:68:67: note: expected char * but argument is of type long unsigned int
int kpa_transaction(AMP *amp, const char *cmd, int cmd_len, char *response,
~~~~~~^~~~~~~~
kpa.c:156:16: error: too few arguments to function kpa_transaction
int retval = kpa_transaction(amp, "^FR;", reponsebuf, sizeof(reponsebuf));
^~~~~~~~~~~~~~~
kpa.c:68:5: note: declared here
int kpa_transaction(AMP *amp, const char *cmd, int cmd_len, char *response,
^~~~~~~~~~~~~~~
kpa.c:160:12: error: err undeclared (first use in this function)
return err;
^~~
kpa.c:167:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: *** [Makefile:479: kpa.lo] Error 1

110
c++/ampclass.cc 100644
Wyświetl plik

@ -0,0 +1,110 @@
/**
* \file src/ampclass.cc
* \brief Ham Radio Control Libraries C++ interface
* \author Stephane Fillod
* \date 2002
*
* Hamlib C++ interface is a frontend implementing wrapper functions.
*/
/*
* Hamlib C++ bindings - main file
* Copyright (c) 2002 by Stephane Fillod
* Copyright (c) 2019 by Michael Black W9MDB
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <hamlib/ampator.h>
#include <hamlib/ampclass.h>
#include <hamlib/rigclass.h>
#define CHECK_AMP(cmd) { int _retval = cmd; if (_retval != RIG_OK) \
THROW(new RigException (_retval)); }
Amplifier::Amplifier(amp_model_t amp_model)
{
theAmp = amp_init(amp_model);
if (!theAmp)
THROW(new RigException ("Amplifier initialization error"));
caps = theAmp->caps;
theAmp->state.obj = (amp_ptr_t)this;
}
Amplifier::~Amplifier()
{
theAmp->state.obj = NULL;
CHECK_ROT( amp_cleanup(theAmp) );
caps = NULL;
}
void Amplifier::open(void) {
CHECK_ROT( amp_open(theAmp) );
}
void Amplifier::close(void) {
CHECK_ROT( amp_close(theAmp) );
}
void Amplifier::setConf(token_t token, const char *val)
{
CHECK_ROT( amp_set_conf(theAmp, token, val) );
}
void Amplifier::setConf(const char *name, const char *val)
{
CHECK_ROT( amp_set_conf(theAmp, tokenLookup(name), val) );
}
void Amplifier::getConf(token_t token, char *val)
{
CHECK_ROT( amp_get_conf(theAmp, token, val) );
}
void Amplifier::getConf(const char *name, char *val)
{
CHECK_ROT( amp_get_conf(theAmp, tokenLookup(name), val) );
}
token_t Amplifier::tokenLookup(const char *name)
{
return amp_token_lookup(theAmp, name);
}
void Amplifier::reset (amp_reset_t reset)
{
CHECK_ROT( amp_reset(theAmp, reset) );
}
void Amplifier::setFreq(freq_t freq, vfo_t vfo) {
CHECK_RIG( amp_set_freq(theAmp, vfo, freq) );
}
freq_t Amplifier::getFreq(vfo_t vfo)
{
freq_t freq;
CHECK_RIG( amp_get_freq(theAmp, vfo, &freq) );
return freq;
}

Wyświetl plik

@ -283,7 +283,7 @@ static int dummy_amp_get_powerstat(AMP *amp, powerstat_t *status)
return RIG_OK;
}
#if 0
#if 0 // not implemented yet
static int dummy_amp_get_ext_level(AMP *amp, token_t token, value_t *val)
{
struct dummy_amp_priv_data *priv = (struct dummy_amp_priv_data *)

Wyświetl plik

@ -1,5 +1,5 @@
/*
* Hamlib C++ bindings - rotator API header
* Hamlib C++ bindings - amplifier API header
* Copyright (c) 2002 by Stephane Fillod
*
*
@ -19,30 +19,30 @@
*
*/
#ifndef _ROTCLASS_H
#define _ROTCLASS_H 1
#ifndef _AMPCLASS_H
#define _AMPCLASS_H 1
#include <hamlib/rotator.h>
#include <hamlib/amplifier.h>
class BACKEND_IMPEXP Rotator
class BACKEND_IMPEXP Amplifier
{
private:
ROT *theRot; // Global ref. to the rot
AMP *theAmp; // Global ref. to the amp
protected:
public:
Rotator(rot_model_t rot_model);
Amplifier(amp_model_t amp_model);
virtual ~Rotator();
virtual ~Amplifier();
const struct rot_caps *caps;
const struct amp_caps *caps;
// This method opens the communication port to the rot
// This method opens the communication port to the amp
void open(void);
// This method closes the communication port to the rot
// This method closes the communication port to the amp
void close(void);
void setConf(token_t token, const char *val);
@ -51,15 +51,12 @@ public:
void getConf(const char *name, char *val);
token_t tokenLookup(const char *name);
void setPosition(azimuth_t az, elevation_t el);
void getPosition(azimuth_t& az, elevation_t& el);
void stop();
void park();
void reset(rot_reset_t reset);
void setFreq(freq_t freq);
freq_t getFreq(freq_t freq);
void move(int direction, int speed);
void reset(amp_reset_t reset);
};
#endif // _ROTCLASS_H
#endif // _AMPCLASS_H

Wyświetl plik

@ -126,81 +126,6 @@ enum amp_level_e
#define AMP_LEVEL_IS_FLOAT(l) ((l)&AMP_LEVEL_FLOAT_LIST)
#define AMP_LEVEL_IS_STRING(l) ((l)&AMP_LEVEL_STRING_LIST)
/**
* \def AMP_MOVE_UP
* \brief A macro that returns the flag for the \b UP direction.
*
* This macro defines the value of the \b UP direction which can be
* used with the amp_move() function.
*
* \sa amp_move(), AMP_MOVE_DOWN, AMP_MOVE_LEFT, AMP_MOVE_CCW,
* AMP_MOVE_RIGHT, AMP_MOVE_CW
*/
#define AMP_MOVE_UP (1<<1)
/**
* \def AMP_MOVE_DOWN
* \brief A macro that returns the flag for the \b DOWN direction.
*
* This macro defines the value of the \b DOWN direction which can be
* used with the amp_move() function.
*
* \sa amp_move(), AMP_MOVE_UP, AMP_MOVE_LEFT, AMP_MOVE_CCW, AMP_MOVE_RIGHT,
* AMP_MOVE_CW
*/
#define AMP_MOVE_DOWN (1<<2)
/**
* \def AMP_MOVE_LEFT
* \brief A macro that returns the flag for the \b LEFT direction.
*
* This macro defines the value of the \b LEFT direction which can be
* used with the amp_move function.
*
* \sa amp_move(), AMP_MOVE_UP, AMP_MOVE_DOWN, AMP_MOVE_CCW, AMP_MOVE_RIGHT,
* AMP_MOVE_CW
*/
#define AMP_MOVE_LEFT (1<<3)
/**
* \def AMP_MOVE_CCW
* \brief A macro that returns the flag for the \b counterclockwise direction.
*
* This macro defines the value of the \b counterclockwise direction which
* can be used with the amp_move() function. This value is equivalent to
* AMP_MOVE_LEFT .
*
* \sa amp_move(), AMP_MOVE_UP, AMP_MOVE_DOWN, AMP_MOVE_LEFT, AMP_MOVE_RIGHT,
* AMP_MOVE_CW
*/
#define AMP_MOVE_CCW AMP_MOVE_LEFT
/**
* \def AMP_MOVE_RIGHT
* \brief A macro that returns the flag for the \b RIGHT direction.
*
* This macro defines the value of the \b RIGHT direction which can be used
* with the amp_move() function.
*
* \sa amp_move(), AMP_MOVE_UP, AMP_MOVE_DOWN, AMP_MOVE_LEFT, AMP_MOVE_CCW,
* AMP_MOVE_CW
*/
#define AMP_MOVE_RIGHT (1<<4)
/**
* \def AMP_MOVE_CW
* \brief A macro that returns the flag for the \b clockwise direction.
*
* This macro defines the value of the \b clockwise direction wich can be
* used with the amp_move() function. This value is equivalent to
* AMP_MOVE_RIGHT .
*
* \sa amp_move(), AMP_MOVE_UP, AMP_MOVE_DOWN, AMP_MOVE_LEFT, AMP_MOVE_CCW,
* AMP_MOVE_RIGHT
*/
#define AMP_MOVE_CW AMP_MOVE_RIGHT
/* Basic amp type, can store some useful info about different amplifiers. Each
* lib must be able to populate this structure, so we can make useful
* enquiries about capablilities.

Wyświetl plik

@ -3295,6 +3295,7 @@ int win32_serial_select( int n, fd_set *readfds, fd_set *writefds,
goto fail;
}
}
goto timeout;
}
#endif
while ( wait == WAIT_TIMEOUT && index->sol.hEvent )

Wyświetl plik

@ -74,27 +74,6 @@ static const struct confparams ampfrontend_cfg_params[] =
"0", RIG_CONF_NUMERIC, { .n = { 0, 10, 1 } }
},
{
TOK_MIN_AZ, "min_az", "Minimum azimuth",
"Minimum amplifier azimuth in degrees",
"-180", RIG_CONF_NUMERIC, { .n = { -360, 360, .001 } }
},
{
TOK_MAX_AZ, "max_az", "Maximum azimuth",
"Maximum amplifier azimuth in degrees",
"180", RIG_CONF_NUMERIC, { .n = { -360, 360, .001 } }
},
{
TOK_MIN_EL, "min_el", "Minimum elevation",
"Minimum amplifier elevation in degrees",
"0", RIG_CONF_NUMERIC, { .n = { -90, 180, .001 } }
},
{
TOK_MAX_EL, "max_el", "Maximum elevation",
"Maximum amplifier elevation in degrees",
"90", RIG_CONF_NUMERIC, { .n = { -90, 180, .001 } }
},
{ RIG_CONF_END, NULL, }
};
@ -445,25 +424,6 @@ int frontamp_get_conf(AMP *amp, token_t token, char *val)
strcpy(val, s);
break;
#if 0
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;
#endif
default:
return -RIG_EINVAL;
}

Wyświetl plik

@ -1962,10 +1962,10 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
return par_ptt_get(&rig->state.pttport, ptt);
case RIG_PTT_CM108:
//if (caps->get_ptt)
//{
// return caps->get_ptt(rig, vfo, ptt);
//}
if (caps->get_ptt)
{
return caps->get_ptt(rig, vfo, ptt);
}
return cm108_ptt_get(&rig->state.pttport, ptt);