Project

General

Profile

Statistics
| Revision:

root / branches / slam / code / projects / slam / computer / data_requests.h @ 398

History | View | Annotate | Download (1.89 KB)

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

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

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

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

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

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

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