Serial communication from JavaScript?

前端 未结 7 2015
感情败类
感情败类 2020-12-28 19:46

Is it possible to communicate over a machine\'s serial port through JavaScript?

I have to write a short program that sends data to a microcontroller over the serial

相关标签:
7条回答
  • 2020-12-28 19:59

    No.

    I'd recommend wx-widgets for the task.

    0 讨论(0)
  • 2020-12-28 20:03

    What you could do is to use a Java applet that connects to the local computer's Java application that reads the serial port. The applet would then transfer the data to a JavaScript class or something that can hold the information. Then additional JavaScript code can be used to access the data. It's a complicated solution but should work.

    Another way is to create a POJO service.

    0 讨论(0)
  • 2020-12-28 20:06

    This is an old question, but in case this helps anyone else, Chrome Apps have access to a serial API - http://developer.chrome.com/apps/serial.html - which might help.

    It's Chrome specific (obviously..), but Chrome is available cross-platform so might answer the question.

    0 讨论(0)
  • 2020-12-28 20:08

    There's a cross platform plugin for serial port communication called jUART.

    0 讨论(0)
  • 2020-12-28 20:17

    Yes, it's possible using an ActiveX(I did it). You can make an activeX and use JavaScript to invoke it. If you prefer, you can make a .net dll and register it using regasm. Take a look at this link

    You also can write an activeX using VB6 and register it. Both works fine. Ps.: if you are using ActiveX, the JavaScript code will run just on IE.

    0 讨论(0)
  • 2020-12-28 20:19

    If you have a DLL library (this includes e.g. most Windows APIs) that allows you to communicate over serial port you can invoke it from Firefox chrome code (or content code with universalxpconnect privileges) by using ctypes.

    0 讨论(0)
提交回复
热议问题