MaaFramework
A automation black-box testing framework based on image recognition.
Loading...
Searching...
No Matches
MaaDef.h File Reference

The type definitions. More...

#include <stdint.h>
#include "MaaPort.h"

Go to the source code of this file.

Classes

struct  MaaRect
 

Macros

#define MaaNullSize   UINT64_MAX
 
#define MaaInvalidId   ((MaaId)0)
 
#define MaaAdbScreencapMethod_EncodeToFileAndPull   1ULL
 
#define MaaAdbScreencapMethod_Encode   (1ULL << 1)
 
#define MaaAdbScreencapMethod_RawWithGzip   (1ULL << 2)
 
#define MaaAdbScreencapMethod_RawByNetcat   (1ULL << 3)
 
#define MaaAdbScreencapMethod_MinicapDirect   (1ULL << 4)
 
#define MaaAdbScreencapMethod_MinicapStream   (1ULL << 5)
 
#define MaaAdbScreencapMethod_EmulatorExtras   (1ULL << 6)
 
#define MaaAdbScreencapMethod_None   0ULL
 
#define MaaAdbScreencapMethod_All   (~MaaAdbScreencapMethod_None)
 
#define MaaAdbScreencapMethod_Default
 
#define MaaAdbInputMethod_AdbShell   1ULL
 
#define MaaAdbInputMethod_MinitouchAndAdbKey   (1ULL << 1)
 
#define MaaAdbInputMethod_Maatouch   (1ULL << 2)
 
#define MaaAdbInputMethod_EmulatorExtras   (1ULL << 3)
 
#define MaaAdbInputMethod_None   0ULL
 
#define MaaAdbInputMethod_All   (~MaaAdbInputMethod_None)
 
#define MaaAdbInputMethod_Default   (MaaAdbInputMethod_All & (~MaaAdbInputMethod_EmulatorExtras))
 
#define MaaWin32ScreencapMethod_None   0ULL
 
#define MaaWin32ScreencapMethod_GDI   1ULL
 
#define MaaWin32ScreencapMethod_FramePool   (1ULL << 1)
 
#define MaaWin32ScreencapMethod_DXGI_DesktopDup   (1ULL << 2)
 
#define MaaWin32ScreencapMethod_DXGI_DesktopDup_Window   (1ULL << 3)
 
#define MaaWin32ScreencapMethod_PrintWindow   (1ULL << 4)
 
#define MaaWin32ScreencapMethod_ScreenDC   (1ULL << 5)
 
#define MaaWin32InputMethod_None   0ULL
 
#define MaaWin32InputMethod_Seize   1ULL
 
#define MaaWin32InputMethod_SendMessage   (1ULL << 1)
 
#define MaaWin32InputMethod_PostMessage   (1ULL << 2)
 
#define MaaWin32InputMethod_LegacyEvent   (1ULL << 3)
 
#define MaaWin32InputMethod_PostThreadMessage   (1ULL << 4)
 
#define MaaWin32InputMethod_SendMessageWithCursorPos   (1ULL << 5)
 
#define MaaWin32InputMethod_PostMessageWithCursorPos   (1ULL << 6)
 
#define MaaDbgControllerType_None   0
 
#define MaaDbgControllerType_CarouselImage   1ULL
 
#define MaaDbgControllerType_ReplayRecording   (1ULL << 1)
 
#define MaaControllerFeature_None   0
 
#define MaaControllerFeature_UseMouseDownAndUpInsteadOfClick   1ULL
 
#define MaaControllerFeature_UseKeyboardDownAndUpInsteadOfClick   (1ULL << 1)
 

Typedefs

typedef uint8_t MaaBool
 
typedef uint64_t MaaSize
 
typedef int64_t MaaId
 
typedef MaaId MaaCtrlId
 
typedef MaaId MaaResId
 
typedef MaaId MaaTaskId
 
typedef MaaId MaaRecoId
 
typedef MaaId MaaActId
 
typedef MaaId MaaNodeId
 
typedef MaaId MaaSinkId
 
typedef struct MaaStringBuffer MaaStringBuffer
 
typedef struct MaaImageBuffer MaaImageBuffer
 
typedef struct MaaStringListBuffer MaaStringListBuffer
 
typedef struct MaaImageListBuffer MaaImageListBuffer
 
typedef struct MaaResource MaaResource
 
typedef struct MaaController MaaController
 
typedef struct MaaTasker MaaTasker
 
typedef struct MaaContext MaaContext
 
typedef int32_t MaaStatus
 
typedef int32_t MaaLoggingLevel
 
typedef int32_t MaaOption
 
typedef void * MaaOptionValue
 
typedef uint64_t MaaOptionValueSize
 
typedef MaaOption MaaGlobalOption
 
typedef MaaOption MaaResOption
 
typedef int32_t MaaInferenceDevice
 
typedef int32_t MaaInferenceExecutionProvider
 
typedef MaaOption MaaCtrlOption
 
typedef MaaOption MaaTaskerOption
 
typedef uint64_t MaaAdbScreencapMethod
 
typedef uint64_t MaaAdbInputMethod
 
typedef uint64_t MaaWin32ScreencapMethod
 
typedef uint64_t MaaWin32InputMethod
 
typedef uint64_t MaaDbgControllerType
 
typedef uint64_t MaaControllerFeature
 
typedef struct MaaRect MaaRect
 
typedef void(MAA_CALLMaaNotificationCallback) (const char *message, const char *details_json, void *notify_trans_arg)
 
typedef void(MAA_CALLMaaEventCallback) (void *handle, const char *message, const char *details_json, void *trans_arg)
 
typedef MaaBool(MAA_CALLMaaCustomRecognitionCallback) (MaaContext *context, MaaTaskId task_id, const char *node_name, const char *custom_recognition_name, const char *custom_recognition_param, const MaaImageBuffer *image, const MaaRect *roi, void *trans_arg, MaaRect *out_box, MaaStringBuffer *out_detail)
 
typedef MaaBool(MAA_CALLMaaCustomActionCallback) (MaaContext *context, MaaTaskId task_id, const char *node_name, const char *custom_action_name, const char *custom_action_param, MaaRecoId reco_id, const MaaRect *box, void *trans_arg)
 

Enumerations

enum  MaaStatusEnum {
  MaaStatus_Invalid = 0 ,
  MaaStatus_Pending = 1000 ,
  MaaStatus_Running = 2000 ,
  MaaStatus_Succeeded = 3000 ,
  MaaStatus_Failed = 4000
}
 
enum  MaaLoggingLevelEnum {
  MaaLoggingLevel_Off = 0 ,
  MaaLoggingLevel_Fatal = 1 ,
  MaaLoggingLevel_Error = 2 ,
  MaaLoggingLevel_Warn = 3 ,
  MaaLoggingLevel_Info = 4 ,
  MaaLoggingLevel_Debug = 5 ,
  MaaLoggingLevel_Trace = 6 ,
  MaaLoggingLevel_All = 7
}
 
enum  MaaGlobalOptionEnum {
  MaaGlobalOption_Invalid = 0 ,
  MaaGlobalOption_LogDir = 1 ,
  MaaGlobalOption_SaveDraw = 2 ,
  MaaGlobalOption_StdoutLevel = 4 ,
  MaaGlobalOption_DebugMode = 6 ,
  MaaGlobalOption_SaveOnError = 7
}
 
enum  MaaInferenceDeviceEnum {
  MaaInferenceDevice_CPU = -2 ,
  MaaInferenceDevice_Auto = -1 ,
  MaaInferenceDevice_0 = 0 ,
  MaaInferenceDevice_1 = 1
}
 
enum  MaaInferenceExecutionProviderEnum {
  MaaInferenceExecutionProvider_Auto = 0 ,
  MaaInferenceExecutionProvider_CPU = 1 ,
  MaaInferenceExecutionProvider_DirectML = 2 ,
  MaaInferenceExecutionProvider_CoreML = 3 ,
  MaaInferenceExecutionProvider_CUDA = 4
}
 
enum  MaaResOptionEnum {
  MaaResOption_Invalid = 0 ,
  MaaResOption_InferenceDevice = 1 ,
  MaaResOption_InferenceExecutionProvider = 2
}
 
enum  MaaCtrlOptionEnum {
  MaaCtrlOption_Invalid = 0 ,
  MaaCtrlOption_ScreenshotTargetLongSide = 1 ,
  MaaCtrlOption_ScreenshotTargetShortSide = 2 ,
  MaaCtrlOption_ScreenshotUseRawSize = 3
}
 Option keys for controller instance options. See MaaControllerSetOption(). More...
 
enum  MaaTaskerOptionEnum { MaaTaskerOption_Invalid = 0 }
 

Detailed Description

The type definitions.

Author

Macro Definition Documentation

◆ MaaNullSize

#define MaaNullSize   UINT64_MAX

◆ MaaInvalidId

#define MaaInvalidId   ((MaaId)0)

◆ MaaAdbScreencapMethod_EncodeToFileAndPull

#define MaaAdbScreencapMethod_EncodeToFileAndPull   1ULL

◆ MaaAdbScreencapMethod_Encode

#define MaaAdbScreencapMethod_Encode   (1ULL << 1)

◆ MaaAdbScreencapMethod_RawWithGzip

#define MaaAdbScreencapMethod_RawWithGzip   (1ULL << 2)

◆ MaaAdbScreencapMethod_RawByNetcat

#define MaaAdbScreencapMethod_RawByNetcat   (1ULL << 3)

◆ MaaAdbScreencapMethod_MinicapDirect

#define MaaAdbScreencapMethod_MinicapDirect   (1ULL << 4)

◆ MaaAdbScreencapMethod_MinicapStream

#define MaaAdbScreencapMethod_MinicapStream   (1ULL << 5)

◆ MaaAdbScreencapMethod_EmulatorExtras

#define MaaAdbScreencapMethod_EmulatorExtras   (1ULL << 6)

◆ MaaAdbScreencapMethod_None

#define MaaAdbScreencapMethod_None   0ULL

◆ MaaAdbScreencapMethod_All

#define MaaAdbScreencapMethod_All   (~MaaAdbScreencapMethod_None)

◆ MaaAdbScreencapMethod_Default

#define MaaAdbScreencapMethod_Default
Value:
(MaaAdbScreencapMethod_All & (~MaaAdbScreencapMethod_RawByNetcat) & (~MaaAdbScreencapMethod_MinicapDirect) \
& (~MaaAdbScreencapMethod_MinicapStream))
#define MaaAdbScreencapMethod_All
Definition MaaDef.h:232
#define MaaAdbScreencapMethod_MinicapDirect
Definition MaaDef.h:227

◆ MaaAdbInputMethod_AdbShell

#define MaaAdbInputMethod_AdbShell   1ULL

◆ MaaAdbInputMethod_MinitouchAndAdbKey

#define MaaAdbInputMethod_MinitouchAndAdbKey   (1ULL << 1)

◆ MaaAdbInputMethod_Maatouch

#define MaaAdbInputMethod_Maatouch   (1ULL << 2)

◆ MaaAdbInputMethod_EmulatorExtras

#define MaaAdbInputMethod_EmulatorExtras   (1ULL << 3)

◆ MaaAdbInputMethod_None

#define MaaAdbInputMethod_None   0ULL

◆ MaaAdbInputMethod_All

#define MaaAdbInputMethod_All   (~MaaAdbInputMethod_None)

◆ MaaAdbInputMethod_Default

#define MaaAdbInputMethod_Default   (MaaAdbInputMethod_All & (~MaaAdbInputMethod_EmulatorExtras))

◆ MaaWin32ScreencapMethod_None

#define MaaWin32ScreencapMethod_None   0ULL

◆ MaaWin32ScreencapMethod_GDI

#define MaaWin32ScreencapMethod_GDI   1ULL

◆ MaaWin32ScreencapMethod_FramePool

#define MaaWin32ScreencapMethod_FramePool   (1ULL << 1)

◆ MaaWin32ScreencapMethod_DXGI_DesktopDup

#define MaaWin32ScreencapMethod_DXGI_DesktopDup   (1ULL << 2)

◆ MaaWin32ScreencapMethod_DXGI_DesktopDup_Window

#define MaaWin32ScreencapMethod_DXGI_DesktopDup_Window   (1ULL << 3)

◆ MaaWin32ScreencapMethod_PrintWindow

#define MaaWin32ScreencapMethod_PrintWindow   (1ULL << 4)

◆ MaaWin32ScreencapMethod_ScreenDC

#define MaaWin32ScreencapMethod_ScreenDC   (1ULL << 5)

◆ MaaWin32InputMethod_None

#define MaaWin32InputMethod_None   0ULL

◆ MaaWin32InputMethod_Seize

#define MaaWin32InputMethod_Seize   1ULL

◆ MaaWin32InputMethod_SendMessage

#define MaaWin32InputMethod_SendMessage   (1ULL << 1)

◆ MaaWin32InputMethod_PostMessage

#define MaaWin32InputMethod_PostMessage   (1ULL << 2)

◆ MaaWin32InputMethod_LegacyEvent

#define MaaWin32InputMethod_LegacyEvent   (1ULL << 3)

◆ MaaWin32InputMethod_PostThreadMessage

#define MaaWin32InputMethod_PostThreadMessage   (1ULL << 4)

◆ MaaWin32InputMethod_SendMessageWithCursorPos

#define MaaWin32InputMethod_SendMessageWithCursorPos   (1ULL << 5)

◆ MaaWin32InputMethod_PostMessageWithCursorPos

#define MaaWin32InputMethod_PostMessageWithCursorPos   (1ULL << 6)

◆ MaaDbgControllerType_None

#define MaaDbgControllerType_None   0

◆ MaaDbgControllerType_CarouselImage

#define MaaDbgControllerType_CarouselImage   1ULL

◆ MaaDbgControllerType_ReplayRecording

#define MaaDbgControllerType_ReplayRecording   (1ULL << 1)

◆ MaaControllerFeature_None

#define MaaControllerFeature_None   0

◆ MaaControllerFeature_UseMouseDownAndUpInsteadOfClick

#define MaaControllerFeature_UseMouseDownAndUpInsteadOfClick   1ULL

◆ MaaControllerFeature_UseKeyboardDownAndUpInsteadOfClick

#define MaaControllerFeature_UseKeyboardDownAndUpInsteadOfClick   (1ULL << 1)

Typedef Documentation

◆ MaaBool

typedef uint8_t MaaBool

◆ MaaSize

typedef uint64_t MaaSize

◆ MaaId

typedef int64_t MaaId

◆ MaaCtrlId

typedef MaaId MaaCtrlId

◆ MaaResId

typedef MaaId MaaResId

◆ MaaTaskId

typedef MaaId MaaTaskId

◆ MaaRecoId

typedef MaaId MaaRecoId

◆ MaaActId

typedef MaaId MaaActId

◆ MaaNodeId

typedef MaaId MaaNodeId

◆ MaaSinkId

typedef MaaId MaaSinkId

◆ MaaStringBuffer

◆ MaaImageBuffer

◆ MaaStringListBuffer

◆ MaaImageListBuffer

◆ MaaResource

typedef struct MaaResource MaaResource

◆ MaaController

typedef struct MaaController MaaController

◆ MaaTasker

typedef struct MaaTasker MaaTasker

◆ MaaContext

typedef struct MaaContext MaaContext

◆ MaaStatus

typedef int32_t MaaStatus

◆ MaaLoggingLevel

typedef int32_t MaaLoggingLevel

◆ MaaOption

typedef int32_t MaaOption

◆ MaaOptionValue

typedef void* MaaOptionValue

◆ MaaOptionValueSize

typedef uint64_t MaaOptionValueSize

◆ MaaGlobalOption

◆ MaaResOption

◆ MaaInferenceDevice

typedef int32_t MaaInferenceDevice

◆ MaaInferenceExecutionProvider

◆ MaaCtrlOption

◆ MaaTaskerOption

◆ MaaAdbScreencapMethod

typedef uint64_t MaaAdbScreencapMethod

Use bitwise OR to set the method you need, MaaFramework will test their speed and use the fastest one.

◆ MaaAdbInputMethod

typedef uint64_t MaaAdbInputMethod

Use bitwise OR to set the method you need, MaaFramework will select the available ones according to priority. The priority is: EmulatorExtras > Maatouch > MinitouchAndAdbKey > AdbShell

◆ MaaWin32ScreencapMethod

typedef uint64_t MaaWin32ScreencapMethod

No bitwise OR, just set it

◆ MaaWin32InputMethod

typedef uint64_t MaaWin32InputMethod

No bitwise OR, just set it

◆ MaaDbgControllerType

typedef uint64_t MaaDbgControllerType

No bitwise OR, just set it

◆ MaaControllerFeature

typedef uint64_t MaaControllerFeature

◆ MaaRect

typedef struct MaaRect MaaRect

◆ MaaNotificationCallback

typedef void(MAA_CALL * MaaNotificationCallback) (const char *message, const char *details_json, void *notify_trans_arg)

◆ MaaEventCallback

typedef void(MAA_CALL * MaaEventCallback) (void *handle, const char *message, const char *details_json, void *trans_arg)

void* handle:

  • MaaTasker* for MaaTasker event
  • MaaResource* for MaaResource event
  • MaaController* for MaaController event
  • MaaContext* for MaaContext event

◆ MaaCustomRecognitionCallback

typedef MaaBool(MAA_CALL * MaaCustomRecognitionCallback) (MaaContext *context, MaaTaskId task_id, const char *node_name, const char *custom_recognition_name, const char *custom_recognition_param, const MaaImageBuffer *image, const MaaRect *roi, void *trans_arg, MaaRect *out_box, MaaStringBuffer *out_detail)

◆ MaaCustomActionCallback

typedef MaaBool(MAA_CALL * MaaCustomActionCallback) (MaaContext *context, MaaTaskId task_id, const char *node_name, const char *custom_action_name, const char *custom_action_param, MaaRecoId reco_id, const MaaRect *box, void *trans_arg)

Enumeration Type Documentation

◆ MaaStatusEnum

Enumerator
MaaStatus_Invalid 
MaaStatus_Pending 
MaaStatus_Running 
MaaStatus_Succeeded 
MaaStatus_Failed 

◆ MaaLoggingLevelEnum

Enumerator
MaaLoggingLevel_Off 
MaaLoggingLevel_Fatal 
MaaLoggingLevel_Error 
MaaLoggingLevel_Warn 
MaaLoggingLevel_Info 
MaaLoggingLevel_Debug 
MaaLoggingLevel_Trace 
MaaLoggingLevel_All 

◆ MaaGlobalOptionEnum

Enumerator
MaaGlobalOption_Invalid 
MaaGlobalOption_LogDir 

Log dir

value: string, eg: "C:\\Users\\Administrator\\Desktop\\log"; val_size: string length 
MaaGlobalOption_SaveDraw 

Whether to save draw

value: bool, eg: true; val_size: sizeof(bool) 
MaaGlobalOption_StdoutLevel 

The level of log output to stdout

value: MaaLoggingLevel, val_size: sizeof(MaaLoggingLevel)
default value is MaaLoggingLevel_Error 
MaaGlobalOption_DebugMode 

Whether to debug

value: bool, eg: true; val_size: sizeof(bool) 
MaaGlobalOption_SaveOnError 

Whether to save screenshot on error

value: bool, eg: true; val_size: sizeof(bool) 

◆ MaaInferenceDeviceEnum

Enumerator
MaaInferenceDevice_CPU 
MaaInferenceDevice_Auto 
MaaInferenceDevice_0 
MaaInferenceDevice_1 

◆ MaaInferenceExecutionProviderEnum

Enumerator
MaaInferenceExecutionProvider_Auto 
MaaInferenceExecutionProvider_CPU 
MaaInferenceExecutionProvider_DirectML 
MaaInferenceExecutionProvider_CoreML 
MaaInferenceExecutionProvider_CUDA 

◆ MaaResOptionEnum

Enumerator
MaaResOption_Invalid 
MaaResOption_InferenceDevice 

Use the specified inference device. Please set this option before loading the model.

value: MaaInferenceDevice, eg: 0; val_size: sizeof(MaaInferenceDevice) default value is MaaInferenceDevice_Auto

MaaResOption_InferenceExecutionProvider 

Use the specified inference execution provider Please set this option before loading the model.

value: MaaInferenceExecutionProvider, eg: 0; val_size: sizeof(MaaInferenceExecutionProvider) default value is MaaInferenceExecutionProvider_Auto

◆ MaaCtrlOptionEnum

Option keys for controller instance options. See MaaControllerSetOption().

Enumerator
MaaCtrlOption_Invalid 
MaaCtrlOption_ScreenshotTargetLongSide 

Only one of long and short side can be set, and the other is automatically scaled according to the aspect ratio.

value: int, eg: 1280; val_size: sizeof(int) 
MaaCtrlOption_ScreenshotTargetShortSide 

Only one of long and short side can be set, and the other is automatically scaled according to the aspect ratio.

value: int, eg: 720; val_size: sizeof(int) 
MaaCtrlOption_ScreenshotUseRawSize 

Screenshot use raw size without scaling. Please note that this option may cause incorrect coordinates on user devices with different resolutions if scaling is not performed.

value: bool, eg: true; val_size: sizeof(bool)

◆ MaaTaskerOptionEnum

Enumerator
MaaTaskerOption_Invalid