No description
Find a file
Manuel Bahamóndez-Honores 2d4cb35e51 Replace hand-written .d.ts with JSDoc + tsc auto-generation
- Delete hand-written index.d.ts that drifted from source
- Add JSDoc type annotations to all source files
- Create src/types.js with shared typedefs (SelfInfo, Contact,
  ContactMessage, ChannelInfo, RepeaterStats, etc.)
- Add tsconfig.json for declaration generation
- Add build:types script and prepublishOnly hook
- Add GitHub Actions CI workflow for type checking
- Use Uint8Array everywhere (no Buffer references)
- Add semantic type aliases (EpochSeconds, Milliseconds, MilliVolts)
- Add typed event overloads on Connection (on/once/off)
- All 11 PR #15 review comments addressed
2026-02-18 05:49:46 -03:00
.github/workflows Replace hand-written .d.ts with JSDoc + tsc auto-generation 2026-02-18 05:49:46 -03:00
examples add example to parse advert from meshcore packet url 2025-10-08 22:38:20 +13:00
src Replace hand-written .d.ts with JSDoc + tsc auto-generation 2026-02-18 05:49:46 -03:00
.gitignore Replace hand-written .d.ts with JSDoc + tsc auto-generation 2026-02-18 05:49:46 -03:00
.npmignore add .idea to .npmignore 2025-02-13 13:32:49 +13:00
index.html fix null check 2025-04-13 13:55:55 +12:00
LICENSE Create LICENSE 2025-02-12 23:09:24 +13:00
package-lock.json Replace hand-written .d.ts with JSDoc + tsc auto-generation 2026-02-18 05:49:46 -03:00
package.json Replace hand-written .d.ts with JSDoc + tsc auto-generation 2026-02-18 05:49:46 -03:00
README.md Update README to link to new meshcore-dev/MeshCore repo 2025-12-09 19:54:39 -08:00
tsconfig.json Replace hand-written .d.ts with JSDoc + tsc auto-generation 2026-02-18 05:49:46 -03:00

MeshCore.js

A Javascript library for interacting with a MeshCore device running the Companion Radio Firmware.

This library can be used in a Web Browser to connect to MeshCore Companion devices over BLE or USB Serial.

It can also be used in NodeJS to connect to MeshCore Companion devices over TCP/WiFi or USB Serial.

Supported Connection Methods

Install

npm install @liamcottle/meshcore.js

Simple Example

import { TCPConnection, NodeJSSerialConnection } from "@liamcottle/meshcore.js";

// serial connections are supported by "companion_radio_usb" firmware
const connection = new NodeJSSerialConnection("/dev/cu.usbmodem14401");

// tcp connections are supported by "companion_radio_wifi" firmware
// const connection = new TCPConnection("10.1.0.226", 5000);

// wait until connected
connection.on("connected", async () => {

    // we are now connected
    console.log("connected!");

    // log contacts
    const contacts = await connection.getContacts();
    for(const contact of contacts) {
        console.log(`Contact: ${contact.advName}`);
    }

    // disconnect
    connection.close();

});

// connect to meshcore device
await connection.connect();

Examples

There's a few other examples scripts in the examples folder.

License

MIT