ProtobufEncode

(Engine-Level Function)

Description: Creates a buffer for a given Protobuf file containing VTScada value data.
Returns: An encoded protocol buffer.
Usage: Script Only.
Function Groups: Protobuf
Related to: ProtobufDecode | ProtobufInstantiate | ProtobufParse
Format: ProtobufEncode(ProtobufHandle, MessageTypeName, DataToEncode)
Parameters:  
ProtobufHandle
Protobuf handle generated by ProtobufParse
MessageTypeName

Message type from ProtobufHandle's proto file.

This is the full name, meaning that if the .proto file includes a package name "com.trihedral.protobufexample" and the message name is "AMessage", this would be "com.trihedral.protobufexample.AMessage". For nested messages this also includes all ancestor messages

DataToEncode
VTScada data structure representing the message to be encoded
Comments:

Protobuf version 2 allows fields to be defined as required. If all fields marked as required are not present when encoding a message ProtobufEncode will return invalid.

 

Decoding and encoding of proto2 groups is not supported.

Example:

See: ProtobufInstantiate