Giter Club home page Giter Club logo

Comments (8)

xorbit avatar xorbit commented on September 7, 2024

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.

gfwilliams avatar gfwilliams commented on September 7, 2024

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.

xorbit avatar xorbit commented on September 7, 2024

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.

gfwilliams avatar gfwilliams commented on September 7, 2024

Ahh, thanks! I'll have a think and will get back to you about this tomorrow :)

from espruinotools.

gfwilliams avatar gfwilliams commented on September 7, 2024

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.

xorbit avatar xorbit commented on September 7, 2024

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.

gfwilliams avatar gfwilliams commented on September 7, 2024

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.

gfwilliams avatar gfwilliams commented on September 7, 2024

Done now

from espruinotools.

Related Issues (20)

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.