RS232 JavaScript Functions

<< Click to Display Table of Contents >>

Navigation:  JavaScript > Custom JavaScript functions for device specific functionality >

RS232 JavaScript Functions

Support for the RS 232 interface is provided by a JavaScript interface - there are no dedicated variables involved.

 

The approach requires instantiating an 'RS232Handler' object which represents one RS 232 interface.

Currently this uses the one port provided on the device.

If more than one port should exist in the future, then one instance per port would have to be created.

 

Once the object is created, all function calls have to be done for this object.

 

Note that this interface was designed mainly for serial printers - that's why the 'read' functionality is rather limited for now.

 

hmtoggle_plus1RS232Handler - constructor to get an RS232 instance

 

hmtoggle_plus1RS232Handler.init - open interface and set baud rate

 

hmtoggle_plus1RS232Handler.encoding - set the character encoding of the target

 

hmtoggle_plus1RS232Handler.getBaudrate - read the baud rate currently used

 

hmtoggle_plus1RS232Handler.getPort - read the name of the RS232 interface currently used

 

hmtoggle_plus1RS232Handler.writeFromBuffer - write a string or an array of numbers to the serial port

 

hmtoggle_plus1RS232Handler.readIntoBuffer - read data from serial interface