# Example code Source: [https://docs.qualcomm.com/doc/80-PK177-134/topic/edgnss_example_code.html](https://docs.qualcomm.com/doc/80-PK177-134/topic/edgnss_example_code.html) ## Java **Required Imports** import com.qualcomm.qti.qesdkIntf.IQesdk; import com.qualcomm.qti.qesdk.QesdkStatusException; import com.qualcomm.qti.qesdk.Location.PP_eDGNSSUDT; import com.qualcomm.qti.qesdk.Location.IPP_eDGNSSCBs; import com.qualcomm.qti.qesdk.Location.PP_eDGNSSEnums; import com.qualcomm.qti.qesdk.Location.PP_eDGNSSManager;Copy to clipboard **Declare required objects** private IQesdk mQesdkManager;Copy to clipboard private PP_eDGNSSManager mPpeEdgnssManager;Copy to clipboard **Create the QESDK Manager Instance and intialize** mQesdkManager = IQesdk.createInstance(this);Copy to clipboard **Create eDGNSS instance as required** mPpeEdgnssManager = new PP_eDGNSSManager(mQesdkManager); int status = PP_eDGNSSSManager.init([String license], (opcodes, subsystem) -> { // Handle QESDK event });Copy to clipboard **Setup callbacks** IQesdkEventCallBack eventCallbackHandler = new IQesdkEventCallBack() { @OverrideCopy to clipboard public void onEvent(int opcode, int[] subsys) { // Handle QESDK event } }; IPP_eDGNSSCBs.ILocationCapabilitiesCallback locationCapabilitiesCallback = new IPP_eDGNSSCBs.ILocationCapabilitiesCallback() { @Override public void onValues(long l) { // Check precise positioning Capabilities } }; // For controlling correction data streaming to Precise Positioning engine IPP_eDGNSSCBs.ICorrectionStreamingControlCallback streamingControlCallback = new IPP_eDGNSSCBs.ICorrectionStreamingControlCallback() { @Override public void onValues(PP_eDGNSSEnums.CorrectionStreamingState correctionStreamingState) { // Start or Stop correction data streaming as requested } // For handling location reports private IPP_eDGNSSCBs.ILocationReportCallback eDgnssLocationReportCallback = new IPP_eDGNSSCBs.ILocationReportCallback() { @Override public void onValues(PP_eDGNSSUDT.Location location) { // Handle eDGNSS location report callback } };Copy to clipboard **Get location capabilities** registerLocationCapabilitiesCallback(locationCapabilitiesCallback)Copy to clipboard **Update NTRIP GGA consent for native NTRIP client (OEM apps only)** mPpeEdgnssManager.updateNTRIPGGAConsent(ntripGgaConsent);Copy to clipboard **Configure the native NTRIP client if required (OEM apps only)** // enable Native NTRIP client mPpeEdgnssManager.enablePPENtripStream(hostNameOrIp, mountPoint, username, password, port, requiresNmeaLocation, useSSL, enableRTKEngine); mPpeEdgnssManager.enablePPENtripStreamV2( new PP_eDGNSSUDT.NtripStreamParams( hostNameOrIp, mountPoint, username, password, port, requiresNmeaLocation, useSSL, enableRTKEngine, nmeaUpdateInterval)); // Disable Native NTRIP client mPpeEdgnssManager.disablePPENtripStream();Copy to clipboard **Register as correction data provider** mPpeEdgnssManager.registerAsCorrectionDataSource( correctionDataType, streamingControlCallback);Copy to clipboard **Deregister as correction data provider** mPpeEdgnssManager.deRegisterAsCorrectionDataSource();Copy to clipboard **Send request for precise location updates** mPpeEdgnssManager.requestPreciseLocationUpdates( minIntervalMillis, eDgnssLocationReportCallback);Copy to clipboard **Remove request for precise location updates** mPpeEdgnssManager.removePreciseLocationUpdates(eDgnssLocationReportCallback)Copy to clipboard **On receiving StreamingControlCallback to start the correction data injection, download from** **application NTRIP client and inject correction data.** mPpeEdgnssManager.injectCorrectionData(correctionData);Copy to clipboard **Receive the precise location reports in the registered ILocationReportCallback** ## Native **Required includes** #include "qesdk_ndk.h" #include "qesdk_Location_PP_eDGNSS.h"Copy to clipboard **Initialize** PP_eDGNSSManager *edgnssManager = new PP_eDGNSSManager(); ret = edgnssManager->init(nativeLicense, len, event_callback_handler);Copy to clipboard **Setup callbacks** void event_callback_handler(uint32_t opcode, uint32_t subsys[]) { // Callback to handle QESDK events } void location_capabilities_callback(uint64_t capabilitiesMask){ // Check precise positioning Capabilities } void edgnss_CorrectionStreamingControlCallback(pp_edgnss_CorrectionStreamingState streamingState){ // Start or Stop correction data streaming as requested } void edgnss_LocationReportCallback(pp_edgnss_Location location){ // Handle eDGNSS location report callback }Copy to clipboard **Get location capabilities** pp_edgnss_LocationStatus ret = pp_edgnss_LocationStatus::QESDK_GENERIC_FAILURE; qesdk_transaction_status qesdk_ndk_response = edgnssManager- >registerLocationCapabilitiesCallback(location_capabilities_callback, ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Update NTRIP GGA consent for native NTRIP client (OEM apps only)** qesdk_ndk_response = edgnssManager- >updateNTRIPGGAConsent(ntrip_gga_consent, ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Configure the native NTRIP client if required (OEM apps only)** qesdk_ndk_response = edgnssManager->enablePPENtripStream(hostNameIP, mountPoint, userName, pass, server_port, require_nmealocation, use_ssl, enable_rtkengine, ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() } qesdk_transaction_status qesdk_ndk_response = edgnssManager->enablePPENtripStreamV2(ntrip_stream_params,qsap_api_response); if(qesdk_ndk_response.is_ok()) ALOGI("edgnssManager->enablePPENtripStreamV2(): %d", qsap_api_response); else ALOGI("QESDK NDK error code: %d", qesdk_ndk_response.get_error_code()); qesdk_ndk_response = edgnssManager->disablePPENtripStream(ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Register as correction data provider** qesdk_ndk_response = edgnssManager- >registerAsCorrectionDataSource((pp_edgnss_CorrectionDataType)correction_data_ type, edgnss_CorrectionStreamingControlCallback, ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Deregister as correction data provider** qesdk_ndk_response = edgnssManager->deRegisterAsCorrectionDataSource(ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Send request for precise location updates** qesdk_ndk_response = edgnssManager->requestPreciseLocationUpdates(min_interval_ms, edgnss_LocationReportCallback, ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Remove request for precise location updates** qesdk_ndk_response = edgnssManager- >removePreciseLocationUpdates(edgnss_LocationReportCallback, ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **On receiving StreamingControlCallback to start the correction data injection, download from** **application NTRIP client and inject correction data.** qesdk_ndk_response = edgnssManager->injectCorrectionData(corr_data, ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Receive the precise location reports in the registered ILocationReportCallback** **Parent Topic:** [eDGNSS](https://docs.qualcomm.com/doc/80-PK177-134/topic/edgnss.html) Last Published: Nov 14, 2024 [Previous Topic Ntrip Stream Parameters](https://docs.qualcomm.com/bundle/publicresource/80-PK177-134/topics/ntrip_stream_params_edgnss.md) [Next Topic RTK](https://docs.qualcomm.com/bundle/publicresource/80-PK177-134/topics/rtk.md)