udmi

package
v0.0.0-test-multiarch Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

README

Auto - UDMI

This auto implements (some of) the UDMI spec for data export and control, via MQTT. Drivers are responsible for conversion to UDMI data structures, and expose this by implementing the UdmiService. That same service also allows for the config UDMI flow, which is how control is implemented.

Documentation

Index

Constants

View Source
const AutoType = "udmi"

Variables

View Source
var (
	ErrAlreadyRunning = errors.New("already running")
	ErrNotRunning     = errors.New("not running")
)
View Source
var Factory auto.Factory = factory{}

Functions

func NewUDMI

func NewUDMI(services auto.Services) service.Lifecycle

Types

type ConfigMessage

type ConfigMessage struct {
	PointSet ConfigPointSet `json:"pointset"`
}

ConfigMessage is a UDMI config message, used for control/settings https://faucetsdn.github.io/udmi/docs/messages/pointset.html#config

type ConfigPointSet

type ConfigPointSet struct {
	Points map[string]PointSetValue `json:"points"`
}

ConfigPointSet is a UDMI point set, for config messages https://faucetsdn.github.io/udmi/docs/messages/pointset.html#config

type PointSetValue

type PointSetValue struct {
	SetValue any `json:"set_value"`
}

PointSetValue is a single UDMI point with set value, for config messages https://faucetsdn.github.io/udmi/docs/messages/pointset.html#config

type PointValue

type PointValue struct {
	// should be a primitive value: string, bool, float...
	PresentValue any `json:"present_value"`
}

PointValue is a single UDMI point value see https://faucetsdn.github.io/udmi/docs/messages/pointset.html#event

type PointsEvent

type PointsEvent map[string]PointValue

PointsEvent presents the JSON payload of a UDMI Event message see https://faucetsdn.github.io/udmi/docs/messages/pointset.html#event

func (PointsEvent) Equal

func (f PointsEvent) Equal(other PointsEvent) bool

type PubSub

type PubSub struct {
	Publisher
	Subscriber
}

type Publisher

type Publisher interface {
	Publish(ctx context.Context, topic string, payload any) error
}

type PublisherFunc

type PublisherFunc func(ctx context.Context, topic string, payload any) error

func (PublisherFunc) Publish

func (p PublisherFunc) Publish(ctx context.Context, topic string, payload any) error

type Subscriber

type Subscriber interface {
	// Subscribe starts a new subscription for the given topic. This will return a nil error if the subscription
	// has been successful, and it has been acknowledged.
	Subscribe(ctx context.Context, topic string, cb mqtt.MessageHandler) error
}

type SubscriberFunc

type SubscriberFunc func(ctx context.Context, topic string, cb mqtt.MessageHandler) error

func (SubscriberFunc) Subscribe

func (p SubscriberFunc) Subscribe(ctx context.Context, topic string, cb mqtt.MessageHandler) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL