Changeset 20:89be93500e98 in xplra


Ignore:
Timestamp:
02/03/13 14:58:36 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added some further values to query

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/multigettest.cc

    r19 r20  
    5151    bool dontregister = false;
    5252    for(int i = 1; i<argc; ++i) {
    53         if (strcmp(argv[i], "dontregister")) {
     53        if (strcmp(argv[i], "dontregister")==0) {
    5454            dontregister = true;
    5555        }
     
    6565        MultiGetter getter(xplane);
    6666
     67        const size_t tailnumID = getter.addByteArray("sim/aircraft/view/acf_tailnum", 40);
     68        const size_t daysID = getter.addInt("sim/time/local_date_days");
     69        const size_t zuluSecID = getter.addFloat("sim/time/zulu_time_sec");
    6770        const size_t pausedID = getter.addInt("sim/time/paused");
    6871        const size_t latitudeID = getter.addDouble("sim/flightmodel/position/latitude");
     
    99102        const size_t altimeterID = getter.addFloat("sim/cockpit/misc/barometer_setting");
    100103        const size_t qnhID = getter.addFloat("sim/flightmodel/misc/Qstatic");
     104        const size_t navTypesID = getter.addIntArray("sim/cockpit/radios/nav_type", 6);
     105        const size_t busVoltsID = getter.addFloatArray("sim/cockpit2/electrical/bus_volts", 4);
    101106
    102107        if (dontregister) {
    103108            getter.finalize();
    104109        } else {
    105             printf("Registering getter\n\n");
     110            printf("Registering getter...\n");
    106111            getter.registerInXPlane();
     112            printf("Registered getter.\n\n");
    107113        }
    108114
     115        const int32_t& days = getter.getIntRef(daysID);
     116        const float& zuluSec = getter.getFloatRef(zuluSecID);
     117        printf("AAA2\n");
    109118        const int32_t& paused = getter.getIntRef(pausedID);
    110119        const double& latitude = getter.getDoubleRef(latitudeID);
     
    142151        const float& altimeter = getter.getFloatRef(altimeterID);
    143152        const float& qnh = getter.getFloatRef(qnhID);
     153        const int32_t* navTypes = getter.getIntArray(navTypesID);
     154        const float* busVolts = getter.getFloatArray(busVoltsID);
    144155
    145156        while(true) {
    146157            getter.execute();
     158            printf("tail number: '%s', days: %d, zuluSec: %f\n",
     159                   getter.getString(tailnumID).c_str(), days, zuluSec);
    147160            printf("paused=%d, replay=%d, overspeed=%d, stalled=%d, onTheGround=%d\n",
    148161                   paused, replay, overspeed, stalled, onTheGround);
     
    161174            printf("altimeter: %f, qnh: %f\n",
    162175                   altimeter, qnh);
     176            printf("NAV types: %d %d %d %d %d %d\n",
     177                   navTypes[0], navTypes[1], navTypes[2],
     178                   navTypes[3], navTypes[4], navTypes[5]);
     179            printf("bus voltages: %f %f %f %f\n",
     180                   busVolts[0], busVolts[1], busVolts[2], busVolts[3]);
    163181            printf("\n");
    164182            Thread::sleep(1000);
Note: See TracChangeset for help on using the changeset viewer.