endpoints

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint interface {
	// SetOwnerID sets endpoint's owner ID (device ID)
	SetOwnerID(id string)
	// GetOwnerID returns owner ID
	GetOwnerID() string
	// GetID returns endpoint ID
	GetID() string
	// HandleMessage handles incoming message
	HandleMessage(cmd string, msg string)
	// RegisterOnStateChangedCb registers callback funkcion that is called when endpoint state is changed
	RegisterOnStateChangedCb(cb func(ep Endpoint, cmd string, state string, err error))
	// RegisterSendMsgCb registers callback function that is called when message from endpoint must be sent to HC GW
	RegisterSendMsgCb(cb func(topic string, msg string) error)
	// SendConfig sends endpoint config to HC GW
	SendConfig() error
	// SendFeedbackMessage sends feedback message to HC GW when some of the commands change state
	SendFeedbackMessage(cmd string, msg string) error
	// SendStatus sends current endpoint commands status
	SendStatus() error
}

Endpoint interface collects all methods needed to handle device endpoint

type HumidityEndpoint

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

func NewHumidityEndpoint

func NewHumidityEndpoint(
	epId string,
	epName string,
	onStateChange func(ep Endpoint, cmd string, state string, err error),
) *HumidityEndpoint

func (HumidityEndpoint) GetID

func (obj HumidityEndpoint) GetID() string

GetID returns endpoint ID

func (HumidityEndpoint) GetOwnerID

func (obj HumidityEndpoint) GetOwnerID() string

GetOwnerID returns owner ID

func (HumidityEndpoint) HandleMessage

func (obj HumidityEndpoint) HandleMessage(cmd string, msg string)

HandleMessage handles incoming message

func (HumidityEndpoint) RegisterOnStateChangedCb

func (obj HumidityEndpoint) RegisterOnStateChangedCb(cb func(ep Endpoint, cmd string, state string, err error))

RegisterOnStateChangedCb registers callback funkcion that is called when endpoint state is changed

func (HumidityEndpoint) RegisterSendMsgCb

func (obj HumidityEndpoint) RegisterSendMsgCb(cb func(topic string, msg string) error)

RegisterSendMsgCb registers callback function that is called when message from endpoint must be sent to HC GW

func (HumidityEndpoint) SendConfig

func (obj HumidityEndpoint) SendConfig() error

SendConfig sends endpoint config to HC GW

func (HumidityEndpoint) SendFeedbackMessage

func (obj HumidityEndpoint) SendFeedbackMessage(cmd string, msg string) error

SendFeedbackMessage sends feedback message to HC GW when some of the commands change state

func (*HumidityEndpoint) SendStatus

func (obj *HumidityEndpoint) SendStatus() error

func (HumidityEndpoint) SetOwnerID

func (obj HumidityEndpoint) SetOwnerID(id string)

SetOwnerID sets endpoint's owner ID (device ID)

type IdentifyEndpoint

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

func NewIdentifyEndpoint

func NewIdentifyEndpoint(
	epId string,
	epName string,
	onStateChange func(ep Endpoint, cmd string, state string, err error),
) *IdentifyEndpoint

func (IdentifyEndpoint) GetID

func (obj IdentifyEndpoint) GetID() string

GetID returns endpoint ID

func (IdentifyEndpoint) GetOwnerID

func (obj IdentifyEndpoint) GetOwnerID() string

GetOwnerID returns owner ID

func (IdentifyEndpoint) HandleMessage

func (obj IdentifyEndpoint) HandleMessage(cmd string, msg string)

HandleMessage handles incoming message

func (IdentifyEndpoint) RegisterOnStateChangedCb

func (obj IdentifyEndpoint) RegisterOnStateChangedCb(cb func(ep Endpoint, cmd string, state string, err error))

RegisterOnStateChangedCb registers callback funkcion that is called when endpoint state is changed

func (IdentifyEndpoint) RegisterSendMsgCb

func (obj IdentifyEndpoint) RegisterSendMsgCb(cb func(topic string, msg string) error)

RegisterSendMsgCb registers callback function that is called when message from endpoint must be sent to HC GW

func (IdentifyEndpoint) SendConfig

func (obj IdentifyEndpoint) SendConfig() error

SendConfig sends endpoint config to HC GW

func (IdentifyEndpoint) SendFeedbackMessage

func (obj IdentifyEndpoint) SendFeedbackMessage(cmd string, msg string) error

SendFeedbackMessage sends feedback message to HC GW when some of the commands change state

func (*IdentifyEndpoint) SendStatus

func (obj *IdentifyEndpoint) SendStatus() error

func (IdentifyEndpoint) SetOwnerID

func (obj IdentifyEndpoint) SetOwnerID(id string)

SetOwnerID sets endpoint's owner ID (device ID)

type LevelEndpoint

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

func NewLevelEndpoint

func NewLevelEndpoint(
	epId string,
	epName string,
	onStateChange func(ep Endpoint, cmd string, state string, err error),
) *LevelEndpoint

func (LevelEndpoint) GetID

func (obj LevelEndpoint) GetID() string

GetID returns endpoint ID

func (LevelEndpoint) GetOwnerID

func (obj LevelEndpoint) GetOwnerID() string

GetOwnerID returns owner ID

func (LevelEndpoint) HandleMessage

func (obj LevelEndpoint) HandleMessage(cmd string, msg string)

HandleMessage handles incoming message

func (LevelEndpoint) RegisterOnStateChangedCb

func (obj LevelEndpoint) RegisterOnStateChangedCb(cb func(ep Endpoint, cmd string, state string, err error))

RegisterOnStateChangedCb registers callback funkcion that is called when endpoint state is changed

func (LevelEndpoint) RegisterSendMsgCb

func (obj LevelEndpoint) RegisterSendMsgCb(cb func(topic string, msg string) error)

RegisterSendMsgCb registers callback function that is called when message from endpoint must be sent to HC GW

func (LevelEndpoint) SendConfig

func (obj LevelEndpoint) SendConfig() error

SendConfig sends endpoint config to HC GW

func (LevelEndpoint) SendFeedbackMessage

func (obj LevelEndpoint) SendFeedbackMessage(cmd string, msg string) error

SendFeedbackMessage sends feedback message to HC GW when some of the commands change state

func (*LevelEndpoint) SendStatus

func (obj *LevelEndpoint) SendStatus() error

func (LevelEndpoint) SetOwnerID

func (obj LevelEndpoint) SetOwnerID(id string)

SetOwnerID sets endpoint's owner ID (device ID)

type MotionEndpoint

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

func NewMotionEndpoint

func NewMotionEndpoint(
	epId string,
	epName string,
	onStateChange func(ep Endpoint, cmd string, state string, err error),
) *MotionEndpoint

func (MotionEndpoint) GetID

func (obj MotionEndpoint) GetID() string

GetID returns endpoint ID

func (MotionEndpoint) GetOwnerID

func (obj MotionEndpoint) GetOwnerID() string

GetOwnerID returns owner ID

func (MotionEndpoint) HandleMessage

func (obj MotionEndpoint) HandleMessage(cmd string, msg string)

HandleMessage handles incoming message

func (MotionEndpoint) RegisterOnStateChangedCb

func (obj MotionEndpoint) RegisterOnStateChangedCb(cb func(ep Endpoint, cmd string, state string, err error))

RegisterOnStateChangedCb registers callback funkcion that is called when endpoint state is changed

func (MotionEndpoint) RegisterSendMsgCb

func (obj MotionEndpoint) RegisterSendMsgCb(cb func(topic string, msg string) error)

RegisterSendMsgCb registers callback function that is called when message from endpoint must be sent to HC GW

func (MotionEndpoint) SendConfig

func (obj MotionEndpoint) SendConfig() error

SendConfig sends endpoint config to HC GW

func (MotionEndpoint) SendFeedbackMessage

func (obj MotionEndpoint) SendFeedbackMessage(cmd string, msg string) error

SendFeedbackMessage sends feedback message to HC GW when some of the commands change state

func (*MotionEndpoint) SendStatus

func (obj *MotionEndpoint) SendStatus() error

func (MotionEndpoint) SetOwnerID

func (obj MotionEndpoint) SetOwnerID(id string)

SetOwnerID sets endpoint's owner ID (device ID)

type OnOffEndpoint

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

func NewOnOffEndpoint

func NewOnOffEndpoint(
	epId string,
	epName string,
	onStateChange func(ep Endpoint, cmd string, state string, err error),
) *OnOffEndpoint

func (OnOffEndpoint) GetID

func (obj OnOffEndpoint) GetID() string

GetID returns endpoint ID

func (OnOffEndpoint) GetOwnerID

func (obj OnOffEndpoint) GetOwnerID() string

GetOwnerID returns owner ID

func (OnOffEndpoint) HandleMessage

func (obj OnOffEndpoint) HandleMessage(cmd string, msg string)

HandleMessage handles incoming message

func (OnOffEndpoint) RegisterOnStateChangedCb

func (obj OnOffEndpoint) RegisterOnStateChangedCb(cb func(ep Endpoint, cmd string, state string, err error))

RegisterOnStateChangedCb registers callback funkcion that is called when endpoint state is changed

func (OnOffEndpoint) RegisterSendMsgCb

func (obj OnOffEndpoint) RegisterSendMsgCb(cb func(topic string, msg string) error)

RegisterSendMsgCb registers callback function that is called when message from endpoint must be sent to HC GW

func (OnOffEndpoint) SendConfig

func (obj OnOffEndpoint) SendConfig() error

SendConfig sends endpoint config to HC GW

func (OnOffEndpoint) SendFeedbackMessage

func (obj OnOffEndpoint) SendFeedbackMessage(cmd string, msg string) error

SendFeedbackMessage sends feedback message to HC GW when some of the commands change state

func (*OnOffEndpoint) SendStatus

func (obj *OnOffEndpoint) SendStatus() error

func (OnOffEndpoint) SetOwnerID

func (obj OnOffEndpoint) SetOwnerID(id string)

SetOwnerID sets endpoint's owner ID (device ID)

type TemperatureEndpoint

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

func NewTemperatureEndpoint

func NewTemperatureEndpoint(
	epId string,
	epName string,
	onStateChange func(ep Endpoint, cmd string, state string, err error),
) *TemperatureEndpoint

func (TemperatureEndpoint) GetID

func (obj TemperatureEndpoint) GetID() string

GetID returns endpoint ID

func (TemperatureEndpoint) GetOwnerID

func (obj TemperatureEndpoint) GetOwnerID() string

GetOwnerID returns owner ID

func (TemperatureEndpoint) HandleMessage

func (obj TemperatureEndpoint) HandleMessage(cmd string, msg string)

HandleMessage handles incoming message

func (TemperatureEndpoint) RegisterOnStateChangedCb

func (obj TemperatureEndpoint) RegisterOnStateChangedCb(cb func(ep Endpoint, cmd string, state string, err error))

RegisterOnStateChangedCb registers callback funkcion that is called when endpoint state is changed

func (TemperatureEndpoint) RegisterSendMsgCb

func (obj TemperatureEndpoint) RegisterSendMsgCb(cb func(topic string, msg string) error)

RegisterSendMsgCb registers callback function that is called when message from endpoint must be sent to HC GW

func (TemperatureEndpoint) SendConfig

func (obj TemperatureEndpoint) SendConfig() error

SendConfig sends endpoint config to HC GW

func (TemperatureEndpoint) SendFeedbackMessage

func (obj TemperatureEndpoint) SendFeedbackMessage(cmd string, msg string) error

SendFeedbackMessage sends feedback message to HC GW when some of the commands change state

func (*TemperatureEndpoint) SendStatus

func (obj *TemperatureEndpoint) SendStatus() error

func (TemperatureEndpoint) SetOwnerID

func (obj TemperatureEndpoint) SetOwnerID(id string)

SetOwnerID sets endpoint's owner ID (device ID)

type ThermostatEndpoint

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

func NewThermostatEndpoint

func NewThermostatEndpoint(
	epId string,
	epName string,
	onStateChange func(ep Endpoint, cmd string, state string, err error),
) *ThermostatEndpoint

func (ThermostatEndpoint) GetID

func (obj ThermostatEndpoint) GetID() string

GetID returns endpoint ID

func (ThermostatEndpoint) GetOwnerID

func (obj ThermostatEndpoint) GetOwnerID() string

GetOwnerID returns owner ID

func (ThermostatEndpoint) HandleMessage

func (obj ThermostatEndpoint) HandleMessage(cmd string, msg string)

HandleMessage handles incoming message

func (ThermostatEndpoint) RegisterOnStateChangedCb

func (obj ThermostatEndpoint) RegisterOnStateChangedCb(cb func(ep Endpoint, cmd string, state string, err error))

RegisterOnStateChangedCb registers callback funkcion that is called when endpoint state is changed

func (ThermostatEndpoint) RegisterSendMsgCb

func (obj ThermostatEndpoint) RegisterSendMsgCb(cb func(topic string, msg string) error)

RegisterSendMsgCb registers callback function that is called when message from endpoint must be sent to HC GW

func (ThermostatEndpoint) SendConfig

func (obj ThermostatEndpoint) SendConfig() error

SendConfig sends endpoint config to HC GW

func (ThermostatEndpoint) SendFeedbackMessage

func (obj ThermostatEndpoint) SendFeedbackMessage(cmd string, msg string) error

SendFeedbackMessage sends feedback message to HC GW when some of the commands change state

func (*ThermostatEndpoint) SendStatus

func (obj *ThermostatEndpoint) SendStatus() error

func (ThermostatEndpoint) SetOwnerID

func (obj ThermostatEndpoint) SetOwnerID(id string)

SetOwnerID sets endpoint's owner ID (device ID)

type ZeroEndpoint

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

func NewZeroEndpoint

func NewZeroEndpoint(
	ownerID string,
	epId string,
	sendConfigsCb func(),
	sendFeedbackCb func(topic string, msg string) error,
) *ZeroEndpoint

func (*ZeroEndpoint) HandleMessage

func (obj *ZeroEndpoint) HandleMessage(msg string)

func (*ZeroEndpoint) SendConfig

func (obj *ZeroEndpoint) SendConfig(enpCount int) error

Jump to

Keyboard shortcuts

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