PDA

View Full Version : Getting the NAV IDENT and NAV NAME


Alphadog
15 Dec 2006, 12:13
Hello all.

I'm getting garbage data when reading the NAV and ADF "strings" available in Aircraft Avionics Data section.

For example, in my struct, I've defined:

struct ScAircraftAvionicsData
{
...
CHAR nav_ident[128];
...
};

And, I've added the AddToDataDefinition call which returns S_OK:
hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINE_ID, "NAV IDENT", "String", SIMCONNECT_DATATYPE_STRING128);

But, I'm receiving garbage data when copying data into the struct:
ScAircraftAvionicsData*pS = (ScAircraftAvionicsData*) &pObjData->dwData;

(i.e. pS->nav_ident contains garbage)

In addition, I receive the following SIMCONNECT_EXCEPTION data:
dwException = SIMCONNECT_EXCEPTION_NAME_UNRECOGNIZED
dwSendID = 145 (in this case...)
dwIndex = 3
cbData = 24

What am I doing wrong?

lc0277
15 Dec 2006, 13:58
The dwIndex member of the exception structure tells you what is the argument that caused an error. In that case it's the "String" argument of the AddToDataDefinition(). Generally for variables without units, you don't need to provide something here, a NULL or empty string is just fine.

Moreover, you'll need to specify the index of the NAV receiver. As usual, you can choose either NAV1 IDENT or NAV IDENT:1