Use Assistance Data

After you have received a response Message that contains assistance or correctional data from GNSS Assistance Data Service, you have to decode the payload data if it is in BER encoded LPP format.

If Message.Data.data_type is one of the following data types: DATATYPE_AGNESS_*, DATATYPE_*_CLOCKS, DATATYPE_*_ORBITS or DATATYPE_NAV_MODEL_PREDICTIONS_*, the data is in BER encoded LPP format.

For the ASN.1 schema that must be used to decode the payloads, see LPP ASN.1 Schema.

The example below demonstrates how to decode the BER encoded LPP data using C++ code, protobuf classes generated by Google protoc compiler, and a LPP decoder generated from ASN.1 schema by using asn1c compiler.

// Subscribe to GNSS assistance data
serverSubscription::subscriptions subs;

// Subscribe to GPS, GLONAS, Beidou, Galileo and QZSS assistance data

    [this](const here::gnss::Message_Data *msg) // Message_Data has been generated to Google protoc compiler
        if (msg == nullptr)
            mServerConnection = false;
        else if ((msg->data_type() == here::gnss::DATATYPE_AGNSS_GPS) ||
                (msg->data_type() == here::gnss::DATATYPE_AGNSS_GLO) ||
                (msg->data_type() == here::gnss::DATATYPE_AGNSS_GAL) ||
                (msg->data_type() == here::gnss::DATATYPE_AGNSS_QZS) ||
                (msg->data_type() == here::gnss::DATATYPE_AGNSS_BEI))
            // Decode BER encoded LPP data to this structure
            // The structure definition has been generated from ASN.1 schema
            // by asn1c compiler
            A_GNSS_ProvideAssistanceData_t *structure = NULL;

            // ber_decode function has been generated by asn1c compiler
            asn_dec_rval_t rval = ber_decode(
                (void **)&structure,

            if(rval.code == RC_FAIL || rval.consumed < 2)
                LOGE(TAG, "Decoding LPP data failed");
                ASN_STRUCT_FREE(asn_DEF_A_GNSS_ProvideAssistanceData, structure);
                return false;

            // Use the decoded data. In this example we just copy the iono model.
            if (structure->gnss_CommonAssistData)
                if (structure->gnss_CommonAssistData->gnss_IonosphericModel)
                    if (structure->gnss_CommonAssistData->gnss_IonosphericModel->klobucharModel)
                        ionUtc.alpha0 = structure->gnss_CommonAssistData->gnss_IonosphericModel->klobucharModel->alfa0;
                        ionUtc.alpha1 = structure->gnss_CommonAssistData->gnss_IonosphericModel->klobucharModel->alfa1;
                        ionUtc.alpha2 = structure->gnss_CommonAssistData->gnss_IonosphericModel->klobucharModel->alfa2;
                        ionUtc.alpha3 = structure->gnss_CommonAssistData->gnss_IonosphericModel->klobucharModel->alfa3;
                        ionUtc.beta0 = structure->gnss_CommonAssistData->gnss_IonosphericModel->klobucharModel->beta0;
                        ionUtc.beta1 = structure->gnss_CommonAssistData->gnss_IonosphericModel->klobucharModel->beta1;
                        ionUtc.beta2 = structure->gnss_CommonAssistData->gnss_IonosphericModel->klobucharModel->beta2;
                        ionUtc.beta3 = structure->gnss_CommonAssistData->gnss_IonosphericModel->klobucharModel->beta3;


            ASN_STRUCT_FREE(asn_DEF_A_GNSS_ProvideAssistanceData, structure);

If Message.Data.data_type is DATATYPE_IONEX or DATATYPE_BSX, then Message.Data.payload data is in a text based format.

results matching ""

    No results matching ""