libaurum: Fix indentation and clean code up
[platform/core/uifw/aurum.git] / libaurum / inc / UiDevice.h
1 #pragma once
2
3 #include "config.h"
4
5 #include "UiObject.h"
6 #include "UiSelector.h"
7
8 #include "IDevice.h"
9 #include "ISearchable.h"
10
11 #include "AccessibleNode.h"
12 #include "Waiter.h"
13
14 #include "Runnable.h"
15 #include "A11yEvent.h"
16
17 #include <functional>
18 #include <string>
19
20 /**
21  * @brief UiDevice class
22  * @since_tizen 5.5
23  */
24 class UiDevice : public IDevice, public ISearchable {
25 public:
26     /**
27      * @brief TBD
28      * @since_tizen 5.5
29      */
30     bool click(const int x, const int y) override;
31
32     /**
33      * @brief TBD
34      * @since_tizen 5.5
35      */
36     bool click(const int x, const int y, const unsigned int intv) override;
37
38     /**
39      * @brief TBD
40      * @since_tizen 5.5
41      */
42     bool drag(const int sx, const int sy, const int ex, const int ey,
43               const int steps, const int durationMs) override;
44
45     /**
46      * @brief TBD
47      * @since_tizen 5.5
48      */
49     int touchDown(const int x, const int y) override;
50
51     /**
52      * @brief TBD
53      * @since_tizen 5.5
54      */
55     bool touchMove(const int x, const int y, const int seq) override;
56
57     /**
58      * @brief TBD
59      * @since_tizen 5.5
60      */
61     bool touchUp(const int x, const int y, const int seq) override;
62
63     /**
64      * @brief TBD
65      * @since_tizen 5.5
66      */
67     bool wheelUp(int amount, const int durationMs) override;
68
69     /**
70      * @brief TBD
71      * @since_tizen 5.5
72      */
73     bool wheelDown(int amount, const int durationMs) override;
74
75     /**
76      * @brief TBD
77      * @since_tizen 5.5
78      */
79     bool pressBack(KeyRequestType type) override;
80
81     /**
82      * @brief TBD
83      * @since_tizen 5.5
84      */
85     bool pressHome(KeyRequestType type) override;
86
87     /**
88      * @brief TBD
89      * @since_tizen 5.5
90      */
91     bool pressMenu(KeyRequestType type) override;
92
93     /**
94      * @brief TBD
95      * @since_tizen 5.5
96      */
97     bool pressVolUp(KeyRequestType type) override;
98
99     /**
100      * @brief TBD
101      * @since_tizen 5.5
102      */
103     bool pressVolDown(KeyRequestType type) override;
104
105     /**
106      * @brief TBD
107      * @since_tizen 5.5
108      */
109     bool pressPower(KeyRequestType type) override;
110
111     /**
112      * @brief TBD
113      * @since_tizen 5.5
114      */
115     bool pressKeyCode(std::string keycode, KeyRequestType type) override;
116
117     /**
118      * @brief TBD
119      * @since_tizen 5.5
120      */
121     bool takeScreenshot(std::string path, float scale, int quality) override;
122
123     /**
124      * @brief TBD
125      * @since_tizen 5.5
126      */
127     long long getSystemTime(TimeRequestType type) override;
128
129 public:
130
131     /**
132      * @brief TBD
133      * @since_tizen 5.5
134      */
135     bool hasObject(const std::shared_ptr<UiSelector> selector) const override;
136
137     /**
138      * @brief TBD
139      * @since_tizen 5.5
140      */
141     std::shared_ptr<UiObject> findObject(
142         const std::shared_ptr<UiSelector> selector) const override;
143
144     /**
145      * @brief TBD
146      * @since_tizen 5.5
147      */
148     std::vector<std::shared_ptr<UiObject>> findObjects(
149         const std::shared_ptr<UiSelector> selector) const override;
150
151     /**
152      * @brief TBD
153      * @since_tizen 5.5
154      */
155     bool waitFor(
156         const std::function<bool(const ISearchable *)> condition) const;
157
158     /**
159      * @brief TBD
160      * @since_tizen 5.5
161      */
162     std::shared_ptr<UiObject> waitFor(
163         const std::function<std::shared_ptr<UiObject>(const ISearchable *)>
164             condition) const;
165
166     /**
167      * @brief TBD
168      * @since_tizen 6.5
169      */
170     bool waitForEvents(
171         const A11yEvent type, const int timeout) const;
172
173     /**
174      * @brief TBD
175      * @since_tizen 6.5
176      */
177     bool sendKeyAndWaitForEvents(
178         const std::string keycode, const A11yEvent type, const int timeout) const;
179 private:
180     bool executeAndWaitForEvents(
181         const Runnable *cmd, const A11yEvent type, const int timeout) const;
182 public:
183     /**
184      * @brief TBD
185      * @since_tizen 5.5
186      */
187     static std::shared_ptr<UiDevice> getInstance(IDevice *deviceImpl = nullptr);
188
189     /**
190      * @brief TBD
191      * @since_tizen 5.5
192      */
193     std::vector<std::shared_ptr<AccessibleNode>> getWindowRoot() const;
194 private:
195     /**
196      * @brief TBD
197      * @since_tizen 5.5
198      */
199     bool waitForIdle() const;
200
201 private:
202     /**
203      * @brief TBD
204      * @since_tizen 5.5
205      */
206     UiDevice();
207
208     /**
209      * @brief TBD
210      * @since_tizen 5.5
211      */
212     UiDevice(IDevice *impl);
213
214 public:
215     /**
216      * @brief TBD
217      * @since_tizen 5.5
218      */
219     virtual ~UiDevice();
220
221 private:
222     /**
223      * @brief TBD
224      */
225     IDevice *mDeviceImpl;
226     /**
227      * @brief TBD
228      */
229     const Waiter *mWaiter;
230 };