Revision 455
client support functions in colonet server (untested)
Command.cpp | ||
---|---|---|
226 | 226 |
break; |
227 | 227 |
|
228 | 228 |
case CLIENT_ASSIGN_ROBOT_ID: |
229 |
|
|
229 |
colonet_server->getPositionMonitor()->assignRealId(atoi(tokens[1]), atoi(tokens[2])); |
|
230 | 230 |
break; |
231 | 231 |
|
232 | 232 |
default: |
... | ... | |
282 | 282 |
} |
283 | 283 |
|
284 | 284 |
int Command::parse_request_robot_positions(int pool_index) { |
285 |
printf("TODO - parse_request_robot_positions\n");
|
|
286 |
|
|
285 |
printf("parse_request_robot_positions\n"); |
|
286 |
|
|
287 | 287 |
map<int, VisionPosition> positions = colonet_server->getPositionMonitor()->getAllRobotPositions(); |
288 |
map<int, VisionPosition>::iterator iter; |
|
288 | 289 |
|
290 |
char position_buffer[256] = ""; |
|
291 |
for (iter = positions.begin(); iter != positions.end(); iter++) { |
|
292 |
char tmpbuf[80]; |
|
293 |
sprintf(tmpbuf, "%d %d %d ", iter->first, iter->second.x, iter->second.y); |
|
294 |
strcat(position_buffer, tmpbuf); |
|
295 |
} |
|
296 |
|
|
297 |
connection_pool->write_to_client(pool_index, position_buffer, strlen(position_buffer)); |
|
298 |
|
|
289 | 299 |
return 0; |
290 | 300 |
} |
291 | 301 |
|
Also available in: Unified diff