Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

dpazj/srad

Open more actions menu

Repository files navigation

srad

srad is a Sparkplug library and development framework in Rust.

CI Documentation Crates.io MIT licensed Apache-2.0 licensed

Additional information for this crate can be found in the docs.

Overview

srad aims to make it easy as possible to build reliable, fast, and resource efficient Sparkplug B Edge Nodes and Applications with minimal overhead.

Features include:

  • Data Type Support - Support for Sparkplug data types including Array types, Property Sets and Templates
    • Template Derive macros provide code generation for template implementations
  • Compliance-focused APIs - APIs designed to prevent non-conformance of the specification
  • Async Node and Application development frameworks - Ready-to-use frameworks built using tokio, providing out-the-box compatibility, scalable implementations, and support for Node/Application specific features
  • MQTT Client Agnostic - Flexible architecture providing the ability to choose the best MQTT implementation for your use case

Getting Started

Examples

A simple Edge Node

use srad::{client_rumqtt, eon::{EoN, EoNBuilder, NoMetricManager}};

#[tokio::main]
async fn main() {

    let opts = client_rumqtt::MqttOptions::new("foo:bar", "localhost", 1883);
    let (eventloop, client) = client_rumqtt::EventLoop::new(opts, 0);

    let (mut eon, handle) = EoNBuilder::new(eventloop, client)
        .with_group_id("foo")
        .with_node_id("bar")
        .with_metric_manager(NoMetricManager::new())
        .build().unwrap();

    eon.run().await;
}

A simple Application

use srad::app::{SubscriptionConfig, generic_app::ApplicationBuilder};
use srad::client_rumqtt;

#[tokio::main]
async fn main() {
    let opts = client_rumqtt::MqttOptions::new("foo", "localhost", 1883);
    let (eventloop, client) = client_rumqtt::EventLoop::new(opts, 0);
    let (mut application, client) = ApplicationBuilder::new("foo", eventloop, client, SubscriptionConfig::AllGroups).build();
    application.run().await
}

More examples can be found in the examples and in the docs.

Dependencies

codegen uses protoc Protocol Buffers compiler to generate types.

Project Layout

  • srad: Re-exports the srad-* crates under one package.
  • srad-eon: SDK for building Sparkplug Edge Nodes.
  • srad-app: SDK for building Sparkplug Applications.
  • srad-client: Trait and type definitions for implementing clients to interact with Sparkplug.
  • srad-client-rumqtt: Client implementation using rumqtt.
  • srad-types: Utility and Protobuf generated types.
  • srad-macros: Derive macro implementation for Templates
  • codegen: Generates types from protobuf files in protos.
  • examples: Example Edge Node and application implementations.

License

This project is dual licensed under the MIT and APACHE licenses.

About

A library for the Sparkplug IoT specification in Rust

Topics

Resources

Stars

Watchers

Forks

Releases

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.