MaxOnTime (FB) ¶ FUNCTION_BLOCK MaxOnTime “warp clock”-enabled maximum on-time. If xInput is TRUE MaxOnTime set xOutput to TRUE not longer then tMaxOn. After tMaxOn is expired xOutput is set to FALSE and a new rising edge of xInput is needed to restart the maximum on-time again. “Warp clock”-enabled ¶ Certain application domains base their functionality / algorithms on real world wall clock date/time. To develop such functionality it is helpful to have control over the application timeline to speedup testing or doesnt loose control on the timeline sitting on breakpoints. WarpClock and “warp clock”-enabled function blocks provides such a control if needed. For more details about “warp” time see WarpClock . To use “warp” time connect an accordingly configured WarpClock to itfDateTimeProvider. InOut: Scope Name Type Initial Comment Input xInput BOOL FALSE Input tMaxOn TIME TIME#0ms Maximum on-time xReset BOOL FALSE Reset itfDateTimeProvider Util.IDateTimeProvider Globals.g_dtpDateTimeProvider Source for the current date and time information in milliseconds since 1.1.1970 00:00:00.000 Output xOutput BOOL Output xError BOOL Error indication eErrorID Error Error ID
GetDeviceTwin (FB) ¶ FUNCTION_BLOCK GetDeviceTwin EXTENDS CBM.ETrigTo Reads the device twin from the Microsoft AZURE IoT Hub via HTTPS. InOut: Scope Name Type Comment Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrigTo udiTimeOut UDINT Defines the time (µs) after which an FB (e.g. requiring an external acknowledgement) aborts operation due to a timeout with error message. ETrigTo Output xDone BOOL TRUE : Action successfully completed ETrigTo xBusy BOOL TRUE : Function block active ETrigTo xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrigTo Input sHubDomainName STRING(255) Domain name of the IoT Hub sDeviceId STRING(255) Device ID wsSaS WSTRING(255) Shared Access Signature (SAS Token) Output eError IOT_HUB_CLIENT_ERROR Error code iHttpStatus INT HTTP status wsData WSTRING(WEB_CLIENT.g_udiMaxResponseSize) The device twin (JSON data)
UpdateDeviceTwin (FB) ¶ FUNCTION_BLOCK UpdateDeviceTwin EXTENDS CBM.ETrigTo Update the device twin (desired properties only!) via HTTPS. InOut: Scope Name Type Comment Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrigTo udiTimeOut UDINT Defines the time (µs) after which an FB (e.g. requiring an external acknowledgement) aborts operation due to a timeout with error message. ETrigTo Output xDone BOOL TRUE : Action successfully completed ETrigTo xBusy BOOL TRUE : Function block active ETrigTo xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrigTo Input sHubDomainName STRING(255) Domain name of the IoT Hub sDeviceId STRING(255) Device ID wsSaS WSTRING(255) Shared Access Signature (SAS Token) pwsData POINTER TO WSTRING The device twin properties to update (Input, JSON format) Output eError IOT_HUB_CLIENT_ERROR Error code iHttpStatus INT HTTP status wsDeviceTwinInfo WSTRING(WEB_CLIENT.g_udiMaxResponseSize) Last device twin info (Output, JSON format)
MinOnOffTime (FB) ¶ FUNCTION_BLOCK MinOnOffTime “warp clock”-enabled minimum on-/off-time. If xInput is TRUE MinOnOffTime set xOutput to TRUE for at least tMinOn. After xInput is set to FALSE and a new rising edge of xInput happens, xOutput doesnt follow xInput until tMinOff is expired. “Warp clock”-enabled ¶ Certain application domains base their functionality / algorithms on real world wall clock date/time. To develop such functionality it is helpful to have control over the application timeline to speedup testing or doesnt loose control on the timeline sitting on breakpoints. WarpClock and “warp clock”-enabled function blocks provides such a control if needed. For more details about “warp” time see WarpClock . To use “warp” time connect an accordingly configured WarpClock to itfDateTimeProvider. InOut: Scope Name Type Initial Comment Input xInput BOOL FALSE Input tMinOn TIME TIME#0ms Minimum on-time tMinOff TIME TIME#0ms Minimum off-time xReset BOOL FALSE Reset itfDateTimeProvider Util.IDateTimeProvider Globals.g_dtpDateTimeProvider Source for the current date and time information in milliseconds since 1.1.1970 00:00:00.000 Output xOutput BOOL Output xError BOOL Error indication eErrorID Error Error ID
GetMessage (FB) ¶ FUNCTION_BLOCK GetMessage EXTENDS CBM.ETrigTo Reads a C2D message from the Microsoft AZURE IoT Hub via HTTPS. InOut: Scope Name Type Comment Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrigTo udiTimeOut UDINT Defines the time (µs) after which an FB (e.g. requiring an external acknowledgement) aborts operation due to a timeout with error message. ETrigTo Output xDone BOOL TRUE : Action successfully completed ETrigTo xBusy BOOL TRUE : Function block active ETrigTo xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrigTo Input sHubDomainName STRING(255) Domain name of the IoT Hub sDeviceId STRING(255) Device ID wsSaS WSTRING(255) Shared Access Signature (SAS Token) Output eError IOT_HUB_CLIENT_ERROR Error code xReceived BOOL TRUE if a message has been received iHttpStatus INT HTTP status wsData WSTRING(WEB_CLIENT.g_udiMaxResponseSize) The last received message wsHeader WSTRING(WEB_CLIENT.g_udiMaxHeaderSize) The http header of the last message
SendMessage (FB) ¶ FUNCTION_BLOCK SendMessage EXTENDS CBM.ETrigTo Sends a D2C message to the Microsoft AZURE IoT Hub via HTTPS. InOut: Scope Name Type Comment Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrigTo udiTimeOut UDINT Defines the time (µs) after which an FB (e.g. requiring an external acknowledgement) aborts operation due to a timeout with error message. ETrigTo Output xDone BOOL TRUE : Action successfully completed ETrigTo xBusy BOOL TRUE : Function block active ETrigTo xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrigTo Input sHubDomainName STRING(255) Domain name of the IoT Hub sDeviceId STRING(255) Device ID wsSaS WSTRING(255) Shared Access Signature (SAS Token) pwsData POINTER TO WSTRING The message to send (JSON format) Output eError IOT_HUB_CLIENT_ERROR Error code iHttpStatus INT HTTP status
GetMQTTDeviceTwin (FB) ¶ FUNCTION_BLOCK GetMQTTDeviceTwin EXTENDS CBML.ETrigTo Function block to read the device twin of the connected device. InOut: Scope Name Type Comment Inherited from Input xExecute BOOL Rising edge: Starts defined operation FALSE : Resets the defined operation after ready condition was reached ETrigTo udiTimeOut UDINT Max. operating time for executing [µs], 0: No operating time limit ETrigTo Output xDone BOOL Ready condition reached ETrigTo xBusy BOOL Operation is running ETrigTo xError BOOL Error condition reached ETrigTo Input pbPayload POINTER TO BYTE Pointer to the receive buffer (device twin) udiMaxPayloadSize UDINT Maximum size of the receive buffer Inout azureMQTTClient AzureMQTTClient Reference to AzureMQTTClient Output eError MQTT.MQTT_ERROR Error code udiPayloadSize UDINT Length of the device twin
OnOffDelay (FB) ¶ FUNCTION_BLOCK OnOffDelay “warp clock”-enabled on-/off-delay. The xOutput follows xInput, but with a delay on both (rising / falling) edges. “Warp clock”-enabled ¶ Certain application domains base their functionality / algorithms on real world wall clock date/time. To develop such functionality it is helpful to have control over the application timeline to speedup testing or doesnt loose control on the timeline sitting on breakpoints. WarpClock and “warp clock”-enabled function blocks provides such a control if needed. For more details about “warp” time see WarpClock . To use “warp” time connect an accordingly configured WarpClock to itfDateTimeProvider. InOut: Scope Name Type Initial Comment Input xInput BOOL FALSE Input to delay tOnDelay TIME TIME#0ms On-delay tOffDelay TIME TIME#0ms Off-delay xReset BOOL FALSE Reset itfDateTimeProvider Util.IDateTimeProvider Globals.g_dtpDateTimeProvider Source for the current date and time information in milliseconds since 1.1.1970 00:00:00.000 Output xOutput BOOL Output xError BOOL Error indication eErrorID Error Error ID
SubscribeMQTTDeviceTwinDesiredProperties (FB) ¶ FUNCTION_BLOCK SubscribeMQTTDeviceTwinDesiredProperties Function block to subscribe for desired property changes of the device twin. InOut: Scope Name Type Initial Comment Input xEnable BOOL TRUE: Subscribe for desired property changes pbPayload POINTER TO BYTE Pointer to the receive buffer udiMaxPayloadSize UDINT Maximum size of the receive buffer Inout azureMQTTClient AzureMQTTClient Reference to AzureMQTTClient Output xError BOOL TRUE, if an error occurred xBusy BOOL TRUE, while the topic is subscribed eError MQTT.MQTT_ERROR Error code xReceived BOOL TRUE, if a message has been received (see |pbPayload| ). udiPayloadSize UDINT Length of the received message xSubscribeActive BOOL FALSE FALSE: When there is no active subscription, TRUE: Subscriber is listening
UpdateMQTTDeviceTwin (FB) ¶ FUNCTION_BLOCK UpdateMQTTDeviceTwin EXTENDS CBML.ETrigTo Function block to update the device twin of the connected device. InOut: Scope Name Type Comment Inherited from Input xExecute BOOL Rising edge: Starts defined operation FALSE : Resets the defined operation after ready condition was reached ETrigTo udiTimeOut UDINT Max. operating time for executing [µs], 0: No operating time limit ETrigTo Output xDone BOOL Ready condition reached ETrigTo xBusy BOOL Operation is running ETrigTo xError BOOL Error condition reached ETrigTo Input pbPayloadUpdate POINTER TO BYTE Pointer to the device twin update data (JSON) udiMaxPayloadUpdateSize UDINT Maximum size of pbPayloadUpdate Inout azureMQTTClient AzureMQTTClient Reference to AzureMQTTClient Output eError MQTT.MQTT_ERROR Error code