This object is the JavaScript interface to a CommandFusion DIN-MOD4 device. It inherits the functions and properties of CFLink.Device. A DIN-MOD4 is a modular unit that also has a couple onboard ports (RS-232, single digital input) To access the onboard RS232, you'll use the CFLink.Device.configureCOMPort, CFLink.Device.sendCOMData and CFLink.Device.watchCOMPort functions. You can monitor the digital input port by calling CFLink.DINMOD4.watchOnboardDigitalInput.
Methods
getDigitalInputState ( )
Get the current state of the onboard digital input (the one located at the back of the DIN-MOD4 unit)
getModule ( slotNumber )
Parameters:
Name Type Description
slotNumber Number the slot number in the DIN-MOD4 unit (1-4). Slot 1 is the one on the left, at the same level as the CFLink ID indicator.
Returns
a module object, or null
Type
CFLink.Module
Obtain the CFLink.Module object that represents a module inserted in one of the slots of the DIN-MOD4 device. If there is no module inserted in this slot, or if the list of inserted modules is not yet known, this function returns null. Once you have a CFLink.Module object, you can use the object to talk to the module itself, get or set the ports, configure it, etc.
unwatch ( watcherID )
Parameters:
Name Type Description
watcherID Number the watcher ID that was returned by CFLink.DINMOD4.watchOnboardDigitalInput
Stop watching the changes you asked to be notified for in CFLink.DINMOD4.watchOnboardDigitalInput You could as well call CFLink.unwatch which does the same thing.
watchOnboardDigitalInput ( callback , me )
Parameters:
Name Type Description
callback Function your callback function, of the form callback(dinmod4_object, portNumber, value)
me Object the object to set as `this' when calling your callback function
Returns
a watcherID you can use to unwatch with CFLink.unwatch or CFLink.DINMOD4.unwatch (both are equivalent)
Type
Number
Setup a callback function that is called when the state of the selected IO port(s) change This is a simple helper that watches the CFLink.IOPort.VALUE_CHANGE event and only calls you back when one of the I/O ports you want to watch changes state. Your callback function should be of the form: myCallback(cfminiObject, portNumber, previousValue, newValue) Where `cfminiObject' is the CFLink.CFMini device object, `portNumber' is the I/O port number that changed state, `previousValue' is the previous value of this I/O port, and `newValue' is its new value. Note that when we get the initial value of the I/O port (at initialization time), the `previousValue' parameter will be -1.