export async function error (packet) { // if (packet.error) { console.log('======== error during socket server processing') console.log(packet.error) console.log('==========') // } } export async function reply (packet) { let req = packet._header.request console.log('==== reply packet received ======') console.log(req) if (packet.response) console.log(packet.response) if (req.cmd ==='busFuncs') { console.log('==========Available Bus Functions=====') console.dir(packet.functions) } } export async function test () { console.log('=============Bus Capabilities ============') let packet = {cmd:'methods'} await this.send(packet) console.log('=============UCI Available Functions ============') packet = {cmd:'busFuncs'} await this.send(packet) console.log('=============Device Address Scan Request ============') packet = {cmd:'scan'} let addresses = (await this.send(packet)).response console.log('addresses to check',addresses) console.log('=============Device ID scan request ============') if (addresses.length === 0) console.log('no devices operational on the bus') else { for (var address of addresses) { console.log(`getting device ID for address ${address}/${address.toString(16)}`) let packet = {cmd:'deviceId', args:{address:address}} await this.send(packet) } } }