• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #ifndef CMD_PARSER_H
17 #define CMD_PARSER_H
18 
19 #include <map>
20 #include <string>
21 #include <vector>
22 
23 namespace OHOS {
24 namespace MMI {
25 class InputReplayCommand {
26 public:
27     InputReplayCommand(int32_t argc, char** argv);
28     bool Parse();
29     bool Execute();
30 
31     static int32_t HandleRecordReplayCommand(int32_t argc, char** argv);
32 private:
33     bool ParseOptions();
34     bool ParseDeviceMapping(const std::string& mappingStr);
35     void SetupSignalHandlers();
36     bool ParseRecordCommand();
37     bool ParseReplayCommand();
38     bool ExecuteRecordCommand();
39     bool ExecuteReplayCommand();
40     void PrintUsage() const;
41 
42     int32_t argc_;
43     char *const *argv_;
44     std::string programName_;
45     std::string command_;
46     std::string filePath_;
47     std::vector<std::string> devicePaths_;
48     bool useAllDevices_ { false };
49     std::map<uint16_t, uint16_t> deviceMapping_;
50 };
51 } // namespace MMI
52 } // namespace OHOS
53 #endif // CMD_PARSER_H