client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Stat
	// contains filtered or unexported fields
}

func NewClient

func NewClient(lc fx.Lifecycle,
	cfg *config.AppConfig,
	mqtt *mqtt.Mqtt,
	serialService *serial.SerialService) *Client

func (*Client) Connect

func (c *Client) Connect()

func (*Client) ResponseFunc

func (c *Client) ResponseFunc(cli MQTT.Client) func(entityId string, data []byte)

func (*Client) SendMessageToThread

func (c *Client) SendMessageToThread(item common.ThreadCaller) (err error)

func (*Client) Shutdown

func (c *Client) Shutdown() error

func (*Client) Start added in v0.1.0

func (c *Client) Start() error

func (*Client) UpdateThreads

func (c *Client) UpdateThreads()

type Stat

type Stat struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewStat added in v0.0.9

func NewStat() Stat

func (*Stat) GetStat added in v0.0.9

func (c *Stat) GetStat() StateSnapshot

type StateSnapshot added in v0.0.9

type StateSnapshot struct {
	Rps       int64     `json:"rps"`
	Min       int64     `json:"min"`
	Latency   int64     `json:"latency"`
	Max       int64     `json:"max"`
	StartedAt time.Time `json:"started_at"`
}

type Thread

type Thread struct {
	sync.Mutex
	Busy bool
	Dev  string

	Active bool
	// contains filtered or unexported fields
}

func NewThread

func NewThread(dev string) (thread *Thread)

func (*Thread) Close

func (t *Thread) Close()

func (*Thread) Device

func (t *Thread) Device() string

func (*Thread) Disable

func (t *Thread) Disable()

func (*Thread) Enable

func (t *Thread) Enable()

func (*Thread) Exec

func (t *Thread) Exec(cb common.ThreadCaller) (resp *common.MessageResponse, err error)

func (*Thread) GetCon

func (t *Thread) GetCon() interface{}

func (*Thread) GetSerial

func (t *Thread) GetSerial() *serial.Serial

func (*Thread) Open

func (t *Thread) Open() (err error)

func (*Thread) Restart

func (t *Thread) Restart()

DEPRECATED

func (*Thread) SetCon

func (t *Thread) SetCon(conn interface{})

func (*Thread) SetErr

func (t *Thread) SetErr()

func (*Thread) SetParams

func (t *Thread) SetParams(baud, timeout, stopBits int) (err error)

type Threads

type Threads map[string]*Thread

Jump to

Keyboard shortcuts

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