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