Skip to content
프로젝트

billhsu/jUART has 202 GitHub stars and 76 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-24 00:58 UTC. Last push 2022-01-11.

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
기록 수집 중
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

소개

Cross platform browser plugin for serial port communication from JavaScript

개발 도구

README.md

Original

jUART

jUART, Cross platform browser plugin for serial port communication from JavaScript

![Gitter](https://badges.gitter.im/Join Chat.svg)

Digital Object Identifiers (DOI): citeDOI

Supported Platforms:

  • Browsers: Chrome, Firefox, Safari, IE(IE version is not released yet)

  • OS: Windows, Linux and Mac

Install Plugin

Windows:

Copy the /bin/Windows/npjUART.dll into your browser's plugin directory.

Take FireFox for example: Copy /bin/Windows/npjUART.dll to C:\Program Files (x86)\Mozilla Firefox\plugins

For Windows 8, you need to register the DLL first. You can copy the DLL under SYSTEM32(or SYSWOW for 64 bit systems). After that there's no need to copy it to browser's folders.

Linux:

Copy the ./bin/Linux/npjUART.so into your browser's plugin directory.

Take FireFox for example:

sudo cp npjUART.so ~/.mozilla/plugins/

Mac:

Mac version is not released yet, I don't have a Mac to build and test the project. You need to build it yourself. Sorry :-(

Usage

  • var ser = plugin().Serial; Get a Serial object

  • ser.open("COMA"); Open a port

  • ser.set_option(baud, parity, csize, flow, stop); Set port options

    • baud: Baud rate
    • parity: 0->none, 1->odd, 2->even
    • csize: 5 6 7 8
    • flow: 0->none, 1->software, 2->hardware
    • stop: 0->one, 1->onepointfive, 2->two
  • ser.recv_callback(recv); Bind callback function for recieve data.

    • 'recv' is a function in JavaScript,function recv(bytes, size)
    • 'bytes' are the data recieved, 'size' is the size of the bytes recieved
  • ser.send(char); Send a byte to serial port

Here is an echo test example, which is contained in the /example directory.

<html>
  <head>
    <title>test page for object fbcontrol</title>
  </head>
  <script type="text/javascript">
    var ser;
    function plugin0()
    {
      return document.getElementById('plugin0');
    }
    plugin = plugin0;
        
    function recv(bytes, size)
    {
      for(var i=0;i<size;++i)
      {
        ser.send(bytes[i]);
      }
    }
        
    function pluginLoaded() 
    {
      ser = plugin().Serial;// Get a Serial object
      ser.open("COMA");// Open a port
      ser.set_option(115200,0,8,0,0);// Set port options 
      ser.recv_callback(recv); // Callback function for recieve data
    }

    function pluginValid()
    {
      if(plugin().valid){
        alert(plugin().echo("This plugin seems to be working!"));
      } else {
        alert("Plugin is not working :(");
      }
    }
  </script>
  <body onload="load()">
    <object id="plugin0" type="application/x-juart" width="0" height="0" >
      <param name="onload" value="pluginLoaded"  />
    </object>
    <h1>jUART Serial Port Echo Test</h1><br/>
    This test will echo the data you sent through serial port.
  </body>
</html>

To Build

    1. Install FireBreath
    1. Run python fbgen.py in firebreath-dev, please set "Plugin Name" to jUART
    1. Goto firebreath-dev/projects, delete the jUART directory
    1. Same in firebreath-dev/projects, run git clone [email protected]:billhsu/jUART.git
    1. Windows: prep2008.cmd (or prep2005.cmd / prep2010.cmdif you have VS2005/2010) Linux: ./prepmake.sh Mac: ./prepmac.sh
    1. Windows: open build/Firebreath.xxx Linux:cd build/ then make

License

https://www.gnu.org/licenses/lgpl-2.1.html

Author

Bill Hsu

관련 프로젝트 살펴보기

불러오는 중…