CommandFusion Wiki

Documentation Resources

User Tools

Site Tools


Sidebar

hardware:cflink:lanbridge-cflink-protocol

This is an old revision of the document!


LANBridge CFLink Protocol

The following documentation is for the LANBridge device CFLink protocol messages.
The LANBridge also has an on-board RS232 port, for which documentation is available in the On-Board RS232 docs.

Common Definitions

The following communication slots exist on a LANBridge:

  • 1 = CFLink slot
  • 2 = On-board RS232 slot
  • 3 = UDP Broadcasting slot (not available for subscriptions, can only be enabled/disabled via UDB command
  • 4 - 10 = Reserved for future use
  • 11 - 20 = Configurable as TCP or UDP communication

Queries

WHO - Device discovery

The WHO query is used to discover what device is at a specific address.
The WHO reply will be automatically broadcast as a notification to the CFLink network when a device is powered up or reset.

Data

The WHO query does not have any associated data.

> [F2]<ID>[F3]QCFXWHO[F4][F5][F5]

Reply

< [F2]<ID>[F3]RLANWHO[F4]LANBridge:<SERIAL#>:<APP_VER>:<CFLINK_VER>:<IP4>:<MAC>[F5][F5]

Example

// Request the details for the device at CFLink ID [02]
> [F2][02][F3]TCFXWHO[F4][F5][F5]
// The Reply if a LANBridge is found
< [F2][02][F3]RLANWHO[F4]LANBridge:00000012:1.0.1:1.0.4:192.168.0.100:00.04.A3.19.D5.70[F5][F5]

CFG - Query Configuration

The CFG query is used to obtain details about the configuration of a specific LANBridge unit.

Data

The CFG query does not have any associated data.

> [F2]<ID>[F3]QLANCFG[F4][F5][F5]

Reply

< [F2]<ID>[F3]RLANCFG[F4]<IPADDRESS>:<SUBNETMASK>:<GATEWAY>:<DNS>:<DHCPMODE>:<RS232MODE>:<BAUD>:<DATABITS>:<PARITY>:<STOPBITS>:<FLOWCONTROL>:<UDPBROADCAST>:<SLOTS>[F5][F5]

  • <IPADDRESS> = The IPv4 address the LANBridge is currently assigned.
  • <SUBNETMASK> = The IPv4 subnet mask the LANBridge is currently assigned.
  • <GATEWAY> = The IPv4 gateway the LANBridge is currently assigned.
  • <DNS> = The IPv4 DNS the LANBridge is currently assigned.
  • <DHCPMODE> = DHCP mode disabled or enabled (0 or 1).
  • <RS232MODE> = The mode of the RS232 port (PGM or 232).
  • <BAUD> = The baud rate of the RS232 port:
    • 100
    • 300
    • 600
    • 1200
    • 2400
    • 4800
    • 9600
    • 14400
    • 19200
    • 38400
    • 57600
    • 115200
    • 128000
    • 256000
  • <DATABITS> = The data bits of the RS232 port, always 8.
  • <PARITY> = The parity of the RS232 port (single char):
    • N None
    • O Odd
    • E Even
  • <STOPBITS> = The stop bits of the RS232 port (1 or 2).
  • <FLOWCONTROL> = The flow control of the RS232 port (0 = None, 1 = RTS/CTS).
  • <UDPBROADCAST> = UDP Broadcast communication for CFLink protocol on port 10207 disabled or enabled (0 or 1).
  • <SLOTS> = The number of communication slots enabled

Example

// Query configuration of LANBridge on ID [02]
> [F2][02][F3]QLANCFG[F4][F5][F5]
// Configuration query reply
< [F2][02][F3]RLANCFG[F4]192.168.0.100:255.255.255.0:192.168.0.1:PGM:115200:8:N:1:1:1:3[F5][F5]

SLT - Query Slot Configuration

The SLT query returns the configuration of a specific communication slot.

Data

> [F2]<ID>[F3]QLANSLT[F4]<SLOT#>[F5][F5]

  • <SLOT#> = The communication slot number to request configuration from

Reply

// If the slot is configured for TCP communications:
< [F2]<ID>[F3]RLANSLT[F4]<SLOT#>:TCP:<TCPMODE>:<IPADDRESS>:<PORT>:<TIMEOUT>:<MAXCONNECTIONS>:<ECHO>[F5][F5]
// If the slot is configured for UDP communications:
< [F2]<ID>[F3]RLANSLT[F4]<SLOT#>:UDP:<UDPMODE>:<IPADDRESS>:<PORT>[F5][F5]

  • <SLOT#> = The communication slot number being described.
  • <TCPMODE> = Server S or client C.
  • <UDPMODE> = Unicast U, Multicast M, Broadcast B.
  • <IPADDRESS> = The IP Address assigned to the slot:
    • TCP Server = The IP Address to allow connections from (0.0.0.0 to allow connections from any IP Address)
    • TCP Client = The IP Address of the TCP Server to connect to
    • UDP Unicast = The IP Address to send data to
    • UDP Multicast = The IP Address of the multicast group to subscribe to
    • UDP Broadcast = The IP Address to broadcast data to (255.255.255.255 to send to all IP Addresses)
  • <PORT> = The port number assigned to the slot (same rules apply as <IPADDRESS> above)
  • <TIMEOUT> = The time in seconds to hold a TCP connection open for without any data transmissions. 0 = Disable timeout.
  • <MAXCONNECTIONS> = The maximum number of connections a TCP Server slot can handle at once. 0 = Unlimited connections. Ignored for TCP Client slots.
  • <ECHO> = Option to echo data received on a TCP Server slot from any TCP Client to all other connected clients. Ignored for TCP Client slots. (0 or 1)

Example

// Query the configuration for slot 12 of LANBridge on ID [02] 
> [F2][02][F3]QLANSLT[F4]12[F5][F5]
// Reply when slot configured as a TCP Server
< [F2][02][F3]RLANSLT[F4]12:TCP:11:S:0.0.0.0:9602:0:10:1[F5][F5]

// Query the configuration for slot 13 of LANBridge on ID [02] 
> [F2][02][F3]QLANSLT[F4]13[F5][F5]
// Reply when slot configured for UDP Unicast
< [F2][02][F3]RLANSLT[F4]13:UDP:U:192.168.0.100:9601[F5][F5]

SUB - Query Slot Subscription Configuration

The SUB query returns the configuration of a specific slot subscription.

Data

Each communication slot (Slot A) can be subscribed to another slot (Slot B). Only one subscription per slot is allowed.
So to retrieve the subscription details, you need to provide the slot number for the Slot A parameter.

> [F2]<ID>[F3]QLANSUB[F4]<SLOT#>[F5][F5]

  • <SLOT#> = The communication slot number of the subscription 'Slot A' parameter.

Reply

< [F2]<ID>[F3]RLANSUB[F4]<SLOTA>:<SLOTB>:<CFLINKID>:<MODULE>:<TXCOMMANDNAME>:<RXCOMMANDNAME>[F5][F5]

  • <SLOTA> = The communication slot number that will transfer data to/from <SLOTB> (2 or 11-20). See SUB Configuration Command for more details
  • <SLOTB> = The communication slot number that will transfer data to/from <SLOTA> (1, 2 or 11-20)
  • <CFLINKID> = If <SLOTB> is configured to slot 1 (CFLink), the CFLink ID is the device on the CFLink network to forward data to/from. This allows you to subscribe a communication slot to a single device on the network. (used only when <SLOTB> is configured to CFLink Slot 1).
  • <MODULE> = If <CFLINKID> is configured to subscribe to a modular device (such as MOD4), then you can optionally specify which module slot to subscribe to. 0 means not subscribed to a module. (optional)
  • <TXCOMMANDNAME> = The 7 char command to use when wrapping the incoming data from <SLOTA> before sending it out via <SLOTB> as valid CFLink protocol. Optional, only used when <SLOTB> is configured to CFLink Slot 0. If <TXCOMMANDNAME> is left empty, then all data received on <SLOTA> will be sent out <SLOTB> without any manipulation, and must be valid CFLink protocol.
  • <RXCOMMANDNAME> = The 7 char command to strip data from when received from <SLOTB> before sending it out via <SLOTA>. Optional, only used when <SLOTB> is configured to CFLink Slot 1. If <RXCOMMANDNAME> is left empty, then all data received on <SLOTB> will be sent out <SLOTA> in it's full CFLink protocol format.

Example

// Query subscription config for slot 12 of a LANBridge on CFLink ID [02]
> [F2][02][F3]QLANSUB[F4]12[F5][F5]
// Slot 12 is subscribed to CFLink Slot 0, to CFLink ID [03], Module 1.
// All incoming data from slot 12 will be wrapped into a CFLink protocol message for setting relay states.
// All outgoing data to slot 12 will be stripped from a relay state reply
< [F2][02][F3]RLANSUB[F4]12:0:03:M1:TRLYSET:RRLYSTA[F5][F5]

// Query subscription config for slot 13 of a LANBridge on CFLink ID [02]
> [F2][02][F3]QLANSUB[F4]13[F5][F5]
// Slot 13 is subscribed to Slot 14 (possibly a TCP Client slot subscribed to a TCP Server)
< [F2][02][F3]RLANSUB[F4]13:14[F5][F5]

TME - Real Time Clock status

The TME query will return the current configuration of the real time clock on-board the LANBridge.

Data

The TME query does not have any associated data.

> [F2]<ID>[F3]QLANTME[F4][F5][F5]

Reply

< [F2]<ID>[F3]RLANTME[F4]<YEAR>:<MONTH>:<DATE>:<DAYOFWEEK>:<HOUR>:<MINUTE>:<SECOND>:<UTCTIMEZONE>:<UTCTIMEZONESTR>[F5][F5]

  • <YEAR> = 4 digit year.
  • <MONTH> = 2 digit month (01-12).
  • <DATE> = 2 digit day (01-31).
  • <DAYOFWEEK> = 1 digit day of week. Sunday = 1, Saturday = 7 (1-7)
  • <HOUR> = 2 digit hour, in 24 hour military format (00-23)
  • <MINUTE> = 2 digit minute (00-59)
  • <SECOND> = 2 digit second (00-59)
  • <UTCTIMEZONE> = ID from Timezone Lookup Table (2 digits, 01-40)
  • <UTCTIMEZONESTR> = String representation of the timezone

Example

// Query time from LANBridge on CFLink ID [02]
> [F2][02][F3]QLANTME[F4][F5][F5]
// Reply
< [F2][02][F3]RLANTME[F4]2011:10:27:3:18:12:12:29:UTC+8.00[F5][F5]

Configuration Messages

IP4 - IPv4 Address

The IP4 command will configure the IPv4 address used by the LANBridge if DHCP is disabled. It will be ignored if DHCP is enabled.
The change will not take effect until the LANBridge is rebooted.

Data

> [F2]<ID>[F3]CLANIP4[F4]<IPADDRESS>[F5][F5]

  • <IPADDRESS> = The IPv4 Address to assign to the LANBridge

Reply

// The reply is just an echo of the command in reply format.
// The change does not take effect until the LANBridge is rebooted, so the reply will not contain any data.
< [F2]<ID>[F3]RLANIP4[F4][F5][F5]

Example

// Configure IP Address of LANBridge on CFLink ID [02]
> [F2][02][F3]CLANIP4[F4]192.168.0.100[F5][F5]
// Reply
< [F2][02][F3]RLANIP4[F4][F5][F5]

SNM - Subnet Mask

The SNM (Subnet Mask) command will configure the subnet mask used by the LANBridge if DHCP is disabled. It will be ignored if DHCP is enabled.
The change will not take effect until the LANBridge is rebooted.

Data

> [F2]<ID>[F3]CLANSNM[F4]<SUBNETMASK>[F5][F5]

  • <SUBNETMASK> = The IPv4 Subnet Mask to assign to the LANBridge

Reply

// The reply is just an echo of the command in reply format.
// The change does not take effect until the LANBridge is rebooted, so the reply will not contain any data.
< [F2]<ID>[F3]RLANSNM[F4][F5][F5]

Example

// Configure Subnet Mask of LANBridge on CFLink ID [02]
> [F2][02][F3]CLANSNM[F4]255.255.255.0[F5][F5]
// Reply
< [F2][02][F3]RLANSNM[F4][F5][F5]

GTW - Default Gateway

The GTW (Gateway) command will configure the default gateway used by the LANBridge if DHCP is disabled. It will be ignored if DHCP is enabled.
The change will not take effect until the LANBridge is rebooted.

Data

> [F2]<ID>[F3]CLANGTW[F4]<GATEWAY>[F5][F5]

  • <GATEWAY> = The IPv4 Gateway to assign to the LANBridge

Reply

// The reply is just an echo of the command in reply format.
// The change does not take effect until the LANBridge is rebooted, so the reply will not contain any data.
< [F2]<ID>[F3]RLANGTW[F4][F5][F5]

Example

// Configure Default Gateway of LANBridge on CFLink ID [02]
> [F2][02][F3]CLANGTW[F4]192.168.0.1[F5][F5]
// Reply
< [F2][02][F3]RLANGTW[F4][F5][F5]

DHC - DHCP Mode

The DHC (DHCP) command will configure the DHCP mode of the LANBridge.
The change will not take affect until the LANBridge is rebooted.

DHCP Mode is enabled by default.

Data

> [F2]<ID>[F3]CLANDHC[F4]<DHCP>[F5][F5]

  • <DHC> = DHCP mode enable/disable (1 or 0).

Reply

// The reply is just an echo of the command in reply format.
// The change does not take affect until the LANBridge is rebooted, so the reply will not contain any data.
< [F2]<ID>[F3]RLANDHC[F4][F5][F5]

Example

// Disable DHCP mode of LANBridge on CFLink ID [02]
> [F2][02][F3]CLANDHC[F4]0[F5][F5]
// Reply
< [F2][02][F3]RLANDHC[F4][F5][F5]

UDB - UDP Broadcasting Configuration

The UDB (UDP Broadcast) command is used to enable/disable broadcasting of UDP Data from CFLink.
The change will take affect immediately.
UDP Broadcasting is enabled by default.

Data

> [F2]<ID>[F3]CLANUDB[F4]<UDBMODE>[F5][F5]

  • <UDBMODE> = UDP Broadcasting mode enable/disable (1 or 0).

Reply

// The reply is an echo of the command in reply format.
< [F2]<ID>[F3]RLANUDB[F4]<UDBMODE>[F5][F5]

Example

// Disable UDB mode of LANBridge on CFLink ID [02]
> [F2][02][F3]CLANUDB[F4]0[F5][F5]
// Reply
< [F2][02][F3]RLANUDB[F4]0[F5][F5]

SLT - Configure TCP Slot

The SLT (Slot TCP) command is used to configure a communication slot for TCP communication.
The change will not take effect until the LANBridge is rebooted.

Data

> [F2]<ID>[F3]CLANSLT[F4]<SLOT#>:<TCPMODE>:<IPADDRESS>:<PORT>:<TIMEOUT>:<MAXCONNECTIONS>:<ECHO>[F5][F5]

  • <SLOT#> = The slot number to configure for TCP communication.
  • <TCPMODE> = S for TCP Server, C for TCP Client.
  • <IPADDRESS> = The IPv4 Address to assign to the slot:
    • TCP Server = The IP Address to allow connections from (0.0.0.0 to allow connections from any IP Address)
    • TCP Client = The IP Address of the TCP Server to connect to
  • <PORT> = The port number to assign to the slot (same rules apply as <IPADDRESS> above)
  • <TIMEOUT> = The time in seconds to hold a TCP connection open for without any data transmissions. 0 = Disable timeout. Valid range 0-4294967295 seconds.
  • <MAXCONNECTIONS> = The maximum number of connections a TCP Server slot can handle at once. 0 = Unlimited connections. Ignored for TCP Client slots. Valid range 0-25.
  • <ECHO> = Option to echo data received on a TCP Server slot from any TCP Client to all other connected clients. Ignored for TCP Client slots. (0 or 1)

Reply

// The reply is an echo of the command in reply format.
// The change does not take effect until the LANBridge is rebooted, so the reply will not contain any data.
< [F2]<ID>[F3]RLANSLT[F4][F5][F5]

Example

// Configure slot 11 to be a TCP Server, on LANBridge ID [02]
> [F2][02][F3]CLANSLT[F4]11:S:0.0.0.0:9601:0:10:1[F5][F5]
// Reply
< [F2][02][F3]RLANSLT[F4][F5][F5]

SLU - Configure UDP Slot

The SLU (Slot UDP) command is used to configure a communication slot for UDP communication.
The change will not take effect until the LANBridge is rebooted.

Data

> [F2]<ID>[F3]CLANSLU[F4]<SLOT#>:<UDPMODE>:<IPADDRESS>:<PORT>[F5][F5]

  • <SLOT#> = The slot number to configure for TCP communication.
  • <UDPMODE> = U for Unicast, M for Multicast, B for Broadcast.
  • <IPADDRESS> = The IPv4 Address to assign to the slot:
    • UDP Unicast = The IP Address to send data to
    • UDP Multicast = The IP Address of the multicast group to subscribe to
    • UDP Broadcast = The IP Address to broadcast data to (255.255.255.255 to send to all IP Addresses)
  • <PORT> = The port number to assign to the slot (same rules apply as <IPADDRESS> above)

Reply

// The reply is an echo of the command in reply format.
// The change does not take affect until the LANBridge is rebooted, so the reply will not contain any data.
< [F2]<ID>[F3]RLANSLU[F4][F5][F5]

Example

// Configure slot 12 to be UDP Unicast, on LANBridge ID [02]
> [F2][02][F3]CLANSLT[F4]12:U:192.168.0.101:9602[F5][F5]
// Reply
< [F2][02][F3]RLANSLU[F4][F5][F5]

SLO - Disable Communication Slot

The SLO (Slot Off) command is used to disable a specific communication slot.
The change will not take affect until the LANBridge is rebooted.

Data

> [F2]<ID>[F3]CLANSLO[F4]<SLOT#>[F5][F5]

  • <SLOT#> = The slot number to disable.

Reply

// The reply is an echo of the command in reply format.
// The change does not take affect until the LANBridge is rebooted, so the reply will not contain any data.
< [F2]<ID>[F3]RLANSLO[F4][F5][F5]

Example

// Disable slot 13 on LANBridge ID [02]
> [F2][02][F3]CLANSLO[F4]13[F5][F5]
// Reply
< [F2][02][F3]RLANSLO[F4][F5][F5]

SUB - Configure Slot Subscription

The SUB (Subscription) command is used to configure a slot subscription. A subscription is a way to send/receive data between two communication slots on the LANBridge automatically.

When subscribing to the CFLink slot, a subscription can be refined to communicate only with a device at a specific CFLink ID and optionally which module.

When subscribing to the CFLink slot, a subscription can also handle automatically manipulating the incoming data to wrap it in CFLink protocol formatting, and stripping the CFLink formatting before sending the outgoing data.

This allows TCP/UDP communication slots to send basic commands like P01:0|P02:0 and have it automatically wrapped into a CFLink command targeted at a specific device and module to open relays in this example. And the same in reverse, taking CFLink protocol message and only sending the data segment.

See the Common Definitions for a list of available communication slots.

Data

> [F2]<ID>[F3]CLANSUB[F4]<SLOTA>:<SLOTB>:<CFLINKID>:<MODULE>:<TXCOMMANDNAME>:<RXCOMMANDNAME>[F5][F5]

  • <SLOTA> = The communication slot number that will transfer data to/from <SLOTB> (2 or 11-20).
  • <SLOTB> = The communication slot number that will transfer data to/from <SLOTA> (0,1, 2 or 11-20). 0 = Turn off subscription for <SLOTA>.
  • <CFLINKID> = If <SLOTB> is configured to slot 1 (CFLink), the CFLink ID is the device on the CFLink network to forward data to/from. This allows you to subscribe a communication slot to a single device on the network. (used only when <SLOTB> is configured to CFLink Slot 1).
  • <MODULE> = If <CFLINKID> is configured to subscribe to a modular device (such as MOD4), then you can optionally specify which module slot to subscribe to. 0 means not subscribed to a module. (optional)
  • <TXCOMMANDNAME> = The 7 char command to use when wrapping the incoming data from <SLOTA> before sending it out via <SLOTB> as valid CFLink protocol. Optional, only used when <SLOTB> is configured to CFLink Slot 1. If <TXCOMMANDNAME> is left empty, then all data received on <SLOTA> will be sent out <SLOTB> without any manipulation, and must be valid CFLink protocol.
  • <RXCOMMANDNAME> = The 7 char command to strip data from when received from <SLOTB> before sending it out via <SLOTA>. Optional, only used when <SLOTB> is configured to CFLink Slot 1. If <RXCOMMANDNAME> is left empty, then all data received on <SLOTB> will be sent out <SLOTA> in it's full CFLink protocol format.

Reply

// The reply is an echo of the command in reply format.
// The change does not take affect until the LANBridge is rebooted, so the reply will not contain any data.
< [F2]<ID>[F3]RLANSUB[F4][F5][F5]

Example

// Subscribe slot 12 to CFLink Slot 1, CFLink ID [02], Module 1, with relay commands for manipulating incoming/outgoing data
> [F2][02][F3]CLANSUB[F4]12:1:02:M1:TRLYSET:RRLYSTA[F5][F5]
// Reply
< [F2][02][F3]RLANSUB[F4][F5][F5]

Error

  • 100 = Invalid Subscription

TME - Configure Real Time Clock

The TME command is used to set the time and date settings for the real time clock on-board the LANBridge.

Data

> [F2]<ID>[F3]CLANTME[F4]<YEAR>:<MONTH>:<DATE>:<DAYOFWEEK>:<HOUR>:<MINUTE>:<SECOND>:<UTCTIMEZONE>[F5][F5]

  • <YEAR> = 4 digit year.
  • <MONTH> = 2 digit month (01-12).
  • <DATE> = 2 digit day (01-31).
  • <DAYOFWEEK> = 1 digit day of week. Sunday = 1, Saturday = 7 (1-7)
  • <HOUR> = 2 digit hour, in 24 hour military format (00-23)
  • <MINUTE> = 2 digit minute (00-59)
  • <SECOND> = 2 digit second (00-59)
  • <UTCTIMEZONE> = ID from Timezone Lookup Table (2 digits, 01-40)

Reply

// Reply with the data used to configure the time/date.
< [F2]<ID>[F3]RLANTME[F4]<YEAR>:<MONTH>:<DATE>:<DAYOFWEEK>:<HOUR>:<MINUTE>:<SECOND>:<UTCTIMEZONE>[F5][F5]

Example

// Configure the real time clock on a LANBridge ID [02]
> [F2][02][F3]CLANTME[F4]2011:12:27:3:18:12:12:29[F5][F5]
// Reply
< [F2][02][F3]RLANTME[F4]2011:12:27:3:18:12:12:29[F5][F5]

Error

  • 100 = Invalid UTC Timezone
  • 100 = Invalid Date
  • 100 = Invalid Time

Transmission Messages

SND - Send Data

The SND (Send) command allows you to send data to a specific communication slot defined on the LANBridge.
Any other communication slots subscribed to the slot targeted by the SND command will also receive the data.
This command is not to be used to send data to the RS232 slot (Slot 1), instead use the ''SPW'' Command common to all devices with an on-board RS232 port.

Data

> [F2]<ID>[F3]TLANSND[F4]<SLOT#>:<DATA>[F5][F5]

  • <SLOT#> = The communication slot number to send data to. Known as the 'target slot'.
  • <DATA> = The actual data to send to the target slot. Hex bytes should be defined in \xFF format. eg. A carriage return is written as \x0D

Reply

// In an effort to reduce network traffic on the CFLink bus, the reply will not contain the <DATA> sent, only the slot it was sent to.
< [F2]<ID>[F3]RLANSND[F4]<SLOT#>[F5][F5]

Example

// Send a command to an ethernet device connected to slot 11, for LANBridge on CFLink ID [02]
> [F2][02][F3]TLANSND[F4]11:Hello World!\x0D[F5][F5]
// Reply
< [F2][02][F3]RLANSND[F4]11[F5][F5]

Error

  • 100 = Invalid Slot Number
hardware/cflink/lanbridge-cflink-protocol.1345525100.txt.gz · Last modified: 2012/08/21 04:58 by jarrod