libaurum: apply smart pointer wider and extract impl out
[platform/core/uifw/aurum.git] / libaurum / inc / Impl / TizenDeviceImpl.h
1 #ifndef DEVICE_GENERAL_H
2 #define DEVICE_GENERAL_H
3 #include "config.h"
4
5 #include "IDevice.h"
6 #include <set>
7
8 #ifdef GBS_BUILD
9 #include <efl_util.h>
10 #endif
11 /**
12  * @brief TizenDeviceImpl Class
13  * @since_tizen 5.5
14  */
15 class TizenDeviceImpl : public IDevice {
16 public:
17     TizenDeviceImpl();
18     ~TizenDeviceImpl();
19
20     bool click(const int x, const int y) override;
21     bool click(const int x, const int y, const unsigned int intv) override;
22
23     bool drag(const int sx, const int sy, const int ex, const int ey,
24               const int steps, const int durationMs) override;
25
26     int touchDown(const int x, const int y) override;
27     bool touchMove(const int x, const int y, const int seq) override;
28     bool touchUp(const int x, const int y, const int seq) override;
29
30     bool wheelUp(int amount, const int durationMs) override;
31     bool wheelDown(int amount, const int durationMs) override;
32
33     bool pressBack(KeyRequestType type) override;
34     bool pressHome(KeyRequestType type) override;
35     bool pressMenu(KeyRequestType type) override;
36     bool pressVolUp(KeyRequestType type) override;
37     bool pressVolDown(KeyRequestType type) override;
38     bool pressPower(KeyRequestType type) override;
39     bool pressKeyCode(std::string keycode, KeyRequestType type) override;
40     bool takeScreenshot(std::string path, float scale, int quality) override;
41     long long getSystemTime(TimeRequestType type) override;
42
43 protected:
44     bool strokeKeyCode(std::string keycode, unsigned int intv);
45     bool pressKeyCode(std::string keycode);
46     bool releaseKeyCode(std::string keycode);
47
48     int grabTouchSeqNumber();
49     bool releaseTouchSeqNumber(int seq);
50
51 private:
52     void startTimer(void);
53     int stopTimer(void);
54
55 private:
56     efl_util_inputgen_h mFakeTouchHandle;
57     efl_util_inputgen_h mFakeKeyboardHandle;
58     efl_util_inputgen_h mFakeWheelHandle;
59     static const unsigned int INTV_CLICK = 5;
60     static const unsigned int INTV_SHORTSTROKE = 100;
61     static const unsigned int INTV_LONGSTROKE = 2000;
62
63     static const unsigned int INTV_MINIMUM_DRAG_MS = 25;
64     static const unsigned int INTV_MINIMUM_USLEEP = 1000;
65     static const unsigned int MINIMUM_DURATION_DRAG = 100;
66     static const unsigned int MSEC_PER_SEC = 1000;
67     static const unsigned int MAX_FINGER_NUMBER = 2;
68
69     struct timespec tStart;
70     bool isTimerStarted;
71
72     std::set<int> mTouchSeq;
73 };
74
75 #endif