gateway

package
v0.0.0-...-f81ab52 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2017 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Overview

gateway connects Broker-Device

Index

Constants

View Source
const (
	DefaultMaxRetryCount    = 3
	DefaultRetryInterval    = 3 // sec
	MaxMsgChanBufferSize    = 20
	MaxBrokerChanBufferSize = 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Gateway

type Gateway struct {
	Name string `validate:"max=256,regexp=[^/]+,validtopic"`

	Devices []device.Devicer
	Brokers broker.Brokers

	MsgChan        chan message.Message   // Broker -> GW
	BrokerChan     chan message.Message   // GW -> Broker
	CmdChan        chan string            // somewhere -> GW
	DeviceChannels []device.DeviceChannel // GW -> device

	MaxRetryCount int `validate:"min=1"`
	RetryInterval int `validate:"min=1"`
}

func NewGateway

func NewGateway(conf config.Config) (*Gateway, error)

NewGateway returns Gateway instance with config object

func (*Gateway) MainLoop

func (gw *Gateway) MainLoop() error

MainLoop loops forever.

func (*Gateway) Publish

func (gw *Gateway) Publish(msg message.Message)

Publish pass the message to a Broker which is connected

func (*Gateway) Start

func (gw *Gateway) Start() error

func (*Gateway) Stop

func (gw *Gateway) Stop()

func (Gateway) String

func (gateway Gateway) String() string

func (*Gateway) Validate

func (gw *Gateway) Validate() error

Jump to

Keyboard shortcuts

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