Revision 1442 trunk/code/projects/hunter_prey/testbench/main.c
| main.c (revision 1442) | ||
|---|---|---|
| 44 | 44 |
|
| 45 | 45 |
// Receive TAG, send ACK |
| 46 | 46 |
printf("Receive TAG, send ACK... ");
|
| 47 |
fflush(stdout); |
|
| 47 | 48 |
// Wait until we receive a packet |
| 48 | 49 |
while (!(packet_data = wl_basic_do_default(&data_length))); |
| 49 | 50 |
|
| 50 | 51 |
if (data_length > 2) |
| 52 |
{
|
|
| 51 | 53 |
printf("Excessive TAG packet length... ");
|
| 54 |
fflush(stdout); |
|
| 55 |
} |
|
| 52 | 56 |
|
| 53 | 57 |
if (data_length >= 2 && packet_data[0] == HUNTER_PREY_ACTION_TAG) |
| 54 | 58 |
{
|
| ... | ... | |
| 64 | 68 |
|
| 65 | 69 |
// Send a TAG, receive an ACK |
| 66 | 70 |
printf("Send TAG, wait for ACK... ");
|
| 71 |
fflush(stdout); |
|
| 67 | 72 |
|
| 68 | 73 |
send_buffer[0] = HUNTER_PREY_ACTION_TAG; |
| 69 | 74 |
send_buffer[1] = ROBOTID; |
| ... | ... | |
| 84 | 89 |
|
| 85 | 90 |
// Receive a TAG, send a delayed ACK |
| 86 | 91 |
printf("Receive a TAG, send a delayed ACK... ");
|
| 92 |
fflush(stdout); |
|
| 87 | 93 |
|
| 88 | 94 |
while (!(packet_data = wl_basic_do_default(&data_length))); |
| 89 | 95 |
|
| ... | ... | |
| 110 | 116 |
|
| 111 | 117 |
// Receive a TAG, never send an ACK |
| 112 | 118 |
printf("Receive TAG, never send ACK... ");
|
| 119 |
fflush(stdout); |
|
| 113 | 120 |
|
| 114 | 121 |
while (!(packet_data = wl_basic_do_default(&data_length))); |
| 115 | 122 |
|
| ... | ... | |
| 128 | 135 |
|
| 129 | 136 |
// Receive TAG, send ACK to incorrect robot |
| 130 | 137 |
printf("Receive TAG, send ACK to incorrect robot... ");
|
| 138 |
fflush(stdout); |
|
| 131 | 139 |
|
| 132 | 140 |
// Wait until we receive a packet |
| 133 | 141 |
while (!(packet_data = wl_basic_do_default(&data_length))); |
| ... | ... | |
| 146 | 154 |
|
| 147 | 155 |
// Simulate TAG from robot A to B, ACK from robot B to A |
| 148 | 156 |
printf("Send TAG from robot A to B, ACK from B to A... ");
|
| 157 |
fflush(stdout); |
|
| 149 | 158 |
|
| 150 | 159 |
// TAG |
| 151 | 160 |
send_buffer[0] = HUNTER_PREY_ACTION_TAG; |
Also available in: Unified diff