Home About us Support Partners SIGN UP NOW
 Home    Blog    Introducing Protocol Buffers

Introducing Google’s Protocol buffers in Bevywise IoT Simulator

by Hema


Google protobuf

The first release update of the year is here..we have something new for our IoT simulator customers. We could see a considerable interest among people in using protocol buffers. This simple language-neutral has a well-justified reputation amongst all programming developers as a convincing perspective in relieving painful growth by taking out concerns from large applications. Bevywise IoT simulator version 3.0 now offers the possibility to use Google’s protocol buffers, the best way of encoding structured data in productive yet extendible pattern / scheme. With this new update, users can customize their payload in the way they need before sending it.

What and Why you need Google Protobuf?

Protocol buffers are google’s structured format to arrange serially and encode your data being the best choice over JSON. You can specify how your data should be in a structured format to make such structured data easy to read & write using the language you prefer. This signifies that one spec is critically enough to transmit data between complexes irrespective of the implementation / execution language. That is you can exchange information between processes or even across different servers with different architectures. With flexible, easy to understand & convenient structure and compiler with support for multiple languages, google protobuf furnishes a format that can be stored & retrieved by both sides.


Google protocol buffers binary encoding pattern which permits you to define a schematic model for your data using a specification language, like so:

message Payload {
optional string contrast_ratio = 1;
optional string viewing_tech = 2;
optional string color_depth = 3;
optional string touch_type = 4;
optional int32 ntsc = 5;
optional int32 temperature = 6;
optional int32 backlight_longevity = 7;
optional int32 luminance = 8;
}

The above schema is an example to define payload in IoT simulator. Here we use a structure that represents contrast_ratio, temperature & more, where it has every fields as a optional attributes.


By providing just a schema, you can now consequently acquire a class that can be used to encode and decode messages into protocol buffer pattern. As of now we had a glimpse of a bit overview of a protobuf, let’s dive in to the use of protobuf in IoT simulator specifics a bit more.

Adding protobuf support to Simulator

For all IoT implementations, JSON has become a default data format because of its light weightness and scalability which makes it easy to get & load the requested data quickly. In that case, you can simulate any level of JSON with IoT simulator to help you test your manager application. But the Protobuf is revamped to be faster than JSON by getting rid of many commitments conventionally done by data formats and making it focus only on the ability to serialize and deserialize data as quickly as possible. With the support of protobuf in IoT simulator you can make your payloads smaller and simpler. Also, if your client doesn’t support binary messages, there are capabilities to protobuf to serialize binary data to string.


Getting started with protobuf in IoT simulator is as simple as that. Just start defining your requirement as schema in .proto file and generate code in your preferred language using protoc compiler. You can start creating your devices and add event that corresponds to the one you have written in .proto file from the simulator UI itself.


The simple extension to have a glimpse and get on with protobuf in IoT Simulator is given here.

Get started with protocol buffers by downloading IoT Simulator of FREE.