iote

package module
v0.0.0-...-9e85f7b Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: BSD-2-Clause Imports: 7 Imported by: 0

README

IoTe - IoT Edge Gateway

This simple IoT edge device basically gathers telemetry data from an associated sensor network reshapes, localy caches and globally persists the data from it's respective network.

The main primary features of IoTe are:

  • MQTT for Messaging (Pub/Sub)
  • REST API for programatic access
  • HTTP Server for embedded web app
  • Websockets for realtime data display
  • Modern Responsive webapp for display control

Building IoTe

To build a fresh version of IoTe is pretty simple: a) Install the go compiler, b) Checkout the IoTe source code, c) Install all package dependencies, d) compile and finally e) run the package.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataCB

func DataCB(mc mqtt.Client, mqttmsg mqtt.Message)

TimeseriesCB call and parse callback data

Types

type Configuration

type Configuration struct {
	Broker string `json:"mqtt-broker"`

	DebugMQTT bool `json:"mqtt-debug"`
	Verbose   bool `json:"verbose"`
}

func GetConfig

func GetConfig() Configuration

type Consumer

type Consumer interface {
	// Recv(msg Msg)
	GetID() string
	GetRecvQ() chan Msg
}

func GetConsumers

func GetConsumers(category string) (cons []Consumer)

type Consumers

type Consumers struct {
	Consumers map[string][]Consumer
}

type Messanger

type Messanger struct {
	mqtt.Client
}

Messanger allows a message consumer to provide a callback to specific message paths

func GetMessanger

func GetMessanger() *Messanger

func (*Messanger) Connect

func (m *Messanger) Connect()

func (*Messanger) Publish

func (m *Messanger) Publish(topic string, msg string)

func (*Messanger) Subscribe

func (m *Messanger) Subscribe(path string, f mqtt.MessageHandler)

type Msg

type Msg struct {
	Station string `json:"station"`
	Sensor  string `json:"sensor"`
	Time    int64  `json:"time"`
	Data    []byte `json:"-"`
}

func (*Msg) Float64

func (m *Msg) Float64() float64

func (*Msg) String

func (m *Msg) String() (dstr string)

func (Msg) ToMsgFloat64

func (m Msg) ToMsgFloat64() (m64 MsgFloat64)

type MsgFloat64

type MsgFloat64 struct {
	Msg
	Value float64 `json:"value"`
}

type Publisher

type Publisher struct {
	Path   string
	Period time.Duration
	// contains filtered or unexported fields
}

Publisher periodically reads from an io.Reader then publishes that value to a corresponding channel

func NewPublisher

func NewPublisher(p string) (pub *Publisher)

func (*Publisher) Publish

func (p *Publisher) Publish(done chan string)

Publish will start producing data from the given data producer via the q channel returned to the caller. The caller lets Publish know to stop sending data when it receives a communication from the done channel

type Subscriber

type Subscriber struct {
	ID   string
	Path string
	mqtt.MessageHandler
	Consumers []Consumer
}

func (*Subscriber) String

func (sub *Subscriber) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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