Update of /cvsroot/playerstage/code/player/examples/libplayerc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14578/examples/libplayerc
Modified Files:
service_discovery.c
Log Message:
device callback
Index: service_discovery.c
===================================================================
RCS file:
/cvsroot/playerstage/code/player/examples/libplayerc/service_discovery.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** service_discovery.c 19 Oct 2007 17:54:14 -0000 1.5
--- service_discovery.c 23 Oct 2007 23:14:31 -0000 1.6
***************
*** 17,20 ****
--- 17,32 ----
void
+ device_cb(void* data)
+ {
+ playerc_laser_t* laser = (playerc_laser_t*)data;
+ printf("received data from %u:%u:%u:%u",
+ laser->info.addr.host,
+ laser->info.addr.robot,
+ laser->info.addr.interf,
+ laser->info.addr.index);
+ printf(" (%d scans)\n", laser->scan_count);
+ }
+
+ void
browse_cb(player_sd_t* sd, player_sd_dev_t* dev)
{
***************
*** 33,36 ****
--- 45,54 ----
exit(-1);
+ // Add a callback to be invoked whenever we receive new data from this
+ // laser
+ playerc_client_addcallback(clients[num_laserdevs],
+ &(lasers[num_laserdevs]->info),
+ device_cb, lasers[num_laserdevs]);
+
num_laserdevs++;
printf("subscribed to: %s:%u:%s:%u\n",
***************
*** 66,80 ****
for(;;)
{
- // Wait for new data from server
- playerc_mclient_read(mclient,100);
-
// Update name service
player_sd_update(sd,0.0);
! /*
! // Print current robot pose
! printf("position2d : %f %f %f\n",
! position2d->px, position2d->py, position2d->pa);
! */
}
--- 84,92 ----
for(;;)
{
// Update name service
player_sd_update(sd,0.0);
! // Wait for new data from server
! playerc_mclient_read(mclient,100);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit