Time related ¶ Function blocks for manipulating the time axis (for non-realtime testing) or other time related function blocks are collected in this folder. DateTimeSplit (FunctionBlock) MaxOnTime (FunctionBlock) “Warp clock”-enabled MinOnOffTime (FunctionBlock) “Warp clock”-enabled OnOffDelay (FunctionBlock) “Warp clock”-enabled OperationalTime (FunctionBlock) “Warp clock”-enabled PeriodicTimer (FunctionBlock) “Warp clock”-enabled WarpClock (FunctionBlock) AddTime (Method) ComputeWarpFactor (Method) GetDateTime (Method) GetLocalSystemTime (Method) GetUtcSystemTime (Method)
IoTHubClientConstants (GVL) ¶ Attributes: qualified_only InOut: Scope Name Type Initial Constant gc_sHostnameBase STRING(20) ‘.azure-devices.net’ gc_sURLDelimiter STRING(1) ‘/’ gc_sAPIVersion STRING(30) ‘/api-version=2016-11-14’ gc_sDevices STRING(8) ‘devices/’ gc_sMessageEvents STRING(17) ‘/messages/events/’ gc_sMessageDeviceBound STRING(25) ‘/messages/devicebound/#’
GlobalVariables ¶ IoTHubClientGVL (GVL)
IoTHubClientGVL (GVL) ¶ Attributes: qualified_only InOut: Name Type Initial g_udiRefId UDINT 0
IMethodInvoker2.Invoke (METH) ¶ METHOD Invoke This method will be called of direct method calls, and can return a payload InOut: Scope Name Type Initial Comment Input wsMethodName WSTRING Name of the method pbInputPayload POINTER TO BYTE Pointer to the input payload udiMaxInputPayloadSize UDINT Maximum size of pbInputPayload udiPayloadSize UDINT Size of pbInputPayload pbOutputPayload POINTER TO BYTE 0 Pointer to the output JSON-String e.g. POINTER TO STRING(255) Output iStatus INT Status of the call
WarpClock (FB) ¶ FUNCTION_BLOCK WarpClock IMPLEMENTS Util.IDateTimeProvider “warp” clock is providing development / debugging control on the application time line. Certain application domains base their functionality / algorithms on real world wall clock date/time. To develop such functionality it is helpful to have control on the application timeline to speedup testing or doesnt loose control on the timeline sitting on breakpoints. WarpClock provides such a control if needed. It allows to: run the clock in real time UTC run the clock with a given “warp” factor start at a certain start time - no matter if UTC or local reset time to a a certain (start) time step forward in time by a given increment To compute the “warp” factor use ComputeWarpFactor . “warp” forward in time needs some knowledge about application cycle time. Of course there is cycle time jitter, and the application can obtain only the cycle time of last cycle. But for “warp” forward in time this is not so important, approximate cycle time information is sufficient for this use case. If udiWarpFactor is set to 1 and the WarpClock is enabled (xEnable:=TRUE) uliTime is representing UTC system time. InOut: Scope Name Type Initial Comment Input xEnable BOOL TRUE Run the clock at real time or “warp time” (system time increments multiplied by “warp” factor). If the clock is running dont use AddTime() and tTimeAdd<>T#0S. uliStartDateTime ULINT Start time in ms since the epoch 1.1.1970 00:00:00.0, default is the epoch udiWarpFactor UDINT 1 “Warp” factor, 1 => run at real time UTC tTimeAdd TIME TIME#0ms Time to add at WarpClock function block call, if clock is not running at real time or “warp time”. Alternatively you might want to use AddTime when appropriate. xReset BOOL FALSE Reset the clock to tStart Output itfDateTimeProvider Util.IDateTimeProvider Output to connect THIS to other function block inputs uliDateTime ULINT Clock output time in ms since the epoch 1.1.1970 00:00:00.0 xError BOOL Error indication eErrorID Error Error ID Methods: AddTime ComputeWarpFactor GetDateTime GetLocalSystemTime GetUtcSystemTime Structure: AddTime (Method) ComputeWarpFactor (Method) GetDateTime (Method) GetLocalSystemTime (Method) GetUtcSystemTime (Method)
SubscribeMQTTMethods (FB) ¶ FUNCTION_BLOCK SubscribeMQTTMethods EXTENDS CBML.LCon Function block to subscribe MQTT methods. InOut: Scope Name Type Comment Inherited from Input xEnable BOOL TRUE : Activates the defined operation FALSE : Aborts/resets the defined operation LCon Output xDone BOOL TRUE : Ready condition reached LCon xBusy BOOL TRUE : Operation is running LCon xError BOOL TRUE : Error condition reached LCon Input pbMethodPayload POINTER TO BYTE Pointer to method input payload buffer udiMaxMethodPayloadSize UDINT Maximum size of pbMethodPayload itfMethodInvoker IMethodInvoker Method invoker Inout azureMQTTClient AzureMQTTClient Reference to AzureMQTTClient Output eError MQTT.MQTT_ERROR Error code udiPayloadSize UDINT Length of the device twin
Functions ¶ LinTransf (Function) LinTransfClip (Function) LinTransfNormalized (Function) Log RealEquals (Function) RealGreaterEqual (Function) RealInRange (Function) RealLessEqual (Function) ServiceIndicationValue (Function) Time related DateTimeToString (Function) UdintInRange (Function)
SubscribeMQTTMethods2 (FB) ¶ FUNCTION_BLOCK SubscribeMQTTMethods2 EXTENDS CBML.LCon Function block to subscribe MQTT methods. This function blocks can return payload of methods. InOut: Scope Name Type Initial Comment Inherited from Input xEnable BOOL TRUE : Activates the defined operation FALSE : Aborts/resets the defined operation LCon Output xDone BOOL TRUE : Ready condition reached LCon xBusy BOOL TRUE : Operation is running LCon xError BOOL TRUE : Error condition reached LCon Input pbMethodPayload POINTER TO BYTE Pointer to method input payload buffer udiMaxMethodPayloadSize UDINT Maximum size of pbMethodPayload pbOutputPayload POINTER TO BYTE 0 Pointer to output payload JSON-String e.g. POINTER TO STRING(255) itfMethodInvoker IMethodInvoker2 Method invoker Inout azureMQTTClient AzureMQTTClient Reference to AzureMQTTClient Output eError MQTT.MQTT_ERROR Error code udiPayloadSize UDINT Length of the device twin
SendMQTTMessage (FB) ¶ FUNCTION_BLOCK SendMQTTMessage Function block for sending D2C messages via MQTT to Azure IoT Hub. InOut: Scope Name Type Comment Input xExecute BOOL Rising edge will send the message |pbPayload| udiTimeOut UDINT Time out in µs, 0: no time out pbPayload POINTER TO BYTE Pointer to the message udiPayloadSize UDINT Size of the message |pbPayload| sPropertyBag STRING Property bag (optional) Example: RFC 2396-encoded(<PropertyName1>)=RFC 2396-encoded(<PropertyValue1>)&RFC 2396-encoded(<PropertyName2> Inout azureMQTTClient AzureMQTTClient Reference to AzureMQTTClient Output xError BOOL TRUE, if an error occurred xBusy BOOL TRUE, while sending the message xDone BOOL TRUE, if the message was sent successfully eError MQTT.MQTT_ERROR Error code