device

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultSocketTimeout = 2 * time.Minute
	ReceiveBufferSize    = 20 * 1024
)

Variables

View Source
var (
	DeviceNotFoundError  = errors.New("Device not found")
	ManagerNotFoundError = errors.New("Manager not found")
)
View Source
var (
	DeviceDisconnectedError = fmt.Errorf("device disconnected")
)

Functions

func StateToString

func StateToString(state State) string

Types

type Connection

type Connection struct {
	Logger              *logrus.Entry
	Connection          *websocket.Conn
	ResponseChannel     chan ResponseData
	ActionChannel       chan action.Response
	ConnectionParameter *action.Connect
}

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) HandleMessages

func (c *Connection) HandleMessages(ctx context.Context)

func (*Connection) Send

func (c *Connection) Send(content []byte) error

type ConnectionState

type ConnectionState uint8
const (
	Disconnected ConnectionState = iota
	Connected
)

type Device

type Device interface {
	DeviceID() string
	DeviceState() State
	DeviceOSName() string
	DeviceOSVersion() string
	DeviceName() string
	DeviceParameter() map[string]string
	DeviceType() int
	PlatformType() int

	TargetVersion() string

	// IsAppBundleAvailable(*app.Parameter) (bool, error)
	IsAppInstalled(*app.Parameter) (bool, error)
	InstallApp(*app.Parameter) error
	UninstallApp(*app.Parameter) error

	NewContext() context.Context
	Cancel()
	ConnectionTimeout() time.Duration
	SetConnection(*Connection)
	Connection() *Connection
	IsAppConnected() bool

	StartApp(*app.Parameter, string, string) error
	StopApp(*app.Parameter) error
	Send([]byte) error

	StartRecording(string) error
	StopRecording() error

	GetScreenshot() ([]byte, int, int, error)

	HasFeature(string) bool
	Execute(string)
	Lock() error
	Unlock() error
	IsLocked() bool

	SetLogWriter(LogWriter)
	GetLogWriter() LogWriter
	Data(string, string)
	LogPerformance(checkpoint string, cpu, fps, mem, vertexCount, triangles float64, other string)
	Log(string, string, ...interface{})
	Error(string, string, ...interface{})
	Exception(string, string, ...interface{})
	AddActionHandler(action.ActionHandler)
	RemoveActionHandler(action.ActionHandler)
	ActionHandlers() []action.ActionHandler
	RunNativeScript(data []byte)
	Passed(result bool)
}

type Handler

type Handler interface {
	Name() string
	Init(masterUrl string, nodeIdentifier string, authToken *string) error
	Start() error
	Stop() error
	StartDevice(string) error
	StopDevice(string) error
	GetDevices() ([]Device, error)
	RefreshDevices(bool) error
	HasDevice(Device) bool
	RegisterDevice(data RegisterData) (Device, error)
}

type LogWriter

type LogWriter interface {
	LogPerformance(checkpoint string, cpu, fps, mem, vertexCount, triangles float64, other string)
	Data(source, data string)
	Log(source, format string, params ...interface{})
	Error(source, format string, params ...interface{})
	TestProtocolId() *uint
	Device() interface{}
	Parent() LogWriter
	Passed(passed bool)
	HasPassed() bool
}

type Properties

type Properties struct {
	Name         string
	DeviceID     string
	Type         string
	OS           string
	Architecture string
	App          string
}

func (*Properties) AreValid

func (p *Properties) AreValid() bool

type RegisterData

type RegisterData struct {
	ManagerType     string
	DeviceID        string
	Name            string
	DeviceOS        string
	DeviceOSVersion string
	TargetVersion   string
	DeviceOSInfos   string
	ProjectDir      string
	DeviceModel     string
	RAM             float32
	GPU             string
	SOC             string
	DeviceIP        net.IP
	Conn            *websocket.Conn
}

type ResponseData

type ResponseData struct {
	Data []byte
	Err  error
}

type State

type State uint8
const (
	StateNone State = iota
	StateUnknown
	StateShutdown
	StateRemoteDisconnected
	StateBooted
	StateLocked
	StateNodeDisconnected
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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