Documentation
¶
Index ¶
- func Click(syncCtx SyncContext, x, y int32) bool
- func FrameworkVersion() string
- func InputText(syncCtx SyncContext, text string) bool
- func PressKey(syncCtx SyncContext, keycode int32) bool
- func RunAction(syncCtx SyncContext, taskName, taskParam string, curBox RectBuffer, ...) bool
- func RunRecognition(syncCtx SyncContext, image ImageBuffer, taskName, taskParam string) (RectBuffer, StringBuffer, bool)
- func RunTask(syncCtx SyncContext, taskName, param string) bool
- 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 Swipe(syncCtx SyncContext, x1, y1, x2, y2, duration int32) bool
- func TouchDown(syncCtx SyncContext, contact, x, y, pressure int32) bool
- func TouchMove(syncCtx SyncContext, contact, x, y, pressure int32) bool
- func TouchUp(syncCtx SyncContext, contact int32) bool
- type AdbControllerType
- type AnalyzeResult
- type Controller
- func NewAdbController(adbPath, address string, adbCtrlType AdbControllerType, ...) Controller
- func NewCustomController(customCtrl CustomControllerImpl, 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 CustomActionHandler
- type CustomActionImpl
- type CustomControllerHandler
- type CustomControllerImpl
- type CustomRecognizerHandler
- type CustomRecognizerImpl
- type DbgControllerType
- type GlobalOption
- type ImageBuffer
- type ImageListBuffer
- 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) int64
- func (i *Instance) PostRecognition(entry, param string) int64
- func (i *Instance) PostStop() bool
- func (i *Instance) PostTask(entry, param string) int64
- func (i *Instance) RegisterCustomAction(name string, action CustomActionImpl) bool
- func (i *Instance) RegisterCustomRecognizer(name string, recognizer CustomRecognizerImpl) bool
- func (i *Instance) Running() bool
- func (i *Instance) SetTaskParam(id int64, param string) bool
- func (i *Instance) TaskStatus(id int64) Status
- func (i *Instance) UnregisterCustomAction(name string) bool
- func (i *Instance) UnregisterCustomRecognizer(name string) bool
- func (i *Instance) WaitTask(id int64) Status
- type LoggingLevel
- type NodeDetail
- type RecognitionDetail
- type RectBuffer
- type Resource
- func (r *Resource) Clear() bool
- func (r *Resource) Destroy()
- func (r *Resource) GetHash() (string, bool)
- func (r *Resource) GetTaskList() (string, bool)
- func (r *Resource) Loaded() bool
- func (r *Resource) PostPath(path string) int64
- func (r *Resource) Status(resId int64) Status
- func (r *Resource) Wait(resId int64) Status
- type Status
- type StringBuffer
- type StringListBuffer
- type SyncContext
- type TaskDetail
- type ThriftControllerType
- type Win32ControllerType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Click ¶
func Click(syncCtx SyncContext, x, y int32) bool
func FrameworkVersion ¶
func FrameworkVersion() string
FrameworkVersion returns the version of the framework.
func InputText ¶
func InputText(syncCtx SyncContext, text string) bool
func PressKey ¶
func PressKey(syncCtx SyncContext, keycode int32) bool
func RunAction ¶
func RunAction(syncCtx SyncContext, taskName, taskParam string, curBox RectBuffer, curRecDetail string) bool
func RunRecognition ¶
func RunRecognition(syncCtx SyncContext, image ImageBuffer, taskName, taskParam string) (RectBuffer, StringBuffer, bool)
func RunTask ¶
func RunTask(syncCtx SyncContext, taskName, param string) bool
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.
func Swipe ¶
func Swipe(syncCtx SyncContext, x1, y1, x2, y2, duration int32) bool
func TouchDown ¶
func TouchDown(syncCtx SyncContext, contact, x, y, pressure int32) bool
func TouchMove ¶
func TouchMove(syncCtx SyncContext, contact, x, y, pressure int32) bool
func TouchUp ¶
func TouchUp(syncCtx SyncContext, contact int32) bool
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 AnalyzeResult struct {
Box RectBuffer
Detail string
}
type Controller ¶
type Controller interface {
Destroy()
Handle() unsafe.Pointer
SetOption(key CtrlOption, value unsafe.Pointer, valSize uint64) bool
PostConnect() int64
PostClick(x, y int32) int64
PostSwipe(x1, y1, x2, y2, duration int32) int64
PostPressKey(keycode int32) int64
PostInputText(text string) int64
PostStartApp(intent string) int64
PostStopApp(intent string) int64
PostTouchDown(contact, x, y, pressure int32) int64
PostTouchMove(contact, x, y, pressure int32) int64
PostTouchUp(contact int32) int64
PostScreencap() int64
Status(id int64) Status
Wait(id int64) Status
Connected() bool
GetImage() (ImageBuffer, bool)
GetUUID() (string, bool)
}
func NewAdbController ¶
func NewAdbController( adbPath, address string, adbCtrlType AdbControllerType, config, agentPath string, callback func(msg, detailsJson string), ) Controller
func NewCustomController ¶
func NewCustomController( customCtrl CustomControllerImpl, callback func(msg, detailsJson string), ) Controller
func NewDbgController ¶
func NewDbgController( readPath, writePath string, dbgCtrlType DbgControllerType, config string, callback func(msg, detailsJson string), ) Controller
func NewThriftController ¶
func NewThriftController( thriftCtrlType ThriftControllerType, host string, port int32, config string, callback func(msg, detailsJson string), ) Controller
func NewWin32Controller ¶
func NewWin32Controller( hWnd unsafe.Pointer, win32CtrlType Win32ControllerType, callback func(msg, detailsJson string), ) Controller
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. // // value: int, eg: 1920; val_size: sizeof(int) CtrlOptionScreenshotTargetLongSide // CtrlOptionScreenshotTargetShortSide Only one of long and short side can be set, and the other is automatically scaled according // to the aspect ratio. // // value: int, eg: 1080; val_size: sizeof(int) CtrlOptionScreenshotTargetShortSide // CtrlOptionDefaultAppPackageEntry For StartApp // // value: string, eg: "com.hypergryph.arknights/com.u8.sdk.U8UnityContext"; val_size: string length CtrlOptionDefaultAppPackageEntry // CtrlOptionDefaultAppPackage For StopApp // // value: string, eg: "com.hypergryph.arknights"; val_size: string length CtrlOptionDefaultAppPackage // CtrlOptionRecording Dump all screenshots and actions // // Recording will evaluate to true if any of this or // MaaGlobalOptionEnum::MaaGlobalOption_Recording is true. // // value: bool, eg: true; val_size: sizeof(bool) CtrlOptionRecording )
CtrlOption
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 CustomActionImpl ¶ added in v0.2.0
type CustomActionImpl interface {
Run(ctx SyncContext, taskName, ActionParam string, curBox RectBuffer, curRecDetail string) bool
Stop()
Handle() unsafe.Pointer
Destroy()
}
CustomActionImpl 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 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 CustomControllerImpl ¶ added in v0.2.0
type CustomControllerImpl interface {
Connect() bool
RequestUUID() (string, bool)
RequestResolution() (width, height int32, ok bool)
StartApp(intent string) bool
StopApp(intent string) bool
Screencap() (ImageBuffer, 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()
}
CustomControllerImpl defines an interface for custom controller. Implementers of this interface must embed a CustomControllerHandler struct and provide implementations for the following methods: Connect, RequestUUID, RequestResolution, StartApp, StopApp, Screencap, Click, Swipe, TouchDown, TouchMove, TouchUp, PressKey and InputText.
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 CustomRecognizerImpl ¶ added in v0.2.0
type CustomRecognizerImpl interface {
Analyze(syncCtx SyncContext, image ImageBuffer, taskName, RecognitionParam string) (AnalyzeResult, bool)
Handle() unsafe.Pointer
Destroy()
}
CustomRecognizerImpl defines an interface for custom recognizer. Implementers of this interface must embed a CustomRecognizerHandler struct and provide an implementation for the Analyze method.
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 ImageBuffer ¶
type ImageBuffer interface {
Destroy()
Handle() unsafe.Pointer
IsEmpty() bool
Clear() bool
GetRawData() unsafe.Pointer
GetWidth() int32
GetHeight() int32
GetType() int32
SetRawData(data unsafe.Pointer, width, height, imageType int32) bool
GetEncoded() unsafe.Pointer
GetEncodedSize() int32
SetEncoded(data unsafe.Pointer, size uint64) bool
}
func CacheImage ¶
func CacheImage(syncCtx SyncContext) (ImageBuffer, bool)
func NewImage ¶
func NewImage() ImageBuffer
func Screencap ¶
func Screencap(syncCtx SyncContext) (ImageBuffer, bool)
type ImageListBuffer ¶
type ImageListBuffer interface {
Destroy()
Handle() unsafe.Pointer
IsEmpty() bool
Clear() bool
Size() uint64
Get(index uint64) ImageBuffer
Append(value ImageBuffer) bool
Remove(index uint64) bool
}
func NewImageList ¶
func NewImageList() ImageListBuffer
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 CustomActionImpl) bool
RegisterCustomAction registers a custom action to the instance.
func (*Instance) RegisterCustomRecognizer ¶
func (i *Instance) RegisterCustomRecognizer(name string, recognizer CustomRecognizerImpl) bool
RegisterCustomRecognizer registers a custom recognizer to the instance.
func (*Instance) SetTaskParam ¶
SetTaskParam sets the parameter of a task.
func (*Instance) TaskStatus ¶
TaskStatus returns the status of a task identified by the id.
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 ¶
func QueryNodeDetail ¶
func QueryNodeDetail(nodeId int64) (*NodeDetail, bool)
QueryNodeDetail queries running detail.
type RecognitionDetail ¶
type RecognitionDetail struct {
Name string
Hit bool
DetailJson string
Raw ImageBuffer
Draws ImageListBuffer
}
func QueryRecognitionDetail ¶
func QueryRecognitionDetail(recId int64) (RecognitionDetail, bool)
QueryRecognitionDetail queries recognition detail.
type RectBuffer ¶
type RectBuffer interface {
Destroy()
Handle() unsafe.Pointer
GetX() int32
GetY() int32
GetW() int32
GetH() int32
Set(x, y, w, h int32) bool
SetY(value int32) bool
SetW(value int32) bool
SetH(value int32) bool
// contains filtered or unexported methods
}
func NewRect ¶
func NewRect() RectBuffer
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.
func (*Resource) PostPath ¶
PostPath adds a path to the resource loading paths. Return id of the resource.
type StringBuffer ¶
type StringBuffer interface {
Destroy()
Handle() unsafe.Pointer
IsEmpty() bool
Clear() bool
Get() string
Size() uint64
Set(str string) bool
SetWithSize(str string, size uint64) bool
}
func NewString ¶
func NewString() StringBuffer
type StringListBuffer ¶
type StringListBuffer interface {
Destroy()
IsEmpty() bool
Clear() bool
Size() uint64
Get(index uint64) string
Append(value StringBuffer) bool
Remove(index uint64) bool
}
func NewStringList ¶
func NewStringList() StringListBuffer
type SyncContext ¶
type SyncContext C.MaaSyncContextHandle
type TaskDetail ¶
func QueryTaskDetail ¶
func QueryTaskDetail(taskId int64) (*TaskDetail, bool)
QueryTaskDetail queries task detail.
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
Source Files
¶
- buffer_image.go
- buffer_image_list.go
- buffer_rect.go
- buffer_string.go
- buffer_string_list.go
- callback_agent.go
- cgo.go
- controller.go
- controller_adb.go
- controller_custom.go
- controller_dbg.go
- controller_thrift.go
- controller_win32.go
- custom_action.go
- custom_recognizer.go
- custom_sync_context.go
- instance.go
- resource.go
- status.go
- utility.go