MqttConnectWithCertBuffer (FB)
FUNCTION_BLOCK MqttConnectWithCertBuffer EXTENDS AbbETrig3
Establish a Connection to the MQTT broker using a certificate from a String Buffer
- InOut:
Scope
Name
Type
Initial
Comment
Input
ConnPOINTER TO MQTT_CONNECTION
0
Pointer to empty / uninitialized MqttConnection struct. Upon successful completion of this FB, this struct can be used to operate all other MQTT FBs.
IpAddressSTRING(Constants.MQTT_MAX_IP_ADDRESS_LEN)Defaults.MQTT_DEFAULT_EMPTY
IP address of the MQTT Broker.
PortWORDDefaults.MQTT_DEFAULT_PORT
Port number of the MQTT Broker.
SecureBOOLDefaults.MQTT_DEFAULT_SECURE
True = Use secure channel for communication (TLS).
ServerCertPOINTER TO STRING(Constants.MQTT_MAX_PEM_CERT_LEN)
0
Pointer to server certificate buffer in PEM format.
ClientCertPOINTER TO STRING(Constants.MQTT_MAX_PEM_CERT_LEN)
0
Pointer to client certificate buffer in PEM format (optional).
ClientKeyPOINTER TO STRING(Constants.MQTT_MAX_PEM_KEY_LEN)
0
Pointer to client private key buffer in PEM format (optional).
ClientIdSTRING(Constants.MQTT_MAX_CLIENT_ID_LEN)Defaults.MQTT_DEFAULT_EMPTY
Client Identifier used to identify the client and the related session.
UsernameSTRING(Constants.MQTT_MAX_USERNAME_LEN)Defaults.MQTT_DEFAULT_EMPTY
Username of a user used by the MQTT Broker.
PasswordSTRING(Constants.MQTT_MAX_PASSWORD_LEN)Defaults.MQTT_DEFAULT_EMPTY
Password for this user.
LastWillOptional Last Will message.
KeepAliveWORDDefaults.MQTT_DEFAULT_KEEPALIVE
Time in seconds, which will be passed to the MQTT Broker and which is normally used by the Broker to disconnect clients if no communication was made for 1,5 * KeepAlive
TimeoutWORDDefaults.MQTT_DEFAULT_TIMEOUT
- Timeout in ms for all network communication of the following Function Blocks: MqttConnectWithCertBuffer,
MqttConnectWithCertFile, MqttDisconnect, MqttPing, MqttPublish, MqttSubscribe, MqttUnsubscribe. If the FB did not receive any communication for that amount of time it will terminate the execution and return MQTT_ERR_COMMUNICATION_TIMEOUT error.
Output
ErrorIDERROR_ID.MQTT_ERR_NO_ERROR
Error code description