kopia lustrzana https://github.com/Hamlib/Hamlib
Merge branch 'master' of https://github.com/Hamlib/Hamlib
commit
556304d455
|
@ -64,7 +64,11 @@ Example JSON
|
||||||
"LowFreq": 14000000,
|
"LowFreq": 14000000,
|
||||||
"HighFreq": 14250000
|
"HighFreq": 14250000
|
||||||
},
|
},
|
||||||
|
LastCommand {
|
||||||
|
"ID": "MyApp 123",
|
||||||
|
"Command": "set_freq VFOA 14074000".
|
||||||
|
"Status": "OK"
|
||||||
|
},
|
||||||
"PTT" : false,
|
"PTT" : false,
|
||||||
"Split": true,
|
"Split": true,
|
||||||
"SatMode": false,
|
"SatMode": false,
|
||||||
|
@ -77,7 +81,6 @@ Example JSON
|
||||||
"Seq": 1,
|
"Seq": 1,
|
||||||
"__comment_crc__": "32-bit CRC of entire JSON record replacing the CRC value with 0x00000000",
|
"__comment_crc__": "32-bit CRC of entire JSON record replacing the CRC value with 0x00000000",
|
||||||
"ErrorMsg": "OK",
|
"ErrorMsg": "OK",
|
||||||
"LastCommand": "Last command executed",
|
|
||||||
"CRC": "0x00000000"
|
"CRC": "0x00000000"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +122,11 @@ namespace HamlibMultiCast
|
||||||
public double LowFreq;
|
public double LowFreq;
|
||||||
public double HighFreq;
|
public double HighFreq;
|
||||||
}
|
}
|
||||||
|
LastCommand {
|
||||||
|
public string ID; // an application name plus sequence number recommended
|
||||||
|
public string Command;
|
||||||
|
public string Status;
|
||||||
|
}
|
||||||
public string ID;
|
public string ID;
|
||||||
public List<VFO> VFOs { get; set; }
|
public List<VFO> VFOs { get; set; }
|
||||||
public bool PTT;
|
public bool PTT;
|
||||||
|
@ -129,7 +137,6 @@ namespace HamlibMultiCast
|
||||||
public string Version;
|
public string Version;
|
||||||
public string Status;
|
public string Status;
|
||||||
public UInt32 Seq;
|
public UInt32 Seq;
|
||||||
public string LastCommand;
|
|
||||||
public string CRC;
|
public string CRC;
|
||||||
public SpectrumClass Spectrum { get; set; }
|
public SpectrumClass Spectrum { get; set; }
|
||||||
public string ErrorMsg;
|
public string ErrorMsg;
|
||||||
|
|
|
@ -32,6 +32,11 @@ namespace HamlibMultiCast
|
||||||
public double LowFreq;
|
public double LowFreq;
|
||||||
public double HighFreq;
|
public double HighFreq;
|
||||||
}
|
}
|
||||||
|
public class LastCommand {
|
||||||
|
public string ID;
|
||||||
|
public string Command;
|
||||||
|
public string Status;
|
||||||
|
}
|
||||||
public string ID;
|
public string ID;
|
||||||
public List<VFO> VFOs { get; set; }
|
public List<VFO> VFOs { get; set; }
|
||||||
public bool Split;
|
public bool Split;
|
||||||
|
@ -40,7 +45,6 @@ namespace HamlibMultiCast
|
||||||
public string App;
|
public string App;
|
||||||
public string Version;
|
public string Version;
|
||||||
public UInt32 Seq;
|
public UInt32 Seq;
|
||||||
public string LastCommand;
|
|
||||||
public string CRC;
|
public string CRC;
|
||||||
public SpectrumClass Spectrum { get; set; }
|
public SpectrumClass Spectrum { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,11 @@
|
||||||
"LowFreq": 14000000,
|
"LowFreq": 14000000,
|
||||||
"HighFreq": 14250000
|
"HighFreq": 14250000
|
||||||
},
|
},
|
||||||
|
"LastCommand": {
|
||||||
|
"ID": "MyApp 123",
|
||||||
|
"Command": "set_freq VFOA 14074000",
|
||||||
|
"Status": "OK"
|
||||||
|
},
|
||||||
|
|
||||||
"Split": true,
|
"Split": true,
|
||||||
"SatMode": false,
|
"SatMode": false,
|
||||||
|
@ -47,7 +52,6 @@
|
||||||
"Version": "20210520",
|
"Version": "20210520",
|
||||||
"__comment_seq__": "Seq is 1-up sequence number 32-bit -- wraps around to 1 from 2^32-1",
|
"__comment_seq__": "Seq is 1-up sequence number 32-bit -- wraps around to 1 from 2^32-1",
|
||||||
"Seq": 1,
|
"Seq": 1,
|
||||||
"LastCommand": "set_freq VFOA 14074000",
|
|
||||||
"__comment_crc__": "32-bit CRC of entire JSON record replacing the CRC value with 0x00000000",
|
"__comment_crc__": "32-bit CRC of entire JSON record replacing the CRC value with 0x00000000",
|
||||||
"CRC": "0x00000000"
|
"CRC": "0x00000000"
|
||||||
}
|
}
|
||||||
|
|
|
@ -997,6 +997,16 @@ enum cookie_e {
|
||||||
RIG_COOKIE_RENEW,
|
RIG_COOKIE_RENEW,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Multicast data items
|
||||||
|
* 3 different data item can be included in the multicast JSON
|
||||||
|
*/
|
||||||
|
enum multicast_item_e {
|
||||||
|
RIG_MULTICAST_POLL, // hamlib will be polling the rig for all rig items
|
||||||
|
RIG_MULTICAST_TRANSCEIVE, // transceive will be turned on and processed
|
||||||
|
RIG_MULTICAST_SPECTRUM // spectrum data will be included
|
||||||
|
};
|
||||||
|
|
||||||
//! @cond Doxygen_Suppress
|
//! @cond Doxygen_Suppress
|
||||||
#define RIG_PARM_FLOAT_LIST (RIG_PARM_BACKLIGHT|RIG_PARM_BAT|RIG_PARM_KEYLIGHT)
|
#define RIG_PARM_FLOAT_LIST (RIG_PARM_BACKLIGHT|RIG_PARM_BAT|RIG_PARM_KEYLIGHT)
|
||||||
#define RIG_PARM_READONLY_LIST (RIG_PARM_BAT)
|
#define RIG_PARM_READONLY_LIST (RIG_PARM_BAT)
|
||||||
|
|
|
@ -406,7 +406,7 @@ int network_close(hamlib_port_t *rp)
|
||||||
* \param default_port Default network socket port
|
* \param default_port Default network socket port
|
||||||
* \return RIG_OK or < 0 if error
|
* \return RIG_OK or < 0 if error
|
||||||
*/
|
*/
|
||||||
int network_multicast_server(RIG *rig, const char *multicast_addr, int default_port)
|
int network_multicast_server(RIG *rig, const char *multicast_addr, int default_port, enum multicast_item_e items)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -417,6 +417,19 @@ int network_multicast_server(RIG *rig, const char *multicast_addr, int default_p
|
||||||
|
|
||||||
if (status != RIG_OK) { RETURNFUNC(status); }
|
if (status != RIG_OK) { RETURNFUNC(status); }
|
||||||
|
|
||||||
|
if (items && RIG_MULTICAST_TRANSCEIVE)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d) MULTICAST_TRANSCEIVE enabled\n", __FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
if (items && RIG_MULTICAST_SPECTRUM)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d) MULTICAST_SPECTRUM enabled\n", __FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s(%d) unknown MULTICAST item requested=0x%x\n", __FILE__, __LINE__, items);
|
||||||
|
}
|
||||||
|
|
||||||
RETURNFUNC(RIG_OK);
|
RETURNFUNC(RIG_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ __BEGIN_DECLS
|
||||||
|
|
||||||
/* Hamlib internal use, see rig.c */
|
/* Hamlib internal use, see rig.c */
|
||||||
int network_open(hamlib_port_t *p, int default_port);
|
int network_open(hamlib_port_t *p, int default_port);
|
||||||
int network_multicast_server(RIG *rig, const char *multicast_addr, int default_port);
|
HAMLIB_EXPORT(int) network_multicast_server(RIG *rig, const char *multicast_addr, int default_port, enum multicast_item_e items);
|
||||||
int network_close(hamlib_port_t *rp);
|
int network_close(hamlib_port_t *rp);
|
||||||
void network_flush(hamlib_port_t *rp);
|
void network_flush(hamlib_port_t *rp);
|
||||||
|
|
||||||
|
|
|
@ -862,6 +862,10 @@ int HAMLIB_API rig_open(RIG *rig)
|
||||||
case RIG_PTT_CM108:
|
case RIG_PTT_CM108:
|
||||||
rs->pttport.fd = cm108_open(&rs->pttport);
|
rs->pttport.fd = cm108_open(&rs->pttport);
|
||||||
|
|
||||||
|
strncpy(rs->rigport.pathname, DEFAULT_CM108_PORT, HAMLIB_FILPATHLEN);
|
||||||
|
rs->rigport.parm.cm108.ptt_bitnum = DEFAULT_CM108_PTT_BITNUM;
|
||||||
|
rs->pttport.parm.cm108.ptt_bitnum = DEFAULT_CM108_PTT_BITNUM;
|
||||||
|
|
||||||
if (rs->pttport.fd < 0)
|
if (rs->pttport.fd < 0)
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_ERR,
|
rig_debug(RIG_DEBUG_ERR,
|
||||||
|
|
|
@ -671,7 +671,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
|
||||||
RETURNFUNC(RIGCTL_PARSE_ERROR);
|
RETURNFUNC(RIGCTL_PARSE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd != 0xa)
|
if (cmd != 0xa && cmd !=0xd)
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: cmd=%c(%02x)\n", __func__,
|
rig_debug(RIG_DEBUG_TRACE, "%s: cmd=%c(%02x)\n", __func__,
|
||||||
isprint(cmd) ? cmd : ' ', cmd);
|
isprint(cmd) ? cmd : ' ', cmd);
|
||||||
|
@ -1143,7 +1143,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
|
||||||
* argument is given, it will be parsed out later.
|
* argument is given, it will be parsed out later.
|
||||||
*/
|
*/
|
||||||
result = strtok(input_line, " ");
|
result = strtok(input_line, " ");
|
||||||
|
readline_repeat:
|
||||||
/* parsed_input stores pointers into input_line where the token strings
|
/* parsed_input stores pointers into input_line where the token strings
|
||||||
* start.
|
* start.
|
||||||
*/
|
*/
|
||||||
|
@ -1737,6 +1737,9 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
|
||||||
fflush(fout);
|
fflush(fout);
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: retcode=%d\n", __func__, retcode);
|
rig_debug(RIG_DEBUG_TRACE, "%s: retcode=%d\n", __func__, retcode);
|
||||||
|
#ifdef HAVE_LIBREADLINE
|
||||||
|
if (input_line != NULL && (result = strtok(NULL, " "))) goto readline_repeat;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sync_cb) { sync_cb(0); } /* unlock if necessary */
|
if (sync_cb) { sync_cb(0); } /* unlock if necessary */
|
||||||
|
|
||||||
|
|
|
@ -746,7 +746,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
saved_result = result;
|
saved_result = result;
|
||||||
|
|
||||||
retcode = network_multicast_server(my_rig, multicast_addr, 4532);
|
enum multicast_item_e items = RIG_MULTICAST_POLL|RIG_MULTICAST_TRANSCEIVE|RIG_MULTICAST_SPECTRUM;
|
||||||
|
retcode = network_multicast_server(my_rig, multicast_addr, 4532, items);
|
||||||
|
|
||||||
if (retcode != RIG_OK)
|
if (retcode != RIG_OK)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue