This is the base class for all CFLink device objects. Subclasses do implement the actual device functionality (i.e. LANBridge, MOD4, SW16, etc). This class provides the base support and functionality for subclasses, like access to onboard COM ports for devices that have one (LAN Bridge, CFMini, DIN-MOD4) and support for sending CFLink-formatted messages. To obtain an object representing one of the devices on your CFLink bus, use the CFLink.getDevice function.
Example
// Obtain a DIN-MOD4 object to access it via JavaScript. This assumes that your
// GUI is configured with an external TCP system named "CFLINK" that connects to
// a LAN Bridge (for example on the default port 10207)
// The DIN-MOD4 we want to access has CFLink ID 11

var dm4 = CFLink.getDevice("CFLINK", CFLink.model.DINMOD4, "11");
Members

<static, constant> ID_CHANGED

Event fired when the ID of a CFLink device has changed. You can observe this event to update your GUI or take any other appropriate action after a device ID change has been successfully completed in the CFLink bus Your callback function should be of the form: function(event, device, oldID) event is the name of this event device is the CFLink.Device object whose ID has changed oldID is the previous CFLink ID this device had on the bus

<static, constant> INFO_RECEIVED

Event fired when the info (full description) for a device has been received. You can observe this event to take any appropriate action, for example further access the modules of a CFLink.DINMOD4 object once the framework has gathered information about which modules have been plugged in. Your callback function should be of the form: function(event, device, ready) event is the name of this event device is the CFLink.Device object that just rebooted ready is a boolean, true if the device is up and running, false if its firmware is invalid and it's in "waiting for flash" mode

<static, constant> REBOOTED

Event fired when a device has rebooted. You can observe this event to take any appropriate action if you need to know that the device is up. Your callback function should be of the form: function(event, device, ready) event is the name of this event device is the CFLink.Device object that just rebooted ready is a boolean, true if the device is up and running, false if its firmware is invalid and it's in "waiting for flash" mode
Methods
configureCOMPort ( mode , baud , dataBits , parity , stopBits , flowControl )
Parameters:
Name Description
mode the mode to set (see CFLink.RS232Port.Valid.Modes)
baud the port speed to set (see CFLink.RS232Port.Valid.Bauds)
dataBits the number of data bits (7 or 8)
parity the parity ("N" for none, "E" for even, "O" for odd)
stopBits the number of stop bits (1 or 2)
flowControl whether to apply flow control (true or false and 1 or 0 accepted)
Configure the onboard COM port of the device has one
rebootDevice ( )
Resets the device, this will also apply some configuration changes for some devices like LANBridge
send ( commandType , command , payload )
Parameters:
Name Type Description
commandType String the command type (i.e. 'Q', 'T', etc)
command String the command (i.e. "SET")
payload String the actual payload of the CFLink packet
Send a CFLink packet to the CFLink device this object represents
sendCOMData ( data )
Parameters:
Name Description
data the data to send. Data is being sent verbatim. You can pass a string, or an array of character codes (if you pass an array, the software assumes these are character codes, and will turn each code into a byte)
Send data to the device's onboard COM port if it has one (i.e. CFMini, LAN Bridge, DIN-MOD4)
setCFLinkID ( id )
Parameters:
Name Type Description
id string CFLink ID of the device in ascii format ('02' - 'EF')
Change the CFLink ID of the device.
unwatch ( watcherID )
Parameters:
Name Type Description
watcherID Number the watcher ID that was returned by CFLink.Device.watchCOMPort
Stop watching the changes you asked to be notified for in CFLink.Device.watchCOMPort You could as well call CFLink.unwatch which does the same thing.
watchCOMPort ( callback , me )
Parameters:
Name Type Description
callback Function your callback function, of the form myCallback(deviceObject, data)
me Object the object to set as `this' when calling your callback function
Returns
a watcherID you can use to unwatch with CFLink.Device.unwatch or CFLink.unwatch
Type
Number
Setup a callback function that will be called whenever data is received on the device's onboard COM port Having multiple callback monitoring the onboard COM port is allowed. Your callback function should be of the form: myCallback(deviceObject, data) Where `deviceObject' is the CFLink.Device device object (for example a CFLink.CFMini object), and `data' is the received data (a String that may contain binary characters, as all received data is passed verbatim to you).