An internal module of Peer Manager. A module for managing persistent storing of GATT attributes.
More...
An internal module of Peer Manager. A module for managing persistent storing of GATT attributes.
typedef void(* gcm_evt_handler_t)(gcm_evt_t const *p_event) |
Event handler for events from the GATT Cache Manager module.
- Parameters
-
[in] | event | The event that has happened. |
[in] | peer | The id of the peer the event pertains to. |
[in] | flags | The data the event pertains to. |
Events that can come from the GATT Cache Manager module.
Enumerator |
---|
GCM_EVT_LOCAL_DB_CACHE_STORED |
The persistent cache for the local database has been updated with provided values, for one peer.
|
GCM_EVT_LOCAL_DB_CACHE_UPDATED |
The persistent cache for the local database has been updated with values from the SoftDevice, for one peer.
|
GCM_EVT_LOCAL_DB_CACHE_APPLIED |
The SoftDevice has been given local database values from the persistent cache, for one peer.
|
GCM_EVT_ERROR_LOCAL_DB_CACHE_APPLY |
The stored local database values for a peer were rejected by the SoftDevice, which means the database has changed.
|
GCM_EVT_REMOTE_DB_CACHE_UPDATED |
The persistent cache for the remote database has been updated with provided values, for one peer.
|
GCM_EVT_SERVICE_CHANGED_INDICATION_SENT |
A service changed indication has been sent to and confirmed by a peer.
|
GCM_EVT_ERROR_DATA_SIZE |
An operation failed because the write buffer of the Peer Database module was not large enough. This is a fatal error.
|
GCM_EVT_ERROR_STORAGE_FULL |
An operation failed because there was no available storage room in persistent storage. Please free up room, and the operation will automatically continue.
|
GCM_EVT_ERROR_UNEXPECTED |
An operation failed with an unexpected error. The error is provided. This is possibly a fatal error.
|
void gcm_ble_evt_handler |
( |
ble_evt_t * |
p_ble_evt | ) |
|
Function for dispatching SoftDevice events to the GATT Cache Manager module.
- Parameters
-
[in] | p_ble_evt | The SoftDevice event. |
Function for initializing the GATT Cache Manager module.
- Parameters
-
[in] | evt_handler | Callback for events from the GATT Cache Manager module. |
- Return values
-
NRF_SUCCESS | Initialization was successful. |
NRF_ERROR_NULL | evt_handler was NULL. |
void gcm_local_database_has_changed |
( |
void |
| ) |
|
Function for manually informing that the local database has changed.
This causes a service changed notification to be sent to all bonded peers that subscribe to it.
Function for retrieving values in the local database cache.
- Note
- This function is not needed for regular operation of the module.
- Parameters
-
[in] | peer_id | Peer to get values for. |
[out] | p_local_db | Database values. |
- Return values
-
NRF_SUCCESS | Values retrieved successfully. |
NRF_ERROR_NOT_FOUND | The peer ID was invalid or unallocated. |
NRF_ERROR_NULL | p_local_db was NULL. |
NRF_ERROR_INVALID_STATE | Module is not initialized. |
Function for setting new values in the local database cache.
- Note
- If the peer is connected, the values will also be applied immediately to the connection.
-
This function is only needed when you want to override the regular functionality of the module.
-
The data in the pointer must be available until the GCM_EVT_LOCAL_DB_CACHE_SET event is received.
- Parameters
-
[in] | peer_id | Peer to set values for. |
[in] | p_local_db | Database values to apply. If NULL, the values will instead be cleared. |
- Return values
-
NRF_SUCCESS | Operation started, and values were applied (if connected). |
NRF_ERROR_NOT_FOUND | The peer ID was invalid or unallocated. |
NRF_ERROR_INVALID_STATE | Module is not initialized. |
ret_code_t gcm_local_db_cache_update |
( |
uint16_t |
conn_handle | ) |
|
Function for triggering local GATT database data to be stored persistently. Values are retrieved from SoftDevice and written to persistent storage.
- Note
- This function is only needed when you want to override the regular functionality of the module, e.g. to immediately store to flash instead of waiting for the native logic to perform the update.
- Parameters
-
[in] | conn_handle | Connection handle to perform update on. |
- Return values
-
NRF_SUCCESS | Store operation started. |
BLE_ERROR_INVALID_CONN_HANDLE | conn_handle does not refer to an active, bonded connection. |
NRF_ERROR_DATA_SIZE | Write buffer not large enough. Call will never work with this GATT database. |
NRF_ERROR_NO_MEM | No room in persistent_storage. Free up space; the operation will be automatically reattempted after the next compression procedure |
NRF_ERROR_INVALID_STATE | Module is not initialized. |
Function for retrieving a persistently stored remote database.
- Parameters
-
[in] | peer_id | Peer to retrieve data for. |
[in,out] | p_remote_db | Copied database values. |
- Return values
-
NRF_SUCCESS | Data retrieved successfully. |
NRF_ERROR_NOT_FOUND | The peer ID is invalid or unallocated. |
NRF_ERROR_NULL | p_remote_db is NULL. |
NRF_ERROR_INVALID_STATE | Module is not initialized. |
Function for storing a discovered remote database persistently.
- Parameters
-
[in] | peer_id | Peer to store the database for. |
[in] | p_remote_db | Database values to store. If NULL, values are cleared instead. |
- Return values
-
NRF_SUCCESS | Store procedure successfully started. |
NRF_ERROR_NOT_FOUND | The peer id is invalid or unallocated. |
NRF_ERROR_INVALID_STATE | Module is not initialized. |