Skip to content

GNSS&LBS&Wi-Fi Positioning API

API Overview

FunctionDescription
Qth_locGetSupportType()Gets the supported positioning techniques.
Qth_locGetInsideLocation()Gets the location data of the module's built-in Wi-Fi positioning feature.
Qth_locSendInsideLocation()Reports the location data of the module's built-in Wi-Fi positioning feature.
Qth_locSendOutsideLocation()Reports the location data obtained from the external GNSS module.

API Description

Qth_locGetSupportType

This function gets the supported positioning techniques.

Prototype

c
char *Qth_locGetSupportType();

Parameter

  • Input Parameter

    • None
  • Output Parameter

    • None
  • Return Value

    • The supported positioning technique(s): Successful execution
    • NULL: Failed execution

Example

c
char *locType = NULL;

locType = Qth_locGetSupportType();
Qhal_mem_free(locType);

Qth_locGetInsideLocation

This function gets the location data of the module's built-in Wi-Fi positioning feature.

Prototype

c
void *Qth_locGetInsideLocation(void);

Parameter

  • Input Parameter

    • None
  • Output Parameter

    • None
  • Return Value

    • The location data of the module's built-in Wi-Fi positioning feature in TTLV format: Successful execution
    • NULL: Failed execution

Example

c
void *nmeaTtlv = NULL;

nmeaTtlv = Qth_locGetInsideLocation();
Quos_ttlvFree(&nmeaTtlv);

Qth_locSendInsideLocation

This function reports the location data of the module's built-in Wi-Fi positioning feature.

Prototype

c
oprt_ret Qth_locSendInsideLocation(quint16_t *pkgId, Qth_sendCb_f sendCb);

Parameter

  • Input Parameter

    • Qth_sendCb_fsendCb: Callback function of the data reporting result.
      • Prototype
        c
        typedef void (*Qth_sendCb_f)(quint16_t pkgId, qbool result);
  • Output Parameter

  • quint16_tpkgId: PkgID of the reported data.

  • Return Value

    • OPRT_OK: Successful execution
    • Other values: Failed execution. See Error Code List for details.

Example

c

void sendCb(quint16_t pkgId, qbool result)
{
    Quos_logPrintf(LL_DBG, "recv send event, pkgId:%u, result:%d", pkgId, result);
}

quint16_t pkgId = 0;
oprt_ret ret = OPRT_OK;
ret = Qth_locSendInsideLocation(&pkgId, sendCb);
if (OPRT_OK != ret)
{
    Quos_logPrintf(APPS_OPEN, LL_ERR, "send inside location error");
}

Qth_locSendOutsideLocation

This function reports the location data obtained from the external GNSS module.

Prototype

c
oprt_ret Qth_locSendOutsideLocation(char *location, quint16_t *pkgId, Qth_sendCb_f sendCb)

Parameter

  • Input Parameter

    • char *location: The location data obtained from the external GNSS module.

    • Qth_sendCb_fsendCb: Callback function of the data reporting result. If you do not care about the reporting result, you can set this parameter to "NULL".

      • Prototype
      c
      typedef void (*Qth_sendCb_f)(quint16_t pkgId, qbool result);
  • Output Parameter

  • quint16_tpkgId: PkgID of the reported data. If you do not care about the reporting result, you can set this parameter to "NULL".

  • Return Value

    • OPRT_OK: Successful execution
    • Other values: Failed execution. See Error Code List for details.

Example

c
void sendCb(quint16_t pkgId, qbool result)
{
    Quos_logPrintf(LL_DBG, "recv send event, pkgId:%u, result:%d", pkgId, result);
}

quint16_t pkgId = 0;
oprt_ret ret = OPRT_OK;
ret = Qth_locSendOutsideLocation("$GPGGA,095029.82,3012.5500,N,12012.7273,E,1,8,1.098,42.110,M,,M,,*70", &pkgId, sendCb);
if (OPRT_OK != ret)
{
    Quos_logPrintf(APPS_OPEN, LL_ERR, "send outside location error");
}

Error Code List

Enumeration ValueHexadecimalDecimalDescription
OPRT_OK-0x0000-0Successful execution.
OPRT_COM_ERROR-0x0001-1General error.
OPRT_INVALID_PARM-0x0002-2Invalid parameter.
OPRT_MALLOC_FAILED-0x0003-3Memory allocation failed.
OPRT_NOT_SUPPORTED-0x0004-4Not supported.
OPRT_NOT_FOUND-0x0005-5Object not found.
OPRT_INDEX_OUT_OF_BOUND-0x0006-6Index out of bounds.
OPRT_EXCEED_UPPER_LIMIT-0x0007-7Exceed upper limit.
OPRT_NOT_EXIST-0x0008-8Not exist.
OPRT_QTH_LOC_OUTSIDE_IS_NULL-0x1500-5376The location data obtained from the external GNSS module is null.