Changeset 15:1c0347ed41c6 in xplra for test
- Timestamp:
- 01/28/13 18:37:00 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/basictest.cc
r14 r15 37 37 using hu::varadiistvan::xplra::XPlane; 38 38 using hu::varadiistvan::xplra::Exception; 39 using hu::varadiistvan::xplra::ProtocolException; 39 40 40 41 //------------------------------------------------------------------------------ … … 47 48 printf("Connecting to X-Plane...\n"); 48 49 xplane.connect(); 49 printf("Connected to X-Plane.\n ");50 printf("Connected to X-Plane.\n\n"); 50 51 51 52 printf("Querying the number of the engines...\n"); 52 53 int numEngines = xplane.getInt("sim/aircraft/engine/acf_num_engines"); 53 printf("The number of engines: %d\n ", numEngines);54 printf("The number of engines: %d\n\n", numEngines); 54 55 55 printf("Querying an invalid dataref...\n"); 56 xplane.getInt("sim/aircraft/engine/num_engines"); 56 try { 57 printf("Querying an invalid dataref...\n"); 58 xplane.getInt("sim/aircraft/engine/num_engines"); 59 printf("\n>>>>>>>>>>>> Succeeded!!!!!!!!!!!!!!!!!!!!!!\n\n"); 60 } catch(const ProtocolException& exception) { 61 printf("Exception caugth: %s\n\n", exception.what()); 62 } 63 64 printf("Querying the spool time of a jet engine...\n"); 65 float spoolTime = xplane.getFloat("sim/aircraft/engine/acf_spooltime_jet"); 66 printf("The spool time: %f\n\n", spoolTime); 67 68 printf("Querying the spool time of a propeller...\n"); 69 spoolTime = xplane.getFloat("sim/aircraft/engine/acf_spooltime_prop"); 70 printf("The spool time: %f\n\n", spoolTime); 71 72 printf("Querying the coordinates...\n"); 73 double latitude = xplane.getDouble("sim/flightmodel/position/latitude"); 74 double longitude = xplane.getDouble("sim/flightmodel/position/longitude"); 75 printf("The coordinates: %f, %f\n\n", latitude, longitude); 57 76 58 77 return 0; 59 78 } catch(const Exception& exception) { 60 printf(" Exception caugth: %s\n", exception.what());79 printf("\n>>>>>>>>>>>>>>>>> Exception caugth: %s\n", exception.what()); 61 80 62 81 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.