Utility APIs offered by the device manager to get information about the peer if and when needed.
More...
Utility APIs offered by the device manager to get information about the peer if and when needed.
This group of API allow the application to access information that is not required to be maintained by the application but may be needed. Hence it is possible to get the information from the module instead of mapping all the information with a device context.
Function for deleting Application Context for a peer device identified by the 'p_handle' parameter.
Delete Application Context for a peer device identified by the 'p_handle' parameter. If this API returns NRF_SUCCESS, DM_EVT_APPL_CONTEXT_DELETED event is notified to the application. The event result notified along with the event and indicates success or failure of this procedure.
- Parameters
-
[in] | p_handle | Identifies peer device for which procedure is requested. |
- Return values
-
NRF_SUCCESS | On success, else an error code indicating reason for failure. |
NRF_ERROR_INVALID_STATE | If the API is called without module initialization and/or application registration. |
NRF_ERROR_NULL | If the p_handle is NULL. |
NRF_ERROR_INVALID_ADDR | If peer is not identified the handle provided by the application. |
DM_NO_APP_CONTEXT | If no application context was set that can be deleted. |
- Note
- The API returns FEATURE_NOT_ENABLED if the DEVICE_MANAGER_APP_CONTEXT_SIZE is set to zero.
Function for getting Application Context for a peer device identified by the 'p_handle' parameter.
Get Application Context for a peer device identified by the 'p_handle' parameter. If this API returns NRF_SUCCESS, DM_EVT_APPL_CONTEXT_LOADED event is notified to the application. Event result notified along with the event indicates success or failure of this procedure.
- Parameters
-
[in] | p_handle | Identifies peer device for which procedure is requested. |
[in] | p_context | Application context being requested. The context information includes length of data and pointer to the contextual data is provided. |
- Return values
-
NRF_SUCCESS | On success, else an error code indicating reason for failure. |
NRF_ERROR_INVALID_STATE | If the API is called without module initialization and/or application registration. |
NRF_ERROR_NULL | If p_handle and/or p_context is NULL. |
NRF_ERROR_INVALID_ADDR | If the peer is not identified by the handle provided by the application. |
DM_NO_APP_CONTEXT | If no application context was set that can be fetched. |
- Note
- The API returns FEATURE_NOT_ENABLED in case DEVICE_MANAGER_APP_CONTEXT_SIZE is set to zero.
Function for setting Application Context for a peer device identified by the 'p_handle' parameter.
This application allows the setting of the application context for the peer device identified by the 'p_handle'. Application context is stored persistently by the module and can be requested by the application at any time using the dm_application_context_get API. Note that this procedure is permitted only for bonded devices. If the device is not bonded, application context cannot be set. However, it is not mandatory that the bonded device is connected when requesting this procedure.
- Parameters
-
[in] | p_handle | Identifies peer device for which procedure is requested. |
[in] | p_context | Application context being set. The context information includes length of the data and pointer to the contextual data being set. The memory pointed to by the data pointer is assumed to be resident when API is being called and can be freed or reused once the set procedure is complete. Set procedure completion is notified by the event DM_EVT_APPL_CONTEXT_STORED. The event result is notified along with the event and indicates success or failure of this procedure. |
- Return values
-
NRF_SUCCESS | On success, else an error code indicating reason for failure. |
NRF_ERROR_INVALID_STATE | If the API is called without module initialization and/or application registration. |
NRF_ERROR_NULL | If p_handle and/or p_context is NULL. |
NRF_ERROR_INVALID_ADDR | If peer is not identified the handle provided by the application. |
- Note
- The API returns FEATURE_NOT_ENABLED in case DEVICE_MANAGER_APP_CONTEXT_SIZE is set to zero.
Function for deleting a peer device context and all related information from the database.
Delete peer device context and all related information from database. If this API returns NRF_SUCCESS, DM_EVT_DEVICE_CONTEXT_DELETED event is notified to the application. Event result notified along with the event indicates success or failure of this procedure.
- Parameters
-
[in] | p_handle | Identifies the peer device to be deleted. |
- Return values
-
NRF_SUCCESS | on success, else an error code indicating reason for failure. |
NRF_ERROR_INVALID_STATE | In the API is called without module initialization and/or application registration. |
NRF_ERROR_NULL | If p_handle is NULL. |
NRF_ERROR_INVALID_ADDR | If peer is not identified the handle provided by the application. |
- Note
- Deleting device context results in deleting service and application context for the bonded device. The respective events DM_EVT_SERVICE_CONTEXT_DELETED and DM_EVT_APPL_CONTEXT_DELETED are not notified to the application.
Function for deleting all peer device context and all related information from the database.
Delete peer device context and all related information from database. If this API returns NRF_SUCCESS, DM_EVT_DEVICE_CONTEXT_DELETED event is notified to the application for each device that is deleted from the data base. Event result notified along with the event indicates success or failure of this procedure.
- Parameters
-
[in] | p_handle | Identifies application instance that is requesting the deletion of all bonded devices. |
- Return values
-
NRF_SUCCESS | On success, else an error code indicating reason for failure. |
NRF_ERROR_INVALID_STATE | If the API is called without module initialization and/or application registration. |
NRF_ERROR_NULL | If p_handle is NULL. |
NRF_ERROR_INVALID_ADDR | If peer is not identified the handle provided by the application. |
- Note
- Deleting device context results in deleting both service and application context for the bonded device. The respective events DM_EVT_SERVICE_CONTEXT_DELETED and DM_EVT_APPL_CONTEXT_DELETED are not notified to the application.
Function for deleting a Service Context for a peer device identified by the 'p_handle' parameter.
This API allows application to delete a Service Context identified for a peer device identified by the 'p_handle' parameter. If this API returns NRF_SUCCESS, DM_EVT_SERVICE_CONTEXT_DELETED event is notified to the application. Event result is notified along with the event and indicates success or failure of this procedure.
- Parameters
-
[in] | p_handle | Identifies peer device for which procedure is requested. |
- Return values
-
NRF_SUCCESS | On success, else an error code indicating reason for failure. |
NRF_ERROR_INVALID_STATE | If the API is called without module initialization and/or application registration. |
NRF_ERROR_NULL | If p_handle is NULL. |
NRF_ERROR_INVALID_ADDR | If the peer is not identified by the handle provided by the application. |
Function for getting Service Context for a peer device identified by 'p_handle' parameter.
Get Service Context for a peer device identified by the 'p_handle' parameter. If this API returns NRF_SUCCESS, DM_EVT_SERVICE_CONTEXT_LOADED event is notified to the application. The event result is notified along with the event indicates success or failure of this procedure.
- Parameters
-
[in] | p_handle | Identifies peer device for which procedure is requested. |
[in] | p_context | Application context being requested. The context information includes length of the data and a pointer to the data. Note that requesting a 'get' of application does not need to provide memory, the pointer to data will be pointing to service data and hence no data movement is involved. |
- Return values
-
NRF_SUCCESS | On success, else an error code indicating reason for failure. |
NRF_ERROR_INVALID_STATE | In case API is called without module initialization and/or application registration. |
NRF_ERROR_NULL | If p_handle is NULL. |
NRF_ERROR_INVALID_ADDR | If the peer is not identified by the handle provided by the application. |
Function for setting Service Context for a peer device identified by 'p_handle' parameter.
This API allows application to Set Service Context for a peer device identified by the 'p_handle' parameter. This API is useful when the Service Context cannot be requested from the SoftDevice, but needs to be assembled by the application or an another module. (or when service context is exchanged in an out of band way.) This API could also be used to trigger a storing of service context into persistent memory. If this is desired, a NULL pointer could be passed to the p_context.
- Parameters
-
[in] | p_handle | Identifies peer device for which the procedure is requested. |
[in] | p_context | Service context being set. The context information includes length of data and pointer to the contextual data being set. The memory pointed to by the pointer to data is assumed to be resident when API is being called and can be freed or reused once the set procedure is complete. Set procedure completion is indicated by the event DM_EVT_SERVICE_CONTEXT_STORED. The Event result is notified along with the event and indicates success or failure of this procedure. |
- Return values
-
NRF_SUCCESS | On success, else an error code indicating reason for failure. |
NRF_ERROR_INVALID_STATE | If the API is called without module initialization and/or application registration. |
NRF_ERROR_NULL | If p_handle is NULL. |
NRF_ERROR_INVALID_ADDR | If the peer is not identified by the handle provided by the application. |