6 #include "UiSelector.h"
9 #include "ISearchable.h"
11 #include "AccessibleNode.h"
17 enum class DeviceType {
22 class UiDevice : public IDevice, public ISearchable {
24 bool click(const int x, const int y) override;
25 bool click(const int x, const int y, const unsigned int intv) override;
27 bool drag(const int sx, const int sy, const int ex, const int ey,
28 const int steps, const int durationMs) override;
30 bool touchDown(const int x, const int y) override;
31 bool touchMove(const int x, const int y) override;
32 bool touchUp(const int x, const int y) override;
34 bool pressBack() override;
35 bool pressHome() override;
36 bool pressMenu() override;
37 bool pressVolUp() override;
38 bool pressVolDown() override;
39 bool pressPower() override;
41 bool pressKeyCode(std::string keycode) override;
42 bool takeScreenshot(std::string path, float scale, int quality) override;
43 long long getSystemTime(TypeRequestType type) override;
46 bool hasObject(const std::shared_ptr<UiSelector> selector) const override;
47 std::unique_ptr<UiObject> findObject(
48 const std::shared_ptr<UiSelector> selector) const override;
49 std::vector<std::unique_ptr<UiObject>> findObjects(
50 const std::shared_ptr<UiSelector> selector) const override;
53 const std::function<bool(const ISearchable *)> condition) const;
54 std::unique_ptr<UiObject> waitFor(
55 const std::function<std::unique_ptr<UiObject>(const ISearchable *)>
59 static UiDevice *getInstance(DeviceType type);
62 std::vector<std::unique_ptr<AccessibleNode>> getWindowRoot() const;
66 UiDevice(DeviceType type, IDevice *impl);
71 IDevice * mDeviceImpl;
72 const Waiter *mWaiter;