device

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func (*API) Run

func (a *API) Run() error

func (*API) Shutdown

func (a *API) Shutdown(ctx context.Context) error

Shutdown closes all active connections.

type Connection

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

Connection links connection and device.

func (*Connection) Close

func (c *Connection) Close() error

Close device's connection.

func (*Connection) GetDevice

func (c *Connection) GetDevice() *model.Device

GetDevice returns assocciated device.

func (*Connection) IsRegistered

func (c *Connection) IsRegistered() bool

IsRegistered show the device has been authenticated and active.

func (*Connection) Read

func (c *Connection) Read(data []byte) (int, error)

func (*Connection) RemoteAddr

func (c *Connection) RemoteAddr() net.Addr

RemoteAddr of connection

func (*Connection) SetDeadline

func (c *Connection) SetDeadline(t time.Time) error

SetDeadline of the connection.

func (*Connection) SetReadDeadline

func (c *Connection) SetReadDeadline(t time.Time) error

SetReadDeadline of the connection.

func (*Connection) SetWriteDeadline

func (c *Connection) SetWriteDeadline(t time.Time) error

SetWriteDeadline of the connecton.

func (*Connection) Write

func (c *Connection) Write(data []byte) (int, error)

Write to device's connection.

type HelloRequest

type HelloRequest struct {
	RequestID     string
	ServerVersion string
	Timestamp     time.Time
}

type Message

type Message struct {
	Type MessageType
	Data []byte
}

type MessageType

type MessageType uint64

MessageType determines how to handle the message

Jump to

Keyboard shortcuts

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