adb

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adb

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

func New

func New(config AdbConfig) *Adb

func (*Adb) Check

func (adb *Adb) Check() error

func (*Adb) Devices

func (adb *Adb) Devices() ([]IDevice, error)

func (*Adb) ExecuteCommand

func (adb *Adb) ExecuteCommand(command ...string) error

func (*Adb) ExecuteCommandWithContext

func (adb *Adb) ExecuteCommandWithContext(context context.Context, command ...string) *BufferedOutput

func (*Adb) ExecuteCommandWithReturn

func (adb *Adb) ExecuteCommandWithReturn(command ...string) (string, error)

func (*Adb) GetVersion

func (adb *Adb) GetVersion() (string, error)

func (*Adb) ReleaseDevice added in v0.3.0

func (adb *Adb) ReleaseDevice(device *Device)

func (*Adb) Start

func (adb *Adb) Start() error

func (*Adb) Stop

func (adb *Adb) Stop() error

type AdbConfig

type AdbConfig struct {
	AdbPath string `yaml:"Path"`
}

type BufferedOutput

type BufferedOutput struct {
	Error error

	Out bytes.Buffer
	Err bytes.Buffer
}

type Device

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

func NewDevice

func NewDevice(id string, product string, model string, device string, adb *Adb) *Device

func (*Device) CatFile added in v0.6.0

func (device *Device) CatFile(deviceFilePath string) (string, error)

func (*Device) CreateDir added in v0.8.0

func (device *Device) CreateDir(remotePath string) error

func (*Device) DeleteDir added in v0.2.1

func (device *Device) DeleteDir(remotePath string) error

func (*Device) DeleteFile added in v0.2.1

func (device *Device) DeleteFile(remotePath string) error

func (*Device) ForceStop

func (device *Device) ForceStop(packageName string) error

func (Device) GetCodeName added in v0.4.0

func (device Device) GetCodeName() string

func (Device) GetId

func (device Device) GetId() string

func (Device) GetManufacturer added in v0.5.0

func (device Device) GetManufacturer() (string, error)

func (Device) GetModel

func (device Device) GetModel() string

func (Device) GetOsVersion added in v0.5.0

func (device Device) GetOsVersion() (string, error)

func (Device) GetProduct

func (device Device) GetProduct() string

func (*Device) Install

func (device *Device) Install(packagePath string, overwrite bool) error

func (*Device) IsFile

func (device *Device) IsFile(deviceFilePath string) bool

func (*Device) IsPackageInstalled

func (device *Device) IsPackageInstalled(packageName string) bool

func (*Device) ListDirectory

func (device *Device) ListDirectory(directory string) ([]string, error)

func (*Device) Logcat

func (device *Device) Logcat(context context.Context) *BufferedOutput

func (*Device) LogcatWithFilter

func (device *Device) LogcatWithFilter(context context.Context, filter string) *BufferedOutput

func (*Device) Mount added in v0.8.0

func (device *Device) Mount(remotePath string) error

func (*Device) Pull

func (device *Device) Pull(remotePath string, localPath string) error

func (*Device) Push

func (device *Device) Push(localPath string, remotePath string) error

func (*Device) Release added in v0.3.0

func (device *Device) Release()

func (*Device) RunActivity

func (device *Device) RunActivity(name string, extraParameters ...string) error

func (*Device) SetGps added in v0.7.0

func (device *Device) SetGps(enabled bool) error

This will work only for Android 11.0+

func (*Device) SetPermission added in v0.7.0

func (device *Device) SetPermission(grant bool, packageName string, permission string) error

func (*Device) SetRoot added in v0.8.0

func (device *Device) SetRoot(root bool) error

func (*Device) Uninstall

func (device *Device) Uninstall(packageName string) error

func (*Device) WakeUp

func (device *Device) WakeUp() error

type IDevice added in v0.3.0

type IDevice interface {
	GetId() string
	GetModel() string
	GetProduct() string
	GetCodeName() string

	GetOsVersion() (string, error)
	GetManufacturer() (string, error)

	IsPackageInstalled(packageName string) bool
	Install(packagePath string, overwrite bool) error
	Uninstall(packageName string) error

	ForceStop(packageName string) error
	RunActivity(name string, extraParameters ...string) error

	Pull(remotePath string, localPath string) error
	Push(localPath string, remotePath string) error

	DeleteFile(remotePath string) error
	DeleteDir(remotePath string) error
	CreateDir(remotePath string) error

	WakeUp() error

	ListDirectory(directory string) ([]string, error)
	IsFile(deviceFilePath string) bool

	Logcat(context context.Context) *BufferedOutput
	LogcatWithFilter(context context.Context, filter string) *BufferedOutput

	SetPermission(grant bool, packageName string, permission string) error
	SetGps(enabled bool) error

	SetRoot(root bool) error

	Mount(remotePath string) error

	Release()
}

Jump to

Keyboard shortcuts

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