root / branches / colonetmk2 / code / projects / libwireless / lib / wl_token_ring.h @ 1456
History | View | Annotate | Download (3.2 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 | #include "sensor_matrix.h" |
| 39 | |
| 40 | /**
|
| 41 | * @defgroup tokenring Token Ring |
| 42 | * @brief Wireless library token ring implementation |
| 43 | * |
| 44 | * This packet group is used to form a token ring, which |
| 45 | * keeps track of the relative directions of the robots |
| 46 | * from one another. |
| 47 | * |
| 48 | * @{
|
| 49 | **/ |
| 50 | |
| 51 | /**@brief Register the token ring group with the wireless library.**/
|
| 52 | int wl_token_ring_register(void); |
| 53 | /**@brief Unregister the token ring group with the wirelss library.**/
|
| 54 | void wl_token_ring_unregister(void); |
| 55 | /**@brief Set the functions called to turn the bom on and off.**/
|
| 56 | void wl_token_ring_set_bom_functions(void (*on_function) (void), void (*off_function) (void), |
| 57 | SensorReading (*max_bom_function) (void));
|
| 58 | |
| 59 | /**@brief Join the token ring **/
|
| 60 | int wl_token_ring_join(void); |
| 61 | /**@brief Leave the token ring **/
|
| 62 | void wl_token_ring_leave(void); |
| 63 | |
| 64 | /**@brief Return the number of robots in the token ring **/
|
| 65 | int wl_token_get_robots_in_ring(void); |
| 66 | /**@brief Return whether a given robot is in the token ring **/
|
| 67 | int wl_token_is_robot_in_ring(int robot); |
| 68 | |
| 69 | /**@brief Begin iterating through robots in the token ring **/
|
| 70 | void wl_token_iterator_begin(void); |
| 71 | /**@brief Returns whether there are more robots to iterate through **/
|
| 72 | int wl_token_iterator_has_next(void); |
| 73 | /**@brief Returns the ID of the next robot in the token ring **/
|
| 74 | int wl_token_iterator_next(void); |
| 75 | |
| 76 | /**@brief Return the latest BOM reading between two robots **/
|
| 77 | SensorReading * wl_token_get_sensor_reading(int source, int dest); |
| 78 | /**@brief Return the latest BOM reading between us and another robot **/
|
| 79 | SensorReading * wl_token_get_my_sensor_reading(int dest);
|
| 80 | /**@brief Return the number of robots in the sensor matrix.*/
|
| 81 | int wl_token_get_num_robots(void); |
| 82 | /**@brief Return the number of non-null elements in the sensor matrix*/
|
| 83 | int wl_token_get_matrix_size(void); |
| 84 | |
| 85 | /** @} **/ //end token ring group |
| 86 | |
| 87 | #endif
|