Skip to content

Commit

Permalink
Merge positioning API (#264)
Browse files Browse the repository at this point in the history
This merge commit adds the positioning API, including the following elements:

- common/ubx_protocol: utility functions to encode and decode a ubx-format message.
- gnss: API to talk to a GNSS chip, either directly connected over a UART or indirectly connected via/inside a cellular module.
- cell/u_cell_loc.h: a new component in the cellular API to talk with Cell Locate.
- common/location: the generic location API that will work with any GNSS, cellular or short-range module.
  • Loading branch information
RobMeades committed Aug 25, 2021
2 parents 1b927cb + f0d9f28 commit 8ac8e80
Show file tree
Hide file tree
Showing 95 changed files with 13,538 additions and 160 deletions.
82 changes: 44 additions & 38 deletions README.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion cell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ The cellular APIs are split into the following groups:
- `sec_tls`: TLS security features.
- `sock`: sockets, for exchanging data (but see the `common/sock` component for the best way to do this).
- `mqtt`: MQTT client (but see the `common/mqtt_client` component for the best way to do this).
- `loc`: getting a location fix using the Cell Locate service (but see the `common/location` component for the best way to do this); you will need an authentication token from the [Location Services section](https://portal.thingstream.io/app/location-services) of your [Thingstream portal](https://portal.thingstream.io/app/dashboard). If you have a GNSS chip attached via a cellular module and want to control it directly from your MCU, see the `gnss` API.

The module types supported by this implementation are listed in `api/u_cell_module_type.h`.

HOWEVER, this is the detailed API; if all you would like to do is bring up a bearer as simply as possible and then get on with exchanging data, please consider using the `common/network` API, along with the `common/sock`, `common/mqtt_client` and `common/security` APIs. You may still dip down into this API from the network level as the handles used at the network level are the ones generated here.
HOWEVER, this is the detailed API; if all you would like to do is bring up a bearer as simply as possible and then get on with exchanging data or establishing location, please consider using the `common/network` API, along with the `common/sock` API, the `common/security` API and the `common/location` API. You may still dip down into this API from the network level as the handles used at the network level are the ones generated here.

This API relies upon the `at_client` common component to send commands to and parse responses received from a cellular module.

Expand Down
3 changes: 2 additions & 1 deletion cell/api/u_cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ typedef enum {
U_CELL_ERROR_NOT_CONNECTED = U_ERROR_CELL_MAX - 7, /**< -263 if U_ERROR_BASE is 0. */
U_CELL_ERROR_NOT_FOUND = U_ERROR_CELL_MAX - 8, /**< -264 if U_ERROR_BASE is 0. */
U_CELL_ERROR_VALUE_OUT_OF_RANGE = U_ERROR_CELL_MAX - 9, /**< -265 if U_ERROR_BASE is 0. */
U_CELL_ERROR_TEMPORARY_FAILURE = U_ERROR_CELL_MAX - 10 /**< -266 if U_ERROR_BASE is 0. */
U_CELL_ERROR_TEMPORARY_FAILURE = U_ERROR_CELL_MAX - 10, /**< -266 if U_ERROR_BASE is 0. */
U_CELL_ERROR_CELL_LOCATE = U_ERROR_CELL_MAX - 11 /**< -267 if U_ERROR_BASE is 0. */
} uCellErrorCode_t;

/* ----------------------------------------------------------------
Expand Down
386 changes: 386 additions & 0 deletions cell/api/u_cell_loc.h

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions cell/src/u_cell.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ void uCellDeinit()
uCellPrivateScanFree(&(pInstance->pScanResults));
// Free any chip to chip security context
uCellPrivateC2cRemoveContext(pInstance);
// Free any location context and associated URC
uCellPrivateLocRemoveContext(pInstance);
free(pInstance);
}

Expand Down Expand Up @@ -230,6 +232,7 @@ int32_t uCellAdd(uCellModuleType_t moduleType,
pInstance->pModule = &(gUCellPrivateModuleList[moduleType]);
pInstance->pSecurityC2cContext = NULL;
pInstance->pMqttContext = NULL;
pInstance->pLocContext = NULL;
pInstance->pNext = NULL;

// Now set up the pins
Expand Down Expand Up @@ -364,6 +367,8 @@ void uCellRemove(int32_t cellHandle)
uCellPrivateScanFree(&(pInstance->pScanResults));
// Free any chip to chip security context
uCellPrivateC2cRemoveContext(pInstance);
// Free any location context and associated URC
uCellPrivateLocRemoveContext(pInstance);
free(pInstance);
}

Expand Down

0 comments on commit 8ac8e80

Please sign in to comment.