multi_device_plugin

command
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

README

Multi Device Plugin

This directory contains an example of a somewhat simple plugin, though more complex than the "simple plugin". It dispatches reads and writes to perform different actions based on the characteristics of the device specified for read or write.

In this case, there are three different kinds of devices. While they are all different types (temperature, voltage, airflow), they could all be the same type with different models. In this example, we are differentiating between devices only by looking at the model, but it shouldn't be hard to extend this to use a different device feature or compound features, e.g. model and type.

Since this example is primarily to look at the plugin setup, the reads are kept very simple for each device model.

  • The airflow device always returns a reading of 100.
  • The temperature device always returns a reading of 10.
  • The voltage device always returns a reading of 1.

For all devices, the write command does nothing.

Usage

To build the simple plugin, simply

make build

from within this directory. This will create the plugin binary which can be run with

./plugin

Once running, you should see some output, and then it will appear to hang. In the background, it is performing reads continuously, however messages are only logged out when incoming gRPC requests are handled. For this you will need to use the gRPC client. See the client directory for more.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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