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 *CustomController, handleArg interface{}, ...) 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 CustomController
- type CustomRecognizer
- 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 *CustomAction, actionArg interface{}) bool
- func (i *Instance) RegisterCustomRecognizer(name string, recognizer *CustomRecognizer, recognizerArg interface{}) 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
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 ¶
func SetRecording ¶
func SetSaveDraw ¶
func SetShowHitDraw ¶
func SetStdoutLevel ¶
func SetStdoutLevel(level LoggingLevel) bool
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, callbackArg interface{}), callbackArg interface{}, ) Controller
func NewCustomController ¶
func NewCustomController( customCtrl *CustomController, handleArg interface{}, callback func(msg, detailsJson string, callbackArg interface{}), callbackArg interface{}, ) Controller
func NewDbgController ¶
func NewDbgController( readPath, writePath string, dbgCtrlType DbgControllerType, config string, callback func(msg, detailsJson string, callbackArg interface{}), callbackArg interface{}, ) Controller
func NewThriftController ¶
func NewThriftController( thriftCtrlType ThriftControllerType, host string, port int32, config string, callback func(msg, detailsJson string, callbackArg interface{}), callbackArg interface{}, ) Controller
func NewWin32Controller ¶
func NewWin32Controller( hWnd unsafe.Pointer, win32CtrlType Win32ControllerType, callback func(msg, detailsJson string, callbackArg interface{}), callbackArg interface{}, ) 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 CustomAction ¶
type CustomAction struct {
// contains filtered or unexported fields
}
func (*CustomAction) Destroy ¶
func (a *CustomAction) Destroy()
func (*CustomAction) Handle ¶
func (a *CustomAction) Handle() unsafe.Pointer
func (*CustomAction) Set ¶
func (a *CustomAction) Set( run func(ctx SyncContext, taskName, customActionParam string, curBox RectBuffer, curRecDetail string, actionArg interface{}, ) bool, stop func(actionArg interface{}), )
type CustomController ¶
type CustomController struct {
// contains filtered or unexported fields
}
func (*CustomController) Destroy ¶
func (c *CustomController) Destroy()
func (*CustomController) Handle ¶
func (c *CustomController) Handle() unsafe.Pointer
func (*CustomController) Set ¶
func (c *CustomController) Set( connect func(handleArg interface{}) bool, requestUUID func(handleArg interface{}) (string, bool), requestResolution func(handleArg interface{}) (width, height int32, ok bool), startApp func(intent string, handleArg interface{}) bool, stopApp func(intent string, handleArg interface{}) bool, screencap func(handle interface{}) (ImageBuffer, bool), click func(x, y int32, handleArg interface{}) bool, swipe func(x1, y1, x2, y2, duration int32, handleArg interface{}) bool, touchDown func(contact, x, y, pressure int32, handleArg interface{}) bool, touchMove func(contact, x, y, pressure int32, handleArg interface{}) bool, touchUp func(contact int32, handleArg interface{}) bool, pressKey func(keycode int32, handleArg interface{}) bool, inputText func(text string, handleArg interface{}) bool, )
type CustomRecognizer ¶
type CustomRecognizer struct {
// contains filtered or unexported fields
}
func (*CustomRecognizer) Destroy ¶
func (r *CustomRecognizer) Destroy()
func (*CustomRecognizer) Handle ¶
func (r *CustomRecognizer) Handle() unsafe.Pointer
func (*CustomRecognizer) Set ¶
func (r *CustomRecognizer) Set( analyze func( syncCtx SyncContext, image ImageBuffer, taskName, customRecognitionParam string, recognizerArg interface{}, ) (AnalyzeResult, bool), )
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
func (*Instance) BindResource ¶
func (*Instance) ClearCustomAction ¶
func (*Instance) ClearCustomRecognizer ¶
func (*Instance) GetController ¶
func (i *Instance) GetController() Controller
func (*Instance) GetResource ¶
func (*Instance) PostAction ¶
func (*Instance) PostRecognition ¶
func (*Instance) RegisterCustomAction ¶
func (i *Instance) RegisterCustomAction(name string, action *CustomAction, actionArg interface{}) bool
func (*Instance) RegisterCustomRecognizer ¶
func (i *Instance) RegisterCustomRecognizer(name string, recognizer *CustomRecognizer, recognizerArg interface{}) bool
func (*Instance) TaskStatus ¶
func (*Instance) UnregisterCustomAction ¶
func (*Instance) UnregisterCustomRecognizer ¶
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)
type RecognitionDetail ¶
type RecognitionDetail struct {
Name string
Hit bool
DetailJson string
Raw ImageBuffer
Draws ImageListBuffer
}
func QueryRecognitionDetail ¶
func QueryRecognitionDetail(recId int64) (RecognitionDetail, bool)
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 ¶
func NewResource(callback func(msg, detailsJson string, callbackArg interface{}), callbackArg interface{}) *Resource
NewResource creates a new resource.
This function takes two arguments:
- callback: The callback function.
- callbackArg: The callback argument.
func (*Resource) Clear ¶
Clear clears the resource loading paths. If the call is successful, it returns true. Otherwise, it returns false.
func (*Resource) GetTaskList ¶
GetTaskList gets 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)
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
Click to show internal directories.
Click to hide internal directories.