Documentation ¶
Index ¶
- func SetDebugMessage(enabled bool) bool
- func SetLogDir(path string) bool
- func SetRecording(enabled bool) bool
- func SetSaveDraw(enabled bool) bool
- func SetShowHitDraw(enabled bool) bool
- func SetStdoutLevel(level LoggingLevel) bool
- func Version() string
- type AdbControllerType
- type AnalyzeResult
- type Controller
- func NewAdbController(adbPath, address string, adbCtrlType AdbControllerType, ...) Controller
- func NewCustomController(ctrl CustomController, callback func(msg, detailsJson string)) Controller
- func NewDbgController(readPath, writePath string, dbgCtrlType DbgControllerType, config string, ...) Controller
- func NewThriftController(thriftCtrlType ThriftControllerType, host string, port int32, config string, ...) Controller
- func NewWin32Controller(hWnd unsafe.Pointer, win32CtrlType Win32ControllerType, ...) Controller
- type CtrlOption
- type CustomAction
- type CustomActionHandler
- type CustomController
- type CustomControllerHandler
- type CustomRecognizer
- type CustomRecognizerHandler
- type DbgControllerType
- type GlobalOption
- type Instance
- func (i *Instance) BindController(ctrl Controller) bool
- func (i *Instance) BindResource(res *Resource) bool
- func (i *Instance) ClearCustomAction() bool
- func (i *Instance) ClearCustomRecognizer() bool
- func (i *Instance) Destroy()
- func (i *Instance) GetController() Controller
- func (i *Instance) GetResource() *Resource
- func (i *Instance) Handle() unsafe.Pointer
- func (i *Instance) Inited() bool
- func (i *Instance) PostAction(entry, param string) TaskJob
- func (i *Instance) PostRecognition(entry, param string) TaskJob
- func (i *Instance) PostStop() bool
- func (i *Instance) PostTask(entry, param string) TaskJob
- func (i *Instance) RegisterCustomAction(name string, action CustomAction) bool
- func (i *Instance) RegisterCustomRecognizer(name string, recognizer CustomRecognizer) bool
- func (i *Instance) Running() bool
- func (i *Instance) UnregisterCustomAction(name string) bool
- func (i *Instance) UnregisterCustomRecognizer(name string) bool
- func (i *Instance) WaitAll()
- type Job
- type LoggingLevel
- type NodeDetail
- type RecognitionDetail
- type RecognitionResult
- type Resource
- type Status
- type SyncContext
- func (ctx SyncContext) CacheImage() (image.Image, error)
- func (ctx SyncContext) Click(x, y int32) bool
- func (ctx SyncContext) InputText(text string) bool
- func (ctx SyncContext) PressKey(keycode int32) bool
- func (ctx SyncContext) RunAction(taskName, taskParam string, curBox buffer.Rect, curRecDetail string) bool
- func (ctx SyncContext) RunRecognition(img image.Image, taskName, taskParam string) (RecognitionResult, error)
- func (ctx SyncContext) RunTask(taskName, param string) bool
- func (ctx SyncContext) Screencap() (image.Image, error)
- func (ctx SyncContext) Swipe(x1, y1, x2, y2, duration int32) bool
- func (ctx SyncContext) TouchDown(contact, x, y, pressure int32) bool
- func (ctx SyncContext) TouchMove(contact, x, y, pressure int32) bool
- func (ctx SyncContext) TouchUp(contact int32) bool
- type TaskDetail
- type TaskJob
- func (job TaskJob) Done() bool
- func (job TaskJob) Failure() bool
- func (job TaskJob) GetDetail() (TaskDetail, bool)
- func (job TaskJob) Invalid() bool
- func (job TaskJob) Pending() bool
- func (job TaskJob) Running() bool
- func (job TaskJob) SetParam(param string) bool
- func (job TaskJob) Status() Status
- func (job TaskJob) Success() bool
- func (job TaskJob) Wait() bool
- type ThriftControllerType
- type Win32ControllerType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDebugMessage ¶
SetDebugMessage sets whether to callback debug message.
func SetRecording ¶
SetRecording sets whether to dump all screenshots and actions.
func SetShowHitDraw ¶
SetShowHitDraw sets whether to show hit draw.
func SetStdoutLevel ¶
func SetStdoutLevel(level LoggingLevel) bool
SetStdoutLevel sets the level of log output to stdout.
Types ¶
type AdbControllerType ¶
type AdbControllerType int32
const ( AdbControllerTypeInvalid AdbControllerType = iota AdbControllerTypeTouchAdb AdbControllerTypeTouchMiniTouch AdbControllerTypeTouchMaaTouch AdbControllerTypeTouchEmulatorExtras AdbControllerTypeTouchAutoDetect AdbControllerType = 0xFF - 1 AdbControllerTypeKeyAdb AdbControllerType = 1 << 8 AdbControllerTypeKeyMaaTouch AdbControllerType = 2 << 8 AdbControllerTypeKeyEmulatorExtras AdbControllerType = 3 << 8 AdbControllerTypeKeyAutoDetect AdbControllerType = 0xFF00 - (1 << 8) AdbControllerTypeInputPresetAdb = AdbControllerTypeTouchAdb | AdbControllerTypeKeyAdb AdbControllerTypeInputPresetMiniTouch = AdbControllerTypeTouchMiniTouch | AdbControllerTypeKeyAdb AdbControllerTypeInputPresetMaaTouch = AdbControllerTypeTouchMaaTouch | AdbControllerTypeKeyMaaTouch AdbControllerTypeInputPresetEmulatorExtras = AdbControllerTypeTouchEmulatorExtras | AdbControllerTypeKeyEmulatorExtras AdbControllerTypeInputPresetAutoDetect = AdbControllerTypeTouchAutoDetect | AdbControllerTypeKeyAutoDetect AdbControllerTypeScreencapFastestWayCompatible AdbControllerType = 1 << 16 AdbControllerTypeScreencapRawByNetcat AdbControllerType = 2 << 16 AdbControllerTypeScreencapRawWithGzip AdbControllerType = 3 << 16 AdbControllerTypeScreencapEncode AdbControllerType = 4 << 16 AdbControllerTypeScreencapEncodeToFile AdbControllerType = 5 << 16 AdbControllerTypeScreencapMinicapDirect AdbControllerType = 6 << 16 AdbControllerTypeScreencapMinicapStream AdbControllerType = 7 << 16 AdbControllerTypeScreencapEmulatorExtras AdbControllerType = 8 << 16 AdbControllerTypeScreencapFastestLosslessWay AdbControllerType = 0xFF0000 - (2 << 16) AdbControllerTypeScreencapFastestWay AdbControllerType = 0xFF0000 - (1 << 16) )
AdbControllerType
type AnalyzeResult ¶
type Controller ¶
type Controller interface { Destroy() Handle() unsafe.Pointer SetScreenshotTargetLongSide(targetLongSide int) bool SetScreenshotTargetShortSide(targetShortSide int) bool SetDefaultAppPackageEntry(appPackage string) bool SetDefaultAppPackage(appPackage string) bool SetRecording(recording bool) bool PostConnect() Job PostClick(x, y int32) Job PostSwipe(x1, y1, x2, y2, duration int32) Job PostPressKey(keycode int32) Job PostInputText(text string) Job PostStartApp(intent string) Job PostStopApp(intent string) Job PostTouchDown(contact, x, y, pressure int32) Job PostTouchMove(contact, x, y, pressure int32) Job PostTouchUp(contact int32) Job PostScreencap() Job Connected() bool GetImage() (image.Image, error) GetUUID() (string, bool) }
Controller is an interface that defines various methods for MAA controller.
func NewAdbController ¶
func NewAdbController( adbPath, address string, adbCtrlType AdbControllerType, config, agentPath string, callback func(msg, detailsJson string), ) Controller
NewAdbController creates an ADB controller instance.
func NewCustomController ¶
func NewCustomController( ctrl CustomController, callback func(msg, detailsJson string), ) Controller
NewCustomController creates a custom controller instance.
func NewDbgController ¶
func NewDbgController( readPath, writePath string, dbgCtrlType DbgControllerType, config string, callback func(msg, detailsJson string), ) Controller
NewDbgController creates a DBG controller instance.
func NewThriftController ¶
func NewThriftController( thriftCtrlType ThriftControllerType, host string, port int32, config string, callback func(msg, detailsJson string), ) Controller
NewThriftController creates a thrift controller instance.
func NewWin32Controller ¶
func NewWin32Controller( hWnd unsafe.Pointer, win32CtrlType Win32ControllerType, callback func(msg, detailsJson string), ) Controller
NewWin32Controller creates a win32 controller instance.
type CtrlOption ¶
type CtrlOption int32
const ( CtrlOptionInvalid CtrlOption = iota // CtrlOptionScreenshotTargetLongSide Only one of long and short side can be set, and the other is automatically scaled according // to the aspect ratio. CtrlOptionScreenshotTargetLongSide // CtrlOptionScreenshotTargetShortSide Only one of long and short side can be set, and the other is automatically scaled according // to the aspect ratio. CtrlOptionScreenshotTargetShortSide // CtrlOptionDefaultAppPackageEntry For StartApp CtrlOptionDefaultAppPackageEntry // CtrlOptionDefaultAppPackage For StopApp CtrlOptionDefaultAppPackage // CtrlOptionRecording Dump all screenshots and actions // // Recording will evaluate to true if any of this or // MaaGlobalOptionEnum::MaaGlobalOption_Recording is true. CtrlOptionRecording )
CtrlOption
type CustomAction ¶
type CustomAction interface { Run(ctx SyncContext, taskName, ActionParam string, curBox buffer.Rect, curRecDetail string) bool Stop() Handle() unsafe.Pointer Destroy() }
CustomAction defines an interface for custom action. Implementers of this interface must embed an CustomActionHandler struct and provide implementations for the Run and Stop methods.
type CustomActionHandler ¶ added in v0.2.0
type CustomActionHandler struct {
// contains filtered or unexported fields
}
func NewCustomActionHandler ¶ added in v0.2.0
func NewCustomActionHandler() CustomActionHandler
func (CustomActionHandler) Destroy ¶ added in v0.2.0
func (a CustomActionHandler) Destroy()
func (CustomActionHandler) Handle ¶ added in v0.2.0
func (a CustomActionHandler) Handle() unsafe.Pointer
type CustomController ¶
type CustomController interface { Connect() bool RequestUUID() (string, bool) StartApp(intent string) bool StopApp(intent string) bool Screencap() (image.Image, bool) Click(x, y int32) bool Swipe(x1, y1, x2, y2, duration int32) bool TouchDown(contact, x, y, pressure int32) bool TouchMove(contact, x, y, pressure int32) bool TouchUp(contact int32) bool PressKey(keycode int32) bool InputText(text string) bool Handle() unsafe.Pointer Destroy() }
CustomController defines an interface for custom controller. Implementers of this interface must embed a CustomControllerHandler struct and provide implementations for the following methods: Connect, RequestUUID, StartApp, StopApp, Screencap, Click, Swipe, TouchDown, TouchMove, TouchUp, PressKey and InputText.
type CustomControllerHandler ¶ added in v0.2.0
type CustomControllerHandler struct {
// contains filtered or unexported fields
}
func NewCustomControllerHandler ¶ added in v0.2.0
func NewCustomControllerHandler() CustomControllerHandler
func (CustomControllerHandler) Destroy ¶ added in v0.2.0
func (c CustomControllerHandler) Destroy()
func (CustomControllerHandler) Handle ¶ added in v0.2.0
func (c CustomControllerHandler) Handle() unsafe.Pointer
type CustomRecognizer ¶
type CustomRecognizer interface { Analyze(syncCtx SyncContext, img image.Image, taskName, RecognitionParam string) (AnalyzeResult, bool) Handle() unsafe.Pointer Destroy() }
CustomRecognizer defines an interface for custom recognizer. Implementers of this interface must embed a CustomRecognizerHandler struct and provide an implementation for the Analyze method.
type CustomRecognizerHandler ¶ added in v0.2.0
type CustomRecognizerHandler struct {
// contains filtered or unexported fields
}
func NewCustomRecognizerHandler ¶ added in v0.2.0
func NewCustomRecognizerHandler() CustomRecognizerHandler
func (CustomRecognizerHandler) Destroy ¶ added in v0.2.0
func (r CustomRecognizerHandler) Destroy()
func (CustomRecognizerHandler) Handle ¶ added in v0.2.0
func (r CustomRecognizerHandler) Handle() unsafe.Pointer
type DbgControllerType ¶
type DbgControllerType int32
const ( DbgControllerTypeInvalid DbgControllerType = iota DbgControllerTypeCarouselImage DbgControllerTypeReplayRecording )
DbgControllerType
type GlobalOption ¶
type GlobalOption int32
const ( GlobalOptionInvalid GlobalOption = iota // GlobalOptionLogDir Log dir // // value: string, eg: "C:\\Users\\Administrator\\Desktop\\log"; val_size: string length GlobalOptionLogDir // GlobalOptionSaveDraw Whether to save draw // // value: bool, eg: true; val_size: sizeof(bool) GlobalOptionSaveDraw // GlobalOptionRecording Dump all screenshots and actions // // Recording will evaluate to true if any of this or MaaCtrlOptionEnum::MaaCtrlOption_Recording // is true. value: bool, eg: true; val_size: sizeof(bool) GlobalOptionRecording // GlobalOptionStdoutLevel The level of log output to stdout // // value: MaaLoggingLevel, val_size: sizeof(MaaLoggingLevel) // default value is MaaLoggingLevel_Error GlobalOptionStdoutLevel // GlobalOptionShowHitDraw Whether to show hit draw // // value: bool, eg: true; val_size: sizeof(bool) GlobalOptionShowHitDraw // GlobalOptionDebugMessage Whether to callback debug message // // value: bool, eg: true; val_size: sizeof(bool) GlobalOptionDebugMessage )
GlobalOption
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
func (*Instance) BindController ¶
func (i *Instance) BindController(ctrl Controller) bool
BindController binds the instance to an initialized controller.
func (*Instance) BindResource ¶
BindResource binds the instance to an initialized resource.
func (*Instance) ClearCustomAction ¶
ClearCustomAction clears all custom actions registered to the instance.
func (*Instance) ClearCustomRecognizer ¶
ClearCustomRecognizer clears all custom recognizers registered to the instance.
func (*Instance) GetController ¶
func (i *Instance) GetController() Controller
GetController returns the controller handle of the instance.
func (*Instance) GetResource ¶
GetResource returns the resource handle of the instance.
func (*Instance) PostAction ¶
PostAction posts an action to the instance.
func (*Instance) PostRecognition ¶
PostRecognition posts a recognition to the instance.
func (*Instance) RegisterCustomAction ¶
func (i *Instance) RegisterCustomAction(name string, action CustomAction) bool
RegisterCustomAction registers a custom action to the instance.
func (*Instance) RegisterCustomRecognizer ¶
func (i *Instance) RegisterCustomRecognizer(name string, recognizer CustomRecognizer) bool
RegisterCustomRecognizer registers a custom recognizer to the instance.
func (*Instance) UnregisterCustomAction ¶
UnregisterCustomAction unregisters a custom action from the instance.
func (*Instance) UnregisterCustomRecognizer ¶
UnregisterCustomRecognizer unregisters a custom recognizer from the instance.
type LoggingLevel ¶
type LoggingLevel int32
const ( LoggingLevelOff LoggingLevel = iota LoggingLevelFatal LoggingLevelError LoggingLevelWarn LoggingLevelInfo LoggingLevelDebug LoggingLevelTrace LoggingLevelAll )
LoggingLevel
type NodeDetail ¶
type NodeDetail struct { ID int64 Name string Recognition RecognitionDetail RunCompleted bool }
func QueryNodeDetail ¶
func QueryNodeDetail(nodeId int64) (NodeDetail, bool)
QueryNodeDetail queries running detail.
type RecognitionDetail ¶
type RecognitionDetail struct { ID int64 Name string Hit bool DetailJson string Raw image.Image Draws []image.Image }
func QueryRecognitionDetail ¶
func QueryRecognitionDetail(recId int64) (RecognitionDetail, error)
QueryRecognitionDetail queries recognition detail.
type RecognitionResult ¶ added in v0.3.0
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func NewResource ¶
NewResource creates a new resource.
func (*Resource) GetTaskList ¶
GetTaskList returns the task list of the resource.
type SyncContext ¶
type SyncContext struct {
// contains filtered or unexported fields
}
func (SyncContext) CacheImage ¶ added in v0.3.0
func (ctx SyncContext) CacheImage() (image.Image, error)
func (SyncContext) Click ¶ added in v0.3.0
func (ctx SyncContext) Click(x, y int32) bool
func (SyncContext) InputText ¶ added in v0.3.0
func (ctx SyncContext) InputText(text string) bool
func (SyncContext) PressKey ¶ added in v0.3.0
func (ctx SyncContext) PressKey(keycode int32) bool
func (SyncContext) RunRecognition ¶ added in v0.3.0
func (ctx SyncContext) RunRecognition(img image.Image, taskName, taskParam string) (RecognitionResult, error)
func (SyncContext) RunTask ¶ added in v0.3.0
func (ctx SyncContext) RunTask(taskName, param string) bool
func (SyncContext) Screencap ¶ added in v0.3.0
func (ctx SyncContext) Screencap() (image.Image, error)
func (SyncContext) Swipe ¶ added in v0.3.0
func (ctx SyncContext) Swipe(x1, y1, x2, y2, duration int32) bool
func (SyncContext) TouchDown ¶ added in v0.3.0
func (ctx SyncContext) TouchDown(contact, x, y, pressure int32) bool
func (SyncContext) TouchMove ¶ added in v0.3.0
func (ctx SyncContext) TouchMove(contact, x, y, pressure int32) bool
func (SyncContext) TouchUp ¶ added in v0.3.0
func (ctx SyncContext) TouchUp(contact int32) bool
type TaskDetail ¶
type TaskDetail struct { ID int64 Entry string NodeDetails []NodeDetail }
func QueryTaskDetail ¶
func QueryTaskDetail(taskId int64) (TaskDetail, bool)
QueryTaskDetail queries task detail.
type TaskJob ¶ added in v0.4.0
type TaskJob struct {
// contains filtered or unexported fields
}
func NewTaskJob ¶ added in v0.4.0
func (TaskJob) GetDetail ¶ added in v0.4.0
func (job TaskJob) GetDetail() (TaskDetail, bool)
type ThriftControllerType ¶
type ThriftControllerType int32
const ( ThriftControllerInvalid ThriftControllerType = iota ThriftControllerTypeSocket ThriftControllerTypeUnixDomainSocket )
type Win32ControllerType ¶
type Win32ControllerType int32
const ( Win32ControllerTypeInvalid Win32ControllerType = iota Win32ControllerTypeTouchSendMessage Win32ControllerTypeTouchSeize Win32ControllerTypeKeySendMessage Win32ControllerType = 1 << 8 Win32ControllerTypeKeySeize Win32ControllerType = 2 << 8 Win32ControllerTypeScreencapGDI Win32ControllerType = 1 << 16 Win32ControllerTypeScreencapDXGIDesktopDup Win32ControllerType = 2 << 16 Win32ControllerTypeScreencapDXGIFramePool Win32ControllerType = 4 << 16 )
Win32ControllerType