6 #include "UiSelector.h"
9 #include "ISearchable.h"
11 #include "AccessibleNode.h"
15 #include "A11yEvent.h"
21 * @brief UiDevice class
24 class UiDevice : public IDevice, public ISearchable {
30 bool click(const int x, const int y) override;
36 bool click(const int x, const int y, const unsigned int intv) override;
42 bool drag(const int sx, const int sy, const int ex, const int ey,
43 const int steps, const int durationMs) override;
49 int touchDown(const int x, const int y) override;
55 bool touchMove(const int x, const int y, const int seq) override;
61 bool touchUp(const int x, const int y, const int seq) override;
67 bool wheelUp(int amount, const int durationMs) override;
73 bool wheelDown(int amount, const int durationMs) override;
79 bool pressBack(KeyRequestType type) override;
85 bool pressHome(KeyRequestType type) override;
91 bool pressMenu(KeyRequestType type) override;
97 bool pressVolUp(KeyRequestType type) override;
103 bool pressVolDown(KeyRequestType type) override;
109 bool pressPower(KeyRequestType type) override;
115 bool pressKeyCode(std::string keycode, KeyRequestType type) override;
121 bool takeScreenshot(std::string path, float scale, int quality) override;
127 long long getSystemTime(TimeRequestType type) override;
135 bool hasObject(const std::shared_ptr<UiSelector> selector) const override;
141 std::shared_ptr<UiObject> findObject(
142 const std::shared_ptr<UiSelector> selector) const override;
148 std::vector<std::shared_ptr<UiObject>> findObjects(
149 const std::shared_ptr<UiSelector> selector) const override;
156 const std::function<bool(const ISearchable *)> condition) const;
162 std::shared_ptr<UiObject> waitFor(
163 const std::function<std::shared_ptr<UiObject>(const ISearchable *)>
171 const A11yEvent type, const int timeout) const;
177 bool sendKeyAndWaitForEvents(
178 const std::string keycode, const A11yEvent type, const int timeout) const;
180 bool executeAndWaitForEvents(
181 const Runnable *cmd, const A11yEvent type, const int timeout) const;
187 static std::shared_ptr<UiDevice> getInstance(IDevice *deviceImpl = nullptr);
193 std::vector<std::shared_ptr<AccessibleNode>> getWindowRoot() const;
199 bool waitForIdle() const;
212 UiDevice(IDevice *impl);
225 IDevice *mDeviceImpl;
229 const Waiter *mWaiter;