SendPF() - The Advanced Send IP Packet Command

This command is used to send custom messages from a port; including IP ports.
You can send Hex, Decimal, or ASCII characters as raw data or from memory locations.
This is a more powerful version of the SendP() command.

Devices confirmed to work with SendPF

Device

Status

PDEG

Confirmed

PDEB

Confirmed

PDDEG-S

Confirmed

DDRC-GRMS-E

Confirmed

DDBC320-DALI

Not Tested

PDTS

Confirmed

DDNG485 V3

Confirmed

PDZG

Not Tested

Configuration

EthernetGateway can be the server or the client.
Port type needs to be set to Text.
In Client mode you need the IP address of the 3rd party device and port number to set up the connection.
In Server mode you define the IP address and port number to set up the connection and provide this to the 3rd party installer.

Syntax

SendPF(Port Type, Port Index, “%c %d %u %s %x”, 1,2,~3…)
Where %c, %d, %u, %s, %x are format specifiers.
For sending text using the printf format, SendPF supports the same instructions as SendP() and more.
This allows values to be easily sent from tilde locations.
The SendPF() command will allow for up to 8 tilde memory locations to be specified where the value of the parameters (by using the % symbol) will be output.

Supported Specifiers
  • %d : Output an integer as a signed decimal number.

  • %u : Output for decimal unsigned int

  • %x : Output an integer as an unsigned hexadecimal number.

  • %c : Output a character (char). No null character is added.

  • %s : Outputs a string. No null character is added.

If the text requires being null terminated then add ‘%c’ after the string and use ‘0’ as parameter.
If the text requires a carriage return then add ‘\r’ after the string. If not text you can use '0x0D' as a carriage return.
Use '0x0A' as a line feed.
To send a 2-byte number append length 'l' (i.e. %ld).
This allows for signed number greater than +/-127 and unsigned numbers greater than 255.
To send a 4-byte number append length 'll' (i.e. %lld).

Port Types
  • 1 - RS485 Port

  • 2 - IPv4 Port

  • 3 - IPv6 Port

  • 5 - WebSocket

Screenshot: Ports showing type and index

Examples

Example 1

Sending Direct Text: IPv4 port, Port Index = 1, Data =”sendthistext”

{
SendPF (2,1,”sendthistext”)         //Simple text send.

SendPF (2,1,” sendthistext%c”,0)    //Text send with null termination.

SendPF (2,1,” sendthistext\r”)      //Text send with carriage return.
}

Example 2

Sending text from a constant. Both output "cmd L1"

#const HVACLine "L1"
#const Command "cmd %s%c%c"
Task1()
{
Name="Task 1"
SendPF(2,1,”cmd %s”, HVACLine)
SendPF(2,1, Command, HVACLine,0x0D,0x0A) //0x0D for carriage return & 0x0A for line feed
Null
}

Example 3

Sending from Tilde Memories
Output will be Area is <Area Number in the DyNet message>
If we use %d for Area Number, then only up to Area 127 will be correctly shown.

Task1()
{
Name="Task 5"
Start(0x1C,x,x,x,x,x,x)
Copy @0,~0,7
//%u is for unsigned integer 0 to 255
//Area value is stored at ~1
Sendpf(1,1,"Area is %u", ~1)
null
}