update get contacts example

This commit is contained in:
liamcottle 2025-04-08 14:32:44 +12:00
parent 42331ae490
commit cfb3743214
2 changed files with 2 additions and 27 deletions

View file

@ -1,6 +1,8 @@
import TCPConnection from "../src/connection/tcp_connection.js";
import NodeJSSerialConnection from "../src/connection/nodejs_serial_connection.js";
// create serial connection
// const connection = new TCPConnection("10.1.0.226", 5000);
const connection = new NodeJSSerialConnection("/dev/cu.usbmodem14401");
// wait until connected

View file

@ -1,27 +0,0 @@
import TCPConnection from "../src/connection/tcp_connection.js";
// create tcp connection
const connection = new TCPConnection("10.1.0.226", 5000);
// wait until connected
connection.on("connected", async () => {
// we are now connected
console.log(`Connected to: [${connection.host}:${connection.port}]`);
// log contacts
const contacts = await connection.getContacts();
for(const contact of contacts) {
console.log(`Contact: ${contact.advName}`);
}
// send message to public channel
// await connection.sendChannelTextMessage(0, "test");
// disconnect
connection.close();
});
// connect to meshcore device
await connection.connect();