iOSのBLEコントローラアプリ「RCBController」と接続し、コントローラの操作を取得するサンプルプログラムです。 mbed HRM1017で動作を確認しています。 2014.08.20時点でのBLEライブラリに対応しました。

Dependencies:   BLE_API mbed

Fork of BLE_RCBController by Junichi Katsu

Committer:
jksoft
Date:
Wed Aug 20 13:24:20 2014 +0000
Revision:
1:48f6e08a3ac2
2014.08.20?????BLE?????????????; ???mbed?????????????????; mbed HRM1017; Nordic nRF51822

Who changed what in which revision?

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