Overview:

The open source Sparkplug sample code can be downloaded here.  Sparkplug consist of three primary features in its definition.  The first is the MQTT topic namespace definition.  The second is the definition of the order and flow of MQTT messages to and from various MQTT clients in the system.  The final is the payload data format which is called Sparkplug B.

  • Sparkplug B
    • Open source Google Protobuf definition specifically designed for Sparkplug.
    • Simple design that supports metrics with a name, a datatype, and a value.
    • Supports metadata around metrics for null values, timestamps per metric, historical messages, and custom properties.
    • Supports metric name aliases to reduce bandwith usage.
    • Template support for complex data types.
    • Dataset support

The Sparkplug source code is laid out with the following directories.

  • client_libraries - These are libaries in various languages to aid in development
    • c - C client library
    • c_sharp - C# client library - coming soon...
    • java - Java client library
    • javascript - Javascript client library
    • python - Python client library
  • sparkplug_b
    • raspberry_pi_examples - This is a set of reference implementations for use with the Raspberry Pi Model 2 B.
    • stand_alone_examples - Examples which can run on multiple platforms (no hardware specific I/O requirements)
    • tools - Utilities including a listener to view messages

Implementation notes and useful tools:

  • Git
    • This is the primary tool used with Github which is where the source code is hosted.
    • This is not explicitly required as Github allows for downloading of zip files as well.
  • C Development
    • A C compiler for your target platform is required to build the examples.  Most examples developed here were developed using Linux and OSX.
  • C# Development
    • Coming soon...
  • Python Development
    • Python is required for running all Python examples.
    • Pip is also very useful for installing module dependencies.
  • Java Development
    • A JDK is required for compiling the Java examples.  Most development was done using Oracle's JDK.
    • Maven is required for building the examples.
    • The Eclipse IDE is not required but is a useful IDE for Java development.  It supports importing of Maven projects as well as connectors to git projects.  Most Java development was done using the 'Eclipse IDE for Java EE Developers'
  • No labels