CommandFusion Wiki

Documentation Resources

User Tools

Site Tools


hardware:cflink:com-module-cflink-documentation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

hardware:cflink:com-module-cflink-documentation [2012/09/28 06:44]
jarrod
hardware:cflink:com-module-cflink-documentation [2015/07/16 04:38] (current)
jarrod
Line 1: Line 1:
-====== ​Rules (Event Triggering) ​======+====== ​COM Module/Card CFLink Documentation ​====== 
 +The following documentation is for COM (serial port) modules and cards.
  
-===== Overview ​=====+===== Port Configurations ​=====
  
-Rules allow each device on the CFLink network ​to perform actions based on string matching of outgoing data on the CFLink bus.\\ +The COM4 supports up to 4 COM port combinations,​ with RS232, RS422 and RS485 support, including flow control options.\\ 
-For example, you can create a rule that when a specific dry contact on a SW16 is closeda custom macro is triggered.+\\ 
 +The default port configuration ​is 4 x RS2329600 Baud Rate, 8 Data Bits, No Parity, 1 Stop Bit, No Flow Control.\\ 
 +\\ 
 +The following tables demonstrate the possible port combinations of a single COM4 module:\\
  
-Rules are stored on the device that sends the commandsSo if you want to perform a rule when a SW16 dry contact closesyou store the rule on the SW16.\\ +<​html>​ 
-If you wanted to perform a rule when data arrived on a TCP socket ​in the LAN Bridgeyou would store the rule on the LAN Bridge.\\ +<style type="​text/​css">​ 
-If you wanted to perform a rule when the resistance input of a MOD-IO8 changed, you would store the rule in the unit housing the module (DIN-MOD4 for example).+.rs232, .rs232H, .rs485, .rs422 { 
 + background-color:​ #fcd4b2; 
 + text-align:​ center; 
 + padding: 0 4px 0 4px;  
 +
 +.rs232H { 
 + background-color:​ #c2d798; 
 +
 +.rs485 { 
 + background-color:​ #e6b7b6; 
 +
 +.rs422 { 
 + background-color:​ #c4bd94; 
 +
 +.tableheading { 
 + text-align:​ center; 
 + font-style:​ italic; 
 + font-size: 0.8em; 
 +
 +</​style>​ 
 +<​table>​ 
 + <​tr>​ 
 + <td colspan="​4"​ class="​tableheading">​Legend:</​td>​ 
 + <​tr>​ 
 + <td class="​rs232">​RS232 without handshaking/​flow control</​td>​ 
 + <td class="​rs232H">​RS232 with RTS/​CTS</​td>​ 
 + <td class="​rs485">​RS485 half-duplex</​td>​ 
 + <td class="​rs422">​RS485/​422 full-duplex</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +<​table>​ 
 +<​tr>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <​td>​2</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <​td>​4</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​4 x RS232<​br/>&​nbsp;</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <​td>​2</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs232H">​232H</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​2 x RS232<​br/>​1 x RS232 RTS/​CTS</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td colspan="​2"​ class="​rs232H">​232H</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs232H">​232H</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​2 x RS232 RTS/​CTS<​br/>&​nbsp;</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td colspan="​2"​ class="​rs485">​485</​td>​ 
 + <​td>&​nbsp</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <​td>​4</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​1 x RS485 half-duplex<​br/>​2 x RS232</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td colspan="​2"​ class="​rs485">​485</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs232H">​232H</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​1 x RS485 half-duplex<​br/>​1 x RS232 RTS/​CTS</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +</​tr>​ 
 +<​tr>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td colspan="​2"​ class="​rs485">​485</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs485">​485</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​2 x RS485 half-duplex<​br/>&​nbsp;</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td colspan="​2"​ class="​rs485">​485</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs422">​485/​422</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​1 x RS485 half-duplex<​br/>​1 x RS485/422 full-duplex</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td colspan="​2"​ class="​rs422">​485/​422</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs422">​485/​422</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​2 x RS485/422 full-duplex<​br/>&​nbsp;</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td colspan="​2"​ class="​rs422">​485/​422</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs232H">​232H</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​1 x RS485/422 full-duplex<​br/>​1 x RS232 RTS/​CTS</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td colspan="​2"​ class="​rs422">​485/​422</​td>​ 
 + <​td>&​nbsp</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <​td>​4</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​1 x RS485/422 full-duplex<​br/>​2 x RS232</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +</​tr>​ 
 +</​table>​ 
 +</​html>​ 
 +Note that when using any RS232 mode in combination with RS485 or RS422 (any duplex type), the RS232 must be on ports 3 and/or 4.\\ 
 +RS232 can never be in ports 1 or 2 when using alongside RS485 or RS422.
  
-===== Rule Properties ​=====+<​html>​ 
 +<​table>​ 
 +<tr style="​background-color:​ #​ee5b5b;">​ 
 + <td colspan="​4"​ style="​text-align:​ center; border-bottom:​ 3px solid red; font-weight:​ bold; color: #​ffffff;">​THE FOLLOWING MODES ARE INVALID!</​td>​ 
 +</​tr>​ 
 +<tr style="​background-color:​ #​f2e8e8;">​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <​td>​2</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs485">​485</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​2 x RS232<​br/>​1 x RS485 half-duplex</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td colspan="​2"​ class="​rs232H">​232H</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs485">​485</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​1 x RS232 RTS/​CTS<​br/>​1 x RS485 half-duplex</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <td class="​rs232">​232</​td>​ 
 + <​td>​2</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs422">​485/​422</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​2 x RS232<​br/>​1 x RS485/422 full-duplex</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +<td align="​center">​ 
 +<​table>​ 
 + <​tr>​ 
 + <​td>​1</​td>​ 
 + <td colspan="​2"​ class="​rs232H">​232H</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <​tr>​ 
 + <​td>​3</​td>​ 
 + <td colspan="​2"​ class="​rs422">​485/​422</​td>​ 
 + <​td>&​nbsp;</​td>​ 
 + </​tr>​ 
 + <tr class="​tableheading">​ 
 + <td colspan="​4">​1 x RS232 RTS/​CTS<​br/>​1 x RS485/422 full-duplex</​td>​ 
 + </​tr>​ 
 +</​table>​ 
 +</​td>​ 
 +</​tr>​ 
 +</​table>​ 
 +</​html>​
  
-A rule is defined with a name, search string and a macro to trigger.+===== Queries =====
  
-  * **Name** ​A name given to the rule for your records. The name has no effect on anything, it's just a way to remember what a rule was created for. +==== SPC - Query Configuration ====
-  * **Search String** ​A search pattern to match an outgoing CFLink message (as well as incoming TCP/UDP packets for LAN Bridge rules). When this search pattern matches any the message, the rule is triggered.\\ Search strings can contain wildcard match characters as follows: +
-    * * (asterisk) means match any character zero or more times, until the next defined character in the search string is found, or until the end of the message. +
-    * . (period) means match any character a single time. +
-  * **Macro Name** ​The name of a macro to perform when the rule is triggered (when the search string matches any outgoing data)+
  
-===== Macro Properties =====+The ''​SPC''​ (Serial Port Configuration) query is used to return the status of the port configurations for the module/​card.
  
-A Macro is defined with a name and a series of actions and delays.+=== Data ===
  
-  * **Name** = The name of the macro. This is used by Rule definitions to call the macro to be performed. +<sxh cflink; light: true> 
-  * **List Of Commands & Delays** = One or more actions with a delay +> [F2]<​ID>​[F3]QCOMSPC[F4]<​M#>​[F5][F5]
-    * **Command Data** = The command data to send as part of the macro. +
-    * **Delay** = The delay before the command data for this action is sent. This delay is sequential, meaning its the delay from the action above it, NOT a delay from the start of the macro. The delay occurs BEFORE the command is sent. Use a delay of 0 (zero) to instantly send the command data.+
  
-===== Rules Protocol =====+</​sxh>​
  
-Due to the storage requirements on CFLink devicesall rules on a device must be transfered in one processSingle 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, WriteRead and Delete.+  * **<​M#>​** = The module number return ​the configuration for. 2 charsuppercase '​M'​ followed by the module/card number. 
 +    * eg. ''​M1''​ = Module/card 1''​M4''​ = Module4.
  
-Below is more information on these three commands, but to make life easier, we have also created a [[http://​github.com/​CommandFusion/​RulesProcessor|RulesProcessor JavaScript object]] that you can use if needed.\\ +=== Reply ===
-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 =====+<sxh cflink; light: true> 
 +< [F2]<​ID>​[F3]RCOMSPC[F4]<​M#>​|<​P##>:<​MODE>:<​BAUD>:<​DATABITS>:<​PARITY>:<​STOPBITS>:<​FLOWCONTROL>​[F5][F5]
  
-Full documentation for the rules file format and transmission protocol is available with diagrams and sample data in the following PDF:\\ +</sxh>
-[[https://​github.com/​downloads/​CommandFusion/​Downloads/​RulesProtocol_v0.8.pdf|Rules Protocol Document]]+
  
-===== Queries ​=====+Each port on the COM module/card will be included in the reply.\\ 
 +See the definitions for all returned data in the SPC command. 
 + 
 +=== Example ​==
 + 
 +<sxh cflink; light: true> 
 +// Query configuration for Module 2 in a MOD4 on CFLink ID [11] 
 +> [F2][11][F3]QCOMSPC[F4]M2[F5][F5] 
 +// Reply 
 +< [F2][11][F3]RCOMSPC[F4]M2|P01:​232:​9600:​8:​N:​1:​0|P02:​232:​115200:​8:​N:​1:​0|P03:​OFF:​9600:​8:​N:​1|P04:​OFF:​9600:​8:​N:​1[F5][F5] 
 +// Ports 03 and 04 are both off. 
 +// Ports 01 and 02 are set to RS232 mode 
 +</​sxh>​ 
 + 
 +===== Configuration Messages ​=====
  
-==== RLR Rules Read ====+==== SPC Configure Serial Port ====
  
-The ''​RLR'' ​query is used to read all the rules stored a specific CFLink device.+The ''​SPC'' ​(Serial Port Configure) command ​is used to setup the configuration of each port within the module.\\ 
 +You can configure multiple ports at once, across multiple modules, using the Port and Module separators.
  
 === Data === === Data ===
  
-The ''​RLR'' ​query does not have any associated data.+<sxh cflink; light: true> 
 +// Target device: COM4 Module 
 +> [F2]<​ID>​[F3]CCOMSPC[F4]<​M#>​|<​P##>:<​MODE>:<​BAUD>:<​DATABITS>:<​PARITY>:<​STOPBITS>:<​FLOWCONTROL>​[F5][F5] 
 + 
 +</​sxh>​ 
 + 
 +  * <M#> = The module number to configure port settings for. 2 chars, uppercase ​'M' ​followed by the module/card number. 
 +    * eg. ''​M1''​ = Module/card 1, ''​M4''​ = Module 4. 
 +  * **<​P##>​** = Port number to configure. 3 chars, uppercase '​P'​ followed by the two digit port number. 
 +    * eg. ''​P01''​ = Port 1, ''​P02''​ = Port 2. 
 +  * **<​MODE>​** = The following modes are available:​ 
 +    * ''​0''​ = Port Off 
 +    * ''​232''​ = RS232 (handshaking determined via the <​FLOWCONTROL>​ setting) 
 +    * ''​485H''​ = Half-duplex RS485 
 +    * ''​4XXF''​ = Full-duplex RS485 or RS422 
 +  * **<​BAUD>​** = The following baud rates are available:​ 
 +    * 100 
 +    * 300 
 +    * 600 
 +    * 1200 
 +    * 2400 
 +    * 4800 
 +    * 9600 
 +    * 14400 
 +    * 19200 
 +    * 38400 
 +    * 57600 
 +    * 115200 
 +    * 128000 
 +    * 256000 
 +  * **<​DATABITS>​** = Always ''​8''​ Data Bits 
 +  * **<​PARITY>​** = The following parity types are available:​ 
 +    * ''​N''​ = No Parity 
 +    * ''​O''​ = Odd (uppercase letter '​O'​) 
 +    * ''​E''​ = Even 
 +  * **<​STOPBITS>​** = The following stop bits are available:​ 
 +    * ''​1''​ = 1 stop bit 
 +    * ''​2''​ = 2 stop bits 
 +  * **<​FLOWCONTROL>​** = The following flow control (handshaking) options are available:​ 
 +    * ''​0''​ = No flow control 
 +    * ''​1''​ = Enable RTS/CTS
  
 === Reply === === 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 actionsetc).\\ +<sxh cflink; light: true> 
-For specific details, on the return format, please see this PDF.+< [F2]<​ID>​[F3]RCOMSPC[F4]<​M#>​|<​P##>:<​MODE>:<​BAUD>:<​DATABITS>:<​PARITY>:<​STOPBITS>:<​FLOWCONTROL>​[F5][F5] 
 + 
 +</​sxh>​ 
 +The reply will contain ​information ​for each port of the module/cardeven if only one port was changedSee the definitions for all returned data above.
  
 === Example === === 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 
  
 <sxh cflink; light: true> <sxh cflink; light: true>
-// Request the Rules stored ​on device at CFLink ID [03+// Set Port 01 to RS485 115200 Baud, 8 data bits, no parity, 1 stop bit, no flow control 
-> [F2][03][F3]QCFXRLR[F4]START[F5][F5] +// For Module 1 in a MOD4 on CFLink ID [11
-// The Reply if the unit was a LAN Bridge would be as follows +> [F2][11][F3]CCOMSPC[F4]M1|P01:​4XXF:​115200:​8:​N:​1:​0[F5][F5] 
-< [F2][03][F3]RLANRLR[F4]<​DATA1>​[F5][F5] +// Reply 
-// We must then acknowledge the data receipt by sending an ACK to the device so that it can continue sending the next reply +< [F2][11][F3]RCOMSPC[F4]M1|P01:​4XXF:​115200:​8:​N:​1:​0|P02:​OFF:​9600:​8:​N:​1|P03:​OFF:​9600:​8:​N:​1|P04:​OFF:​9600:​8:​N:​1[F5][F5] 
-> [F2][03][F3]QLANRLR[F4]ACK[F5][F5] + 
-// Second packet of rule data will now be transmitted +// Port 01 is already set to RS485 mode, now we want to set port 02 to 232 mode. 
-[F2][03][F3]RLANRLR[F4]<​DATA2>​[F5][F5+// For Module 2 in a MOD4 on CFLink ID [11
-// Acknowledge receipt of the data again +// This will break the RS485 mode, as it requires both A and B ports combined. 
-> [F2][03][F3]QLANRLR[F4]ACK[F5][F5] +> [F2][11][F3]CCOMSPC[F4]M2|P02:​232:​115200:​8:​N:​1:​0[F5][F5] 
-// Continue this back and forth whilst more rule data packets need to be received +// Reply 
-< [F2][03][F3]RLANRLR[F4]<​DATA3>​[F5][F5] +< [F2][11][F3]RCOMSPC[F4]M2|P01:​232:​9600:​8:​N:​1:​0|P02:​232:​115200:​8:​N:​1:​0|P03:​OFF:​9600:​8:​N:​1|P04:​OFF:​9600:​8:​N:​1[F5][F5] 
-> [F2][03][F3]QLANRLR[F4]ACK[F5][F5] + 
-< [F2][03][F3]RLANRLR[F4]<​DATA4>​[F5][F5] +// Error setting port mode, invalid port combination (only port 01 or 03 can be set in RS485/422 mode) 
-> [F2][03][F3]QLANRLR[F4]ACK[F5][F5] +> [F2][11][F3]CCOMSPC[F4]M1|P04:​4XXF:​115200:​8:​N:​1:​0[F5][F5] 
-+// Replywhen previous command was sent from LANBridge on CFLink ID [02
-+[F2][11][F3]RCOMERR[F4]Invalid COM Mode:​02:​CCOMSPC:​M1|P04:​4XXF:​115200:​8:​N:​1:​0[F5][F5]
-. +
-// Once all rule data has been transmitted by the device, a final END message is transmitted. +
-[F2][03][F3]RLANRLR[F4]END[F5][F5+
-// We must then acknowledge the END receipt as well. +
-[F2][03][F3]QLANRLR[F4]ACK[F5][F5]+
 </​sxh>​ </​sxh>​
  
-All the received rule data can then be appended to create a single byte array, and parsed using the RulesProcessor JavaScript.+===== Transmission Messages =====
  
-===== Configuration Messages =====+==== SPW - Send Serial Data ====
  
-==== RLW - Rules Write ====+The ''​SPW''​ (Serial Port Write) command is used to send serial data out a specific port within the module/​card.
  
-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.+<sxh cflink; light: true> 
 +// Target ​device: COM4 Module 
 +> [F2]<​ID>​[F3]TCOMSPW[F4]<​M#>​|<​P##>:<​DATA>​[F5][F5]
  
-=== Data ===+</​sxh>​
  
-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.+  * **<​M#>​** = The module number to send the data via. 2 chars, uppercase ​'M' ​followed by the module/card number. 
 +    * eg. ''​M1''​ = Module/card 1, ''​M4''​ = Module 4. 
 +  * **<​P##>​** = Port number to send the data out via. 3 chars, uppercase '​P'​ followed by the two digit port number. 
 +    * eg. ''​P01''​ = Port 1, ''​P02''​ = Port 2. 
 +  * **<​DATA>​** = This is the actual data you want to send out the serial port. Data cannot contain ''​[F5][F5]'' ​as it will strip all data from that point as per the CFLink protocol End Of Message specifier. When you want to send hex data, it must be already converted to hex within ​the ''<​DATA>''​ before sending the CFLink message to the serial port.\\ 
 +Note: Only one port can be written to per transmission command.
  
 === Reply === === Reply ===
  
-After each record, the device ​will reply with the acknowledgement reply, and the same for the final END command.+<sxh cflink; light: true> 
 +// Replying ​device: COM4 Module 
 +< [F2]<​ID>​[F3]RCOMSPW[F4]<​M#>​|<​P##>​[F5][F5]
  
-=== Example ===+</​sxh>​
  
-Here is a basic example (without actual rule data) to show the basic sequence of events when requesting ​the stored rule information+If the SPW command ​is successful, ​the reply will contain ​the module/card and port number parameters used for the SPW. The data will not be echoed, in an effort to reduce bus traffic. 
 + 
 +=== Example - Sending Serial Data ===
  
 <sxh cflink; light: true> <sxh cflink; light: true>
-// Start by sending the first record ​of Rule data to be stored ​on device at CFLink ID [03+// Send a command out of port 02 of a COM4 module in slot 1 of a MOD4 on CFLink ID [04
-> [F2][03][F3]CCFXRLW[F4]<​DATA1>​[F5][F5] +> [F2][04][F3]TCOMSPW[F4]M1|P02:​PWRON[0D][F5][F5] 
-// Device will then acknowledge the data receipt by sending an ACK +< [F2][04][F3]RCOMSPW[F4]M1|P02[F5][F5] 
-< [F2][03][F3]RLANRLW[F4]ACK[F5][F5] +
-// We can continue sending the next record of data +
-> [F2][03][F3]CCFXRLW[F4]<​DATA2>​[F5][F5] +
-// Acknowledge receipt of the data replied again +
-< [F2][03][F3]RLANRLW[F4]ACK[F5][F5] +
-// Continue this back and forth whilst more rule record data packets need to be sent +
-> [F2][03][F3]CCFXRLW[F4]<​DATA3>​[F5][F5] +
-< [F2][03][F3]RLANRLW[F4]ACK[F5][F5] +
-> [F2][03][F3]CCFXRLW[F4]<​DATA4>​[F5][F5] +
-< [F2][03][F3]RLANRLW[F4]ACK[F5][F5] +
-+
-+
-+
-// Once all rule data has been transmitted to the device, a final END message must be transmitted. +
-> [F2][03][F3]CCFXRLW[F4]END[F5][F5] +
-// We then receive acknowledgment of the END message as well. +
-< [F2][03][F3]RLANRLW[F4]ACK[F5][F5]+
 </​sxh>​ </​sxh>​
 +=== Errors ===
  
-==== RLD - Rules Delete ====+  * 003 Invalid Port Number 
 +  * 004 Invalid Module/card Number
  
-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.+===== Notifications =====
  
-=== Data ===+==== SPR - Read Serial ​Data ====
  
-The ''​RLD'' ​command does not have any associated ​data. +The ''​SPR'' ​(Serial Port Read) reply contains ​any data received via a specific port within the module/card.\\ 
- +This reply is automatically transmitted whenever data is received.
-=== Reply ===+
  
 <sxh cflink; light: true> <sxh cflink; light: true>
-// After the delete command is issued, the following message is replied from the device +// Replying ​device: COM4 Module 
-< [F2]<​ID>​[F3]RCFXRLD[F4]<NUM_RULES_DELETED>:<NUM_MACROS_DELETED>​[F5][F5]+< [F2]<​ID>​[F3]RCOMSPR[F4]<M#>​|<​P#​>:<DATA_RECEIVED>​[F5][F5] 
 </​sxh>​ </​sxh>​
  
-=== Example ===+  * **<​M#>​** = The module number that received the data. 2 chars, uppercase '​M'​ followed by the module/card number. 
 +    * eg. ''​M1''​ = Module/card 1, ''​M4''​ = Module 4. 
 +  * **<​P##>​** = Port number that received the data. 3 chars, uppercase '​P'​ followed by the two digit port number. 
 +    * eg. ''​P01''​ = Port 1, ''​P02''​ = Port 2. 
 +  * **<​DATA_RECEIVED>​** = This is the actual data that was received via the serial port. 
 + 
 +=== Example ​- Receiving Serial Data ===
  
 <sxh cflink; light: true> <sxh cflink; light: true>
-// Start by sending the delete command to LAN Bridge ​on CFLink ID [03+// Receive data via port 1 of a COM4 module in slot 1 of MOD4 on CFLink ID [04
-[F2][03][F3]CCFXRLD[F4][F5][F5] +[F2][04][F3]RCOMSPR[F4]M1|P01:​MV50[0D][F5][F5] 
-// LAN Bridge will then reply that the rules have been deleted with the stats of deleted items + 
-< [F2][03][F3]RLANRLD[F4]4:3[F5][F5] +// Receive data via port 3 of a COM4 module in slot 2 of a MOD4 on CFLink ID [04] 
-// 4 rules deleted +< [F2][04][F3]RCOMSPR[F4]M2|P03:Hello World![F5][F5]
-// 3 macros deleted+
 </​sxh>​ </​sxh>​
 +
 +===== Glossary =====
 +
 +  * **Flow Control** - Flow Control is the method that a serial port uses to control the flow of traffic. COM4 only supports RTS/CTS (software) flow control. XON/XOFF is not supported
hardware/cflink/com-module-cflink-documentation.1348814681.txt.gz · Last modified: 2012/09/28 06:44 by jarrod