CommandFusion Wiki

Documentation Resources

User Tools

Site Tools


hardware:cflink:rules

This is an old revision of the document!


Rules (Event Triggering)

Overview

Rules allow each device on the CFLink network to perform actions based on string matching of outgoing data on the CFLink bus.
For example, you can create a rule that when a specific dry contact on a SW16 is closed, a custom macro is triggered.

For more details on how to configure rules, please see our general rules tab entry on our wiki.

Rules Protocol

Due to the storage requirements on CFLink devices, all rules on a device must be transfered in one process. Single rules cannot be added/edited/removed without sending all other rule information stored on the device at the same time. This means there are only three CFLink messages used to manipulate rules on a device, Write, Read and Delete.

Below is more information on these three commands, but to make life easier, we have also created a RulesProcessor JavaScript object that you can use if needed.
This script will handle all the byte formatting and rule object creation for you, based on the CF Rules File Format specification.

File Format Documentation

Full documentation for the rules file format and transmission protocol is available with diagrams and sample data in the following PDF:
Rules Protocol Document

Queries

RLR - Rules Read

The RLR query is used to read all the rules stored a specific CFLink device.

Data

The RLR query does not have any associated data.

Reply

All rule information is transmitted in a series of replies, depending on the size of the data (the number of rules defined, number and size of actions, etc).
For specific details, on the return format, please see this PDF.

Example

Here is a basic example (without actual rule data) to show the basic sequence of events when sending rule information to be stored on the device

All the received rule data can then be appended to create a single byte array, and parsed using the RulesProcessor JavaScript.

Configuration Messages

RLW - Rules Write

The RLW command is used to write rules to the on-board memory of a CFLink device. All rules must be included in the transmition, as partial rule writing is not possible.

Data

The RLW command requires sending the rule records as the command data, split into packets of 264 bytes, padding with \xFF bytes if the final record does not reach 264 bytes in length.

Reply

After each record, the device will reply with the acknowledgement reply, and the same for the final END command.

Example

Here is a basic example (without actual rule data) to show the basic sequence of events when requesting the stored rule information

RLD - Rules Delete

The RLD command is used to delete rules stored in the on-board memory of a CFLink device. All rules will be deleted when this command is sent.

Data

The RLD command does not have any associated data.

Reply

Example

hardware/cflink/rules.1389589425.txt.gz · Last modified: 2015/10/15 12:53 (external edit)