aoa

package module
v0.0.0-...-b2a8960 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: MIT Imports: 5 Imported by: 1 module, 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.

README

说明

这是一个Andorid open accessory协议的go语言封装库,底层USB通信以来gousb

配置

sudo apt install libusb-1.0-0-dev

安装go-a-a

go get github.com/jt6562/go-aoa

Documentation

Index

Constants

View Source
const (
	MODE_ACCESSORY uint8 = 1
	MODE_AUDIO           = 2
)
View Source
const (
	ACCESSORY_VENDOR_ID = 0x18D1

	PRODUCT_ID_ACCESSORY           = 0x2D00
	PRODUCT_ID_ACCESSORY_ADB       = 0x2D01
	PRODUCT_ID_AUDIO               = 0x2D02
	PRODUCT_ID_AUDIO_ADB           = 0x2D03
	PRODUCT_ID_ACCESSORY_AUDIO     = 0x2D04
	PRODUCT_ID_ACCESSORY_AUDIO_ADB = 0x2D05

	ACCESSORY_STRING_MANUFACTURER = 0
	ACCESSORY_STRING_MODEL        = 1
	ACCESSORY_STRING_DESCRIPTION  = 2
	ACCESSORY_STRING_VERSION      = 3
	ACCESSORY_STRING_URI          = 4
	ACCESSORY_STRING_SERIAL       = 5
)
View Source
const (
	USB_DIR_OUT     uint8 = 0
	USB_DIR_IN            = 0x80
	USB_TYPE_VENDOR       = (0x02 << 5)
)

requestType

View Source
const (
	ACCESSORY_GET_PROTOCOL        uint8 = 51
	ACCESSORY_SEND_STRING               = 52
	ACCESSORY_START                     = 53
	ACCESSORY_REGISTER_HID              = 54
	ACCESSORY_UNREGISTER_HID            = 55
	ACCESSORY_SET_HID_REPORT_DESC       = 56
	ACCESSORY_SEND_HID_EVENT            = 57
	ACCESSORY_SET_AUDIO_MODE            = 58
)

requests

Variables

View Source
var (
	// Errors
	ErrNoDevice              error = errors.New("No device")
	ErrorFailedToGetProtocol       = errors.New("Failed to get protocol")
	ErrorNotSupport                = errors.New("Not support this function")
)

Functions

This section is empty.

Types

type Accessory

type Accessory struct {
	AoAProtocol uint16
	// contains filtered or unexported fields
}

func NewAccessory

func NewAccessory() *Accessory

func (*Accessory) Close

func (acc *Accessory) Close()

func (*Accessory) OpenAcessoryInterface

func (acc *Accessory) OpenAcessoryInterface() (*AccessoryMode, error)

func (*Accessory) SetAccessoryConfig

func (acc *Accessory) SetAccessoryConfig(config AccessoryConfig)

func (*Accessory) SwitchToAccessoryMode

func (acc *Accessory) SwitchToAccessoryMode(mode uint8) (err error)

type AccessoryConfig

type AccessoryConfig struct {
	Manufacturer string
	Model        string
	Description  string
	Version      string
	URI          string
	Serial       string
}

type AccessoryMode

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

func (*AccessoryMode) Read

func (a *AccessoryMode) Read(b []byte) (int, error)

func (*AccessoryMode) Write

func (a *AccessoryMode) Write(b []byte) (int, error)

type AudioMode

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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