connector

package
v0.0.0-...-91c7ab2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeviceNotRegister = errors.New("device not register")
	ErrDeviceNotOnline   = errors.New("device not online")
)

Functions

This section is empty.

Types

type Connector

type Connector interface {
	Run()
	GetConnectStatus() bool
	GetSubDeviceConnectStatus(deviceIdentifier string) bool
	SendDeviceAddWaitResponse(deviceInfo proto.DeviceInfo) error
	SendDeviceChangeStatusWaitResponse(deviceIdentifier string, connectStatus proto.DeviceConnectStatus) error
	SendDeviceQueryWaitResponse(deviceIdentifier string) (proto.DeviceInfo, error)
	SendDeviceCommandResponse(mid int, success bool, body interface{}) error
	SendDeviceData(deviceIdentifier string, services []proto.Service) error
}

func NewConnector

func NewConnector(conf proto.Config, handler MsgHandler) Connector

func NewGateway

func NewGateway(conf proto.Config, handler MsgHandler) Connector

func NewTerminal

func NewTerminal(conf proto.Config, handler MsgHandler) Connector

type Gateway

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

func (*Gateway) GetConnectStatus

func (g *Gateway) GetConnectStatus() bool

func (*Gateway) GetSubDeviceConnectStatus

func (g *Gateway) GetSubDeviceConnectStatus(deviceIdentifier string) bool

func (*Gateway) Run

func (g *Gateway) Run()

func (*Gateway) SendDeviceAddWaitResponse

func (g *Gateway) SendDeviceAddWaitResponse(subDevice proto.DeviceInfo) error

func (*Gateway) SendDeviceChangeStatusWaitResponse

func (g *Gateway) SendDeviceChangeStatusWaitResponse(deviceIdentifier string, connectStatus proto.DeviceConnectStatus) error

func (*Gateway) SendDeviceCommandResponse

func (g *Gateway) SendDeviceCommandResponse(mid int, success bool, body interface{}) (err error)

func (*Gateway) SendDeviceData

func (g *Gateway) SendDeviceData(deviceIdentifier string, services []proto.Service) (err error)

func (*Gateway) SendDeviceQueryWaitResponse

func (g *Gateway) SendDeviceQueryWaitResponse(deviceIdentifier string) (proto.DeviceInfo, error)

type MsgHandler

type MsgHandler interface {
	OnConnected(client MQTT.Client)
	ConnectionLost(client MQTT.Client, err error)

	//HandleDeviceDelete 删除设备
	HandleDeviceDelete(deviceIdentifier string)
	//HandleDeviceCommand 命令下发
	HandleDeviceCommand(command proto.Command)
}

type Terminal

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

func (*Terminal) ConnectionLost

func (t *Terminal) ConnectionLost(client MQTT.Client, err error)

func (*Terminal) GetConnectStatus

func (t *Terminal) GetConnectStatus() bool

func (*Terminal) GetSubDeviceConnectStatus

func (t *Terminal) GetSubDeviceConnectStatus(deviceIdentifier string) bool

func (*Terminal) OnConnected

func (t *Terminal) OnConnected(client MQTT.Client)

func (*Terminal) Run

func (t *Terminal) Run()

func (*Terminal) SendDeviceAddWaitResponse

func (t *Terminal) SendDeviceAddWaitResponse(deviceInfo proto.DeviceInfo) (err error)

func (*Terminal) SendDeviceChangeStatusWaitResponse

func (t *Terminal) SendDeviceChangeStatusWaitResponse(deviceIdentifier string, connectStatus proto.DeviceConnectStatus) (err error)

func (*Terminal) SendDeviceCommandResponse

func (t *Terminal) SendDeviceCommandResponse(mid int, success bool, body interface{}) (err error)

func (*Terminal) SendDeviceData

func (t *Terminal) SendDeviceData(deviceIdentifier string, services []proto.Service) (err error)

func (*Terminal) SendDeviceQueryWaitResponse

func (t *Terminal) SendDeviceQueryWaitResponse(deviceIdentifier string) (deviceInfo proto.DeviceInfo, err error)

Jump to

Keyboard shortcuts

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