Subversion Repositories Projects

Rev

Rev 127 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 127 Rev 130
1
/**************************************************
1
/**************************************************
2
 *
2
 *
3
 *
3
 *
4
 * Riddim
4
 * Riddim
5
 * Remote Interactive Digital Drone Interface Mashup
5
 * Remote Interactive Digital Drone Interface Mashup
6
 *
6
 *
7
 * 2008 Marcus -LiGi- Bueschleb
7
 * 2008 Marcus -LiGi- Bueschleb
8
 *
8
 *
9
 *
9
 *
10
**************************************************/
10
**************************************************/
11
 
11
 
12
// for config file parsing
12
// for config file parsing
13
#include <confuse.h>
13
#include <confuse.h>
14
#include <string.h>
14
#include <string.h>
-
 
15
 
-
 
16
 
-
 
17
// for configuration file parsing
-
 
18
#include "config.h" 
-
 
19
// for measuring
15
 
20
#include "statistics.h"
16
// for understanding the FC
21
// for understanding the FC
17
#include "fc.h"
22
#include "fc.h"
18
#include "bluetooth_handler.h"
23
#include "bluetooth_handler.h"
-
 
24
#include "evdev_handler.h"
19
 
25
 
20
#include <stdio.h>
26
#include <stdio.h>
21
#include <stdlib.h>
27
#include <stdlib.h>
22
#include <fcntl.h>
28
#include <fcntl.h>
23
 
29
 
24
 
30
 
25
#include "lib/x52/x52.h"
31
#include "lib/x52/x52.h"
26
 
32
 
27
#include <sys/socket.h>
33
#include <sys/socket.h>
28
 
34
 
29
 
35
 
30
#include <sys/time.h>
36
#include <sys/time.h>
31
#include <bluetooth/rfcomm.h>
-
 
32
 
-
 
33
 
37
 
34
#include <linux/joystick.h>
38
 
35
 
39
 
36
 
40
 
37
 
-
 
-
 
41
 
38
#include <errno.h>
42
 
39
 
43
#include <errno.h>
40
#include <sys/types.h>
44
#include <sys/types.h>
41
#include <netinet/in.h>
45
#include <netinet/in.h>
42
#include <unistd.h>//for close() for socket
46
#include <unistd.h>//for close() for socket
43
 
47
 
44
 
48
 
45
int act_nick=0;
49
int act_nick=0;
46
int act_roll=0;
50
int act_roll=0;
47
int act_gier=0;
51
int act_gier=0;
48
int act_gas=0;
52
int act_gas=0;
49
int act_mode=0;
53
int act_mode=0;
-
 
54
 
-
 
55
 
-
 
56
 
-
 
57
#define FALSE 0
-
 
58
#define TRUE 1
50
 
59
 
51
#define JOY_DEV "/dev/input/js0"
60
#define JOY_DEV "/dev/input/js0"
52
 
61
 
53
 
62
 
54
 
63
 
55
 
64
 
56
#define STATEID_SCANNING 0
65
#define STATEID_SCANNING 0
57
#define STATEID_CONNECTING 1
66
#define STATEID_CONNECTING 1
-
 
67
 
58
 
68
 
59
#define BUTTON_SELECT 26
69
#define BUTTON_SELECT 26
60
#define BUTTON_DOWN 28
70
#define BUTTON_DOWN 28
61
#define BUTTON_UP 27
71
#define BUTTON_UP 27
62
 
72
 
63
 
73
 
64
// #define AXIS_ROLL 0
74
// #define AXIS_ROLL 0
65
// #define AXIS_NICK 1
75
// #define AXIS_NICK 1
66
// #define AXIS_GIER 5
76
// #define AXIS_GIER 5
67
// #define AXIS_GAS  2
77
// #define AXIS_GAS  2
68
 
78
 
69
 
79
 
70
 
80
 
71
// for x52
81
// for x52
72
/*
82
/*
73
#define AXIS_ROLL 4
83
#define AXIS_ROLL 4
74
#define AXIS_NICK 3
84
#define AXIS_NICK 3
75
#define AXIS_GIER 5
85
#define AXIS_GIER 5
76
#define AXIS_GAS  2
86
#define AXIS_GAS  2
77
 
87
 
78
#define INVERT_ROLL -1
88
#define INVERT_ROLL -1
79
#define INVERT_NICK -1
89
#define INVERT_NICK -1
80
#define INVERT_GIER 1
90
#define INVERT_GIER 1
81
#define INVERT_GAS  -1
91
#define INVERT_GAS  -1
82
*/
92
*/
83
 
93
 
84
#define AXIS_ROLL 0
94
#define AXIS_ROLL 0
85
#define AXIS_NICK 1
95
#define AXIS_NICK 1
86
#define AXIS_GIER 3
96
#define AXIS_GIER 3
87
#define AXIS_GAS  2
97
#define AXIS_GAS  2
88
 
98
 
89
#define INVERT_ROLL 1
99
#define INVERT_ROLL 1
90
#define INVERT_NICK -1
100
#define INVERT_NICK -1
91
#define INVERT_GIER 1
101
#define INVERT_GIER 1
92
#define INVERT_GAS  -1
102
#define INVERT_GAS  -1
93
 
103
 
94
 
104
 
95
#define INPUT_NONE 0
105
#define INPUT_NONE 0
96
#define INPUT_JOYDEV 1
106
#define INPUT_JOYDEV 1
97
#define INPUT_EVDEV 2
107
#define INPUT_EVDEV 2
98
 
108