Enable multicast by default on 224.0.0.1 port 4532

Does not allow for rig control yet -- just rig info
https://github.com/Hamlib/Hamlib/issues/695
pull/1404/head
Mike Black W9MDB 2023-10-20 15:18:23 -05:00
rodzic d87671b54b
commit df413d0dc4
4 zmienionych plików z 84 dodań i 7 usunięć

3
NEWS
Wyświetl plik

@ -13,6 +13,9 @@ Version 5.x -- future
* Change FT1000MP Mark V model names to align with FT1000MP
Version 4.6
* Hamlib now starts a multicast server that sends out rig information. Does not receive commands yet.
See README.multicast
* rigctld has new -b/bind-all option to try all interfaces -- restores original behavior. This was done to fix duplicate rigctld instances on Windows
* Yaesu rigs can now use send_morse to send keyer message 1-5 or a CW message up to 50 chars (which will use memory 1)
* rig set level METER can now take SWR,COMP,ALC,IC/ID,DB,PO,VDD,TEMP arguments to set which meter to display

Wyświetl plik

@ -1,13 +1,69 @@
Planned for version 5.0 -- comments/suggestions about this are more than welcome
Planned for version 4.6 -- comments/suggestions about this are more than welcome
Example of multicast packet as of 2023-10-20
===================================================================
{
"app": "Hamlib",
"version": "4.6~git 2023-10-20T16:52:59Z SHA=d87671",
"seq": 183,
"time": "2023-10-20T20:13:53.139869-0000",
"crc": 0,
"rig": {
"id": "FLRig:127.0.0.1:12345:30508",
"status": "OK",
"errorMsg": "",
"name": "FLRig",
"split": false,
"splitVfo": "VFOA",
"satMode": false,
"modelist": "AM CW USB LSB FM CWR PKTLSB PKTUSB "
},
"vfos": [
{
"name": "VFOA",
"freq": 14074270,
"mode": "PKTUSB",
"width": 3,
"ptt": false,
"rx": true,
"tx": true
},
{
"name": "VFOB",
"freq": 14074500,
"mode": "",
"width": 0,
"ptt": false,
"rx": false,
"tx": false
}
],
"spectra": [
{
"id": 0,
"name": "?",
"type": "FIXED",
"minLevel": 0,
"maxLevel": 0,
"minStrength": 0,
"maxStrength": 0,
"centerFreq": 0,
"span": 0,
"lowFreq": 0,
"highFreq": 0,
"length": 0,
"data": ""
}
]
}
===========================================================
Multicast UDP broadcast containing rig snapshot data
Bidirectional rig control and status
Choice of token pairs or JSON
All packets will be tagged with ID=[unique name] -- so multiple rigs can broadcast/rx on the same port
Will be able to set freq, mode, width, ptt, satmode, and split to start since those are common to many apps.
Will eventually be able to set freq, mode, width, ptt, satmode, and split to start since those are common to many apps.
More functions will be added as time goes on.
Broadcast packet contents to be based on get_rig_info output
This will be the text format of name=value pairs
Can be multiple VFO lines
Parsers should allow for unknown tags that may be added in the future

Wyświetl plik

@ -881,6 +881,7 @@ int HAMLIB_API rig_open(RIG *rig)
value_t parm_value;
//unsigned int net1, net2, net3, net4, net5, net6, net7, net8, port;
int is_network = 0;
int retval = 0;
ENTERFUNC2;
@ -1450,7 +1451,7 @@ int HAMLIB_API rig_open(RIG *rig)
if (rig->caps->get_freq)
{
int retval = rig_get_freq(rig, RIG_VFO_A, &freq);
retval = rig_get_freq(rig, RIG_VFO_A, &freq);
if (retval == RIG_OK && rig->caps->rig_model != RIG_MODEL_F6K)
{
@ -1484,6 +1485,21 @@ int HAMLIB_API rig_open(RIG *rig)
memcpy(&rs->dcdport_deprecated, &rs->dcdport, sizeof(hamlib_port_t_deprecated));
rig_flush_force(&rs->rigport, 1);
// if (rig->caps->rig_model != RIG_MODEL_NETRIGCTL) multicast_init(rig, "224.0.0.1", 4532);
// multicast_init(rig, "224.0.0.1", 4532);
char *multicast_addr = "224.0.0.1";
int multicast_port = 4532;
enum multicast_item_e items = RIG_MULTICAST_POLL | RIG_MULTICAST_TRANSCEIVE |
RIG_MULTICAST_SPECTRUM;
retval = network_multicast_publisher_start(rig, multicast_addr,
multicast_port, items);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: network_multicast_server failed: %s\n", __FILE__,
rigerror(retval));
// we will consider this non-fatal for now
}
RETURNFUNC2(RIG_OK);
}

Wyświetl plik

@ -1,5 +1,7 @@
#include <sys/types.h>
#define _XOPEN_SOURCE 700
#include <unistd.h>
#include <hamlib/config.h>
#include <hamlib/rig.h>
#include "misc.h"
#include "snapshot_data.h"
@ -19,8 +21,8 @@ static int snapshot_serialize_rig(cJSON *rig_node, RIG *rig)
char buf[1024];
// TODO: need to assign rig an ID, e.g. from command line
snprintf(buf, sizeof(buf), "%s:%s", rig->caps->model_name,
rig->state.rigport.pathname);
snprintf(buf, sizeof(buf), "%s:%s:%d", rig->caps->model_name,
rig->state.rigport.pathname, getpid());
node = cJSON_AddStringToObject(rig_node, "id", buf);