network

package
v0.0.0-...-1830482 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//MQTT protocol
	MQTT = "mqtt"

	LogNone     = "none"
	LogDebug    = "debug"
	LogInfo     = "info"
	LogWarning  = "warning"
	LogError    = "error"
	LogCritical = "critical"
)

Variables

This section is empty.

Functions

func NewError

func NewError(text string) error

NewError raise an error

Types

type Client

type Client = mqtt.Client

Client representation

type MQTTNetwork

type MQTTNetwork struct {
	// contains filtered or unexported fields
}

MQTTNetwork Protocol MQTT

func (*MQTTNetwork) Disconnect

func (p *MQTTNetwork) Disconnect()

Disconnect disconnect from MQTT

func (*MQTTNetwork) Initialize

func (p *MQTTNetwork) Initialize(config NetworkConfig) error

Initialize protocol communication

func (*MQTTNetwork) SendCommand

func (p *MQTTNetwork) SendCommand(topic, payload string) error

SendCommand send a command

type Message

type Message = mqtt.Message

Message message Payload

type NetworkConfig

type NetworkConfig struct {
	IP        string
	Port      string
	Callbacks map[string]func(Client, Message)
	LogLevel  string
	User      string //for authentification
	Password  string
	CaPath    string
	Secure    bool
}

NetworkConfig configuration structure

type NetworkInterface

type NetworkInterface interface {
	Disconnect()

	SendCommand(string, string) error

	Initialize(config NetworkConfig) error
}

NetworkInterface network abstraction layer

func NewNetwork

func NewNetwork(protocol string) (NetworkInterface, error)

NewNetwork instanciate the appropriate networkinterface

Jump to

Keyboard shortcuts

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