• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - Sequencer
  • ProtobufDecode

ProtobufDecode

ProtobufDecode

The ProtobufDecode block is an operator, that allows to decode input binary string from Protocol Buffers message encoding to output arguments.

Protocol Buffers (protobuf) is a method for serializing structured data, developed by Google. It is designed to be a language-agnostic, platform-neutral, and extensible mechanism for serializing structured data. Protocol Buffers is widely used for communication protocols, data storage, and configuration files, among other things.

Protocol Buffers uses an Interface Definition Language (IDL) to define data structures - message types and their fields. Protocol Buffers definitions are usually contained in the files having .proto extension and have to be compiled to the programming language used by the application using protoc compiler. For this block you only need to copy the definitions into the block Proto attribute value instead and the definitions will be runtime-compiled from there.

Arguments

NameAppearanceDescription
InPredefined input argumentThe Protocol Buffers encoded message (binary string)
Protocol Buffers message field name to decodeAny number of user-configurable output argumentsArgument name will be searched from the Protocol Buffers message field list and when found, the this argument value will be set to the field value. When the field named as the argument is not found, then the argument value will be set to empty (or 0 for numeric arguments).

Properties

NameDescription
ProtoProtocol Buffers message definition in Interface Definition Language (IDL). It can be copied here from the .proto file, used for the particular communication definition.
MessageMessage name to use from the Protocol Buffers definition for the decoding. There can be several messages described in the Proto definition, but only the one named in Message is used for this operator for decoding.

Note: The message (In argument) may contain non-printable characters that are not always printable in the CDP Studio Block Diagram next to the connection line. But you can still get some printed representation of the message binary body from the Table Editor or in the Block Diagram sidebar.

Example

The following block diagram shows how to decode a Protocol Buffers message like this:

syntax = "proto3";
message SensorInfo {
  string name = 1;
  uint64 timestamp = 2;
  double value = 3;
}

The ProtobufDecode operator Proto attribute was set to the message definition given above and the Message attribute was set to SensorInfo. To decode message fields, 3 output arguments were added to the block: name (Sequencer.Argument<string>), timestamp ((Sequencer.Argument<uint64_t>) and value ((Sequencer.Argument<string>)). These fields are looked up from the input Protocol Buffers message and when found, their values will be set to the field values, as can be seen in the block diagram:

See also ProtobufDecoder, ProtobufEncode, and Argument.

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top