diff --git a/examples/nodejs_serial_connection.js b/examples/get_contacts.js similarity index 84% rename from examples/nodejs_serial_connection.js rename to examples/get_contacts.js index 6787b0a..64975ae 100644 --- a/examples/nodejs_serial_connection.js +++ b/examples/get_contacts.js @@ -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 diff --git a/examples/tcp_connection.js b/examples/tcp_connection.js deleted file mode 100644 index 222405d..0000000 --- a/examples/tcp_connection.js +++ /dev/null @@ -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();