• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 namespace {
22 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, OHOS::MMI::MMI_LOG_DOMAIN, "MmiEventSimulateDemoMain" };
23 } // namespace
24 
main(int32_t argc,char * argv[])25 int32_t main(int32_t argc, char* argv[])
26 {
27     using namespace OHOS::MMI;
28     do {
29         SetThreadName("main");
30         InjectionToolsHelpFunc helpFunc;
31         if (!helpFunc.CheckInjectionCommand(argc, argv)) {
32             MMI_HILOGE("Invalid Input Para, Please Check the validity of the para! errCode:%d", PARAM_INPUT_FAIL);
33             std::cout << "Try './mmi-event-injection --help' for more information" << std::endl;
34             return RET_ERR;
35         }
36         InjectionEventDispatch injection;
37         injection.SetArgvs(helpFunc.GetArgvs());
38         injection.Init();
39         if (!injection.VerifyArgvs()) {
40             MMI_HILOGE("Parameter and function validation failed");
41             return RET_ERR;
42         }
43         injection.Run();
44     } while (0);
45     return RET_OK;
46 }
47