Subversion Repositories Projects

Rev

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

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