An internal module of Peer Manager . A module for managing persistent storing of GATT attributes pertaining to the GATT server role of the local device. More...
Data Structures |
|
| struct | gscm_evt_t |
|
Structure containing an event from the GSCM module.
More...
|
|
Typedefs |
|
| typedef void(* | gscm_evt_handler_t )( gscm_evt_t const *p_event) |
|
Event handler for events from the GATT Server Cache Manager module.
More...
|
|
Enumerations |
|
| enum |
gscm_evt_id_t
{
GSCM_EVT_LOCAL_DB_CACHE_STORED , GSCM_EVT_LOCAL_DB_CACHE_UPDATED , GSCM_EVT_SC_STATE_STORED } |
|
Events that can come from the GATT Server Cache Manager module.
More...
|
|
Functions |
|
| ret_code_t | gscm_init ( gscm_evt_handler_t evt_handler) |
|
Function for initializing the GATT Server Cache Manager module.
More...
|
|
| ret_code_t | gscm_local_db_cache_update (uint16_t conn_handle) |
|
Function for triggering local GATT database data to be stored persistently. Values are retrieved from the SoftDevice and written to persistent storage.
More...
|
|
| ret_code_t | gscm_local_db_cache_apply (uint16_t conn_handle) |
|
Function for applying stored local GATT database data to the SoftDevice. Values are retrieved from persistent storage and given to the SoftDevice.
More...
|
|
| ret_code_t | gscm_local_db_cache_set ( pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t *p_local_db) |
|
Function for setting new values in the local database cache.
More...
|
|
| ret_code_t | gscm_local_db_cache_get ( pm_peer_id_t peer_id, pm_peer_data_local_gatt_db_t *p_local_db) |
|
Function for retrieving values in the local database cache.
More...
|
|
| void | gscm_local_database_has_changed (void) |
|
Function for storing the fact that the local database has changed, for all currently bonded peers.
More...
|
|
| bool | gscm_service_changed_ind_needed (uint16_t conn_handle) |
|
Function for checking if a service changed indication should be sent.
More...
|
|
| ret_code_t | gscm_service_changed_ind_send (uint16_t conn_handle) |
|
Function for sending a service changed indication to a connected peer.
More...
|
|
| void | gscm_peer_was_notified_of_db_change ( pm_peer_id_t peer_id) |
|
Function for specifying that a peer has been made aware of the latest local database change.
More...
|
|
Detailed Description
An internal module of Peer Manager . A module for managing persistent storing of GATT attributes pertaining to the GATT server role of the local device.
Typedef Documentation
| typedef void(* gscm_evt_handler_t)( gscm_evt_t const *p_event) |
Event handler for events from the GATT Server 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.
Enumeration Type Documentation
| enum gscm_evt_id_t |
Events that can come from the GATT Server Cache Manager module.
Function Documentation
| ret_code_t gscm_init | ( | gscm_evt_handler_t | evt_handler | ) |
Function for initializing the GATT Server Cache Manager module.
- Parameters
-
[in] evt_handler Callback for events from the GATT Server Cache Manager module.
- Return values
-
NRF_SUCCESS Initialization was successful. NRF_ERROR_NULL evt_handler was NULL.
| void gscm_local_database_has_changed | ( | void | ) |
Function for storing the fact that the local database has changed, for all currently bonded peers.
- Note
- This will cause a later call to gscm_service_changed_ind_needed to return true for a connection with a currently bonded peer.
| ret_code_t gscm_local_db_cache_apply | ( | uint16_t | conn_handle | ) |
Function for applying stored local GATT database data to the SoftDevice. Values are retrieved from persistent storage and given to the SoftDevice.
- Parameters
-
[in] conn_handle Connection handle to apply values to.
- Return values
-
NRF_SUCCESS Store operation started. BLE_ERROR_INVALID_CONN_HANDLE conn_handle does not refer to an active connection with a bonded peer. NRF_ERROR_INVALID_DATA The stored data was rejected by the SoftDevice, which probably means that the local database has changed. The system part of the sys_attributes was attempted applied, so service changed indications can be sent to subscribers. NRF_ERROR_BUSY Unable to perform operation at this time. Reattempt later. NRF_ERROR_INVALID_STATE Module is not initialized.
- Returns
- An unexpected return value from an internal function call.
| ret_code_t gscm_local_db_cache_get | ( | pm_peer_id_t | peer_id , |
| pm_peer_data_local_gatt_db_t * | p_local_db | ||
| ) |
Function for retrieving values in the local database cache.
- Parameters
-
[in] peer_id Peer to get values for. [in,out] p_local_db Where to store the data. The length field needs to reflect the available buffer space. On a successful read, the length field is updated to match the length of the read data.
- 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.
| ret_code_t gscm_local_db_cache_set | ( | pm_peer_id_t | peer_id , |
| pm_peer_data_local_gatt_db_t * | p_local_db | ||
| ) |
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.
- The data in the pointer must be available until the GSCM_EVT_LOCAL_DB_STORED 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.
- Returns
- An unexpected return value from an internal function call.
| ret_code_t gscm_local_db_cache_update | ( | uint16_t | conn_handle | ) |
Function for triggering local GATT database data to be stored persistently. Values are retrieved from the SoftDevice and written to persistent storage.
- 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 connection with a bonded peer. NRF_ERROR_BUSY Unable to perform operation at this time. Reattempt later. 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.
| void gscm_peer_was_notified_of_db_change | ( | pm_peer_id_t | peer_id | ) |
Function for specifying that a peer has been made aware of the latest local database change.
- Note
- After calling this, a later call to gscm_service_changed_ind_needed will to return false for this peer unless gscm_local_database_has_changed is called again.
- Parameters
-
[in] peer_id The connection to send the indication on.
| bool gscm_service_changed_ind_needed | ( | uint16_t | conn_handle | ) |
Function for checking if a service changed indication should be sent.
- Parameters
-
[in] conn_handle The connection to check.
- Returns
- true if a service changed indication should be sent, false if not.
| ret_code_t gscm_service_changed_ind_send | ( | uint16_t | conn_handle | ) |
Function for sending a service changed indication to a connected peer.
- Parameters
-
[in] conn_handle The connection to send the indication on.
- Return values
-
NRF_SUCCESS Indication sent or not needed. BLE_ERROR_INVALID_CONN_HANDLE conn_handle does not refer to an active connection. NRF_ERROR_BUSY Unable to send indication at this time. Reattempt later. BLE_ERROR_GATTS_SYS_ATTR_MISSING Information missing. Apply local cache, then reattempt. NRF_ERROR_INVALID_PARAM From sd_ble_gatts_service_changed . Unexpected.