[r234]: / branches / aliazzz / mqttsparkplugb / SparkplugB / Function Blocks / FB_SparkplugB_1 / FB_SparkplugBSimple / svnobj  Maximize  Restore  History

Download this file

44 lines (42 with data), 5.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(*
	Provides various Helpers / Certificats for SparkplugB usage
*)
FUNCTION_BLOCK FB_SparkplugBSimple 
VAR
    // Payload 
	_PayloadEncoder     : FB_PayloadSimpleEncoder;
    _Blob               : ARRAY [0..65535] OF BYTE;
	_BlobSize           : DINT;
	_Pool               : List;
    _seqNum 			: INT := 0; //next sequence number (0..255)
	_Error              : BOOL;  //Based on CBML.LCon, but will automatically be reset if xEncode
	_eError             : ERROR;
    
    // Helpers
    _SparkplugInt8      : FB_SparkplugInt8;
    _SparkplugInt16     : FB_SparkplugInt16;
    _SparkplugInt32     : FB_SparkplugInt32;
    _SparkplugInt64     : FB_SparkplugInt64;
    _SparkplugFloat     : FB_SparkplugFloat;
    _SparkplugDouble    : FB_SparkplugDouble;
    _SparkplugBoolean   : FB_SparkplugBoolean;
    _SparkplugString    : FB_SparkplugString;
    _SparkplugDateTime  : FB_SparkplugDateTime;
    _SparkplugText      : FB_SparkplugText;
    _SparkplugUInt8     : FB_SparkplugUInt8;
    _SparkplugUInt16    : FB_SparkplugUInt16;
    _SparkplugUInt32    : FB_SparkplugUInt32;
    _SparkplugUInt64    : FB_SparkplugUInt64;
    _SparkplugUUID      : FB_SparkplugUUID;
END_VAR
GetTime();
_PayloadEncoder(
	xEnable := _Encode,
	protobufBlobSize:= _BlobSize, 
	myProtobufBlob:= _Blob, 
	myMetricsPool:= _Pool, 
	xDone=> _Done, 
	xBusy=> _Busy, 
	xError=> _Error, 
	eError=> _eError);
// Diagnose for the Encoder
Diag();