• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #ifndef TEST_WUKONG_INPUF_MSG_OBJECT_H
17 #define TEST_WUKONG_INPUF_MSG_OBJECT_H
18 
19 #include <iostream>
20 #include <map>
21 #include <string>
22 #include <vector>
23 
24 #include "input_action.h"
25 #include "singleton.h"
26 #include "wukong_define.h"
27 
28 namespace OHOS {
29 namespace WuKong {
30 enum inputedMode {
31     multimodeInput = 0,
32     componmentInput,
33     invalidIput
34 };
35 class InputedMsgObject {
36 public:
InputedMsgObject(inputedMode inputedMode)37     InputedMsgObject(inputedMode inputedMode)
38     {
39         inputedMode_ = inputedMode;
40     }
41 
GetInputedMode()42     inputedMode GetInputedMode()
43     {
44         return inputedMode_;
45     }
46     virtual ~InputedMsgObject() = default;
47 
48 private:
49     inputedMode inputedMode_ = invalidIput;
50 };
51 
52 class MultimodeInputMsg : public InputedMsgObject {
53 public:
MultimodeInputMsg()54     MultimodeInputMsg() : InputedMsgObject(multimodeInput)
55     {
56     }
GetInputType()57     std::string GetInputType()
58     {
59         std::string inputString = "";
60         DEBUG_LOG_STR("inputType{%d}", inputType_);
61         switch (inputType_) {
62             case INPUTTYPE_TOUCHINPUT:
63                 /* code */
64                 inputString = "touch";
65                 break;
66             case INPUTTYPE_SWAPINPUT:
67                 /* code */
68                 inputString = "swap";
69                 break;
70             case INPUTTYPE_MOUSEINPUT:
71                 /* code */
72                 inputString = "mouse";
73                 break;
74             case INPUTTYPE_KEYBOARDINPUT:
75                 /* code */
76                 inputString = "keyboard";
77                 break;
78             case INPUTTYPE_APPSWITCHINPUT:
79                 /* code */
80                 inputString = "appswitch";
81                 break;
82             case INPUTTYPE_HARDKEYINPUT:
83                 /* code */
84                 inputString = "hardkey";
85                 break;
86             default:
87                 break;
88         }
89         return inputString;
90     }
91     virtual ~MultimodeInputMsg() = default;
92     InputType inputType_ = INPUTTYPE_INVALIDINPUT;
93 };
94 
95 class ComponmentInputMsg : public InputedMsgObject {
96 public:
ComponmentInputMsg()97     ComponmentInputMsg() : InputedMsgObject(componmentInput)
98     {
99     }
100     virtual ~ComponmentInputMsg() = default;
101     std::string componmentType_ = "";
102     uint32_t pageId_ = 0;
103     std::vector<std::string> pageComponments;
104 };
105 }  // namespace WuKong
106 }  // namespace OHOS
107 #endif
108