event

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventMessage

type EventMessage struct {
	EventType EventType
	AreaID    uint64
	Param     map[string]interface{}
}

func NewEventMessage

func NewEventMessage(et EventType, areaID uint64) *EventMessage

func (*EventMessage) GetAttr

func (e *EventMessage) GetAttr() *entity.Attribute

func (*EventMessage) GetDeviceID

func (e *EventMessage) GetDeviceID() int

func (*EventMessage) SetAttr

func (e *EventMessage) SetAttr(attr entity.Attribute)

func (*EventMessage) SetDeviceID

func (e *EventMessage) SetDeviceID(deviceID int)

type EventType

type EventType string
const (
	AttributeChange EventType = "attribute_change"
	DeviceIncrease  EventType = "device_increase"
	DeviceDecrease  EventType = "device_decrease"
)

type HandleFunc

type HandleFunc func(em EventMessage) error

type Server

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

func GetServer

func GetServer() *Server

func (*Server) Notify

func (s *Server) Notify(em *EventMessage)

func (*Server) RegisterHandler

func (s *Server) RegisterHandler(eventType EventType, handlerFunctions ...HandleFunc)

Jump to

Keyboard shortcuts

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