Patched version of nrf51822 FOTA compatible driver, with GPTIO disabled, as it clashed with the mbed definitions...

Fork of nRF51822 by Nordic Semiconductor

Committer:
rgrover1
Date:
Wed Apr 15 08:59:11 2015 +0100
Revision:
103:138bdc859cc9
Child:
112:737b08b3b995
Synchronized with git rev fa183c40
Author: Rohit Grover
updating to v7.1 of the Nordic SDK.
Re-organized file layout to match that from the SDK.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rgrover1 103:138bdc859cc9 1 /* Copyright (C) 2013 Nordic Semiconductor. All Rights Reserved.
rgrover1 103:138bdc859cc9 2 *
rgrover1 103:138bdc859cc9 3 * The information contained herein is property of Nordic Semiconductor ASA.
rgrover1 103:138bdc859cc9 4 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
rgrover1 103:138bdc859cc9 5 *
rgrover1 103:138bdc859cc9 6 * Licensees are granted free, non-transferable use of the information. NO
rgrover1 103:138bdc859cc9 7 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
rgrover1 103:138bdc859cc9 8 * the file.
rgrover1 103:138bdc859cc9 9 *
rgrover1 103:138bdc859cc9 10 */
rgrover1 103:138bdc859cc9 11
rgrover1 103:138bdc859cc9 12 /**
rgrover1 103:138bdc859cc9 13 * @file device_manager.h
rgrover1 103:138bdc859cc9 14 *
rgrover1 103:138bdc859cc9 15 * @defgroup device_manager Device Manager
rgrover1 103:138bdc859cc9 16 * @ingroup ble_sdk_lib
rgrover1 103:138bdc859cc9 17 * @{
rgrover1 103:138bdc859cc9 18 * @brief Device Manager Application Interface Abstraction.
rgrover1 103:138bdc859cc9 19 *
rgrover1 103:138bdc859cc9 20 * @details The Device Manager module manages Active and Bonded Peers. Management of peer includes
rgrover1 103:138bdc859cc9 21 * book keeping of contextual information like the Security Keys, GATT
rgrover1 103:138bdc859cc9 22 * configuration and any application specific information.
rgrover1 103:138bdc859cc9 23 *
rgrover1 103:138bdc859cc9 24 * Active Peers are devices which are connected, and may or may not be bonded.
rgrover1 103:138bdc859cc9 25 * Bonded Peers are devices which are bonded, and may or may not be Active (Connected).
rgrover1 103:138bdc859cc9 26 * Active Bonded Peer refers to a device which is connected and bonded.
rgrover1 103:138bdc859cc9 27 *
rgrover1 103:138bdc859cc9 28 * Paired Devices refers to peer devices that are connected and have necessary context
rgrover1 103:138bdc859cc9 29 * establishment/exchange for the current connection session. On disconnect,
rgrover1 103:138bdc859cc9 30 * all contextual information is flushed. For example, SMP Information Exchanged during
rgrover1 103:138bdc859cc9 31 * pairing and GATT Configuration is not retained on disconnection.
rgrover1 103:138bdc859cc9 32 *
rgrover1 103:138bdc859cc9 33 * Note that this module allows management of contextual information but
rgrover1 103:138bdc859cc9 34 * does not provide an interface for connection management. Therefore, entering connectible
rgrover1 103:138bdc859cc9 35 * mode, connection establishment, or disconnection of a link with peer is not in scope
rgrover1 103:138bdc859cc9 36 * of this module.
rgrover1 103:138bdc859cc9 37 *
rgrover1 103:138bdc859cc9 38 * For bonded peers, the contextual information is required to be retained on disconnection
rgrover1 103:138bdc859cc9 39 * and power cycling. Persistent storage of contextual information is handled by the
rgrover1 103:138bdc859cc9 40 * module. This module categorizes the contextual information into 3 categories:
rgrover1 103:138bdc859cc9 41 * - <b>Bonding Information</b>
rgrover1 103:138bdc859cc9 42 * Bond information is the information exchanged between local and peer device to
rgrover1 103:138bdc859cc9 43 * establish a bond. It also includes peer identification information,
rgrover1 103:138bdc859cc9 44 * like the peer address or the IRK or both. From here on this category of information
rgrover1 103:138bdc859cc9 45 * is referred to as Device Context.
rgrover1 103:138bdc859cc9 46 * - <b>Service/Protocol Information</b>
rgrover1 103:138bdc859cc9 47 * Service/Protocol information is the information retained for the peer to save on one-time
rgrover1 103:138bdc859cc9 48 * procedures like the GATT Service Discovery procedures and Service Configurations.
rgrover1 103:138bdc859cc9 49 * It allows devices to resume data exchange on subsequent reconnection without having
rgrover1 103:138bdc859cc9 50 * to perform initial set-up procedures each time. From here on this category is
rgrover1 103:138bdc859cc9 51 * referred to as Service Context.
rgrover1 103:138bdc859cc9 52 * - <b>Application Information</b>
rgrover1 103:138bdc859cc9 53 * Application information is the context that the application would like to associate with
rgrover1 103:138bdc859cc9 54 * each of the bonded device. For example, if the application chooses to rank its peers
rgrover1 103:138bdc859cc9 55 * in order to manage them better, the rank information could be treated as
rgrover1 103:138bdc859cc9 56 * Application Information. This storage space is provided to save the application from
rgrover1 103:138bdc859cc9 57 * maintaining a mapping table with each Device Instance and Application Information.
rgrover1 103:138bdc859cc9 58 * However, if the application have no use for this, it is possible to not
rgrover1 103:138bdc859cc9 59 * use or employ this at compile time. From here on this category of information is
rgrover1 103:138bdc859cc9 60 * referred to as Application Context.
rgrover1 103:138bdc859cc9 61 */
rgrover1 103:138bdc859cc9 62
rgrover1 103:138bdc859cc9 63
rgrover1 103:138bdc859cc9 64 #ifndef DEVICE_MANAGER_H__
rgrover1 103:138bdc859cc9 65 #define DEVICE_MANAGER_H__
rgrover1 103:138bdc859cc9 66
rgrover1 103:138bdc859cc9 67 #include <stdint.h>
rgrover1 103:138bdc859cc9 68 #include <stdbool.h>
rgrover1 103:138bdc859cc9 69 #include "sdk_common.h"
rgrover1 103:138bdc859cc9 70 #include "ble.h"
rgrover1 103:138bdc859cc9 71 #include "ble_gap.h"
rgrover1 103:138bdc859cc9 72 #include "device_manager_cnfg.h"
rgrover1 103:138bdc859cc9 73
rgrover1 103:138bdc859cc9 74 /**
rgrover1 103:138bdc859cc9 75 * @defgroup dm_service_cntext_types Service/Protocol Types
rgrover1 103:138bdc859cc9 76 *
rgrover1 103:138bdc859cc9 77 * @brief Describes the possible types of Service/Protocol Contexts for a bonded/peer device.
rgrover1 103:138bdc859cc9 78 *
rgrover1 103:138bdc859cc9 79 * @details Possible Service/Protocol context per peer device. The Device Manager provides the
rgrover1 103:138bdc859cc9 80 * functionality of persistently storing the Service/Protocol context and can automatically
rgrover1 103:138bdc859cc9 81 * load them when needed.
rgrover1 103:138bdc859cc9 82 * For example system attributes for a GATT Server. Based on the nature of the application,
rgrover1 103:138bdc859cc9 83 * not all service types may be needed. The application can specify
rgrover1 103:138bdc859cc9 84 * only the service/protocol context it wants to use at the time of registration.
rgrover1 103:138bdc859cc9 85 * @{
rgrover1 103:138bdc859cc9 86 */
rgrover1 103:138bdc859cc9 87 #define DM_PROTOCOL_CNTXT_NONE 0x00 /**< No Service Context, this implies the application does not want to associate any service/protocol context with the peer device */
rgrover1 103:138bdc859cc9 88 #define DM_PROTOCOL_CNTXT_GATT_SRVR_ID 0x01 /**< GATT Server Service Context, this implies the application does associate GATT Server with the peer device and this information will be loaded when needed for a bonded device */
rgrover1 103:138bdc859cc9 89 #define DM_PROTOCOL_CNTXT_GATT_CLI_ID 0x02 /**< GATT Client Service Context, this implies the application does associate GATT Client with the peer device and this information will be loaded when needed for a bonded device */
rgrover1 103:138bdc859cc9 90 #define DM_PROTOCOL_CNTXT_ALL \
rgrover1 103:138bdc859cc9 91 (DM_PROTOCOL_CNTXT_GATT_SRVR_ID | DM_PROTOCOL_CNTXT_GATT_CLI_ID) /**< All Service/Protocol Context, this implies that the application wants to associate all Service/Protocol Information with the bonded device. This is configurable based on system requirements. If the application has only one type of service, this define could be altered to reflect the same. */
rgrover1 103:138bdc859cc9 92 /** @} */
rgrover1 103:138bdc859cc9 93
rgrover1 103:138bdc859cc9 94
rgrover1 103:138bdc859cc9 95 /**
rgrover1 103:138bdc859cc9 96 * @defgroup dm_events Device Manager Events
rgrover1 103:138bdc859cc9 97 *
rgrover1 103:138bdc859cc9 98 * @brief This section describes the device manager events that are notified to the application.
rgrover1 103:138bdc859cc9 99 *
rgrover1 103:138bdc859cc9 100 * @details The Device Manager notifies the application of various asynchronous events using the
rgrover1 103:138bdc859cc9 101 * asynchronous event notification callback. All events has been categorized into:
rgrover1 103:138bdc859cc9 102 * a. General.
rgrover1 103:138bdc859cc9 103 * b. Link Status.
rgrover1 103:138bdc859cc9 104 * c. Context Management.
rgrover1 103:138bdc859cc9 105 *
rgrover1 103:138bdc859cc9 106 * In the callback, these events are notified along with handle that uniquely identifies:
rgrover1 103:138bdc859cc9 107 * application instance, active instance (if applicable), device instance
rgrover1 103:138bdc859cc9 108 * bonding instance, (if applicable) and service instance.
rgrover1 103:138bdc859cc9 109 * Not all events are pertaining to an active connection, for example a context deletion event could occur even if the peer
rgrover1 103:138bdc859cc9 110 * is not connected. Also, general category of events may not be pertaining to any specific peer.
rgrover1 103:138bdc859cc9 111 * See also \ref dm_event_cb_t and \ref dm_register.
rgrover1 103:138bdc859cc9 112 * @{
rgrover1 103:138bdc859cc9 113 */
rgrover1 103:138bdc859cc9 114 /**
rgrover1 103:138bdc859cc9 115 * @defgroup general_events General Events
rgrover1 103:138bdc859cc9 116 *
rgrover1 103:138bdc859cc9 117 * @brief General or miscellaneous events.
rgrover1 103:138bdc859cc9 118 *
rgrover1 103:138bdc859cc9 119 * @details This category of events are general events not pertaining to a peer or context.
rgrover1 103:138bdc859cc9 120 *
rgrover1 103:138bdc859cc9 121 * @{
rgrover1 103:138bdc859cc9 122 */
rgrover1 103:138bdc859cc9 123 #define DM_EVT_RFU 0x00 /**< Reserved for future use, is never notified. */
rgrover1 103:138bdc859cc9 124 #define DM_EVT_ERROR 0x01 /**< Device Manager Event Error. */
rgrover1 103:138bdc859cc9 125 /** @} */
rgrover1 103:138bdc859cc9 126
rgrover1 103:138bdc859cc9 127 /**
rgrover1 103:138bdc859cc9 128 * @defgroup link_status_events Link Status Events
rgrover1 103:138bdc859cc9 129 *
rgrover1 103:138bdc859cc9 130 * @brief Link Status Events.
rgrover1 103:138bdc859cc9 131 *
rgrover1 103:138bdc859cc9 132 * @details This category of events notify the application of the link status. Event result associated
rgrover1 103:138bdc859cc9 133 * with the event is provided along with the event in the callback to provide more details of
rgrover1 103:138bdc859cc9 134 * whether a procedure succeeded or failed and assist the application in decision making of
rgrover1 103:138bdc859cc9 135 * how to proceed. For example if a DM_DEVICE_CONNECT_IND is indicated with NRF_SUCCESS
rgrover1 103:138bdc859cc9 136 * result, the application may want to proceed with discovering and association with
rgrover1 103:138bdc859cc9 137 * service of the peer. However, if indicated with a failure result, the application may
rgrover1 103:138bdc859cc9 138 * want to take an alternate action such as reattempting to connect or go into a
rgrover1 103:138bdc859cc9 139 * sleep mode.
rgrover1 103:138bdc859cc9 140 *
rgrover1 103:138bdc859cc9 141 * @{
rgrover1 103:138bdc859cc9 142 */
rgrover1 103:138bdc859cc9 143 #define DM_EVT_CONNECTION 0x11 /**< Indicates that link with the peer is established. */
rgrover1 103:138bdc859cc9 144 #define DM_EVT_DISCONNECTION 0x12 /**< Indicates that link with peer is torn down. */
rgrover1 103:138bdc859cc9 145 #define DM_EVT_SECURITY_SETUP 0x13 /**< Security procedure for link started indication */
rgrover1 103:138bdc859cc9 146 #define DM_EVT_SECURITY_SETUP_COMPLETE 0x14 /**< Security procedure for link completion indication. */
rgrover1 103:138bdc859cc9 147 #define DM_EVT_LINK_SECURED 0x15 /**< Indicates that link with the peer is secured. For bonded devices, subsequent reconnections with bonded peer will result only in this event when the link is secured and setup procedures will not occur unless the bonding information is either lost or deleted on either or both sides. */
rgrover1 103:138bdc859cc9 148 #define DM_EVT_SECURITY_SETUP_REFRESH 0x16 /**< Indicates that the security on the link was re-established. */
rgrover1 103:138bdc859cc9 149 /** @} */
rgrover1 103:138bdc859cc9 150
rgrover1 103:138bdc859cc9 151 /**
rgrover1 103:138bdc859cc9 152 * @defgroup context_mgmt_events Context Management Events
rgrover1 103:138bdc859cc9 153 *
rgrover1 103:138bdc859cc9 154 * @brief Context Management Events.
rgrover1 103:138bdc859cc9 155 *
rgrover1 103:138bdc859cc9 156 * @details These events notify the application of the status of context loading and storing.
rgrover1 103:138bdc859cc9 157 *
rgrover1 103:138bdc859cc9 158 * @{
rgrover1 103:138bdc859cc9 159 */
rgrover1 103:138bdc859cc9 160 #define DM_EVT_DEVICE_CONTEXT_LOADED 0x21 /**< Indicates that device context for a peer is loaded. */
rgrover1 103:138bdc859cc9 161 #define DM_EVT_DEVICE_CONTEXT_STORED 0x22 /**< Indicates that device context is stored persistently. */
rgrover1 103:138bdc859cc9 162 #define DM_EVT_DEVICE_CONTEXT_DELETED 0x23 /**< Indicates that device context is deleted. */
rgrover1 103:138bdc859cc9 163 #define DM_EVT_SERVICE_CONTEXT_LOADED 0x31 /**< Indicates that service context for a peer is loaded. */
rgrover1 103:138bdc859cc9 164 #define DM_EVT_SERVICE_CONTEXT_STORED 0x32 /**< Indicates that service context is stored persistently. */
rgrover1 103:138bdc859cc9 165 #define DM_EVT_SERVICE_CONTEXT_DELETED 0x33 /**< Indicates that service context is deleted. */
rgrover1 103:138bdc859cc9 166 #define DM_EVT_APPL_CONTEXT_LOADED 0x41 /**< Indicates that application context for a peer is loaded. */
rgrover1 103:138bdc859cc9 167 #define DM_EVT_APPL_CONTEXT_STORED 0x42 /**< Indicates that application context is stored persistently. */
rgrover1 103:138bdc859cc9 168 #define DM_EVT_APPL_CONTEXT_DELETED 0x43 /**< Indicates that application context is deleted. */
rgrover1 103:138bdc859cc9 169 /** @} */
rgrover1 103:138bdc859cc9 170 /** @} */
rgrover1 103:138bdc859cc9 171
rgrover1 103:138bdc859cc9 172 #define DM_INVALID_ID 0xFF /**< Invalid instance idenitifer. */
rgrover1 103:138bdc859cc9 173
rgrover1 103:138bdc859cc9 174 /**
rgrover1 103:138bdc859cc9 175 * @defgroup dm_data_structure Device Manager Data Types
rgrover1 103:138bdc859cc9 176 *
rgrover1 103:138bdc859cc9 177 * @brief This section describes all the data types exposed by the module to the application.
rgrover1 103:138bdc859cc9 178 * @{
rgrover1 103:138bdc859cc9 179 */
rgrover1 103:138bdc859cc9 180
rgrover1 103:138bdc859cc9 181 /**
rgrover1 103:138bdc859cc9 182 * @brief Application Instance.
rgrover1 103:138bdc859cc9 183 *
rgrover1 103:138bdc859cc9 184 * @details Application instance uniquely identifies an application. The identifier is allocated by
rgrover1 103:138bdc859cc9 185 * the device manager when application registers with the module. The application is
rgrover1 103:138bdc859cc9 186 * expected to identify itself with this instance identifier when initiating subsequent
rgrover1 103:138bdc859cc9 187 * requests. Application should use the utility API \ref dm_application_instance_set in
rgrover1 103:138bdc859cc9 188 * order to set its application instance in dm_handle_t needed for all subsequent APIs.
rgrover1 103:138bdc859cc9 189 * See also \ref dm_register.
rgrover1 103:138bdc859cc9 190 */
rgrover1 103:138bdc859cc9 191 typedef uint8_t dm_application_instance_t;
rgrover1 103:138bdc859cc9 192
rgrover1 103:138bdc859cc9 193 /**
rgrover1 103:138bdc859cc9 194 * @brief Connection Instance.
rgrover1 103:138bdc859cc9 195 *
rgrover1 103:138bdc859cc9 196 * @details Identifies connection instance for an active device. This instance is allocated by the
rgrover1 103:138bdc859cc9 197 * device manager when a connection is established and is notified with DM_EVT_CONNECTION
rgrover1 103:138bdc859cc9 198 * with the event result NRF_SUCCESS.
rgrover1 103:138bdc859cc9 199 */
rgrover1 103:138bdc859cc9 200 typedef uint8_t dm_connection_instance_t;
rgrover1 103:138bdc859cc9 201
rgrover1 103:138bdc859cc9 202 /**
rgrover1 103:138bdc859cc9 203 * @brief Device Instance.
rgrover1 103:138bdc859cc9 204 *
rgrover1 103:138bdc859cc9 205 * @details Uniquely identifies a bonded peer device. The peer device may or may not be connected.
rgrover1 103:138bdc859cc9 206 * In case of the central: The bonded device instance to identify the peer is allocated when bonding procedure is initiated by the central using dm_security_setup_req.
rgrover1 103:138bdc859cc9 207 * In case of the peripheral: When the bonding procedure is successful, the DM_EVT_SECURITY_SETUP_COMPLETE event with success event result, is received.
rgrover1 103:138bdc859cc9 208 * In case the module cannot add more bonded devices, no instance is allocated, this is indicated by an appropriate error code for the API/event as the case may be. Application can choose to disconnect the link.
rgrover1 103:138bdc859cc9 209 */
rgrover1 103:138bdc859cc9 210 typedef uint8_t dm_device_instance_t;
rgrover1 103:138bdc859cc9 211
rgrover1 103:138bdc859cc9 212 /**
rgrover1 103:138bdc859cc9 213 * @brief Service Instance.
rgrover1 103:138bdc859cc9 214 *
rgrover1 103:138bdc859cc9 215 * @details Uniquely identifies a peer device. The peer device may or may not be connected. This
rgrover1 103:138bdc859cc9 216 * instance is allocated by the device manager when a device is bonded and is notified
rgrover1 103:138bdc859cc9 217 * when security procedures have been initiated.
rgrover1 103:138bdc859cc9 218 * Security Procedures initiation is notified with DM_SECURITY_SETUP_IND with
rgrover1 103:138bdc859cc9 219 * success event result. In case the event result indicates that the module cannot add more
rgrover1 103:138bdc859cc9 220 * bonded devices, no instance is allocated. Application can chose to disconnect the link.
rgrover1 103:138bdc859cc9 221 */
rgrover1 103:138bdc859cc9 222 typedef uint8_t dm_service_instance_t;
rgrover1 103:138bdc859cc9 223
rgrover1 103:138bdc859cc9 224 /**
rgrover1 103:138bdc859cc9 225 * @brief Service/Protocol Type Identifier.
rgrover1 103:138bdc859cc9 226 *
rgrover1 103:138bdc859cc9 227 * @details Uniquely identifies a service or a protocol type. Service/Protocol Type identification
rgrover1 103:138bdc859cc9 228 * is needed as each service/protocol can have its own contextual data.
rgrover1 103:138bdc859cc9 229 * This allows the peer to access more than one service at a time. \ref dm_service_cntext_types describes the
rgrover1 103:138bdc859cc9 230 * list of services/protocols supported.
rgrover1 103:138bdc859cc9 231 */
rgrover1 103:138bdc859cc9 232 typedef uint8_t service_type_t;
rgrover1 103:138bdc859cc9 233
rgrover1 103:138bdc859cc9 234 /**@brief Device Manager Master identification and encryption information. */
rgrover1 103:138bdc859cc9 235 typedef struct dm_enc_key
rgrover1 103:138bdc859cc9 236 {
rgrover1 103:138bdc859cc9 237 ble_gap_enc_info_t enc_info; /**< GAP encryption information. */
rgrover1 103:138bdc859cc9 238 ble_gap_master_id_t master_id; /**< Master identification. */
rgrover1 103:138bdc859cc9 239 } dm_enc_key_t;
rgrover1 103:138bdc859cc9 240
rgrover1 103:138bdc859cc9 241 /** @brief Device Manager identity and address information. */
rgrover1 103:138bdc859cc9 242 typedef struct dm_id_key
rgrover1 103:138bdc859cc9 243 {
rgrover1 103:138bdc859cc9 244 ble_gap_irk_t id_info; /**< Identity information. */
rgrover1 103:138bdc859cc9 245 ble_gap_addr_t id_addr_info; /**< Identity address information. */
rgrover1 103:138bdc859cc9 246 } dm_id_key_t;
rgrover1 103:138bdc859cc9 247
rgrover1 103:138bdc859cc9 248 /** @brief Device Manager signing information. */
rgrover1 103:138bdc859cc9 249 typedef struct dm_sign_key
rgrover1 103:138bdc859cc9 250 {
rgrover1 103:138bdc859cc9 251 ble_gap_sign_info_t sign_key; /**< GAP signing information. */
rgrover1 103:138bdc859cc9 252 } dm_sign_key_t;
rgrover1 103:138bdc859cc9 253
rgrover1 103:138bdc859cc9 254 /** @brief Security keys. */
rgrover1 103:138bdc859cc9 255 typedef struct dm_sec_keyset
rgrover1 103:138bdc859cc9 256 {
rgrover1 103:138bdc859cc9 257 union
rgrover1 103:138bdc859cc9 258 {
rgrover1 103:138bdc859cc9 259 dm_enc_key_t * p_enc_key; /**< Pointer to Device Manager encryption information structure. */
rgrover1 103:138bdc859cc9 260 ble_gap_enc_info_t * p_enc_info; /**< Pointer to GAP encryption information. */
rgrover1 103:138bdc859cc9 261 } enc_key;
rgrover1 103:138bdc859cc9 262 dm_id_key_t * p_id_key; /**< Identity key, or NULL. */
rgrover1 103:138bdc859cc9 263 dm_sign_key_t * p_sign_key; /**< Signing key, or NULL. */
rgrover1 103:138bdc859cc9 264 } dm_sec_keys_t;
rgrover1 103:138bdc859cc9 265
rgrover1 103:138bdc859cc9 266 /** @brief Device Manager security key set. */
rgrover1 103:138bdc859cc9 267 typedef struct
rgrover1 103:138bdc859cc9 268 {
rgrover1 103:138bdc859cc9 269 dm_sec_keys_t keys_periph; /**< Keys distributed by the device in the Peripheral role. */
rgrover1 103:138bdc859cc9 270 dm_sec_keys_t keys_central; /**< Keys distributed by the device in the Central role. */
rgrover1 103:138bdc859cc9 271 } dm_sec_keyset_t;
rgrover1 103:138bdc859cc9 272
rgrover1 103:138bdc859cc9 273 /**
rgrover1 103:138bdc859cc9 274 * @brief Device Handle used for unique identification of each peer.
rgrover1 103:138bdc859cc9 275 *
rgrover1 103:138bdc859cc9 276 * @details This data type is used to uniquely identify each peer device. A peer device could be
rgrover1 103:138bdc859cc9 277 * active and/or bonded. Therefore an instance for active and bonded is provided.
rgrover1 103:138bdc859cc9 278 * However, the application is expected to treat this is an opaque structure and use this for
rgrover1 103:138bdc859cc9 279 * all API interactions once stored on appropriate events.
rgrover1 103:138bdc859cc9 280 * See \ref dm_events.
rgrover1 103:138bdc859cc9 281 */
rgrover1 103:138bdc859cc9 282 typedef struct device_handle
rgrover1 103:138bdc859cc9 283 {
rgrover1 103:138bdc859cc9 284 dm_application_instance_t appl_id; /**< Identifies the application instances for the device that is being managed. */
rgrover1 103:138bdc859cc9 285 dm_connection_instance_t connection_id; /**< Identifies the active connection instance. */
rgrover1 103:138bdc859cc9 286 dm_device_instance_t device_id; /**< Identifies peer instance in the data base. */
rgrover1 103:138bdc859cc9 287 dm_service_instance_t service_id; /**< Service instance identifier. */
rgrover1 103:138bdc859cc9 288 } dm_handle_t;
rgrover1 103:138bdc859cc9 289
rgrover1 103:138bdc859cc9 290 /**
rgrover1 103:138bdc859cc9 291 * @brief Definition of Data Context.
rgrover1 103:138bdc859cc9 292 *
rgrover1 103:138bdc859cc9 293 * @details Defines contextual data format, it consists of context data length and pointer to data.
rgrover1 103:138bdc859cc9 294 */
rgrover1 103:138bdc859cc9 295 typedef struct
rgrover1 103:138bdc859cc9 296 {
rgrover1 103:138bdc859cc9 297 uint32_t len; /**< Length of data . */
rgrover1 103:138bdc859cc9 298 uint8_t * p_data; /**< Pointer to contextual data, a copy is made of the data. */
rgrover1 103:138bdc859cc9 299 } dm_context_t;
rgrover1 103:138bdc859cc9 300
rgrover1 103:138bdc859cc9 301
rgrover1 103:138bdc859cc9 302 /**
rgrover1 103:138bdc859cc9 303 * @brief Device Context.
rgrover1 103:138bdc859cc9 304 *
rgrover1 103:138bdc859cc9 305 * @details Defines "device context" type for a device managed by device manager.
rgrover1 103:138bdc859cc9 306 */
rgrover1 103:138bdc859cc9 307 typedef dm_context_t dm_device_context_t;
rgrover1 103:138bdc859cc9 308
rgrover1 103:138bdc859cc9 309 /**
rgrover1 103:138bdc859cc9 310 * @brief Service Context.
rgrover1 103:138bdc859cc9 311 *
rgrover1 103:138bdc859cc9 312 * @details Service context data for a service identified by the 'service_type' field.
rgrover1 103:138bdc859cc9 313 */
rgrover1 103:138bdc859cc9 314 typedef struct
rgrover1 103:138bdc859cc9 315 {
rgrover1 103:138bdc859cc9 316 service_type_t service_type; /**< Identifies the service/protocol to which the context data is related. */
rgrover1 103:138bdc859cc9 317 dm_context_t context_data; /**< Contains length and pointer to context data */
rgrover1 103:138bdc859cc9 318 } dm_service_context_t;
rgrover1 103:138bdc859cc9 319
rgrover1 103:138bdc859cc9 320 /**
rgrover1 103:138bdc859cc9 321 * @brief Application context.
rgrover1 103:138bdc859cc9 322 *
rgrover1 103:138bdc859cc9 323 * @details The application context can be used by the application to map any application level
rgrover1 103:138bdc859cc9 324 * information that is to be mapped with a particular peer.
rgrover1 103:138bdc859cc9 325 * For bonded peers, this information will be stored by the bond manager persistently.
rgrover1 103:138bdc859cc9 326 * Note that the device manager treats this information as an
rgrover1 103:138bdc859cc9 327 * opaque block of bytes.
rgrover1 103:138bdc859cc9 328 * Necessary APIs to get and set this context for a peer have been provided.
rgrover1 103:138bdc859cc9 329 */
rgrover1 103:138bdc859cc9 330 typedef dm_context_t dm_application_context_t;
rgrover1 103:138bdc859cc9 331
rgrover1 103:138bdc859cc9 332 /**
rgrover1 103:138bdc859cc9 333 * @brief Event parameters.
rgrover1 103:138bdc859cc9 334 *
rgrover1 103:138bdc859cc9 335 * @details Defines event parameters for each of the events notified by the module.
rgrover1 103:138bdc859cc9 336 */
rgrover1 103:138bdc859cc9 337 typedef union
rgrover1 103:138bdc859cc9 338 {
rgrover1 103:138bdc859cc9 339 ble_gap_evt_t * p_gap_param; /**< All events that are triggered in device manager as a result of GAP events, like connection, disconnection and security procedures are accompanied with GAP parameters. */
rgrover1 103:138bdc859cc9 340 dm_application_context_t * p_app_context; /**< All events that are associated with application context procedures of store, load, and deletion have this as event parameter. */
rgrover1 103:138bdc859cc9 341 dm_service_context_t * p_service_context; /**< All events that are associated with service context procedures of store, load and deletion have this as event parameter. */
rgrover1 103:138bdc859cc9 342 dm_device_context_t * p_device_context; /**< All events that are associated with device context procedures of store, load and deletion have this as event parameter. */
rgrover1 103:138bdc859cc9 343 } dm_event_param_t;
rgrover1 103:138bdc859cc9 344
rgrover1 103:138bdc859cc9 345 /**
rgrover1 103:138bdc859cc9 346 * @brief Asynchronous events details notified to the application by the module.
rgrover1 103:138bdc859cc9 347 *
rgrover1 103:138bdc859cc9 348 * @details Defines event type along with event parameters notified to the application by the
rgrover1 103:138bdc859cc9 349 * module.
rgrover1 103:138bdc859cc9 350 */
rgrover1 103:138bdc859cc9 351 typedef struct
rgrover1 103:138bdc859cc9 352 {
rgrover1 103:138bdc859cc9 353 uint8_t event_id; /**< Identifies the event. See \ref dm_events for details on event types and their significance. */
rgrover1 103:138bdc859cc9 354 dm_event_param_t event_param; /**< Event parameters. Can be NULL if the event does not have any parameters. */
rgrover1 103:138bdc859cc9 355 uint16_t event_paramlen; /**< Length of the event parameters, is zero if the event does not have any parameters. */
rgrover1 103:138bdc859cc9 356 } dm_event_t;
rgrover1 103:138bdc859cc9 357
rgrover1 103:138bdc859cc9 358 /**
rgrover1 103:138bdc859cc9 359 * @brief Event notification callback registered by application with the module.
rgrover1 103:138bdc859cc9 360 *
rgrover1 103:138bdc859cc9 361 * @details Event notification callback registered by application with the module when registering
rgrover1 103:138bdc859cc9 362 * the module using \ref dm_register API.
rgrover1 103:138bdc859cc9 363 *
rgrover1 103:138bdc859cc9 364 * @param[in] p_handle Identifies the peer for which the event is being notified.
rgrover1 103:138bdc859cc9 365 * @param[in] p_event Identifies the event, any associated parameters and parameter length.
rgrover1 103:138bdc859cc9 366 * See \ref dm_events for details on event types and their significance.
rgrover1 103:138bdc859cc9 367 * @param[in,out] event_result Provide additional information on the event.
rgrover1 103:138bdc859cc9 368 * In addition to SDK error codes there is also a return value
rgrover1 103:138bdc859cc9 369 * indicating if maximum number of connections has been reached when connecting or bonding.
rgrover1 103:138bdc859cc9 370 *
rgrover1 103:138bdc859cc9 371 * @retval NRF_SUCCESS on success, or a failure to indicate if it could handle the event
rgrover1 103:138bdc859cc9 372 * successfully. There is no action taken in case application returns a failure.
rgrover1 103:138bdc859cc9 373 */
rgrover1 103:138bdc859cc9 374 typedef api_result_t (*dm_event_cb_t)(dm_handle_t const * p_handle,
rgrover1 103:138bdc859cc9 375 dm_event_t const * p_event,
rgrover1 103:138bdc859cc9 376 api_result_t event_result);
rgrover1 103:138bdc859cc9 377
rgrover1 103:138bdc859cc9 378 /**
rgrover1 103:138bdc859cc9 379 * @brief Initialization Parameters.
rgrover1 103:138bdc859cc9 380 *
rgrover1 103:138bdc859cc9 381 * @details Indicates the application parameters. Currently this only encompasses clearing
rgrover1 103:138bdc859cc9 382 * all persistent data.
rgrover1 103:138bdc859cc9 383 */
rgrover1 103:138bdc859cc9 384 typedef struct
rgrover1 103:138bdc859cc9 385 {
rgrover1 103:138bdc859cc9 386 bool clear_persistent_data; /**< Set to true in case the module should clear all persistent data. */
rgrover1 103:138bdc859cc9 387 } dm_init_param_t;
rgrover1 103:138bdc859cc9 388
rgrover1 103:138bdc859cc9 389 /**
rgrover1 103:138bdc859cc9 390 * @brief Application Registration Parameters.
rgrover1 103:138bdc859cc9 391 *
rgrover1 103:138bdc859cc9 392 * @details Parameters needed by the module when registering with it.
rgrover1 103:138bdc859cc9 393 */
rgrover1 103:138bdc859cc9 394 typedef struct
rgrover1 103:138bdc859cc9 395 {
rgrover1 103:138bdc859cc9 396 dm_event_cb_t evt_handler; /**< Event Handler to be registered. It will receive asynchronous notification from the module, see \ref dm_events for asynchronous events. */
rgrover1 103:138bdc859cc9 397 uint8_t service_type; /**< Bit mask identifying services that the application intends to support for all peers. */
rgrover1 103:138bdc859cc9 398 ble_gap_sec_params_t sec_param; /**< Security parameters to be used for the application. */
rgrover1 103:138bdc859cc9 399 } dm_application_param_t;
rgrover1 103:138bdc859cc9 400
rgrover1 103:138bdc859cc9 401 /**
rgrover1 103:138bdc859cc9 402 * @brief Defines possible security status/states.
rgrover1 103:138bdc859cc9 403 *
rgrover1 103:138bdc859cc9 404 * @details Defines possible security status/states of a link when requested by application using
rgrover1 103:138bdc859cc9 405 * the \ref dm_security_status_req.
rgrover1 103:138bdc859cc9 406 */
rgrover1 103:138bdc859cc9 407 typedef enum
rgrover1 103:138bdc859cc9 408 {
rgrover1 103:138bdc859cc9 409 NOT_ENCRYPTED, /**< The link does not security. */
rgrover1 103:138bdc859cc9 410 ENCRYPTION_IN_PROGRESS, /**< Security is in progress of being established.*/
rgrover1 103:138bdc859cc9 411 ENCRYPTED /**< The link is secure.*/
rgrover1 103:138bdc859cc9 412 } dm_security_status_t;
rgrover1 103:138bdc859cc9 413 /** @} */
rgrover1 103:138bdc859cc9 414
rgrover1 103:138bdc859cc9 415 /**
rgrover1 103:138bdc859cc9 416 * @defgroup dm_api Device Module APIs
rgrover1 103:138bdc859cc9 417 *
rgrover1 103:138bdc859cc9 418 * @brief This section describes APIs exposed by the module.
rgrover1 103:138bdc859cc9 419 *
rgrover1 103:138bdc859cc9 420 * @details This section describes APIs exposed by the module. The APIs have been categorized to provide
rgrover1 103:138bdc859cc9 421 * better and specific look up for developers. Categories are:
rgrover1 103:138bdc859cc9 422 * - Set up APIs.
rgrover1 103:138bdc859cc9 423 * - Context Management APIs.
rgrover1 103:138bdc859cc9 424 * - Utility APIs.
rgrover1 103:138bdc859cc9 425 *
rgrover1 103:138bdc859cc9 426 * MSCs describe usage of these APIs.
rgrover1 103:138bdc859cc9 427 * See @ref dm_msc.
rgrover1 103:138bdc859cc9 428 * @{
rgrover1 103:138bdc859cc9 429 */
rgrover1 103:138bdc859cc9 430 /**
rgrover1 103:138bdc859cc9 431 * @defgroup dm_setup_api Device Module Set-up APIs
rgrover1 103:138bdc859cc9 432 *
rgrover1 103:138bdc859cc9 433 * @brief Initialization & registration APIs that are pre-requisite for all other module procedures.
rgrover1 103:138bdc859cc9 434 * @details This section describes the Module Initialization and Registration APIs needed to be set up by
rgrover1 103:138bdc859cc9 435 * the application before device manager can start managing devices and device contexts
rgrover1 103:138bdc859cc9 436 * for the application.
rgrover1 103:138bdc859cc9 437 *
rgrover1 103:138bdc859cc9 438 * @{
rgrover1 103:138bdc859cc9 439 */
rgrover1 103:138bdc859cc9 440
rgrover1 103:138bdc859cc9 441 /**
rgrover1 103:138bdc859cc9 442 * @brief Module Initialization Routine.
rgrover1 103:138bdc859cc9 443 *
rgrover1 103:138bdc859cc9 444 * @details Function for initializing the module. Must called before any other APIs of the module are used.
rgrover1 103:138bdc859cc9 445 *
rgrover1 103:138bdc859cc9 446 * @param[in] p_init_param Initialization parameters.
rgrover1 103:138bdc859cc9 447 *
rgrover1 103:138bdc859cc9 448 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 449 *
rgrover1 103:138bdc859cc9 450 * @note It is mandatory that pstorage is initialized before initializing this module.
rgrover1 103:138bdc859cc9 451 */
rgrover1 103:138bdc859cc9 452 api_result_t dm_init(dm_init_param_t const * p_init_param);
rgrover1 103:138bdc859cc9 453
rgrover1 103:138bdc859cc9 454 /**
rgrover1 103:138bdc859cc9 455 * @brief Function for registering the application.
rgrover1 103:138bdc859cc9 456 *
rgrover1 103:138bdc859cc9 457 * @details This routine is used by the application to register for asynchronous events with the
rgrover1 103:138bdc859cc9 458 * device manager. During registration the application also indicates the services that it
rgrover1 103:138bdc859cc9 459 * intends to support on this instance. It is possible to register multiple times with the
rgrover1 103:138bdc859cc9 460 * device manager. At least one instance shall be registered with the device manager after
rgrover1 103:138bdc859cc9 461 * the module has been initialized.
rgrover1 103:138bdc859cc9 462 * Maximum number of application instances device manager can support is determined
rgrover1 103:138bdc859cc9 463 * by DM_MAX_APPLICATIONS.
rgrover1 103:138bdc859cc9 464 *
rgrover1 103:138bdc859cc9 465 * All applications must be registered before initiating or accepting connections from the peer.
rgrover1 103:138bdc859cc9 466 *
rgrover1 103:138bdc859cc9 467 * @param[in] p_appl_param Application parameters.
rgrover1 103:138bdc859cc9 468 * @param[out] p_appl_instance Application Instance Identifier in case registration is successful.
rgrover1 103:138bdc859cc9 469 *
rgrover1 103:138bdc859cc9 470 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 471 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization.
rgrover1 103:138bdc859cc9 472 * @retval NRF_ERROR_NO_MEM If module cannot support more applications.
rgrover1 103:138bdc859cc9 473 *
rgrover1 103:138bdc859cc9 474 * @note Currently only one application instance is supported by the module.
rgrover1 103:138bdc859cc9 475 */
rgrover1 103:138bdc859cc9 476 api_result_t dm_register(dm_application_instance_t * p_appl_instance,
rgrover1 103:138bdc859cc9 477 dm_application_param_t const * p_appl_param);
rgrover1 103:138bdc859cc9 478
rgrover1 103:138bdc859cc9 479 /**
rgrover1 103:138bdc859cc9 480 * @brief Function for handling BLE events.
rgrover1 103:138bdc859cc9 481 *
rgrover1 103:138bdc859cc9 482 * @details BLE Event Handler for the module. This routine should be called from BLE stack event
rgrover1 103:138bdc859cc9 483 * dispatcher for the module to work as expected.
rgrover1 103:138bdc859cc9 484 *
rgrover1 103:138bdc859cc9 485 * @param[in] p_ble_evt BLE stack event being dispatched to the function.
rgrover1 103:138bdc859cc9 486 *
rgrover1 103:138bdc859cc9 487 */
rgrover1 103:138bdc859cc9 488 void dm_ble_evt_handler(ble_evt_t * p_ble_evt);
rgrover1 103:138bdc859cc9 489
rgrover1 103:138bdc859cc9 490 /** @} */
rgrover1 103:138bdc859cc9 491
rgrover1 103:138bdc859cc9 492
rgrover1 103:138bdc859cc9 493 /**
rgrover1 103:138bdc859cc9 494 * @defgroup dm_security_api APIs to set up or read status of security on a link.
rgrover1 103:138bdc859cc9 495 *
rgrover1 103:138bdc859cc9 496 * @brief This section describes APIs to set up Security. These APIs require that the peer is
rgrover1 103:138bdc859cc9 497 * connected before the procedures can be requested.
rgrover1 103:138bdc859cc9 498 *
rgrover1 103:138bdc859cc9 499 * @details This group allows application to request security procedures
rgrover1 103:138bdc859cc9 500 * or get the status of the security on a link.
rgrover1 103:138bdc859cc9 501 * @{
rgrover1 103:138bdc859cc9 502 */
rgrover1 103:138bdc859cc9 503 /**
rgrover1 103:138bdc859cc9 504 * @brief Function for requesting setting up security on a link.
rgrover1 103:138bdc859cc9 505 *
rgrover1 103:138bdc859cc9 506 * @details This API initiates security procedures with a peer device.
rgrover1 103:138bdc859cc9 507 * @note For the GAP Central role, in case peer is not bonded, request to bond/pair is
rgrover1 103:138bdc859cc9 508 * initiated. If it is bonded, the link is re-encrypted using the existing bond information.
rgrover1 103:138bdc859cc9 509 * For the GAP peripheral role, a Slave security request is sent.
rgrover1 103:138bdc859cc9 510 * @details If a pairing procedure is initiated successfully, application is notified of
rgrover1 103:138bdc859cc9 511 * @ref DM_EVT_SECURITY_SETUP_COMPLETE. A result indicating success or failure is notified along with the event.
rgrover1 103:138bdc859cc9 512 * In case the link is re-encrypted using existing bond information, @ref DM_EVT_LINK_SECURED is
rgrover1 103:138bdc859cc9 513 * notified to the application.
rgrover1 103:138bdc859cc9 514 *
rgrover1 103:138bdc859cc9 515 * @param[in] p_handle Identifies the link on which security is desired.
rgrover1 103:138bdc859cc9 516 *
rgrover1 103:138bdc859cc9 517 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 518 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 519 * application registration.
rgrover1 103:138bdc859cc9 520 * @retval NRF_ERROR_NULL If p_handle is NULL.
rgrover1 103:138bdc859cc9 521 * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application
rgrover1 103:138bdc859cc9 522 * or if the peer is not connected when this procedure is requested.
rgrover1 103:138bdc859cc9 523 */
rgrover1 103:138bdc859cc9 524 api_result_t dm_security_setup_req(dm_handle_t * p_handle);
rgrover1 103:138bdc859cc9 525
rgrover1 103:138bdc859cc9 526 /**
rgrover1 103:138bdc859cc9 527 * @brief Function for reading the status of the security on a link.
rgrover1 103:138bdc859cc9 528 *
rgrover1 103:138bdc859cc9 529 * @details This API allows application to query status of security on a link.
rgrover1 103:138bdc859cc9 530 *
rgrover1 103:138bdc859cc9 531 * @param[in] p_handle Identifies the link on which security is desired.
rgrover1 103:138bdc859cc9 532 * @param[out] p_status Pointer where security status is provided to the application.
rgrover1 103:138bdc859cc9 533 * See \ref dm_security_status_t for possible statuses that can be expected.
rgrover1 103:138bdc859cc9 534 *
rgrover1 103:138bdc859cc9 535 * @retval NRF_SUCCESS Or appropriate error code indicating reason for failure.
rgrover1 103:138bdc859cc9 536 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 537 * application registration.
rgrover1 103:138bdc859cc9 538 * @retval NRF_ERROR_NULL If p_handle or p_status is NULL.
rgrover1 103:138bdc859cc9 539 * @retval NRF_ERROR_INVALID_ADDR If peer is not identified by the handle provided by the application
rgrover1 103:138bdc859cc9 540 * or if peer is not connected when this procedure is requested.
rgrover1 103:138bdc859cc9 541 */
rgrover1 103:138bdc859cc9 542 api_result_t dm_security_status_req(dm_handle_t const * p_handle, dm_security_status_t * p_status);
rgrover1 103:138bdc859cc9 543
rgrover1 103:138bdc859cc9 544 /**
rgrover1 103:138bdc859cc9 545 * @brief Function for creating the whitelist.
rgrover1 103:138bdc859cc9 546 *
rgrover1 103:138bdc859cc9 547 * @details This API allows application to create whitelist based on bonded peer devices in module
rgrover1 103:138bdc859cc9 548 * data base.
rgrover1 103:138bdc859cc9 549 *
rgrover1 103:138bdc859cc9 550 * @param[in] p_handle Identifies the application requesting whitelist creation.
rgrover1 103:138bdc859cc9 551 * @param[in,out] p_whitelist Pointer where created whitelist is provided to the application.
rgrover1 103:138bdc859cc9 552 *
rgrover1 103:138bdc859cc9 553 * @note 'addr_count' and 'irk_count' fields of the structure should be populated with the maximum
rgrover1 103:138bdc859cc9 554 * number of devices that the application wishes to request in the whitelist.
rgrover1 103:138bdc859cc9 555 * If the number of bonded devices is less than requested, the fields are updated with that number of devices.
rgrover1 103:138bdc859cc9 556 * If the number of devices are more than requested, the module will populate the list
rgrover1 103:138bdc859cc9 557 * with devices in the order the bond was established with the peer devices. Also, if this routine is
rgrover1 103:138bdc859cc9 558 * called when a connection exists with one or more peer devices,
rgrover1 103:138bdc859cc9 559 * those connected devices are not added to the whitelist.
rgrover1 103:138bdc859cc9 560 *
rgrover1 103:138bdc859cc9 561 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 562 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 563 * application registration.
rgrover1 103:138bdc859cc9 564 * @retval NRF_ERROR_NULL If p_handle or p_whitelist is NULL.
rgrover1 103:138bdc859cc9 565 */
rgrover1 103:138bdc859cc9 566 api_result_t dm_whitelist_create(dm_application_instance_t const * p_handle,
rgrover1 103:138bdc859cc9 567 ble_gap_whitelist_t * p_whitelist);
rgrover1 103:138bdc859cc9 568
rgrover1 103:138bdc859cc9 569 /** @} */
rgrover1 103:138bdc859cc9 570
rgrover1 103:138bdc859cc9 571
rgrover1 103:138bdc859cc9 572 /**
rgrover1 103:138bdc859cc9 573 * @defgroup dm_cntxt_mgmt_api Context Management APIs
rgrover1 103:138bdc859cc9 574 *
rgrover1 103:138bdc859cc9 575 * @brief Utility APIs offered by the device manager to get information about the peer if and
rgrover1 103:138bdc859cc9 576 * when needed.
rgrover1 103:138bdc859cc9 577 *
rgrover1 103:138bdc859cc9 578 * @details This group of API allow the application to access information that is not required to be
rgrover1 103:138bdc859cc9 579 * maintained by the application but may be needed. Hence it is possible to get the
rgrover1 103:138bdc859cc9 580 * information from the module instead of mapping all the information with a device
rgrover1 103:138bdc859cc9 581 * context.
rgrover1 103:138bdc859cc9 582 * @{
rgrover1 103:138bdc859cc9 583 */
rgrover1 103:138bdc859cc9 584
rgrover1 103:138bdc859cc9 585 api_result_t dm_device_add(dm_handle_t * p_handle,
rgrover1 103:138bdc859cc9 586 dm_device_context_t const * p_context);
rgrover1 103:138bdc859cc9 587
rgrover1 103:138bdc859cc9 588 /**
rgrover1 103:138bdc859cc9 589 * @brief Function for deleting a peer device context and all related information from the database.
rgrover1 103:138bdc859cc9 590 *
rgrover1 103:138bdc859cc9 591 * @details Delete peer device context and all related information from database. If
rgrover1 103:138bdc859cc9 592 * this API returns NRF_SUCCESS, DM_EVT_DEVICE_CONTEXT_DELETED event is notified to the
rgrover1 103:138bdc859cc9 593 * application. Event result notified along with the event indicates success or failure
rgrover1 103:138bdc859cc9 594 * of this procedure.
rgrover1 103:138bdc859cc9 595 *
rgrover1 103:138bdc859cc9 596 * @param[in] p_handle Identifies the peer device to be deleted.
rgrover1 103:138bdc859cc9 597 *
rgrover1 103:138bdc859cc9 598 * @retval NRF_SUCCESS on success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 599 * @retval NRF_ERROR_INVALID_STATE In the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 600 * application registration.
rgrover1 103:138bdc859cc9 601 * @retval NRF_ERROR_NULL If p_handle is NULL.
rgrover1 103:138bdc859cc9 602 * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application.
rgrover1 103:138bdc859cc9 603 *
rgrover1 103:138bdc859cc9 604 * @note Deleting device context results in deleting service and application context for the
rgrover1 103:138bdc859cc9 605 * bonded device. The respective events DM_EVT_SERVICE_CONTEXT_DELETED and
rgrover1 103:138bdc859cc9 606 * DM_EVT_APPL_CONTEXT_DELETED are not notified to the application.
rgrover1 103:138bdc859cc9 607 */
rgrover1 103:138bdc859cc9 608 api_result_t dm_device_delete(dm_handle_t const * p_handle);
rgrover1 103:138bdc859cc9 609
rgrover1 103:138bdc859cc9 610 /**
rgrover1 103:138bdc859cc9 611 * @brief Function for deleting all peer device context and all related information from the database.
rgrover1 103:138bdc859cc9 612 *
rgrover1 103:138bdc859cc9 613 * @details Delete peer device context and all related information from database. If
rgrover1 103:138bdc859cc9 614 * this API returns NRF_SUCCESS, DM_EVT_DEVICE_CONTEXT_DELETED event is notified to the
rgrover1 103:138bdc859cc9 615 * application for each device that is deleted from the data base. Event result
rgrover1 103:138bdc859cc9 616 * notified along with the event indicates success or failure of this procedure.
rgrover1 103:138bdc859cc9 617 *
rgrover1 103:138bdc859cc9 618 * @param[in] p_handle Identifies application instance that is requesting
rgrover1 103:138bdc859cc9 619 * the deletion of all bonded devices.
rgrover1 103:138bdc859cc9 620 *
rgrover1 103:138bdc859cc9 621 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 622 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 623 * application registration.
rgrover1 103:138bdc859cc9 624 * @retval NRF_ERROR_NULL If p_handle is NULL.
rgrover1 103:138bdc859cc9 625 * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application.
rgrover1 103:138bdc859cc9 626 *
rgrover1 103:138bdc859cc9 627 * @note Deleting device context results in deleting both service and application context for the
rgrover1 103:138bdc859cc9 628 * bonded device. The respective events DM_EVT_SERVICE_CONTEXT_DELETED and
rgrover1 103:138bdc859cc9 629 * DM_EVT_APPL_CONTEXT_DELETED are not notified to the application.
rgrover1 103:138bdc859cc9 630 */
rgrover1 103:138bdc859cc9 631 api_result_t dm_device_delete_all(dm_application_instance_t const * p_handle);
rgrover1 103:138bdc859cc9 632
rgrover1 103:138bdc859cc9 633 /**
rgrover1 103:138bdc859cc9 634 * @brief Function for setting Service Context for a peer device identified by 'p_handle' parameter.
rgrover1 103:138bdc859cc9 635 *
rgrover1 103:138bdc859cc9 636 * @details This API allows application to Set Service Context for a peer device identified by the
rgrover1 103:138bdc859cc9 637 * 'p_handle' parameter. This API is useful when the Service Context cannot be requested
rgrover1 103:138bdc859cc9 638 * from the SoftDevice, but needs to be assembled by the application or an another module.
rgrover1 103:138bdc859cc9 639 * (or when service context is exchanged in an out of band way.)
rgrover1 103:138bdc859cc9 640 * This API could also be used to trigger a storing of service context into persistent
rgrover1 103:138bdc859cc9 641 * memory. If this is desired, a NULL pointer could be passed to the p_context.
rgrover1 103:138bdc859cc9 642 *
rgrover1 103:138bdc859cc9 643 * @param[in] p_handle Identifies peer device for which the procedure is requested.
rgrover1 103:138bdc859cc9 644 * @param[in] p_context Service context being set. The context information includes length of
rgrover1 103:138bdc859cc9 645 * data and pointer to the contextual data being set. The memory pointed to by
rgrover1 103:138bdc859cc9 646 * the pointer to data is assumed to be resident when API is being called and
rgrover1 103:138bdc859cc9 647 * can be freed or reused once the set procedure is complete. Set procedure
rgrover1 103:138bdc859cc9 648 * completion is indicated by the event \ref DM_EVT_SERVICE_CONTEXT_STORED.
rgrover1 103:138bdc859cc9 649 * The Event result is notified along with the event and indicates success or failure of
rgrover1 103:138bdc859cc9 650 * this procedure.
rgrover1 103:138bdc859cc9 651 *
rgrover1 103:138bdc859cc9 652 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 653 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 654 * application registration.
rgrover1 103:138bdc859cc9 655 * @retval NRF_ERROR_NULL If p_handle is NULL.
rgrover1 103:138bdc859cc9 656 * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application.
rgrover1 103:138bdc859cc9 657 */
rgrover1 103:138bdc859cc9 658 api_result_t dm_service_context_set(dm_handle_t const * p_handle,
rgrover1 103:138bdc859cc9 659 dm_service_context_t const * p_context);
rgrover1 103:138bdc859cc9 660
rgrover1 103:138bdc859cc9 661 /**
rgrover1 103:138bdc859cc9 662 * @brief Function for getting Service Context for a peer device identified by 'p_handle' parameter.
rgrover1 103:138bdc859cc9 663 *
rgrover1 103:138bdc859cc9 664 * @details Get Service Context for a peer device identified by the 'p_handle' parameter. If
rgrover1 103:138bdc859cc9 665 * this API returns NRF_SUCCESS, DM_EVT_SERVICE_CONTEXT_LOADED event is notified to the
rgrover1 103:138bdc859cc9 666 * application. The event result is notified along with the event indicates success or failure
rgrover1 103:138bdc859cc9 667 * of this procedure.
rgrover1 103:138bdc859cc9 668 *
rgrover1 103:138bdc859cc9 669 * @param[in] p_handle Identifies peer device for which procedure is requested.
rgrover1 103:138bdc859cc9 670 * @param[in] p_context Application context being requested. The context information includes length
rgrover1 103:138bdc859cc9 671 * of the data and a pointer to the data. Note that requesting a 'get'
rgrover1 103:138bdc859cc9 672 * of application does not need to provide memory, the pointer to data will be
rgrover1 103:138bdc859cc9 673 * pointing to service data and hence no data movement is involved.
rgrover1 103:138bdc859cc9 674 *
rgrover1 103:138bdc859cc9 675 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 676 * @retval NRF_ERROR_INVALID_STATE In case API is called without module initialization and/or
rgrover1 103:138bdc859cc9 677 * application registration.
rgrover1 103:138bdc859cc9 678 * @retval NRF_ERROR_NULL If p_handle is NULL.
rgrover1 103:138bdc859cc9 679 * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application.
rgrover1 103:138bdc859cc9 680 */
rgrover1 103:138bdc859cc9 681 api_result_t dm_service_context_get(dm_handle_t const * p_handle,
rgrover1 103:138bdc859cc9 682 dm_service_context_t * p_context);
rgrover1 103:138bdc859cc9 683
rgrover1 103:138bdc859cc9 684 /**
rgrover1 103:138bdc859cc9 685 * @brief Function for deleting a Service Context for a peer device identified by the 'p_handle' parameter.
rgrover1 103:138bdc859cc9 686 *
rgrover1 103:138bdc859cc9 687 * @details This API allows application to delete a Service Context identified for a peer device
rgrover1 103:138bdc859cc9 688 * identified by the 'p_handle' parameter. If this API returns NRF_SUCCESS,
rgrover1 103:138bdc859cc9 689 * DM_EVT_SERVICE_CONTEXT_DELETED event is notified to the application.
rgrover1 103:138bdc859cc9 690 * Event result is notified along with the event and indicates success or failure of this
rgrover1 103:138bdc859cc9 691 * procedure.
rgrover1 103:138bdc859cc9 692 *
rgrover1 103:138bdc859cc9 693 * @param[in] p_handle Identifies peer device for which procedure is requested.
rgrover1 103:138bdc859cc9 694 *
rgrover1 103:138bdc859cc9 695 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 696 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 697 * application registration.
rgrover1 103:138bdc859cc9 698 * @retval NRF_ERROR_NULL If p_handle is NULL.
rgrover1 103:138bdc859cc9 699 * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application.
rgrover1 103:138bdc859cc9 700 */
rgrover1 103:138bdc859cc9 701 api_result_t dm_service_context_delete(dm_handle_t const * p_handle);
rgrover1 103:138bdc859cc9 702
rgrover1 103:138bdc859cc9 703 /**
rgrover1 103:138bdc859cc9 704 * @brief Function for setting Application Context for a peer device identified by the 'p_handle' parameter.
rgrover1 103:138bdc859cc9 705 *
rgrover1 103:138bdc859cc9 706 * @details This application allows the setting of the application context for the peer device identified by
rgrover1 103:138bdc859cc9 707 * the 'p_handle'. Application context is stored persistently by the module and can be
rgrover1 103:138bdc859cc9 708 * requested by the application at any time using the \ref dm_application_context_get
rgrover1 103:138bdc859cc9 709 * API. Note that this procedure is permitted only for bonded devices. If the
rgrover1 103:138bdc859cc9 710 * device is not bonded, application context cannot be set. However, it is not mandatory
rgrover1 103:138bdc859cc9 711 * that the bonded device is connected when requesting this procedure.
rgrover1 103:138bdc859cc9 712 *
rgrover1 103:138bdc859cc9 713 * @param[in] p_handle Identifies peer device for which procedure is requested.
rgrover1 103:138bdc859cc9 714 *
rgrover1 103:138bdc859cc9 715 * @param[in] p_context Application context being set. The context information includes length of the
rgrover1 103:138bdc859cc9 716 * data and pointer to the contextual data being set. The memory pointed to by
rgrover1 103:138bdc859cc9 717 * the data pointer is assumed to be resident when API is being called and
rgrover1 103:138bdc859cc9 718 * can be freed or reused once the set procedure is complete. Set procedure
rgrover1 103:138bdc859cc9 719 * completion is notified by the event \ref DM_EVT_APPL_CONTEXT_STORED.
rgrover1 103:138bdc859cc9 720 * The event result is notified along with the event and indicates success or
rgrover1 103:138bdc859cc9 721 * failure of this procedure.
rgrover1 103:138bdc859cc9 722 *
rgrover1 103:138bdc859cc9 723 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 724 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 725 * application registration.
rgrover1 103:138bdc859cc9 726 * @retval NRF_ERROR_NULL If p_handle and/or p_context is NULL.
rgrover1 103:138bdc859cc9 727 * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application.
rgrover1 103:138bdc859cc9 728 *
rgrover1 103:138bdc859cc9 729 * @note The API returns FEATURE_NOT_ENABLED in case DEVICE_MANAGER_APP_CONTEXT_SIZE is set to zero.
rgrover1 103:138bdc859cc9 730 */
rgrover1 103:138bdc859cc9 731 api_result_t dm_application_context_set(dm_handle_t const * p_handle,
rgrover1 103:138bdc859cc9 732 dm_application_context_t const * p_context);
rgrover1 103:138bdc859cc9 733
rgrover1 103:138bdc859cc9 734 /**
rgrover1 103:138bdc859cc9 735 * @brief Function for getting Application Context for a peer device identified by the 'p_handle' parameter.
rgrover1 103:138bdc859cc9 736 *
rgrover1 103:138bdc859cc9 737 * @details Get Application Context for a peer device identified by the 'p_handle' parameter. If
rgrover1 103:138bdc859cc9 738 * this API returns NRF_SUCCESS, DM_EVT_APPL_CONTEXT_LOADED event is notified to the
rgrover1 103:138bdc859cc9 739 * application. Event result notified along with the event indicates success or failure
rgrover1 103:138bdc859cc9 740 * of this procedure.
rgrover1 103:138bdc859cc9 741 *
rgrover1 103:138bdc859cc9 742 * @param[in] p_handle Identifies peer device for which procedure is requested.
rgrover1 103:138bdc859cc9 743 * @param[in] p_context Application context being requested. The context information includes
rgrover1 103:138bdc859cc9 744 * length of data and pointer to the contextual data is provided.
rgrover1 103:138bdc859cc9 745 *
rgrover1 103:138bdc859cc9 746 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 747 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 748 * application registration.
rgrover1 103:138bdc859cc9 749 * @retval NRF_ERROR_NULL If p_handle and/or p_context is NULL.
rgrover1 103:138bdc859cc9 750 * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application.
rgrover1 103:138bdc859cc9 751 * @retval DM_NO_APP_CONTEXT If no application context was set that can be fetched.
rgrover1 103:138bdc859cc9 752 *
rgrover1 103:138bdc859cc9 753 * @note The API returns FEATURE_NOT_ENABLED in case DEVICE_MANAGER_APP_CONTEXT_SIZE is set to
rgrover1 103:138bdc859cc9 754 * zero.
rgrover1 103:138bdc859cc9 755 */
rgrover1 103:138bdc859cc9 756 api_result_t dm_application_context_get(dm_handle_t const * p_handle,
rgrover1 103:138bdc859cc9 757 dm_application_context_t * p_context);
rgrover1 103:138bdc859cc9 758
rgrover1 103:138bdc859cc9 759 /**
rgrover1 103:138bdc859cc9 760 * @brief Function for deleting Application Context for a peer device identified by the 'p_handle' parameter.
rgrover1 103:138bdc859cc9 761 *
rgrover1 103:138bdc859cc9 762 * @details Delete Application Context for a peer device identified by the 'p_handle' parameter. If
rgrover1 103:138bdc859cc9 763 * this API returns NRF_SUCCESS, DM_EVT_APPL_CONTEXT_DELETED event is notified to the
rgrover1 103:138bdc859cc9 764 * application. The event result notified along with the event and indicates success or failure
rgrover1 103:138bdc859cc9 765 * of this procedure.
rgrover1 103:138bdc859cc9 766 *
rgrover1 103:138bdc859cc9 767 * @param[in] p_handle Identifies peer device for which procedure is requested.
rgrover1 103:138bdc859cc9 768 *
rgrover1 103:138bdc859cc9 769 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 770 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 771 * application registration.
rgrover1 103:138bdc859cc9 772 * @retval NRF_ERROR_NULL If the p_handle is NULL.
rgrover1 103:138bdc859cc9 773 * @retval NRF_ERROR_INVALID_ADDR If peer is not identified the handle provided by the application.
rgrover1 103:138bdc859cc9 774 * @retval DM_NO_APP_CONTEXT If no application context was set that can be deleted.
rgrover1 103:138bdc859cc9 775 *
rgrover1 103:138bdc859cc9 776 * @note The API returns FEATURE_NOT_ENABLED if the DEVICE_MANAGER_APP_CONTEXT_SIZE is set to zero.
rgrover1 103:138bdc859cc9 777 */
rgrover1 103:138bdc859cc9 778 api_result_t dm_application_context_delete(dm_handle_t const * p_handle);
rgrover1 103:138bdc859cc9 779
rgrover1 103:138bdc859cc9 780 /** @} */
rgrover1 103:138bdc859cc9 781
rgrover1 103:138bdc859cc9 782
rgrover1 103:138bdc859cc9 783 /**
rgrover1 103:138bdc859cc9 784 * @defgroup utility_api Utility APIs
rgrover1 103:138bdc859cc9 785 * @{
rgrover1 103:138bdc859cc9 786 * @brief This section describes the utility APIs offered by the module.
rgrover1 103:138bdc859cc9 787 *
rgrover1 103:138bdc859cc9 788 * @details APIs defined in this section are utility or assisting/helper APIs.
rgrover1 103:138bdc859cc9 789 */
rgrover1 103:138bdc859cc9 790 /**
rgrover1 103:138bdc859cc9 791 * @brief Function for Setting/Copying Application instance to Device Manager handle.
rgrover1 103:138bdc859cc9 792 *
rgrover1 103:138bdc859cc9 793 * @param[in] p_appl_instance Application instance to be set.
rgrover1 103:138bdc859cc9 794 * @param[out] p_handle Device Manager handle for which the instance is to be copied.
rgrover1 103:138bdc859cc9 795 *
rgrover1 103:138bdc859cc9 796 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 797 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 798 * application registration.
rgrover1 103:138bdc859cc9 799 * @retval NRF_ERROR_NULL If p_handle and/or p_addr is NULL.
rgrover1 103:138bdc859cc9 800 */
rgrover1 103:138bdc859cc9 801 api_result_t dm_application_instance_set(dm_application_instance_t const * p_appl_instance,
rgrover1 103:138bdc859cc9 802 dm_handle_t * p_handle);
rgrover1 103:138bdc859cc9 803
rgrover1 103:138bdc859cc9 804 /**
rgrover1 103:138bdc859cc9 805 * @brief Function for getting a peer's device address.
rgrover1 103:138bdc859cc9 806 *
rgrover1 103:138bdc859cc9 807 * @param[in] p_handle Identifies the peer device whose address is requested. Can not be NULL.
rgrover1 103:138bdc859cc9 808 * @param[out] p_addr Pointer where address is to be copied. Can not be NULL.
rgrover1 103:138bdc859cc9 809 *
rgrover1 103:138bdc859cc9 810 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 811 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 812 * application registration.
rgrover1 103:138bdc859cc9 813 * @retval NRF_ERROR_NULL If p_handle and/or p_addr is NULL.
rgrover1 103:138bdc859cc9 814 * @retval NRF_ERROR_NOT_FOUND If the peer could not be identified.
rgrover1 103:138bdc859cc9 815 */
rgrover1 103:138bdc859cc9 816 api_result_t dm_peer_addr_get(dm_handle_t const * p_handle,
rgrover1 103:138bdc859cc9 817 ble_gap_addr_t * p_addr);
rgrover1 103:138bdc859cc9 818
rgrover1 103:138bdc859cc9 819 /**
rgrover1 103:138bdc859cc9 820 * @brief Function for setting/updating a peer's device address.
rgrover1 103:138bdc859cc9 821 *
rgrover1 103:138bdc859cc9 822 * @param[in] p_handle Identifies the peer device whose address is requested to be set/updated.
rgrover1 103:138bdc859cc9 823 * @param[out] p_addr Address to be set/updated.
rgrover1 103:138bdc859cc9 824 *
rgrover1 103:138bdc859cc9 825 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 826 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 827 * application registration.
rgrover1 103:138bdc859cc9 828 * @retval NRF_ERROR_NULL If p_handle and/or p_addr is NULL.
rgrover1 103:138bdc859cc9 829 * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application.
rgrover1 103:138bdc859cc9 830 * @retval NRF_ERROR_INVALID_PARAM If this procedure is requested while connected to the peer or if the address
rgrover1 103:138bdc859cc9 831 * type was set to BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE.
rgrover1 103:138bdc859cc9 832 *
rgrover1 103:138bdc859cc9 833 * @note Setting or updating a peer's device address is permitted
rgrover1 103:138bdc859cc9 834 * only for a peer that is bonded and disconnected.
rgrover1 103:138bdc859cc9 835 * @note Updated address is reflected only after DM_EVT_DEVICE_CONTEXT_STORED is notified to the
rgrover1 103:138bdc859cc9 836 * application for this bonded device instance. In order to avoid abnormal behaviour, it is
rgrover1 103:138bdc859cc9 837 * recommended to not invite/initiate connections on the updated address unless this event
rgrover1 103:138bdc859cc9 838 * has been notified.
rgrover1 103:138bdc859cc9 839 */
rgrover1 103:138bdc859cc9 840 api_result_t dm_peer_addr_set(dm_handle_t const * p_handle,
rgrover1 103:138bdc859cc9 841 ble_gap_addr_t const * p_addr);
rgrover1 103:138bdc859cc9 842
rgrover1 103:138bdc859cc9 843 /**
rgrover1 103:138bdc859cc9 844 * @brief Function for initializing Device Manager handle.
rgrover1 103:138bdc859cc9 845 *
rgrover1 103:138bdc859cc9 846 * @param[in] p_handle Device Manager handle to be initialized.
rgrover1 103:138bdc859cc9 847 *
rgrover1 103:138bdc859cc9 848 * @retval NRF_SUCCESS On success.
rgrover1 103:138bdc859cc9 849 * @retval NRF_ERROR_NULL If p_handle is NULL.
rgrover1 103:138bdc859cc9 850 *
rgrover1 103:138bdc859cc9 851 * @note This routine is permitted before initialization of the module.
rgrover1 103:138bdc859cc9 852 */
rgrover1 103:138bdc859cc9 853 api_result_t dm_handle_initialize(dm_handle_t * p_handle);
rgrover1 103:138bdc859cc9 854
rgrover1 103:138bdc859cc9 855 /**
rgrover1 103:138bdc859cc9 856 * @brief Function for getting distributed keys for a device.
rgrover1 103:138bdc859cc9 857 *
rgrover1 103:138bdc859cc9 858 * @details This routine is used to get distributed keys with a bonded device. This API is currently
rgrover1 103:138bdc859cc9 859 * only available on S120 (GAP Central role).
rgrover1 103:138bdc859cc9 860 *
rgrover1 103:138bdc859cc9 861 * @param[in] p_handle Device Manager handle identifying the peer.
rgrover1 103:138bdc859cc9 862 *
rgrover1 103:138bdc859cc9 863 * @param[out] p_key_dist Pointer to distributed keys.
rgrover1 103:138bdc859cc9 864 *
rgrover1 103:138bdc859cc9 865 * @retval NRF_SUCCESS On success, else an error code indicating reason for failure.
rgrover1 103:138bdc859cc9 866 * @retval NRF_ERROR_INVALID_STATE If the API is called without module initialization and/or
rgrover1 103:138bdc859cc9 867 * application registration.
rgrover1 103:138bdc859cc9 868 * @retval NRF_ERROR_NULL If the p_handle and/or p_key_dist pointer is NULL.
rgrover1 103:138bdc859cc9 869 * @retval NRF_ERROR_INVALID_ADDR If the peer is not identified by the handle provided by the application.
rgrover1 103:138bdc859cc9 870 */
rgrover1 103:138bdc859cc9 871 api_result_t dm_distributed_keys_get(dm_handle_t const * p_handle,
rgrover1 103:138bdc859cc9 872 dm_sec_keyset_t * p_key_dist);
rgrover1 103:138bdc859cc9 873
rgrover1 103:138bdc859cc9 874 /** @} */
rgrover1 103:138bdc859cc9 875 /** @} */
rgrover1 103:138bdc859cc9 876 /** @} */
rgrover1 103:138bdc859cc9 877 #endif // DEVICE_MANAGER_H__
rgrover1 103:138bdc859cc9 878