Giter Site home page Giter Site logo

meshtastic / js Goto Github PK

View Code? Open in Web Editor NEW
58.0 15.0 32.0 2.44 MB

JS/TS library for interfacing with Meshtastic devices

Home Page: https://meshtastic.org

License: GNU General Public License v3.0

TypeScript 99.89% Dockerfile 0.11%
meshtastic typescript library

js's People

Contributors

ajmcquilkin avatar crossan007 avatar davidlpower avatar dependabot[bot] avatar hunter275 avatar ianmcorvidae avatar jstarpl avatar mc-hamster avatar mkinney avatar nougatbyte avatar pdxlocations avatar rcarteraz avatar sachaw avatar scruplelesswizard avatar thebentern avatar thepoweroftwo avatar trelbutate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js's Issues

Consider WebSockets

Not sure if the dev-https branch of meshtastic-device has support for it yet, but I wonder if WebSockets would be a better fit than HTTP polling.

It might get around the // Important: the connect action must be called from a user interaction (e.g. button press), otherwise the browsers won't allow the connect situation as well.

GATT operation not authorized

  • Running Windows 10 Chrome
  • Latest update of meshtastic.js
  • hw_model: "tlora-v1" with firmware_version: "1.1.5" - NOTE: no screen. I connect via PUTTY to get Bluetooth Pairing Code
  • Pair tlora via Windows Bluetooth Add connection.
  • Click "Connect" on HTML form
  • Select meshtastic device in Chrome pop up
  • Error logged to console
Error: Error in meshtasticjs.IBLEConnection.connect: Error in meshtasticjs.IMeshDevice.onConnected: GATT operation not authorized.
    at EventTarget.connect (meshtastic.js:formatted:3999)

SerialConnection not working in Node.js

I've been able to succesfully connect to a device over HTTP in a Node.js app, but discovered when that connecting over Serial is dependent on navigator and doesn't work in Node.js. Is there any workaround, or possibility to remove this dependency?

Implement Web Serial functions

Make it possible to connect to a meshtastic device via the Web Serial API.
It is currently in origin trial in chrome.

https://www.chromestatus.com/feature/6577673212002304

Example:
https://codelabs.developers.google.com/codelabs/web-serial/?hl=iw

Maybe: add a feature to the meshtastic device code so that "autodiscover" works; meaning when you connect the device via usb a notification from the browser pops up that tells the user what to do. (Link to a meshtastic web app under app.meshtastic.org)

Export types and interfaces

Currently, you export types as a namespace and as a named export, so usage is a little convoluted:

import type { Types as MeshtasticTypes } from '@meshtastic/js';

params: MeshtasticTypes.HttpConnectionParameters

But that's not the best.

It would be great if you could simply export each type directly so we can do....

import type { HttpConnectionParameters } from '@meshtastic/js';

params: HttpConnectionParameters

Many thanks,
Drew

Payload data does not get decoded properly

Right now the library does not decode a text data payload, instead the payload object property contains a UInt8Array.
Expected behaviour: Data payload with type CLEAR_TEXT gets decoded to text.

payload

This is not an issue that was introduced with the typescript changes.

[Bug]: Saving MQTT config via web interface on Heltec v3 doesn't work

Category

Other

Hardware

Heltec V3

Firmware Version

2.3.1

Description

Trying to save MQTT config via web interface doesn't work.

Relevant log output

Console output Chrome:

index-nsbd6Oaw.js:84 Uncaught (in promise) TypeError: o.toBinary is not a function
    at zg (index-nsbd6Oaw.js:84:14940)
    at Vg (index-nsbd6Oaw.js:84:14228)
    at Object.writeMessage (index-nsbd6Oaw.js:84:11921)
    at i.toBinary (index-nsbd6Oaw.js:83:29735)
    at zg (index-nsbd6Oaw.js:84:14940)
    at Vg (index-nsbd6Oaw.js:84:14228)
    at Object.writeMessage (index-nsbd6Oaw.js:84:11921)
    at i.toBinary (index-nsbd6Oaw.js:83:29735)
    at zg (index-nsbd6Oaw.js:84:14940)
    at Vg (index-nsbd6Oaw.js:84:14228)

Install issue

While trying to run pnpm add @meshtastic/meshtasticjs I get the following error  ERR_PNPM_FETCH_404  GET https://registry.npmjs.org/@buf%2Fmeshtastic_protobufs.bufbuild_es: Not Found - 404

This issue seems to have been created in version 2.0.13-2? Not really sure what it's about.

Switching Atak Forwarder to work on Atak mil 4.2/4.3

Hello there

Would like to know if it's possible to modify the source code from Atak Forwarder 4.10 to make it work on Atak mil version

Currently it's running on civtak, would like to make it work on the milspec one

Sry for bad english :)

SUPER COOL!

This project is super cool! Bravo. Is it okay for me to add links to it from the main webpage?

Also - if you'd like to put it in the meshtastic github project, I'm happy to add you as a committer there and you can do so. (but no pressure)

Incorrectly set enums in protobuf messages

I originally discovered an occasional type mismatch in received protobufs when working on the meshtastic.js library, and found that enums are sent as there property name as against there index, i.e. "modemConfig": "Bw125Cr48Sf4096" vs "modemConfig": 3
This has two issues, firstly messages are much larger than they need to be, secondly, some protobuf libraries aren't smart enough to automatically handle these inconsistencies.

image

Add Type definitions or convert project to TypeScript

Hi, I have started using the meshtastic.js lib recently, but as a typescript developer I am having to generate my own type definitions.
looking at the how the library is being written, it should be easy to convert to ts, which would allow for better es6 support and targeting js versions for the output, I would be willing to make this conversion and make a pr, just seeing what people's opinions are first.

Unable to use with Create-React-App

I've been trying to pnpm add @meshtastic/meshtasticjs into an existing create-react-app but I keep getting errors

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
        - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "os": false }

This is how I created the react app:

pnpm create react-app pnpm-cra
cd pnpm-cra/ 
pnpm add @meshtastic/meshtasticjs

Then I added the snippet from the docs to a file Mesh.js:

import { IHTTPConnection } from "@meshtastic/meshtasticjs";

export const Connection = () => {
  const connection = new IHTTPConnection();

  const connect = () => {
    void connection.connect({
      address: "10.0.0.10",
      fetchInterval: 3000,
    });
  };

  return <button onClick={connect}>Connect Bluetooth</button>;
};

And then I tried to use it in App.js:

import logo from "./logo.svg";
import "./App.css";
import { Connection } from "./Mesh";
function App() {
  return (
    <div className="App">
      <Connection />
    </div>
  );
}

export default App;

Using:

~/projects/pnpm-cra$ node -v
v18.12.1

Support portnum architecture

Preliminary support for the portnum architecture is done, however the library still accesses and writes to some deprecated properties, this should be fixed.

Trouble importing meshtastic with node

I have installed meshtasticjs using npm and there were no errors.
When I tried to import in node v16.17.0 using this line:
import { IHTTPConnection } from "@meshtastic/meshtasticjs";
I get an error:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/gtnoble/Documents/Projects/meshtastic-test/node_modules/@meshtastic/meshtasticjs/dist/generated/module_config' imported from /home/gtnoble/Documents/Projects/meshtastic-test/node_modules/@meshtastic/meshtasticjs/dist/generated/mesh.js at new NodeError (node:internal/errors:387:5) at finalizeResolution (node:internal/modules/esm/resolve:429:11) at moduleResolve (node:internal/modules/esm/resolve:1006:10) at defaultResolve (node:internal/modules/esm/resolve:1214:11) at nextResolve (node:internal/modules/esm/loader:165:28) at ESMLoader.resolve (node:internal/modules/esm/loader:844:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18) at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40) at link (node:internal/modules/esm/module_job:75:36) { code: 'ERR_MODULE_NOT_FOUND' }
This could be a mistake on my part, but I thought I would reach out in case it was a deeper problem.

Changing INodeSerialConnection baud rate

Should we change the INodeSerialConnection baud rate to 921600? This is what the python CLI app uses for serial connections. I can't connect to the device without changing the baud rate for INodeSerialConnection to 921600. Another possibility is to add a parameter in the constructor to allow the use of different baud rates.

Make connection failure behaviour more robust

Right now, the TTGO-TBeams go into bluetooth sleep after a while.
If the library then tries to read/write from device, it is no longer available, so it fires the "disconnected" event and tries to reconnect three times (with an exponentially increasing wait time between tries).
This could lead to confusion, because the behaviour when using http is different, as there is no real connection state.

Proposed behaviour:
Make behaviour consistent so that it is clear when a device is finally disconnected and connect needs to be called again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.