ViconDataStreamSDK_CPPTest.cpp
Go to the documentation of this file.
00001 
00002 //
00003 // Copyright (C) OMG Plc 2009.
00004 // All rights reserved.  This software is protected by copyright
00005 // law and international treaties.  No part of this software / document
00006 // may be reproduced or distributed in any form or by any means,
00007 // whether transiently or incidentally to some other use of this software,
00008 // without the written permission of the copyright owner.
00009 //
00011 #include "Client.h"
00012 #include <iostream>
00013 
00014 #ifdef WIN32
00015   #include <conio.h>   // For _kbhit()
00016   #include <windows.h> // For Sleep()
00017 #endif // WIN32
00018 
00019 using namespace ViconDataStreamSDK::CPP;
00020 
00021 namespace
00022 {
00023   std::string Adapt( const bool i_Value )
00024   {
00025     return i_Value ? "True" : "False";
00026   }
00027 
00028   std::string Adapt( const Direction::Enum i_Direction )
00029   {
00030     switch( i_Direction )
00031     {
00032       case Direction::Forward:
00033         return "Forward";
00034       case Direction::Backward:
00035         return "Backward";
00036       case Direction::Left:
00037         return "Left";
00038       case Direction::Right:
00039         return "Right";
00040       case Direction::Up:
00041         return "Up";
00042       case Direction::Down:
00043         return "Down";
00044       default:
00045         return "Unknown";
00046     }
00047   }
00048 
00049   std::string Adapt( const DeviceType::Enum i_DeviceType )
00050   {
00051     switch( i_DeviceType )
00052     {
00053       case DeviceType::ForcePlate:
00054         return "ForcePlate";
00055       case DeviceType::Unknown:
00056       default:
00057         return "Unknown";
00058     }
00059   }
00060 
00061   std::string Adapt( const Unit::Enum i_Unit )
00062   {
00063     switch( i_Unit )
00064     {
00065       case Unit::Meter:
00066         return "Meter";
00067       case Unit::Volt:
00068         return "Volt";
00069       case Unit::NewtonMeter:
00070         return "NewtonMeter";
00071       case Unit::Newton:
00072         return "Newton";
00073       case Unit::Unknown:
00074       default:
00075         return "Unknown";
00076     }
00077   }
00078 }
00079 
00080 int main( int argc, char* argv[] )
00081 {
00082   // Program options
00083   bool TransmitMulticast = false;
00084   
00085   std::string HostName = "192.168.0.12:801";
00086   if( argc == 2 )
00087   {
00088     HostName = argv[1];
00089   }
00090 
00091   // Make a new client
00092   Client MyClient;
00093 
00094   // Connect to a server
00095   std::cout << "Connecting to " << HostName << " ..." << std::flush;
00096   while( !MyClient.IsConnected().Connected )
00097   {
00098     // Direct connection
00099     MyClient.Connect( HostName );
00100 
00101     // Multicast connection
00102     // MyClient.ConnectToMulticast( HostName, "224.0.0.0" );
00103 
00104     std::cout << ".";
00105 #ifdef WIN32
00106     Sleep( 200 );
00107 #else
00108     sleep(1);
00109 #endif
00110   }
00111   std::cout << std::endl;
00112 
00113   // Enable some different data types
00114   MyClient.EnableSegmentData();
00115   MyClient.EnableMarkerData();
00116   MyClient.EnableUnlabeledMarkerData();
00117   MyClient.EnableDeviceData();
00118 
00119   std::cout << "Segment Data Enabled: "          << Adapt( MyClient.IsSegmentDataEnabled().Enabled )         << std::endl;
00120   std::cout << "Marker Data Enabled: "           << Adapt( MyClient.IsMarkerDataEnabled().Enabled )          << std::endl;
00121   std::cout << "Unlabeled Marker Data Enabled: " << Adapt( MyClient.IsUnlabeledMarkerDataEnabled().Enabled ) << std::endl;
00122   std::cout << "Device Data Enabled: "           << Adapt( MyClient.IsDeviceDataEnabled().Enabled )          << std::endl;
00123 
00124   // Set the streaming mode
00125   MyClient.SetStreamMode( ViconDataStreamSDK::CPP::StreamMode::ClientPull );
00126 //   MyClient.SetStreamMode( ViconDataStreamSDK::CPP::StreamMode::ClientPullPreFetch );
00127 //   MyClient.SetStreamMode( ViconDataStreamSDK::CPP::StreamMode::ServerPush );
00128 
00129   // Set the global up axis
00130   MyClient.SetAxisMapping( Direction::Forward, 
00131                            Direction::Left, 
00132                            Direction::Up ); // Z-up
00133   // MyClient.SetGlobalUpAxis( Direction::Forward, 
00134   //                           Direction::Up, 
00135   //                           Direction::Right ); // Y-up
00136 
00137   Output_GetAxisMapping _Output_GetAxisMapping = MyClient.GetAxisMapping();
00138   std::cout << "Axis Mapping: X-" << Adapt( _Output_GetAxisMapping.XAxis ) 
00139                          << " Y-" << Adapt( _Output_GetAxisMapping.YAxis ) 
00140                          << " Z-" << Adapt( _Output_GetAxisMapping.ZAxis ) << std::endl;
00141 
00142   // Discover the version number
00143   Output_GetVersion _Output_GetVersion = MyClient.GetVersion();
00144   std::cout << "Version: " << _Output_GetVersion.Major << "." 
00145                            << _Output_GetVersion.Minor << "." 
00146                            << _Output_GetVersion.Point << std::endl;
00147 
00148   if( TransmitMulticast )
00149   {
00150     MyClient.StartTransmittingMulticast( "localhost", "224.0.0.0" );
00151   }
00152 
00153   // Loop until a key is pressed
00154 #ifdef WIN32
00155   while( !_kbhit() )
00156 #else
00157   while( true)
00158 #endif
00159   {
00160     // Get a frame
00161     std::cout << "Waiting for new frame...";
00162     while( MyClient.GetFrame().Result != Result::Success )
00163     {
00164       // Sleep a little so that we don't lumber the CPU with a busy poll
00165       #ifdef WIN32
00166         Sleep( 200 );
00167       #else
00168         sleep(1);
00169       #endif
00170 
00171       std::cout << ".";
00172     }
00173     std::cout << std::endl;
00174 
00175     // Get the frame number
00176     Output_GetFrameNumber _Output_GetFrameNumber = MyClient.GetFrameNumber();
00177     std::cout << "Frame Number: " << _Output_GetFrameNumber.FrameNumber << std::endl;
00178 
00179     // Get the timecode
00180     Output_GetTimecode _Output_GetTimecode  = MyClient.GetTimecode();
00181 
00182     std::cout << "Timecode: "
00183               << _Output_GetTimecode.Hours               << "h "
00184               << _Output_GetTimecode.Minutes             << "m " 
00185               << _Output_GetTimecode.Seconds             << "s "
00186               << _Output_GetTimecode.Frames              << "f "
00187               << _Output_GetTimecode.SubFrame            << "sf "
00188               << Adapt( _Output_GetTimecode.FieldFlag ) << " " 
00189               << _Output_GetTimecode.Standard            << " " 
00190               << _Output_GetTimecode.SubFramesPerFrame   << " " 
00191               << _Output_GetTimecode.UserBits            << std::endl << std::endl;
00192 
00193     // Get the latency
00194     std::cout << "Latency: " << MyClient.GetLatencyTotal().Total << "s" << std::endl;
00195     
00196     for( unsigned int LatencySampleIndex = 0 ; LatencySampleIndex < MyClient.GetLatencySampleCount().Count ; ++LatencySampleIndex )
00197     {
00198       std::string SampleName  = MyClient.GetLatencySampleName( LatencySampleIndex ).Name;
00199       double      SampleValue = MyClient.GetLatencySampleValue( SampleName ).Value;
00200 
00201       std::cout << "  " << SampleName << " " << SampleValue << "s" << std::endl;
00202     }
00203     std::cout << std::endl;
00204 
00205     // Count the number of subjects
00206     unsigned int SubjectCount = MyClient.GetSubjectCount().SubjectCount;
00207     std::cout << "Subjects (" << SubjectCount << "):" << std::endl;
00208     for( unsigned int SubjectIndex = 0 ; SubjectIndex < SubjectCount ; ++SubjectIndex )
00209     {
00210       std::cout << "  Subject #" << SubjectIndex << std::endl;
00211 
00212       // Get the subject name
00213       std::string SubjectName = MyClient.GetSubjectName( SubjectIndex ).SubjectName;
00214       std::cout << "            Name: " << SubjectName << std::endl;
00215 
00216       // Get the root segment
00217       std::string RootSegment = MyClient.GetSubjectRootSegmentName( SubjectName ).SegmentName;
00218       std::cout << "    Root Segment: " << RootSegment << std::endl;
00219 
00220       // Count the number of segments
00221       unsigned int SegmentCount = MyClient.GetSegmentCount( SubjectName ).SegmentCount;
00222       std::cout << "    Segments (" << SegmentCount << "):" << std::endl;
00223       for( unsigned int SegmentIndex = 0 ; SegmentIndex < SegmentCount ; ++SegmentIndex )
00224       {
00225         std::cout << "      Segment #" << SegmentIndex << std::endl;
00226 
00227         // Get the segment name
00228         std::string SegmentName = MyClient.GetSegmentName( SubjectName, SegmentIndex ).SegmentName;
00229         std::cout << "          Name: " << SegmentName << std::endl;
00230 
00231         // Get the segment parent
00232         std::string SegmentParentName = MyClient.GetSegmentParentName( SubjectName, SegmentName ).SegmentName;
00233         std::cout << "        Parent: " << SegmentParentName << std::endl;
00234 
00235         // Get the segment's children
00236         unsigned int ChildCount = MyClient.GetSegmentChildCount( SubjectName, SegmentName ).SegmentCount;
00237         std::cout << "     Children (" << ChildCount << "):" << std::endl;
00238         for( unsigned int ChildIndex = 0 ; ChildIndex < ChildCount ; ++ChildIndex )
00239         {
00240           std::string ChildName = MyClient.GetSegmentChildName( SubjectName, SegmentName, ChildIndex ).SegmentName;
00241           std::cout << "       " << ChildName << std::endl;
00242         }
00243 
00244         // Get the static segment translation
00245         Output_GetSegmentStaticTranslation _Output_GetSegmentStaticTranslation = 
00246           MyClient.GetSegmentStaticTranslation( SubjectName, SegmentName );
00247         std::cout << "        Static Translation: (" << _Output_GetSegmentStaticTranslation.Translation[ 0 ]  << ", " 
00248                                                      << _Output_GetSegmentStaticTranslation.Translation[ 1 ]  << ", " 
00249                                                      << _Output_GetSegmentStaticTranslation.Translation[ 2 ]  << ") " << std::endl;
00250 
00251         // Get the static segment rotation in helical co-ordinates
00252         Output_GetSegmentStaticRotationHelical _Output_GetSegmentStaticRotationHelical = 
00253           MyClient.GetSegmentStaticRotationHelical( SubjectName, SegmentName );
00254         std::cout << "        Static Rotation Helical: (" << _Output_GetSegmentStaticRotationHelical.Rotation[ 0 ]     << ", " 
00255                                                           << _Output_GetSegmentStaticRotationHelical.Rotation[ 1 ]     << ", " 
00256                                                           << _Output_GetSegmentStaticRotationHelical.Rotation[ 2 ]     << ") " << std::endl;
00257 
00258         // Get the static segment rotation as a matrix
00259         Output_GetSegmentStaticRotationMatrix _Output_GetSegmentStaticRotationMatrix = 
00260           MyClient.GetSegmentStaticRotationMatrix( SubjectName, SegmentName );
00261         std::cout << "        Static Rotation Matrix: (" << _Output_GetSegmentStaticRotationMatrix.Rotation[ 0 ]     << ", " 
00262                                                          << _Output_GetSegmentStaticRotationMatrix.Rotation[ 1 ]     << ", " 
00263                                                          << _Output_GetSegmentStaticRotationMatrix.Rotation[ 2 ]     << ", " 
00264                                                          << _Output_GetSegmentStaticRotationMatrix.Rotation[ 3 ]     << ", " 
00265                                                          << _Output_GetSegmentStaticRotationMatrix.Rotation[ 4 ]     << ", " 
00266                                                          << _Output_GetSegmentStaticRotationMatrix.Rotation[ 5 ]     << ", " 
00267                                                          << _Output_GetSegmentStaticRotationMatrix.Rotation[ 6 ]     << ", " 
00268                                                          << _Output_GetSegmentStaticRotationMatrix.Rotation[ 7 ]     << ", " 
00269                                                          << _Output_GetSegmentStaticRotationMatrix.Rotation[ 8 ]     << ") " << std::endl;
00270 
00271         // Get the static segment rotation in quaternion co-ordinates
00272         Output_GetSegmentStaticRotationQuaternion _Output_GetSegmentStaticRotationQuaternion = 
00273           MyClient.GetSegmentStaticRotationQuaternion( SubjectName, SegmentName );
00274         std::cout << "        Static Rotation Quaternion: (" << _Output_GetSegmentStaticRotationQuaternion.Rotation[ 0 ]     << ", " 
00275                                                              << _Output_GetSegmentStaticRotationQuaternion.Rotation[ 1 ]     << ", " 
00276                                                              << _Output_GetSegmentStaticRotationQuaternion.Rotation[ 2 ]     << ", " 
00277                                                              << _Output_GetSegmentStaticRotationQuaternion.Rotation[ 3 ]     << ") " << std::endl;
00278 
00279         // Get the static segment rotation in EulerXYZ co-ordinates
00280         Output_GetSegmentStaticRotationEulerXYZ _Output_GetSegmentStaticRotationEulerXYZ = 
00281           MyClient.GetSegmentStaticRotationEulerXYZ( SubjectName, SegmentName );
00282         std::cout << "        Static Rotation EulerXYZ: (" << _Output_GetSegmentStaticRotationEulerXYZ.Rotation[ 0 ]     << ", " 
00283                                                            << _Output_GetSegmentStaticRotationEulerXYZ.Rotation[ 1 ]     << ", " 
00284                                                            << _Output_GetSegmentStaticRotationEulerXYZ.Rotation[ 2 ]     << ") " << std::endl;
00285 
00286         // Get the global segment translation
00287         Output_GetSegmentGlobalTranslation _Output_GetSegmentGlobalTranslation = 
00288           MyClient.GetSegmentGlobalTranslation( SubjectName, SegmentName );
00289         std::cout << "        Global Translation: (" << _Output_GetSegmentGlobalTranslation.Translation[ 0 ]  << ", " 
00290                                                      << _Output_GetSegmentGlobalTranslation.Translation[ 1 ]  << ", " 
00291                                                      << _Output_GetSegmentGlobalTranslation.Translation[ 2 ]  << ") " 
00292                                                      << Adapt( _Output_GetSegmentGlobalTranslation.Occluded ) << std::endl;
00293 
00294         // Get the global segment rotation in helical co-ordinates
00295         Output_GetSegmentGlobalRotationHelical _Output_GetSegmentGlobalRotationHelical = 
00296           MyClient.GetSegmentGlobalRotationHelical( SubjectName, SegmentName );
00297         std::cout << "        Global Rotation Helical: (" << _Output_GetSegmentGlobalRotationHelical.Rotation[ 0 ]     << ", " 
00298                                                           << _Output_GetSegmentGlobalRotationHelical.Rotation[ 1 ]     << ", " 
00299                                                           << _Output_GetSegmentGlobalRotationHelical.Rotation[ 2 ]     << ") " 
00300                                                           << Adapt( _Output_GetSegmentGlobalRotationHelical.Occluded ) << std::endl;
00301 
00302         // Get the global segment rotation as a matrix
00303         Output_GetSegmentGlobalRotationMatrix _Output_GetSegmentGlobalRotationMatrix = 
00304           MyClient.GetSegmentGlobalRotationMatrix( SubjectName, SegmentName );
00305         std::cout << "        Global Rotation Matrix: (" << _Output_GetSegmentGlobalRotationMatrix.Rotation[ 0 ]     << ", " 
00306                                                          << _Output_GetSegmentGlobalRotationMatrix.Rotation[ 1 ]     << ", " 
00307                                                          << _Output_GetSegmentGlobalRotationMatrix.Rotation[ 2 ]     << ", " 
00308                                                          << _Output_GetSegmentGlobalRotationMatrix.Rotation[ 3 ]     << ", " 
00309                                                          << _Output_GetSegmentGlobalRotationMatrix.Rotation[ 4 ]     << ", " 
00310                                                          << _Output_GetSegmentGlobalRotationMatrix.Rotation[ 5 ]     << ", " 
00311                                                          << _Output_GetSegmentGlobalRotationMatrix.Rotation[ 6 ]     << ", " 
00312                                                          << _Output_GetSegmentGlobalRotationMatrix.Rotation[ 7 ]     << ", " 
00313                                                          << _Output_GetSegmentGlobalRotationMatrix.Rotation[ 8 ]     << ") " 
00314                                                          << Adapt( _Output_GetSegmentGlobalRotationMatrix.Occluded ) << std::endl;
00315 
00316         // Get the global segment rotation in quaternion co-ordinates
00317         Output_GetSegmentGlobalRotationQuaternion _Output_GetSegmentGlobalRotationQuaternion = 
00318           MyClient.GetSegmentGlobalRotationQuaternion( SubjectName, SegmentName );
00319         std::cout << "        Global Rotation Quaternion: (" << _Output_GetSegmentGlobalRotationQuaternion.Rotation[ 0 ]     << ", " 
00320                                                              << _Output_GetSegmentGlobalRotationQuaternion.Rotation[ 1 ]     << ", " 
00321                                                              << _Output_GetSegmentGlobalRotationQuaternion.Rotation[ 2 ]     << ", " 
00322                                                              << _Output_GetSegmentGlobalRotationQuaternion.Rotation[ 3 ]     << ") " 
00323                                                              << Adapt( _Output_GetSegmentGlobalRotationQuaternion.Occluded ) << std::endl;
00324 
00325         // Get the global segment rotation in EulerXYZ co-ordinates
00326         Output_GetSegmentGlobalRotationEulerXYZ _Output_GetSegmentGlobalRotationEulerXYZ = 
00327           MyClient.GetSegmentGlobalRotationEulerXYZ( SubjectName, SegmentName );
00328         std::cout << "        Global Rotation EulerXYZ: (" << _Output_GetSegmentGlobalRotationEulerXYZ.Rotation[ 0 ]     << ", " 
00329                                                            << _Output_GetSegmentGlobalRotationEulerXYZ.Rotation[ 1 ]     << ", " 
00330                                                            << _Output_GetSegmentGlobalRotationEulerXYZ.Rotation[ 2 ]     << ") " 
00331                                                            << Adapt( _Output_GetSegmentGlobalRotationEulerXYZ.Occluded ) << std::endl;
00332 
00333         // Get the local segment translation
00334         Output_GetSegmentLocalTranslation _Output_GetSegmentLocalTranslation = 
00335           MyClient.GetSegmentLocalTranslation( SubjectName, SegmentName );
00336         std::cout << "        Local Translation: (" << _Output_GetSegmentLocalTranslation.Translation[ 0 ]  << ", " 
00337                                                     << _Output_GetSegmentLocalTranslation.Translation[ 1 ]  << ", " 
00338                                                     << _Output_GetSegmentLocalTranslation.Translation[ 2 ]  << ") " 
00339                                                     << Adapt( _Output_GetSegmentLocalTranslation.Occluded ) << std::endl;
00340 
00341         // Get the local segment rotation in helical co-ordinates
00342         Output_GetSegmentLocalRotationHelical _Output_GetSegmentLocalRotationHelical = 
00343           MyClient.GetSegmentLocalRotationHelical( SubjectName, SegmentName );
00344         std::cout << "        Local Rotation Helical: (" << _Output_GetSegmentLocalRotationHelical.Rotation[ 0 ]     << ", " 
00345                                                          << _Output_GetSegmentLocalRotationHelical.Rotation[ 1 ]     << ", " 
00346                                                          << _Output_GetSegmentLocalRotationHelical.Rotation[ 2 ]     << ") " 
00347                                                          << Adapt( _Output_GetSegmentLocalRotationHelical.Occluded ) << std::endl;
00348 
00349         // Get the local segment rotation as a matrix
00350         Output_GetSegmentLocalRotationMatrix _Output_GetSegmentLocalRotationMatrix = 
00351           MyClient.GetSegmentLocalRotationMatrix( SubjectName, SegmentName );
00352         std::cout << "        Local Rotation Matrix: (" << _Output_GetSegmentLocalRotationMatrix.Rotation[ 0 ]     << ", " 
00353                                                         << _Output_GetSegmentLocalRotationMatrix.Rotation[ 1 ]     << ", " 
00354                                                         << _Output_GetSegmentLocalRotationMatrix.Rotation[ 2 ]     << ", " 
00355                                                         << _Output_GetSegmentLocalRotationMatrix.Rotation[ 3 ]     << ", " 
00356                                                         << _Output_GetSegmentLocalRotationMatrix.Rotation[ 4 ]     << ", " 
00357                                                         << _Output_GetSegmentLocalRotationMatrix.Rotation[ 5 ]     << ", " 
00358                                                         << _Output_GetSegmentLocalRotationMatrix.Rotation[ 6 ]     << ", " 
00359                                                         << _Output_GetSegmentLocalRotationMatrix.Rotation[ 7 ]     << ", " 
00360                                                         << _Output_GetSegmentLocalRotationMatrix.Rotation[ 8 ]     << ") " 
00361                                                         << Adapt( _Output_GetSegmentLocalRotationMatrix.Occluded ) << std::endl;
00362 
00363         // Get the local segment rotation in quaternion co-ordinates
00364         Output_GetSegmentLocalRotationQuaternion _Output_GetSegmentLocalRotationQuaternion = 
00365           MyClient.GetSegmentLocalRotationQuaternion( SubjectName, SegmentName );
00366         std::cout << "        Local Rotation Quaternion: (" << _Output_GetSegmentLocalRotationQuaternion.Rotation[ 0 ]     << ", " 
00367                                                             << _Output_GetSegmentLocalRotationQuaternion.Rotation[ 1 ]     << ", " 
00368                                                             << _Output_GetSegmentLocalRotationQuaternion.Rotation[ 2 ]     << ", " 
00369                                                             << _Output_GetSegmentLocalRotationQuaternion.Rotation[ 3 ]     << ") " 
00370                                                             << Adapt( _Output_GetSegmentLocalRotationQuaternion.Occluded ) << std::endl;
00371 
00372         // Get the local segment rotation in EulerXYZ co-ordinates
00373         Output_GetSegmentLocalRotationEulerXYZ _Output_GetSegmentLocalRotationEulerXYZ = 
00374           MyClient.GetSegmentLocalRotationEulerXYZ( SubjectName, SegmentName );
00375         std::cout << "        Local Rotation EulerXYZ: (" << _Output_GetSegmentLocalRotationEulerXYZ.Rotation[ 0 ]     << ", " 
00376                                                           << _Output_GetSegmentLocalRotationEulerXYZ.Rotation[ 1 ]     << ", " 
00377                                                           << _Output_GetSegmentLocalRotationEulerXYZ.Rotation[ 2 ]     << ") " 
00378                                                           << Adapt( _Output_GetSegmentLocalRotationEulerXYZ.Occluded ) << std::endl;
00379       }
00380 
00381       // Count the number of markers
00382       unsigned int MarkerCount = MyClient.GetMarkerCount( SubjectName ).MarkerCount;
00383       std::cout << "    Markers (" << MarkerCount << "):" << std::endl;
00384       for( unsigned int MarkerIndex = 0 ; MarkerIndex < MarkerCount ; ++MarkerIndex )
00385       {
00386         // Get the marker name
00387         std::string MarkerName = MyClient.GetMarkerName( SubjectName, MarkerIndex ).MarkerName;
00388 
00389         // Get the marker parent
00390         std::string MarkerParentName = MyClient.GetMarkerParentName( SubjectName, MarkerName ).SegmentName;
00391 
00392         // Get the global marker translation
00393         Output_GetMarkerGlobalTranslation _Output_GetMarkerGlobalTranslation =
00394           MyClient.GetMarkerGlobalTranslation( SubjectName, MarkerName );
00395 
00396         std::cout << "      Marker #" << MarkerIndex            << ": "
00397                                       << MarkerName             << " ("
00398                                       << _Output_GetMarkerGlobalTranslation.Translation[ 0 ]  << ", "
00399                                       << _Output_GetMarkerGlobalTranslation.Translation[ 1 ]  << ", "
00400                                       << _Output_GetMarkerGlobalTranslation.Translation[ 2 ]  << ") "
00401                                       << Adapt( _Output_GetMarkerGlobalTranslation.Occluded ) << std::endl;
00402       }
00403     }
00404 
00405     // Get the unlabeled markers
00406     unsigned int UnlabeledMarkerCount = MyClient.GetUnlabeledMarkerCount().MarkerCount;
00407     std::cout << "  Unlabeled Markers (" << UnlabeledMarkerCount << "):" << std::endl;
00408     for( unsigned int UnlabeledMarkerIndex = 0 ; UnlabeledMarkerIndex < UnlabeledMarkerCount ; ++UnlabeledMarkerIndex )
00409     { 
00410       // Get the global marker translation
00411       Output_GetUnlabeledMarkerGlobalTranslation _Output_GetUnlabeledMarkerGlobalTranslation =
00412         MyClient.GetUnlabeledMarkerGlobalTranslation( UnlabeledMarkerIndex );
00413 
00414       std::cout << "      Marker #" << UnlabeledMarkerIndex   << ": ("
00415                                     << _Output_GetUnlabeledMarkerGlobalTranslation.Translation[ 0 ] << ", "
00416                                     << _Output_GetUnlabeledMarkerGlobalTranslation.Translation[ 1 ] << ", "
00417                                     << _Output_GetUnlabeledMarkerGlobalTranslation.Translation[ 2 ] << ") " << std::endl;
00418     }
00419 
00420     // Count the number of devices
00421     unsigned int DeviceCount = MyClient.GetDeviceCount().DeviceCount;
00422     std::cout << "  Devices (" << DeviceCount << "):" << std::endl;
00423     for( unsigned int DeviceIndex = 0 ; DeviceIndex < DeviceCount ; ++DeviceIndex )
00424     {
00425       std::cout << "    Device #" << DeviceIndex << ":" << std::endl;
00426 
00427       // Get the device name and type
00428       Output_GetDeviceName _Output_GetDeviceName = MyClient.GetDeviceName( DeviceIndex );
00429       std::cout << "      Name: " << _Output_GetDeviceName.DeviceName << std::endl;
00430       std::cout << "      Type: " << Adapt( _Output_GetDeviceName.DeviceType ) << std::endl;
00431 
00432       // Count the number of device outputs
00433       unsigned int DeviceOutputCount = MyClient.GetDeviceOutputCount( _Output_GetDeviceName.DeviceName ).DeviceOutputCount;
00434       std::cout << "      Device Outputs (" << DeviceOutputCount << "):" << std::endl;
00435       for( unsigned int DeviceOutputIndex = 0 ; DeviceOutputIndex < DeviceOutputCount ; ++DeviceOutputIndex )
00436       {
00437         // Get the device output name and unit
00438         Output_GetDeviceOutputName _Output_GetDeviceOutputName = 
00439           MyClient.GetDeviceOutputName( _Output_GetDeviceName.DeviceName, DeviceOutputIndex );
00440 
00441         // Get the device output value
00442         Output_GetDeviceOutputValue _Output_GetDeviceOutputValue = 
00443           MyClient.GetDeviceOutputValue( _Output_GetDeviceName.DeviceName, _Output_GetDeviceOutputName.DeviceOutputName );
00444 
00445         std::cout << "        Device Output #" << DeviceOutputIndex                                     << ": "
00446                                                << _Output_GetDeviceOutputName.DeviceOutputName          << " "
00447                                                << _Output_GetDeviceOutputValue.Value                    << " " 
00448                                                << Adapt( _Output_GetDeviceOutputName.DeviceOutputUnit ) << " " 
00449                                                << Adapt( _Output_GetDeviceOutputValue.Occluded )        << std::endl;
00450       }
00451     }
00452   }
00453 
00454   if( TransmitMulticast )
00455   {
00456     MyClient.StopTransmittingMulticast();
00457   }
00458 
00459   // Disconnect and dispose
00460   MyClient.Disconnect();
00461 }


vicon_bridge
Author(s): Markus Achtelik
autogenerated on Sun Oct 5 2014 23:47:39