MaaFramework
A automation black-box testing framework based on image recognition.
Loading...
Searching...
No Matches
MaaDef.h
Go to the documentation of this file.
1
10// IWYU pragma: private, include <MaaFramework/MaaAPI.h>
11
12#pragma once
13
14#include <stdint.h>
15
16#include "MaaPort.h" // IWYU pragma: export
17
18typedef uint8_t MaaBool;
19typedef uint64_t MaaSize;
20#define MaaNullSize UINT64_MAX
21
22typedef int64_t MaaId;
30#define MaaInvalidId ((MaaId)0)
31
36
37typedef struct MaaResource MaaResource;
39typedef struct MaaTasker MaaTasker;
40typedef struct MaaContext MaaContext;
41
42typedef int32_t MaaStatus;
43
45{
51 // MaaStatus_Timeout = 5000,
52};
53
54typedef int32_t MaaLoggingLevel;
55
67
68typedef int32_t MaaOption;
69typedef void* MaaOptionValue;
70typedef uint64_t MaaOptionValueSize;
71
73
75{
77
82
87
88 // Deprecated
89 // Dump all screenshots and actions
90 //
91 // Recording will evaluate to true if any of this or MaaCtrlOptionEnum::MaaCtrlOption_Recording is true.
92 // value: bool, eg: true; val_size: sizeof(bool)
93 // MaaGlobalOption_Recording = 3,
94
100
101 // Deprecated
102 // Whether to show hit draw
103 //
104 // value: bool, eg: true; val_size: sizeof(bool)
105 // MaaGlobalOption_ShowHitDraw = 5,
106
111
116};
117
119
120typedef int32_t MaaInferenceDevice;
122
131
133{
134 // I don't recommend setting up MaaResOption_InferenceDevice in this case,
135 // because you don't know which EP will be used on different user devices.
137
138 // MaaResOption_InferenceDevice will not work.
140
141 // MaaResOption_InferenceDevice will be used to set adapter id,
142 // It's from Win32 API `EnumAdapters1`.
144
145 // MaaResOption_InferenceDevice will be used to set coreml_flag,
146 // Reference to
147 // https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/providers/coreml/coreml_provider_factory.h
148 // But you need to pay attention to the onnxruntime version we use, the latest flag may not be supported.
150
151 // MaaResOption_InferenceDevice will be used to set NVIDIA GPU ID
152 // TODO!
154};
155
174
176
182{
184
189
194
200
201 // Deprecated
202 // Dump all screenshots and actions
203 //
204 // Recording will evaluate to true if any of this or
205 // MaaGlobalOptionEnum::MaaGlobalOption_Recording is true.
206 //
207 // value: bool, eg: true; val_size: sizeof(bool)
208 // MaaCtrlOption_Recording = 5,
209};
210
212
217
218// MaaAdbScreencapMethod:
222typedef uint64_t MaaAdbScreencapMethod;
223#define MaaAdbScreencapMethod_EncodeToFileAndPull 1ULL
224#define MaaAdbScreencapMethod_Encode (1ULL << 1)
225#define MaaAdbScreencapMethod_RawWithGzip (1ULL << 2)
226#define MaaAdbScreencapMethod_RawByNetcat (1ULL << 3)
227#define MaaAdbScreencapMethod_MinicapDirect (1ULL << 4)
228#define MaaAdbScreencapMethod_MinicapStream (1ULL << 5)
229#define MaaAdbScreencapMethod_EmulatorExtras (1ULL << 6)
230
231#define MaaAdbScreencapMethod_None 0ULL
232#define MaaAdbScreencapMethod_All (~MaaAdbScreencapMethod_None)
233#define MaaAdbScreencapMethod_Default \
234 (MaaAdbScreencapMethod_All & (~MaaAdbScreencapMethod_RawByNetcat) & (~MaaAdbScreencapMethod_MinicapDirect) \
235 & (~MaaAdbScreencapMethod_MinicapStream))
236
237// MaaAdbInputMethod:
242typedef uint64_t MaaAdbInputMethod;
243#define MaaAdbInputMethod_AdbShell 1ULL
244#define MaaAdbInputMethod_MinitouchAndAdbKey (1ULL << 1)
245#define MaaAdbInputMethod_Maatouch (1ULL << 2)
246#define MaaAdbInputMethod_EmulatorExtras (1ULL << 3)
247
248#define MaaAdbInputMethod_None 0ULL
249#define MaaAdbInputMethod_All (~MaaAdbInputMethod_None)
250#define MaaAdbInputMethod_Default (MaaAdbInputMethod_All & (~MaaAdbInputMethod_EmulatorExtras))
251
252// MaaWin32ScreencapMethod:
256typedef uint64_t MaaWin32ScreencapMethod;
257#define MaaWin32ScreencapMethod_None 0ULL
258#define MaaWin32ScreencapMethod_GDI 1ULL
259#define MaaWin32ScreencapMethod_FramePool (1ULL << 1)
260#define MaaWin32ScreencapMethod_DXGI_DesktopDup (1ULL << 2)
261#define MaaWin32ScreencapMethod_DXGI_DesktopDup_Window (1ULL << 3)
262#define MaaWin32ScreencapMethod_PrintWindow (1ULL << 4)
263#define MaaWin32ScreencapMethod_ScreenDC (1ULL << 5)
264
265// MaaWin32InputMethod:
269typedef uint64_t MaaWin32InputMethod;
270#define MaaWin32InputMethod_None 0ULL
271#define MaaWin32InputMethod_Seize 1ULL
272#define MaaWin32InputMethod_SendMessage (1ULL << 1)
273#define MaaWin32InputMethod_PostMessage (1ULL << 2)
274#define MaaWin32InputMethod_LegacyEvent (1ULL << 3)
275#define MaaWin32InputMethod_PostThreadMessage (1ULL << 4)
276#define MaaWin32InputMethod_SendMessageWithCursorPos (1ULL << 5)
277#define MaaWin32InputMethod_PostMessageWithCursorPos (1ULL << 6)
278
279// MaaDbgControllerType:
283typedef uint64_t MaaDbgControllerType;
284#define MaaDbgControllerType_None 0
285#define MaaDbgControllerType_CarouselImage 1ULL
286#define MaaDbgControllerType_ReplayRecording (1ULL << 1)
287
288typedef uint64_t MaaControllerFeature;
289#define MaaControllerFeature_None 0
290#define MaaControllerFeature_UseMouseDownAndUpInsteadOfClick 1ULL
291#define MaaControllerFeature_UseKeyboardDownAndUpInsteadOfClick (1ULL << 1)
292
293typedef struct MaaRect
294{
295 int32_t x;
296 int32_t y;
297 int32_t width;
298 int32_t height;
300
301/*
302 * See MaaMsg.h
303 */
304
305// Deprecated, use MaaEventCallback instead
306typedef void(MAA_CALL* MaaNotificationCallback)(const char* message, const char* details_json, void* notify_trans_arg);
307
313typedef void(MAA_CALL* MaaEventCallback)(void* handle, const char* message, const char* details_json, void* trans_arg);
314
316 MaaContext* context,
317 MaaTaskId task_id,
318 const char* node_name,
319 const char* custom_recognition_name,
320 const char* custom_recognition_param,
321 const MaaImageBuffer* image,
322 const MaaRect* roi,
323 void* trans_arg,
324 /* out */ MaaRect* out_box,
325 /* out */ MaaStringBuffer* out_detail);
326
328 MaaContext* context,
329 MaaTaskId task_id,
330 const char* node_name,
331 const char* custom_action_name,
332 const char* custom_action_param,
333 MaaRecoId reco_id,
334 const MaaRect* box,
335 void* trans_arg);
MaaInferenceExecutionProviderEnum
Definition MaaDef.h:133
@ MaaInferenceExecutionProvider_CPU
Definition MaaDef.h:139
@ MaaInferenceExecutionProvider_CUDA
Definition MaaDef.h:153
@ MaaInferenceExecutionProvider_CoreML
Definition MaaDef.h:149
@ MaaInferenceExecutionProvider_Auto
Definition MaaDef.h:136
@ MaaInferenceExecutionProvider_DirectML
Definition MaaDef.h:143
struct MaaImageBuffer MaaImageBuffer
Definition MaaDef.h:33
int32_t MaaInferenceExecutionProvider
Definition MaaDef.h:121
uint64_t MaaWin32ScreencapMethod
Definition MaaDef.h:256
uint64_t MaaWin32InputMethod
Definition MaaDef.h:269
uint8_t MaaBool
Definition MaaDef.h:18
uint64_t MaaAdbScreencapMethod
Definition MaaDef.h:222
uint64_t MaaControllerFeature
Definition MaaDef.h:288
struct MaaStringBuffer MaaStringBuffer
Definition MaaDef.h:32
uint64_t MaaOptionValueSize
Definition MaaDef.h:70
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)
Definition MaaDef.h:327
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)
Definition MaaDef.h:315
void(MAA_CALL * MaaEventCallback)(void *handle, const char *message, const char *details_json, void *trans_arg)
Definition MaaDef.h:313
MaaInferenceDeviceEnum
Definition MaaDef.h:124
@ MaaInferenceDevice_Auto
Definition MaaDef.h:126
@ MaaInferenceDevice_1
Definition MaaDef.h:128
@ MaaInferenceDevice_0
Definition MaaDef.h:127
@ MaaInferenceDevice_CPU
Definition MaaDef.h:125
MaaId MaaTaskId
Definition MaaDef.h:25
uint64_t MaaSize
Definition MaaDef.h:19
MaaId MaaRecoId
Definition MaaDef.h:26
struct MaaStringListBuffer MaaStringListBuffer
Definition MaaDef.h:34
int32_t MaaInferenceDevice
Definition MaaDef.h:120
MaaOption MaaGlobalOption
Definition MaaDef.h:72
uint64_t MaaDbgControllerType
Definition MaaDef.h:283
MaaTaskerOptionEnum
Definition MaaDef.h:214
@ MaaTaskerOption_Invalid
Definition MaaDef.h:215
MaaLoggingLevelEnum
Definition MaaDef.h:57
@ MaaLoggingLevel_Debug
Definition MaaDef.h:63
@ MaaLoggingLevel_All
Definition MaaDef.h:65
@ MaaLoggingLevel_Trace
Definition MaaDef.h:64
@ MaaLoggingLevel_Info
Definition MaaDef.h:62
@ MaaLoggingLevel_Off
Definition MaaDef.h:58
@ MaaLoggingLevel_Error
Definition MaaDef.h:60
@ MaaLoggingLevel_Fatal
Definition MaaDef.h:59
@ MaaLoggingLevel_Warn
Definition MaaDef.h:61
void(MAA_CALL * MaaNotificationCallback)(const char *message, const char *details_json, void *notify_trans_arg)
Definition MaaDef.h:306
struct MaaImageListBuffer MaaImageListBuffer
Definition MaaDef.h:35
struct MaaTasker MaaTasker
Definition MaaDef.h:39
MaaStatusEnum
Definition MaaDef.h:45
@ MaaStatus_Running
Definition MaaDef.h:48
@ MaaStatus_Invalid
Definition MaaDef.h:46
@ MaaStatus_Failed
Definition MaaDef.h:50
@ MaaStatus_Succeeded
Definition MaaDef.h:49
@ MaaStatus_Pending
Definition MaaDef.h:47
MaaOption MaaResOption
Definition MaaDef.h:118
int64_t MaaId
Definition MaaDef.h:22
MaaResOptionEnum
Definition MaaDef.h:157
@ MaaResOption_InferenceDevice
Definition MaaDef.h:165
@ MaaResOption_InferenceExecutionProvider
Definition MaaDef.h:172
@ MaaResOption_Invalid
Definition MaaDef.h:158
uint64_t MaaAdbInputMethod
Definition MaaDef.h:242
struct MaaController MaaController
Definition MaaDef.h:38
MaaId MaaSinkId
Definition MaaDef.h:29
struct MaaResource MaaResource
Definition MaaDef.h:37
void * MaaOptionValue
Definition MaaDef.h:69
int32_t MaaOption
Definition MaaDef.h:68
MaaId MaaResId
Definition MaaDef.h:24
MaaId MaaActId
Definition MaaDef.h:27
MaaCtrlOptionEnum
Option keys for controller instance options. See MaaControllerSetOption().
Definition MaaDef.h:182
@ MaaCtrlOption_ScreenshotUseRawSize
Definition MaaDef.h:199
@ MaaCtrlOption_Invalid
Definition MaaDef.h:183
@ MaaCtrlOption_ScreenshotTargetShortSide
Definition MaaDef.h:193
@ MaaCtrlOption_ScreenshotTargetLongSide
Definition MaaDef.h:188
MaaGlobalOptionEnum
Definition MaaDef.h:75
@ MaaGlobalOption_SaveOnError
Definition MaaDef.h:115
@ MaaGlobalOption_StdoutLevel
Definition MaaDef.h:99
@ MaaGlobalOption_DebugMode
Definition MaaDef.h:110
@ MaaGlobalOption_LogDir
Definition MaaDef.h:81
@ MaaGlobalOption_SaveDraw
Definition MaaDef.h:86
@ MaaGlobalOption_Invalid
Definition MaaDef.h:76
struct MaaContext MaaContext
Definition MaaDef.h:40
int32_t MaaStatus
Definition MaaDef.h:42
MaaOption MaaTaskerOption
Definition MaaDef.h:211
MaaId MaaCtrlId
Definition MaaDef.h:23
MaaId MaaNodeId
Definition MaaDef.h:28
MaaOption MaaCtrlOption
Definition MaaDef.h:175
int32_t MaaLoggingLevel
Definition MaaDef.h:54
#define MAA_CALL
Definition MaaPort.h:7
Definition MaaDef.h:294
int32_t x
Definition MaaDef.h:295
int32_t width
Definition MaaDef.h:297
int32_t y
Definition MaaDef.h:296
int32_t height
Definition MaaDef.h:298