import { XmlRpcClient } from "@foxglove/xmlrpc"; export default function flrig(opts) { const client = new XmlRpcClient(opts.flrig.url); const setPtt = async (state) => { try { await client.methodCall('rig.set_ptt', [state]); } catch (ex) { console.error(`Cannot send rig.set_ptt(${state}) to flrig (${opts.flrig.url}) -- perhaps it's not running? ${ex.code ?? 'unknown'} at ${ex.erroredSysCall ?? '?'}`); } } return { pttDown: () => { setPtt(1); }, pttUp: () => { setPtt(0); } }; };