ArDrone SDK 1.8 added
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ARDroneLib / Soft / Lib / ardrone_tool / ardrone_tool_configuration.h
1 /*
2  *  ardrone_tool_configuration.h
3  *  
4  *
5  *  Created by Frederic D'HAEYER on 13/09/10.
6  *  Copyright 2010 Parrot SA. All rights reserved.
7  *
8  */
9 #ifndef _ARDRONE_TOOL_CONFIGURATION_H_
10 #define _ARDRONE_TOOL_CONFIGURATION_H_
11 #include <ardrone_api.h>
12 #include <VP_Os/vp_os_types.h>
13 #include <VP_Os/vp_os_signal.h>
14 #include <VP_Api/vp_api_thread_helper.h>
15
16 #include <ardrone_tool/Control/ardrone_control_ack.h>
17 #include <ardrone_tool/Control/ardrone_control_configuration.h>
18
19 #include <iniparser3.0b/src/iniparser.h>
20
21 #undef ARDRONE_CONFIG_KEY_IMM
22 #undef ARDRONE_CONFIG_KEY_REF
23 #undef ARDRONE_CONFIG_KEY_STR
24 #define ARDRONE_CONFIG_KEY_IMM(KEY, NAME, INI_TYPE, C_TYPE, C_TYPE_PTR, RW, DEFAULT, CALLBACK)
25 #define ARDRONE_CONFIG_KEY_REF(KEY, NAME, INI_TYPE, C_TYPE, C_TYPE_PTR, RW, DEFAULT, CALLBACK)
26 #define ARDRONE_CONFIG_KEY_STR(KEY, NAME, INI_TYPE, C_TYPE, C_TYPE_PTR, RW, DEFAULT, CALLBACK)
27 #include <config_keys.h>
28
29 typedef void (*ardrone_tool_configuration_callback)(bool_t result);
30
31 typedef struct _ardrone_tool_configuration_data_t {
32         char* key;
33         void* value;
34         ardrone_at_configuration_set callback;
35         ARDRONE_CONTROL_MODE control_mode;
36         ardrone_tool_configuration_callback result_callback;
37         ardrone_control_event_t* event;
38 } ardrone_tool_configuration_data_t;
39
40 #define ARDRONE_TOOL_CONFIGURATION_ADDEVENT(NAME, VALUE, CALLBACK)      ardrone_tool_configuration_addevent_##NAME(VALUE, CALLBACK)
41 #define ARDRONE_TOOL_CONFIGURATION_GET(CALLBACK)                                        ardrone_tool_configuration_get(CALLBACK)
42 #define ARDRONE_TOOL_CUSTOM_CONFIGURATION_GET(CALLBACK)                         ardrone_tool_custom_configuration_get(CALLBACK)
43
44 #undef ARDRONE_CONFIG_KEY_IMM
45 #undef ARDRONE_CONFIG_KEY_REF
46 #undef ARDRONE_CONFIG_KEY_STR
47 #define ARDRONE_CONFIG_KEY_IMM(KEY, NAME, INI_TYPE, C_TYPE, C_TYPE_PTR, RW, DEFAULT, CALLBACK) \
48 bool_t ardrone_tool_configuration_addevent_##NAME(C_TYPE_PTR value, ardrone_tool_configuration_callback result_callback);
49 #define ARDRONE_CONFIG_KEY_REF(KEY, NAME, INI_TYPE, C_TYPE, C_TYPE_PTR, RW, DEFAULT, CALLBACK)
50 #define ARDRONE_CONFIG_KEY_STR(KEY, NAME, INI_TYPE, C_TYPE, C_TYPE_PTR, RW, DEFAULT, CALLBACK) \
51 bool_t ardrone_tool_configuration_addevent_##NAME(C_TYPE_PTR value, ardrone_tool_configuration_callback result_callback);
52 #include <config_keys.h>
53
54 extern ardrone_config_t         ardrone_control_config;
55 extern ardrone_config_t         ardrone_control_config_default;
56 extern ardrone_config_t         ardrone_application_default_config;
57
58 void ardrone_tool_reset_configuration(void);
59 void ardrone_tool_configuration_init(void);
60 void ardrone_tool_send_application_default(void);
61 void ardrone_tool_send_user_default(void);
62 void ardrone_tool_send_session_default(void);
63 bool_t ardrone_tool_configuration_get(ardrone_tool_configuration_callback result_callback);
64 bool_t ardrone_tool_custom_configuration_get(ardrone_tool_configuration_callback result_callback);
65
66 PROTO_THREAD_ROUTINE(ardrone_configuration, data);
67
68 #endif // _ARDRONE_TOOL_CONFIGURATION_H_