• 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             case INPUTTYPE_ROTATEINPUT:
87                 /* code */
88                 inputString = "rotate";
89                 break;
90             default:
91                 break;
92         }
93         return inputString;
94     }
95     virtual ~MultimodeInputMsg() = default;
96     InputType inputType_ = INPUTTYPE_INVALIDINPUT;
97 };
98 
99 class ComponmentInputMsg : public InputedMsgObject {
100 public:
ComponmentInputMsg()101     ComponmentInputMsg() : InputedMsgObject(componmentInput)
102     {
103     }
104     virtual ~ComponmentInputMsg() = default;
105     std::string componmentType_ = "";
106     uint32_t pageId_ = 0;
107     std::vector<std::string> pageComponments;
108     std::string pagePath_;
109     std::string content_;
110     int32_t startX_ = 0;
111     int32_t startY_ = 0;
112     int32_t endX_ = 0;
113     int32_t endY_ = 0;
114 };
115 }  // namespace WuKong
116 }  // namespace OHOS
117 #endif
118