qbus

package
v0.0.0-...-7fa8532 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 7 Imported by: 0

README

QBUS

The EQOweb api is used to communicate to a CTD0xE controller.

Documentation

Index

Constants

View Source
const (
	COMMAND_ERROR               = 0
	COMMAND_LOGIN               = 1
	COMMAND_LOGIN_RESPONSE      = 2
	COMMAND_GET_GROUPS          = 10
	COMMAND_GET_GROUPS_RESPONSE = 11
	COMMAND_SET_STATUS          = 12
	COMMAND_SET_STATUS_RESPONSE = 13
)
View Source
const (
	ON  = 255
	OFF = 0
)

Variables

View Source
var (
	ErrBusy                   = errors.New("The controller is busy, please try again later")
	ErrSessionTimeout         = errors.New("The session timed out")
	ErrTooManyConnections     = errors.New("Too much devices are connected to the controller")
	ErrFailed                 = errors.New("The controller was unable to execute your command")
	ErrSessionStartFailure    = errors.New("Your session could not be started")
	ErrUnknownCommand         = errors.New("The command is unknown")
	ErrNoEQWebConfig          = errors.New("No EQOweb configuration found, please run System manager to upload and configure EQOweb.")
	ErrSystemManagerConnected = errors.New("System manager is still connected. Please close System manager to continue")
	ErrUndefined              = errors.New("Undefined error in the controller. Please try again later")
)

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID    uint   `json:"Chnl"`
	Name  string `json:"Nme"`
	Icon  uint   `json:"Ico"`
	Value []int  `json:"Val"`
}

type Client

type Client struct {
	Url      string
	User     string
	Password string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url, user, password string) *Client

func (*Client) GetGroups

func (c *Client) GetGroups() (groups []Group, err error)

func (*Client) Login

func (c *Client) Login() (err error)

func (*Client) SetStatus

func (c *Client) SetStatus(channelID, status int) (err error)

type Command

type Command struct {
	Type  int
	Value any
}

func NewGetGroupsCommand

func NewGetGroupsCommand() *Command

func NewLoginCommand

func NewLoginCommand(user, password string) *Command

func NewSetStatusCommand

func NewSetStatusCommand(channelID int, status []int) *Command

type Group

type Group struct {
	Name  string    `json:"Nme"`
	Items []Channel `json:"Itms"`
}

type Response

type Response struct {
	Type  int
	Value json.RawMessage
}

func (*Response) Error

func (r *Response) Error() (err error)

Error returns the appropriate error if the response is an error response (Type==0), nil if not

func (*Response) GetGroupsResponse

func (r *Response) GetGroupsResponse() (groups []Group, err error)

func (*Response) GetLoginResponse

func (r *Response) GetLoginResponse() (sessionID string, err error)

func (*Response) SetStatusResponse

func (r *Response) SetStatusResponse() (channelID int, status []int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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