meshtastic / js

JS/TS library for interfacing with Meshtastic devices
https://meshtastic.org
GNU General Public License v3.0
77 stars 36 forks source link

Simple CLI example showing serial connection, subscribing to events and publishing messages #86

Open timcash opened 5 months ago

timcash commented 5 months ago

The examples I see all use react and rxjs. A simple javascript / typescript cli app that shows all the functionality as a test would be very helpful to get started using this. I would be able to help improve it if someone could help me get started.

Hunter275 commented 3 months ago

I've got an extremely basic app in #95

Going to write up a README for it tomorrow

Hunter275 commented 3 months ago

@timcash @michaelachrisco

Check out #95 (https://github.com/Hunter275/js/tree/example/example)

Let me know if you have any issues starting the app or anything

michaelachrisco commented 3 months ago

Ill give it a shot after work. Thanks @Hunter275

TheCyberRonin commented 1 month ago

@timcash @michaelachrisco

Check out #95 (https://github.com/Hunter275/js/tree/example/example)

Let me know if you have any issues starting the app or anything

I just got into Meshtastic and I have a good amount of JS experience. That example uses HttpConnection and not SerialConnection like this issue is asking for. I also wanted to toy around to get this to work for myself. What I've found is that the web serial API is not the same as in NodeJS. You can avoid the failure of navigator.serial if you use the popular serialport, but you run into issues down the line. What would have to happen is to essentially have another type of connection that would support serialport bindings and be able to be used for node. Something like NodeSerialConnection. You could also probably have it extend SerialConnection and fill in the gaps.

Hunter275 commented 1 month ago

@TheCyberRonin

I've only recently taken over this repo, and have not spent much time in it yet, I'm more focused on the web repo currently.

If you're willing to submit a PR with NodeSerialConnection to support serialport, even as a proof of concept, that would be awesome. If all goes well, we can assess what it would take to swap navigator.serial if we so desire.

TheCyberRonin commented 1 month ago

@Hunter275 I'd be more than happy to try that out! When I have some free time I'll port that over and see what shakes out.

TheCyberRonin commented 1 month ago

@Hunter275 just an update, I got it kind of working. I think I need to alter some things and make a separate transform for Node as well. It doesn't error when I build and connect to my heltec via serial, but it does shut my device down lol. So it's communicating, just got some signals crossed it seems.