Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / slam.bak2 / computer / data_requests.h @ 721

History | View | Annotate | Download (1.97 KB)

1
#define DATA_REQUEST_GROUP 7
2
#define BOM_TYPE 0
3
#define IR_TYPE 1
4
#define ENCODER_TYPE 2
5
#define ALL_TYPE 3
6

    
7
/** 
8
* @brief I tried to leave the data in an easy manipulable form, however
9
* the side effect is that you're going to have to reference here sometimes.
10
* The fields are obvious...
11
*   robot_id is the id of the robot that was being looked at by robot that the
12
* list encapsulates.
13
*   value is the 0-15 value of the IR receiver that saw the robot. (Counter clockwise
14
* from the right side.
15
*   next is a pointer to the next BomNode (or NULL).
16
*/
17
typedef struct {
18
  short int robot_id;
19
  char value;
20
  struct BomNode* next;
21
} BomNode;
22

    
23
/*typedef struct{
24
    unsigned char* packet;
25
    char type;
26
    int source;
27
    int length;
28
} RawData;*/
29

    
30
/** 
31
* @brief Initializes the Data Request functionality on the server side.
32
* 
33
* @param void*(bom_data_handler(BomNode** head)) A function that accepts 
34
* a BomNode** as an argument and handles the bom data however you would like.
35
* 
36
* @param void*(IR_data_handler(short** data)) A function that accepts an
37
* array of shorts for processing.
38
*
39
* @param void*(encoder_data_handler(unsigned char** data)) A function that
40
* accepts an array of unsigned chars (tentatively) as data for processing.
41
*/
42
void data_requests_init(
43
                        void(*bom_data_handler)(short id, BomNode** head),
44
                        void(*IR_data_handler)(short id, short** data),
45
                        void(*encoder_data_handler)(short id, unsigned char** data));
46

    
47
/** 
48
* @brief Pings the robot for BOM data.
49
* 
50
* @param robot_id The robot ID of the robot to ping. Typically you will need
51
* to join (if not insert yourself into) the token ring to get a list of robot
52
* id's.
53
*/
54
void request_bom_data(int robot_id);
55

    
56
/** 
57
* @brief Pings the robot for BOM data.
58
*/
59
void request_IR_data(int robot_id);
60

    
61
/** 
62
* @brief Pings the robot for encoder data.
63
* NOT YET DONE (We don't have encoders yet...)
64
*/
65
void request_encoder_data(int robot_id);
66

    
67
void request_all(int robot_id);