1 /*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "injection_event_dispatch.h"
17
18 #include "error_multimodal.h"
19 #include "mmi_log.h"
20
21 #undef MMI_LOG_TAG
22 #define MMI_LOG_TAG "MmiEventSimulateDemoMain"
23
main(int32_t argc,char * argv[])24 int32_t main(int32_t argc, char* argv[])
25 {
26 using namespace OHOS::MMI;
27 do {
28 SetThreadName("main");
29 InjectionToolsHelpFunc helpFunc;
30 if (!helpFunc.CheckInjectionCommand(argc, argv)) {
31 MMI_HILOGE("Invalid Input Para, Please Check the validity of the para! errCode:%d", PARAM_INPUT_FAIL);
32 std::cout << "Try './mmi-event-injection --help' for more information" << std::endl;
33 return RET_ERR;
34 }
35 InjectionEventDispatch injection;
36 injection.SetArgvs(helpFunc.GetArgvs());
37 injection.Init();
38 if (!injection.VerifyArgvs()) {
39 MMI_HILOGE("Parameter and function validation failed");
40 return RET_ERR;
41 }
42 injection.Run();
43 } while (0);
44 return RET_OK;
45 }
46