diff --git a/kenwood/kenwood.c b/kenwood/kenwood.c index 0e677d060..750d3d8bc 100644 --- a/kenwood/kenwood.c +++ b/kenwood/kenwood.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - main file * Copyright (c) 2000,2001,2002 by Stephane Fillod * - * $Id: kenwood.c,v 1.30 2002-01-24 23:36:54 fillods Exp $ + * $Id: kenwood.c,v 1.31 2002-02-18 18:25:42 pa4tu 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 @@ -788,10 +788,33 @@ int kenwood_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) return RIG_OK; } +/* + * kenwood_get_ptt + * Assumes rig!=NULL, ptt!=NULL + */ +int kenwood_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) +{ + unsigned char infobuf[50]; + int info_len, retval; + + retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len); + if (retval != RIG_OK) + return retval; + + if (info_len != 38) { + rig_debug(RIG_DEBUG_ERR,"kenwood_get_ptt: wrong answer len=%d\n", + info_len); + return -RIG_ERJCTED; + } + + *ptt = infobuf[28] == '0' ? RIG_PTT_OFF : RIG_PTT_ON; + + return RIG_OK; +} + /* * kenwood_set_ptt * Assumes rig!=NULL - * TODO: kenwood_get_ptt reading P8 field returned by IF; */ int kenwood_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { diff --git a/kenwood/kenwood.h b/kenwood/kenwood.h index 7be27b993..ea3791725 100644 --- a/kenwood/kenwood.h +++ b/kenwood/kenwood.h @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - main header * Copyright (c) 2000,2001,2002 by Stephane Fillod * - * $Id: kenwood.h,v 1.18 2002-01-24 23:36:54 fillods Exp $ + * $Id: kenwood.h,v 1.19 2002-02-18 18:26:08 pa4tu 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 @@ -60,6 +60,7 @@ int kenwood_set_powerstat(RIG *rig, powerstat_t status); int kenwood_get_powerstat(RIG *rig, powerstat_t *status); int kenwood_reset(RIG *rig, reset_t reset); int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg); +int kenwood_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); int kenwood_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); int kenwood_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); int kenwood_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op);