Discovery

How to discover a transmitter and detect if it supports CoAP.

T7470 will send a UDP broadcast on port 3701 with the payload _lrs-coap._udp. From there, the IP address of the transmitter can be retrieved from the UDP packet.

/**
 * Searches for T7470 broadcast messages.
 */
const dgram = require('dgram');

let server = dgram.createSocket('udp4');
server.on('error', err => {
  server.close();
});

server.on('message', (msg, rinfo) => {
  msg = msg.toString('utf-8');
  
  if (msg === '_lrs-coap._udp') {
    // Initialize CoAP integration implementation
    console.log('Found transmitter with CoAP at: ' + rinfo.address);
    server.close();
  }
});

server.bind(3701, '255.255.255.255');