1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Getting the NAV IDENT and NAV NAME

Discussion in 'SimConnect' started by Alphadog, 15/12/06.

  1. Alphadog

    Alphadog Guest

    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?
    Last edited by a moderator: 15/12/06
  2. lc0277

    lc0277

    Joined:
    25/9/06
    Messages:
    156
    Country:
    france
    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

Share This Page