====== IR Port CFLink Protocol ======
The following documentation describes the CFLink protocol for controlling IR devices via any device with IR Ports.\\
This includes IR modules and standalone devices such as the [[hardware:cf-mini|CF Mini]], [[hardware:ir-blaster|IR Blaster]] and [[hardware:solo|Solo]].
===== Transmission Messages =====
==== SND - Send IR ====
The ''SND'' (Send) command is used to send an IR command via one or more IR ports across one or more modules/devices.
=== Data ===
// Modular devices
> [F2][F3]TIRXSND[F4]|::[F5][F5]
// Standalone devices
> [F2][F3]TIRXSND[F4]::[F5][F5]
* **** = The module number to send the IR via. 2 chars, uppercase 'M' followed by the module number.
* eg. ''M1'' = Module 1, ''M4'' = Module 4.
* **** = The IR port in the specified module to send the IR data via. 3 chars, uppercase 'P' followed by the port number (2 digits) eg. P01 = Port 1, P04 = Port 4, PZZ = All ports on the module.
* **** = The format of the to send:
* ''DBA'' - Send an IR command from the internal database.
* ''MEM'' - Send a learned IR code that is stored on the device memory.
* ''RAW'' - Send an IR code in raw hex format, eg. Pronto CCF codes.
* ''STR'' - Send an IR code in CommandFusion's proprietary format.
* ''232'' - Send an RS232 command via an IR port that supports 1-way RS232 transmission.
* **** = The data of the IR code to send. The format depends on the chosen:
* ''DBA'' - :: - See the [[http://www.commandfusion.com/docs/cflink/irdatabase.html|IR Database Documentation]] for more details.
* **** = The number corresponding to the type of device. (2 digits)
* **** = The code set number from the Database table.
* **** = The key code from the Database table.
* ''MEM'' - :
* **** = The name of the device, as stored in the IR file.
* **** = The name of the IR function to send, within the device IR file.
* ''RAW'' - - The raw hex code (Often called CCF) to send. Only 'learned' IR codes (starting with 0000) are allowed.
* ''STR'' - - See the CommandFusion IR Format Documentation for more details.
* ''232'' - - This is the raw RS232 data that you want to send. Only IR ports with 1-way RS232 support can use this option.
Note that a single ''SND'' command can contain multiple modules and ports to send to, using the [[hardware:cflink:cflink-introduction#data-separators|standard port and module separators]].
=== Reply ===
// The reply does not echo the data sent in an effort to reduce bus traffic
< [F2][F3]RIRXSND[F4][F5][F5]
If sending multiple IR commands via a single CFLink message, the reply will only happen after all IR commands have been sent.
=== Example ===
// Send a CCF hex code to Module 1, port 1.
// Send a database code to Module 1, port 2.
// Send an IR code from device memory to Module 2, port 5.
// Modular device is a DIN-MOD4 on CFLink ID [04].
> [F2][04][F3]TIRXSND[F4]M1|P01:RAW:0000 0067 0000 0015 0060 0018 0030 0018 0018 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0018 0018 0018 0030 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0216|P02:DBA:06:1033:01,M2|P05:MEM:sony:power[F5][F5]
// Reply from DIN-MOD4
< [F2][04][F3]RIRXSND[F4][F5][F5]
// Send a database IR code to IR port 2 of a CF Mini on CFLink ID [20].
> [F2][20][F3]TIRXSND[F4]P02:DBA:06:1033:01[F5][F5]
// Reply from CF Mini when IR command has been sent
< [F2][20][F3]RIRXSND[F4][F5][F5]
// Send an RS232 command "PON\x0D" via 1-way IR port 4 of a Solo controller on CFLink ID [04].
> [F2][04][F3]TIRXSND[F4]P04:232:PON[0D][F5][F5]
// Reply from Solo when RS232 command has been sent via 1-way IR port
< [F2][20][F3]RIRXSND[F4][F5][F5]
=== Error ===
* 003 = Invalid Port Number
* 004 = Invalid Module Number
* 450 = Invalid IR Format Type
* 451 = Invalid IR Database Parameters
* 452 = Invalid IR Memory Parameters
* 453 = Invalid IR Raw Hex Code
* 454 = Invalid CF IR format