new SW16

Interface to a SW16 device

Parameters:
Name Description
systemName
id
dataString
The CFLink.SW16 object lets you interact with an SW16 device on your CFLink bus
Members

<static> DRY_CONTACT_CHANGE :String

Event fired when a dry contact changes state Your callback function for watching this event should be of the type: function(event, sender, dryContactNumber, state) the dryContactNumber is the number of the dry contact, 1-16 the state is 1 or 0
Methods
blinkBacklightLED ( index , minLevel , maxLevel , timeMax , timeMin , count )
Parameters:
Name Description
index a single backlight led number (1-4) or an array of backlight led numbers (i.e. [1,3])
minLevel minimum level (0-100)
maxLevel maximum level (0-100)
timeMax time to stay at max level, in 0.1s increments
timeMin time to stay at min level, in 0.1s increments
count number of times to switch from min level to max level and back. Pass 0 for unlimited
Blink one or more LEDs, switching instantly between the minimum and maximum levels and remaining at each level the specified time
blinkLED ( index , minLevel , maxLevel , timeMax , timeMin , count )
Parameters:
Name Description
index a single led number (1-16) or an array of led numbers (i.e. [1,3,5,9])
minLevel minimum level (0-100)
maxLevel maximum level (0-100)
timeMax time to stay at max level, in 0.1s increments
timeMin time to stay at min level, in 0.1s increments
count number of times to switch from min level to max level and back. Pass 0 for unlimited
Blink one or more LEDs, switching instantly between the minimum and maximum levelsĀ  and remaining at each level the specified time
dimBacklightLED ( index , minLevel , maxLevel , timeToMax , timeToMin , count )
Parameters:
Name Description
index a single backlight led number (1-4) or an array of backlight led numbers (i.e. [1,3])
minLevel minimum level (0-100)
maxLevel maximum level (0-100)
timeToMax time to reach max level, in 0.1s increments
timeToMin time to reach min level, in 0.1s increments
count number of times to dim from min level to max level and back. Pass 0 for unlimited
Dim one or more backlight LEDs, fading between the minimum and maximum levels
dimLED ( index , minLevel , maxLevel , timeToMax , timeToMin , count )
Parameters:
Name Description
index a single led number (1-16) or an array of led numbers (i.e. [1,3,5,9])
minLevel minimum level (0-100)
maxLevel maximum level (0-100)
timeToMax time to reach max level, in 0.1s increments
timeToMin time to reach min level, in 0.1s increments
count number of times to dim from min level to max level and back. Pass 0 for unlimited
Dim one or more LEDs, fading between the minimum and maximum levels
getBacklightLED ( number )
Parameters:
Name Description
number the backlight LED to get (1-4)
Returns
a LED object
Type
CFLink.LEDPort
Obtain the backlight CFLink.LEDPort object at specified position. You can obtain the current state and level from the returned object.
getDryContactState ( number )
Parameters:
Name Description
number the dry contact number (1-16)
Returns
1 if closed (pushed), 0 if open (released), -1 if not known yet
Get the current state of a dry contact of this SW16
getDryContactStates ( )
Obtain the full state list of dry contacts. Returns an array of numbers. First element represents dry contact #1, last element (index 15) represents dry contact #16.
getLED ( number )
Parameters:
Name Description
number the LED to get (1-16)
Returns
a LED object
Type
CFLink.LEDPort
Obtain the CFLink.LEDPort object at specified position. You can obtain the current state and level from the returned object.
pulseBacklightLED ( index , time )
Parameters:
Name Description
index a single backlight led number (1-4) or an array of backlight led numbers (i.e. [1,3])
time the time to pulse the LED on for, in a resolution of 0.1 seconds. Min 0 seconds (0), Max 999.9 seconds (9999)
Pulse one or more backlight LEDs
pulseLED ( index , time )
Parameters:
Name Description
index a single led number (1-16) or an array of led numbers (i.e. [1,3,5,9])
time the time to pulse the LED on for, in a resolution of 0.1 seconds. Min 0 seconds (0), Max 999.9 seconds (9999)
Pulse one or more LEDs
rampBacklightLED ( index , level , time )
Parameters:
Name Description
index a single backlight led number (1-4) or an array of backlight led numbers (i.e. [1,3])
level the level to which to ramp the aforementioned LEDs
time the ramp duration in 0.1s increments
Ramp one or more LEDs
rampLED ( index , level , time )
Parameters:
Name Description
index a single led number (1-16) or an array of led numbers (i.e. [1,3,5,9])
level the level to which to ramp the aforementioned LEDs
time the ramp duration in 0.1s increments
Ramp one or more LEDs
readStatus ( )
Ask the device to report its complete status (dry contacts states, LEDs & backlight LEDs current values)
setBacklightLED ( index , on )
Parameters:
Name Description
index a single backlight led number (1-4) or an array of backlight led numbers (i.e. [1,3])
on true to turn on, false to turn offevel of the LED, 0-100
Sets the state of one or more backlight LEDs
setLED ( index , on )
Parameters:
Name Description
index a single led number (1-16) or an array of led numbers (i.e. [1,3,5,9])
on true to turn on, false to turn offevel of the LED, 0-100 (can also pass 1 / 0)
Sets the state of one or more LEDs
toggleBacklightLED ( index )
Parameters:
Name Description
index a single backlight led number (1-4) or an array of backlight led numbers (i.e. [1,3])
Toggle the state of one or more backlight LEDs
toggleLED ( index )
Parameters:
Name Description
index a single led number (1-16) or an array of led numbers (i.e. [1,3,5,9])
Toggle the state of one or more LEDs
unwatchContacts ( watcherID )
Parameters:
Name Type Description
watcherID number the watcher ID that was returned by CFLink.SW16.watchContacts
Stop watching the contact changes you asked to be notified for in CFLink.SW16.watchContacts. You could as well call CFLink.unwatch which does the same thing.
watchContacts ( contacts , callback , me )
Parameters:
Name Type Description
contacts Array an array of the contact numbers to watch. Pass `null' to watch all dry contacts
callback Function your callback function, of the form callback(sw16_object, contactNumber, contactState)
me Object the object to set as `this' when calling your callback function
Returns
a watcherID you can use to unwatch with CFLink.SW16.unwatchContacts
Type
number
Setup a callback function that is called when the state of selected contacts changes This is a simple helper that watches the CFLink.SW16.DRY_CONTACT_CHANGE event and only calls you back when one of the dry contacts you want to watch changes state. Note that when a contact is being pressed then released, you will be called twice (once for Press, once for Release)