dummy

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2017 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BufferSize = 10

BufferSize indicates the maximum number of dummy messages that should be buffered

Functions

This section is empty.

Types

type Dummy

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

Dummy backend

func New

func New(ctx log.Interface) *Dummy

New returns a new Dummy backend

func (*Dummy) CleanupGateway

func (d *Dummy) CleanupGateway(gatewayID string)

CleanupGateway implements backend interfaces

func (*Dummy) Connect

func (d *Dummy) Connect() error

Connect implements backend interfaces

func (*Dummy) Disconnect

func (d *Dummy) Disconnect() error

Disconnect implements backend interfaces

func (*Dummy) PublishConnect

func (d *Dummy) PublishConnect(message *types.ConnectMessage) error

PublishConnect publishes connect messages to the dummy backend

func (*Dummy) PublishDisconnect

func (d *Dummy) PublishDisconnect(message *types.DisconnectMessage) error

PublishDisconnect publishes disconnect messages to the dummy backend

func (d *Dummy) PublishDownlink(message *types.DownlinkMessage) error

PublishDownlink implements backend interfaces

func (*Dummy) PublishStatus

func (d *Dummy) PublishStatus(message *types.StatusMessage) error

PublishStatus implements backend interfaces

func (d *Dummy) PublishUplink(message *types.UplinkMessage) error

PublishUplink implements backend interfaces

func (*Dummy) SubscribeConnect

func (d *Dummy) SubscribeConnect() (<-chan *types.ConnectMessage, error)

SubscribeConnect implements backend interfaces

func (*Dummy) SubscribeDisconnect

func (d *Dummy) SubscribeDisconnect() (<-chan *types.DisconnectMessage, error)

SubscribeDisconnect implements backend interfaces

func (d *Dummy) SubscribeDownlink(gatewayID string) (<-chan *types.DownlinkMessage, error)

SubscribeDownlink implements backend interfaces

func (*Dummy) SubscribeStatus

func (d *Dummy) SubscribeStatus(gatewayID string) (<-chan *types.StatusMessage, error)

SubscribeStatus implements backend interfaces

func (d *Dummy) SubscribeUplink(gatewayID string) (<-chan *types.UplinkMessage, error)

SubscribeUplink implements backend interfaces

func (*Dummy) UnsubscribeConnect

func (d *Dummy) UnsubscribeConnect() error

UnsubscribeConnect implements backend interfaces

func (*Dummy) UnsubscribeDisconnect

func (d *Dummy) UnsubscribeDisconnect() error

UnsubscribeDisconnect implements backend interfaces

func (d *Dummy) UnsubscribeDownlink(gatewayID string) error

UnsubscribeDownlink implements backend interfaces

func (*Dummy) UnsubscribeStatus

func (d *Dummy) UnsubscribeStatus(gatewayID string) error

UnsubscribeStatus implements backend interfaces

func (d *Dummy) UnsubscribeUplink(gatewayID string) error

UnsubscribeUplink implements backend interfaces

func (*Dummy) WithHTTPServer

func (d *Dummy) WithHTTPServer(addr string) *WithServer

WithHTTPServer returns the Dummy that also has a HTTP server exposing the events on addr

type Server

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

Server is a http server that exposes some events over websockets

func NewServer

func NewServer(ctx log.Interface, addr string) (*Server, error)

NewServer creates a new server

func (*Server) Connect

func (s *Server) Connect(gatewayID string)

Connect emits a message when a gateway connects

func (*Server) ConnectedGateways

func (s *Server) ConnectedGateways() []string

ConnectedGateways returns the list of connected gateway IDs

func (*Server) Disconnect

func (s *Server) Disconnect(gatewayID string)

Disconnect emits a message when a gateway disconnects

func (s *Server) Downlink(msg *types.DownlinkMessage)

Downlink emits a downlink message on the server page

func (*Server) Listen

func (s *Server) Listen()

Listen opens the server and starts listening for http requests

func (*Server) Status

func (s *Server) Status(msg *types.StatusMessage)

Status emits a status message on the server page

func (s *Server) Uplink(msg *types.UplinkMessage)

Uplink emits an uplink message on the server page

type WithServer

type WithServer struct {
	*Dummy
	// contains filtered or unexported fields
}

WithServer is a Dummy backend that exposes some events on a http page with websockets

func (d *WithServer) PublishDownlink(message *types.DownlinkMessage) error

PublishDownlink implements backend interfaces

func (*WithServer) PublishStatus

func (d *WithServer) PublishStatus(message *types.StatusMessage) error

PublishStatus implements backend interfaces

func (d *WithServer) PublishUplink(message *types.UplinkMessage) error

PublishUplink implements backend interfaces

func (d *WithServer) SubscribeUplink(gatewayID string) (<-chan *types.UplinkMessage, error)

SubscribeUplink implements backend interfaces

func (d *WithServer) UnsubscribeUplink(gatewayID string) error

UnsubscribeUplink implements backend interfaces

Jump to

Keyboard shortcuts

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