SendData_OnChange
This method is called once to send data to the broker.
The SendData method always transfers the entire data as a retain message. With the SendData_OnChange method, on the other hand, it is possible to transfer individual parts of the data in order to save data traffic. However, it should be noted that with the SendData_OnChange method the messages are not sent as retain messages and are therefore only known to currently connected app instances. The data must be kept ready in the TwinCAT project and sent as a complete data block and as a retain message when a new client is connected using the SendData method.
It should be noted at this point that the OnChange mechanisms are mainly intended for use with the SendDataAsString methods. With the SendData methods, OnChange can only be used if a structure is used when sending the structure that has the same variable path up to the variables to be changed.
Syntax
METHOD SendData_OnChange : BOOL
VAR_INPUT
pMachineStruct : PVOID;
nStructSize : UINT;
END_VAR
Return value
Name | Type | Description |
---|---|---|
SendData_OnChange | BOOL | The method returns the return value TRUE if the call was successful. |
Inputs
Name | Type | Description |
---|---|---|
pMachineStruct | PVOID | Address for the structure in which the device variables are declared. |
nStructSize | UINT | Size of the structure specified in pMachineStruct. |
Possible errors are output at the outputs bError and hrErrorCode of the function block instance.