Revision: 8547
http://playerstage.svn.sourceforge.net/playerstage/?rev=8547&view=rev
Author: thjc
Date: 2010-02-06 18:30:17 +0000 (Sat, 06 Feb 2010)
Log Message:
-----------
Applied patch 2935385: Playerprint given number of updates
Modified Paths:
--------------
code/player/trunk/utils/playerprint/playerprint.cc
Modified: code/player/trunk/utils/playerprint/playerprint.cc
===================================================================
--- code/player/trunk/utils/playerprint/playerprint.cc 2010-02-06 15:31:45 UTC
(rev 8546)
+++ code/player/trunk/utils/playerprint/playerprint.cc 2010-02-06 18:30:17 UTC
(rev 8547)
@@ -126,6 +126,7 @@
int32_t g_port = PlayerCc::PLAYER_PORTNUM;
int16_t g_index = 0;
double g_rate = 0;
+int16_t g_count = -1;
uint32_t g_transport = PLAYERC_TRANSPORT_TCP;
std::string g_device("");
@@ -134,18 +135,19 @@
print_usage()
{
using namespace std;
- cout << "USAGE: playerprint [-r <rate>] [-h <host>] [-p <port>] [-i <index>]
<device>" << endl;
+ cout << "USAGE: playerprint [-r <rate>] [-h <host>] [-p <port>] [-i <index>]
[-c <count>] <device>" << endl;
cout << " -h <host>: connect to Player on this host" << endl;
cout << " -p <port>: connect to Player on this TCP port" << endl;
cout << " -r <rate>: request data update at <rate> in Hz" << endl;
cout << " -i <index>: the index of the device" << endl;
+ cout << " -c <count>: the number of updates to print" << endl;
}
int
get_options(int argc, char **argv)
{
int ch=0;
- const char* optflags = "i:h:p:r:t:";
+ const char* optflags = "i:h:p:r:t:c:";
while((ch=getopt(argc, argv, optflags))!=-1)
{
@@ -164,6 +166,9 @@
case 'r':
g_rate = strtod(optarg,NULL);
break;
+ case 'c':
+ g_count = atoi(optarg);
+ break;
case 't':
g_transport = atoi(optarg);
break;
@@ -325,7 +330,9 @@
gettimeofday(&then,NULL);
}
- for(;;)
+ int16_t g_count_loop = 0;
+ // Loop for g_count or forever if g_count hasn't been set
+ for(;g_count == -1 || g_count_loop < g_count; g_count_loop++)
{
/* this blocks until new data comes; */
client.Read();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit