Updated package changelog.
[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 #define D_DEV_NAME_PARTS_EV "event"
25
26 class CJoyStickEV : public CJoyStick
27 {
28   public:
29             CJoyStickEV();
30     virtual ~CJoyStickEV();
31
32     virtual int Open();
33     virtual int Close();
34     virtual int Read(int *number, int *value);
35     virtual int ReadData();
36     virtual bool getDeviceName(int fd, char* devNM, size_t sz);
37     bool deviceGrab(int fd);
38     bool deviceGrabRelese(int fd);
39     int getJS_EVENT_BUTTON(int& num, int& val, const struct input_event& s);
40     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 calc2pm32767(int val, const struct input_absinfo& ai);
43     enum {
44         E_ABSX = 0, /* ABS_X */
45         E_ABSY,     /* ABS_Y */
46         E_ABSHAT0X, /* ABS_HAT0X */
47         E_ABSHAT0Y, /* ABS_HAT0Y */
48         E_ABSMAX    /* */
49     };
50   private:
51     struct input_absinfo m_absInf[E_ABSMAX];
52     bool m_grab;
53 };
54
55 #endif /* CJOYSTICKEV_H_ */
56 /**
57  * End of File.(CJoyStickEV.h)
58  */