Firefox 控制CR
發表於 : 2011-01-13 11:24:48
http://stackoverflow.com/questions/5920 ... erial-port
http://www.jsdb.org/
Javascript in particular, or just from the browser with some method? And which browser? (IE or Firefox?) Firefox plugins using XUL + javascript are pretty easy, although you'd still have to implement something in XPCOM (the Mozilla equivalent of ActiveX/COM) to work the RS232.
Alternatively you could use JSDB as an impromptu web server (on an alternate port of the local machine). It's ridiculously easy to use the RS232 port in JSDB:
c:\>jsdb
js>S=new Stream('com1://115200');
com1
js>S.write('\x00'); // send ASCII character 0 to the serial port
1
js>
So your browser-side implementation could just be whatever your favorite bookmark/link/thingy is that links to http://localhost:9999/comport/1 where 9999 is the port # JSDB is listening to, and "1" is the serial port switch. The JSDB code would listen to the port and send the appropriate RS232 command after parsing a GET request from the browser.
http://www.jsdb.org/
Javascript in particular, or just from the browser with some method? And which browser? (IE or Firefox?) Firefox plugins using XUL + javascript are pretty easy, although you'd still have to implement something in XPCOM (the Mozilla equivalent of ActiveX/COM) to work the RS232.
Alternatively you could use JSDB as an impromptu web server (on an alternate port of the local machine). It's ridiculously easy to use the RS232 port in JSDB:
c:\>jsdb
js>S=new Stream('com1://115200');
com1
js>S.write('\x00'); // send ASCII character 0 to the serial port
1
js>
So your browser-side implementation could just be whatever your favorite bookmark/link/thingy is that links to http://localhost:9999/comport/1 where 9999 is the port # JSDB is listening to, and "1" is the serial port switch. The JSDB code would listen to the port and send the appropriate RS232 command after parsing a GET request from the browser.