Hello,
I'm trying to determine if the user has autopilot enabled via SimConnect, but I'm running into some problems with the bool types of the simvars I'm trying to request.
I'm sending a request for "autopilot available" and "autopilot master", both of which are listed in the simvar doc as being not writable (which is fine, I just want to see them) and of type boolean.
I've created my local structure to have two bool vars, and set up the data definition stuff:
struct AutopilotInfo
{
bool available;
bool onOff;
};
hr = SimConnect_AddToDataDefinition(hSimConnect, D_AUTOPILOT_INFO, "AUTOPILOT AVAILABLE", "Boolean");
hr = SimConnect_AddToDataDefinition(hSimConnect, D_AUTOPILOT_INFO, "AUTOPILOT MASTER", "Boolean");
However when I request this struct for my user plane, I'm always apparently getting back false. Even when I know it's on (ie: turning it on manually in the virtual cockpit in the Constellation, for example).
The documentation states that bool values are ints, with 0 being false and something else (probably 1 or -1 for true). So I changed my Autopilot struct to have ints. However - whenever I request the data again, I'm getting a result from the 'autopilot available' var as 0 always, and the autopilot master var as 1072693248 all the time - again, regardless of the actual state of the autopilot.
struct AutopilotInfo
{
int available;
int onOff;
};
AutopilotInfo *pAI = (AutopilotInfo*)&pObjData->dwData;
printf("\nAutopilot Info:: Avail: %i, On: %i", pAI->available, pAI->onOff);
Am I checking the wrong variables for the state of the autopilot? Am I correctly using an int for these bool variables or should I be using something else?
Also - is there a way on the glass cockpits (such as the default Bravo with G1000) to tell when autopilot is on or off?
Thanks,
david |