adb

package
v0.0.0-...-3ed38a9 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const FileStatSize = 4 * 16
View Source
const IdData = 'D' | ('A' << 8) | ('T' << 16) | ('A' << 24)
View Source
const IdDentV2 = 'D' | ('N' << 8) | ('T' << 16) | ('2' << 24)
View Source
const IdDone = 'D' | ('O' << 8) | ('N' << 16) | ('E' << 24)
View Source
const IdFail = 'F' | ('A' << 8) | ('I' << 16) | ('L' << 24)
View Source
const IdLStatV2 = 'L' | ('S' << 8) | ('T' << 16) | ('2' << 24)
View Source
const IdListV2 = 'L' | ('I' << 8) | ('S' << 16) | ('2' << 24)
View Source
const IdOkay = 'O' | ('K' << 8) | ('A' << 16) | ('Y' << 24)
View Source
const IdRecvV2 = 'R' | ('C' << 8) | ('V' << 16) | ('2' << 24)
View Source
const IdSendV2 = 'S' | ('N' << 8) | ('D' << 16) | ('2' << 24)
View Source
const IdStatV2 = 'S' | ('T' << 8) | ('A' << 16) | ('2' << 24)
View Source
const MaxData = 64 * 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type Adb

type Adb interface {
	StartServer() error
	SendCommand(cmd []byte) (RawConnection, error)
	ExecuteCommand(cmd []byte, hasBody bool) ([]byte, error)
	WaitForEmulator() error
	OpenEmulator() (RawConnection, error)
	ListDirectory(path string) ([]ListDirectoryEntry, error)
	StatFile(path string, followLinks bool) (uint32, *FileStat, error)
	PullFile(path string) (*PullFileStream, error)
	PushFile(path string, mode uint32) (*PushFileStream, error)
}

func New

func New(log *zap.SugaredLogger, rawFactory RawConnectionFactory) Adb

type FileStat

type FileStat struct {
	Dev   uint64
	INo   uint64
	Mode  uint32
	NLink uint32
	UId   uint32
	GId   uint32
	Size  uint64
	ATime int64
	MTime int64
	CTime int64
}

type ListDirectoryEntry

type ListDirectoryEntry struct {
	Name      string
	StatError uint32
	Stat      FileStat
}

type PullFileStream

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

func (*PullFileStream) Close

func (s *PullFileStream) Close() error

func (*PullFileStream) Recv

func (s *PullFileStream) Recv() ([]byte, error)

type PushFileStream

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

func (*PushFileStream) Close

func (s *PushFileStream) Close() error

func (*PushFileStream) Done

func (s *PushFileStream) Done(mtime uint32) error

func (*PushFileStream) Send

func (s *PushFileStream) Send(blob []byte) error

type RawConnection

type RawConnection interface {
	Close() error
	WriteRaw(packet []byte) error
	WriteMessage(msg []byte) error
	ReadRaw(blob []byte) error
	ReadStatus() (string, error)
	ReadHexPrefixedBlob() ([]byte, error)
	ReadShellBlob() (byte, []byte, error)
	ReadLine() (*string, error)
	WriteShellBlob(id byte, blob []byte) error
	SendCommand(cmd []byte) error
}

RawConnection based on https://android.googlesource.com/platform/packages/modules/adb/+/HEAD/OVERVIEW.TXT

type RawConnectionFactory

type RawConnectionFactory interface {
	NewRawConnection() (RawConnection, error)
}

func NewRawConnectionFactory

func NewRawConnectionFactory() RawConnectionFactory

Jump to

Keyboard shortcuts

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