api

package
v0.0.0-...-6575fcc Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrArgs = errors.New("argument error")

Functions

func NewArgsErr

func NewArgsErr(want, got any) error

Types

type ApiAdb

type ApiAdb interface {
	InputHandler
	// 执行 adb 命令
	Cmd(string) ([]byte, error)
}

func NewApiAdb

func NewApiAdb(device adb.Device) ApiAdb

type ApiImg

type ApiImg interface {
	// 查找元素
	FindE(e string) (image.Point, float32, error)
	// 返回范围内的文字识别结果
	Ocr(x1, y1, x2, y2 int) (string, error)
	OcrE(e string) (string, error)
	// 锁定与解锁当前 Find 函数的对象
	Lock() error
	Unlock() error
}

“Element” 类型参数是指在 lua 中以 “click(E.main.start)” 的形式调用

func NewApiImg

func NewApiImg(adbCmd adb.ADBRunner, elementImg map[string]project.ElImg, elementArea map[string]project.ElArea) (ApiImg, error)

type ImgHandler

type ImgHandler interface {
	// 模版匹配
	Find(img gocv.Mat, tmpl gocv.Mat) (float32, image.Point, error)
	// Sseract 识别文字
	Ocr(img []byte) (string, error)
}

type InputHandler

type InputHandler interface {
	// 按下一个元素或坐标,duration 单位是 ms。duration 为 0 时,将会自动把 duration 赋值为 100
	Press(x, y, duration int) error
	// 滑动
	Swipe(x, y int) InputHandlerSwipeTo
}

type InputHandlerSwipeAction

type InputHandlerSwipeAction interface {
	// 第一个返回值是开始滑动的点,第二个返回值是滑动结束的点,第三个返回值表示是否成功
	Action(duration int) (image.Point, image.Point, bool, error)
}

type InputHandlerSwipeTo

type InputHandlerSwipeTo interface {
	To(x, y int) InputHandlerSwipeAction
}

type ScreencapTool

type ScreencapTool interface {
	// 获取设备屏幕的截图并输出为 []byte
	ToByte() ([]byte, error)
}

type SwipeHandler

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

func (*SwipeHandler) Action

func (h *SwipeHandler) Action(duration int) (image.Point, image.Point, bool, error)

func (*SwipeHandler) To

Jump to

Keyboard shortcuts

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