fix dependency
[profile/ivi/ico-vic-carsimulator.git] / src / CJoyStickEV.h
1 /*
2  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
3  *
4  * This program is licensed under the terms and conditions of the 
5  * Apache License, version 2.0.  The full text of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  */
9 /**
10  * @brief   Gets the value of the joystick operation
11  * @file    CJoyStickEV.h
12  */
13
14 #ifndef CJOYSTICKEV_H_
15 #define CJOYSTICKEV_H_
16
17 #include <fcntl.h>
18 #include <linux/joystick.h>
19 #include <stdio.h>
20 #include <unistd.h>
21 #include <string.h>
22 #include <poll.h>
23
24 #include "CJoyStick.h"
25
26 #define D_DEV_NAME_PARTS_EV "event"
27
28 class CJoyStickEV : public CJoyStick
29 {
30   public:
31             CJoyStickEV();
32     virtual ~CJoyStickEV();
33
34     virtual int Open();
35     virtual int Close();
36     virtual int Read(int *number, int *value);
37     virtual int ReadData();
38     virtual bool getDeviceName(int fd, char* devNM, size_t sz);
39     int getJS_EVENT_BUTTON(int& num, int& val, const struct input_event& s);
40     virtual int getJS_EVENT_AXIS(int& num, int& val, const struct input_event& s);
41     int calc1pm32767(int val, const struct input_absinfo& ai);
42     int calc2p65535(int val, const struct input_absinfo& ai);
43     int calc3p32767(int val, const struct input_absinfo& ai);
44     int calc3p32767Reverse(int val, const struct input_absinfo& ai);
45     bool recvEV();
46     static void *loop(void *arg);
47     enum {
48         E_ABSX = 0, /* ABS_X */
49         E_ABSY,     /* ABS_Y */
50         E_ABSZ,
51         E_ABSRZ,
52         E_ABSHAT0X, /* ABS_HAT0X */
53         E_ABSHAT0Y, /* ABS_HAT0Y */
54         E_ABSMAX    /* */
55     };
56     struct input_absinfo m_absInf[E_ABSMAX];
57     std::string m_devName;
58     CJoyStickQueue<struct input_event > queue;
59   private:
60     pthread_t  m_threadid;
61 };
62
63 #endif /* CJOYSTICKEV_H_ */
64 /**
65  * End of File.(CJoyStickEV.h)
66  */