Statistics
| Revision:

root / demos / joystick / lib / src / libwireless / wl_token_ring.h @ 1736

History | View | Annotate | Download (3.1 KB)

1
/**
2
 * Copyright (c) 2007 Colony Project
3
 * 
4
 * Permission is hereby granted, free of charge, to any person
5
 * obtaining a copy of this software and associated documentation
6
 * files (the "Software"), to deal in the Software without
7
 * restriction, including without limitation the rights to use,
8
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9
 * copies of the Software, and to permit persons to whom the
10
 * Software is furnished to do so, subject to the following
11
 * conditions:
12
 * 
13
 * The above copyright notice and this permission notice shall be
14
 * included in all copies or substantial portions of the Software.
15
 * 
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
 * OTHER DEALINGS IN THE SOFTWARE.
24
 **/
25

    
26
/**
27
 * @file wl_token_ring.h
28
 * @brief Declarations for the token ring packet group
29
 * 
30
 * Contains declarations for the token ring packet group.
31
 *
32
 * @author Brian Coltin, Colony Project, CMU Robotics Club
33
 **/
34

    
35
#ifndef WL_TOKEN_RING_H
36
#define WL_TOKEN_RING_H
37

    
38
/**
39
 * @defgroup tokenring Token Ring
40
 * @brief Wireless library token ring implementation
41
 *
42
 * This packet group is used to form a token ring, which
43
 * keeps track of the relative directions of the robots
44
 * from one another.
45
 *
46
 * @{
47
 **/
48

    
49
/**@brief Register the token ring group with the wireless library.**/
50
int wl_token_ring_register(void);
51
/**@brief Unregister the token ring group with the wirelss library.**/
52
void wl_token_ring_unregister(void);
53
/**@brief Set the functions called to turn the bom on and off.**/
54
void wl_token_ring_set_bom_functions(void (*on_function) (void), void (*off_function) (void),
55
  int (*max_bom_function) (void));
56

    
57
/**@brief Join the token ring **/
58
int wl_token_ring_join(void);
59
/**@brief Leave the token ring **/
60
void wl_token_ring_leave(void);
61

    
62
/**@brief Return the number of robots in the token ring **/
63
int wl_token_get_robots_in_ring(void);
64
/**@brief Return whether a given robot is in the token ring **/
65
int wl_token_is_robot_in_ring(int robot);
66

    
67
/**@brief Begin iterating through robots in the token ring **/
68
void wl_token_iterator_begin(void);
69
/**@brief Returns whether there are more robots to iterate through **/
70
int wl_token_iterator_has_next(void);
71
/**@brief Returns the ID of the next robot in the token ring **/
72
int wl_token_iterator_next(void);
73

    
74
/**@brief Return the latest BOM reading between two robots **/
75
int wl_token_get_sensor_reading(int source, int dest);
76
/**@brief Return the latest BOM reading between us and another robot **/
77
int wl_token_get_my_sensor_reading(int dest);
78
/**@brief Return the number of robots in the sensor matrix.*/
79
int wl_token_get_num_robots(void);
80
/**@brief Return the number of non-null elements in the sensor matrix*/
81
int wl_token_get_matrix_size(void);
82

    
83
/** @} **/ //end token ring group
84

    
85
#endif