Comments (8)
I am working on a node.js module to make HM-10 BLE serial available through a socket or TCP/IP port. Can you provide any direction on how to implement it to make it compatible with this change?
from espruinotools.
Do you think you could explain in a bit more detail - will you be using an Espruino board for this?
It seems like you could do what you want just using node-serialport and node's socket library. I'm not sure you'd need to use EspruinoTools, in which case this change wouldn't affect you.
from espruinotools.
I have added a HM-10 module to my Espruino board and my goal is to use it as a wireless serial connection for the WebIDE. It is entirely possible that I'm making this more complicated than it needs to be but:
- It seems the HM-10, since it's BLE and doesn't support SPP, does not create a tty device. If there's already a way to accomplish this, I'd love to hear it!
- So I decided to make a node.js module to provide a stream interface to the HM-10 (https://github.com/xorbit/node-hm-ble). I can use this from node to communicate with the Espruino terminal when it's battery powered.
- Now I'd like to somehow tie that in to the WebIDE. I'm trying to figure out the best way to do that. I can pipe the stream to a socket, or to a pseudo tty. When I try the socket (or TCP/IP port), it works fine using telnet, but AFAIK there isn't a way yet for the WebIDE to talk to a socket. When I try the pseudo tty with a serial terminal, the Espruino seems to receive everything I type, but for some reason half of what it sends back to me gets lost somewhere. There are also some permission issues to figure out that prevent the WebIDE from picking it up.
Any thoughts or recommendations to figure this out? I would love to hear that it's an already solved problem and I'm way off with my approach. :-)
from espruinotools.
Ahh, thanks! I'll have a think and will get back to you about this tomorrow :)
from espruinotools.
It'd be great if there was a way to make it appear as a tty device. It looks like you may be able to use mkfifo or similar to create a tty from your userspace code - it might be an easy solution and wouldn't then be specific to Espruino (whether it could fool chrome enough to appear in the list of ttys I don't know!).
The other nice option would be to try and roll everything into one program. The Espruino Web IDE should be able to run with Node-Webkit with a few changes, and then you could just use BLE directly. I guess that's likely to end up being significantly more work, but I'd love it if that happened - a lot of people have been after a self-contained Web IDE executable.
So yes, I guess your options are pretty limited - as you say the socket route might be good and useful for the future (if it's possible - I'm not sure what socket support Chrome Web Apps provide). It'd be great if you wanted to create a new serial.js
that implemented Espruino.Core.Serial
, and to then just have all the other serial_*.js
register some kind of handler, although that's something I could do when I get a bit of time if you wanted?
If you just want to create a single-use Web App then I'd just create a serial_socket.js
file in the same style as the others. When I do implement this bug hopefully the changes to the files won't be massive - and if yours is in GitHub I'll make the changes to that as well.
from espruinotools.
I sent you a pull request for a quick and dirty serial-over-socket implementation that can be used with my BLE socket driver @ https://github.com/xorbit/node-hm-ble. I''m sure this needs some work but check if it works for you and if you like the concept, and I may put in some more time to integrate this.
from espruinotools.
Thanks - just pulled that in. It looks good... When I sort this bug out, it should allow users to choose between the different communication methods... At that point I'd move the throttling code as well, so it should really clean up all the serial_*.js
files.
from espruinotools.
Done now
from espruinotools.
Related Issues (20)
- Remove unicode.js HOT 3
- Upload code to flash using node module HOT 2
- Cannot find bangle.js with espruino --list HOT 7
- Error EspruinoTools and JQuery 3.6.0. HOT 9
- Error after fix for electron (0.1.42) HOT 11
- CLI attempts to access UNIX socket on Windows HOT 11
- espruino --list returns "Error: No compatible USB Bluetooth 4.0 device found!" HOT 3
- Cannot connect to puck.js on raspios/bullseye/arm64 HOT 5
- Terminal support for handling color text display with ANSI escape sequences HOT 14
- Dependency "tar.gz" is deprecated and contains security vulnerabilities HOT 1
- Use CLI with IDE Relay? HOT 2
- espruino-cli: Watch mode with file argument requires process.stdin.rawMode HOT 1
- Play program HOT 5
- 404 not found during `npm install espruino` HOT 1
- Work with arm64 HOT 1
- Improvements to localModules HOT 2
- Unable to install due to error in unmaintained dependency HOT 6
- Better typescript type support HOT 11
- EspruinoTools to exe HOT 3
- Pretokenization broken for at least BangleApps HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from espruinotools.