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