Compiling Google Protobuf Binding Classes

Protocol Buffers, referred to as Protobuf, is widely used at Google for storing and interchanging all kinds of structured information.

Perform the following steps to compile the Google Protobuf (GPB) binding class.

  1. Download the latest controller GPB .proto files from the RUCKUS support site at: https://support.ruckuswireless.com/software/4663-smartzone-7-1-1-patch1-gpb-proto-google-protobuf-image-for-gpb-mqtt.
  2. Follow the compiling instructions for getting the binding classes for different languages. For more information, refer to https://developers.google.com/protocol-buffers/.
  3. If you have not installed the compiler, download the protoc compiler version 2.6.1, and follow the instructions in the README file.
  4. Run the compiler and specify the following:
    • Source directory where the source code of your application is stored. The current directory is used if you do not provide a value.
    • Destination directory where you want the generated code to be stored. This is usually the same as SRC_DIR.
    • Path to the .proto file.
    We can use ap_client.proto as an example for this task. You can substitute any .proto file.
  5. Generate the classes for reading and writing the AP Client GPB messages. To do this, you need to run the protocol buffer compiler protoc on your .proto file by:
    1. Java—Run the following script using the java_out option for Java classes. Similar options are provided for other supported languages .
      protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR/ap_client.proto
      This generates com/ruckuswireless/scg/protobuf/APClient.java in your specified destination directory.
    2. Python—Run the following script using the python_out option for Python classes. Similar options are provided for other supported languages.
      protoc -I=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/ap_client.proto
      This generates apclient_pb2.py in your specified destination directory.
    3. C++—Run the following script using thecpp_out option for C++ classes. Similar options are provided for other supported languages .
      protoc -I=$SRC_DIR --cpp_out=$DST_DIR $SRC_DIR/ap_client.proto
      This generates the following files in your specified destination directory:
      • apclient.pb.h—The header which declares your generated classes.
      • apclient.pb.cc—Contains the implementation of your classes.
  6. Copy the requisite technology stack GPB binding classes or source files to your project, which is used for receiving the controller’s GPB streaming data. It can be used to decode and parse the content of GPB message data.