Device Manager manages all bonded devices managing all contexts for a bonded device. Various contexts are identified under
- Device Context: Bonding and peer identification information.
- Service Context: GATT Server's configuration for peer device is a typical example for service context. Module has provision to store GATT client related information as well, but not completely implemented. In case application does not implement GATT Server or Client, DM_PROTOCOL_CNTXT_NONE can be used when registering the application to indicate respective service context are not used. See Service/Protocol Types for details.
- Application Context: In case application requires to store application specific data per bonded device, it can do so by requesting Device Manager to store application context for the device. Application context is not permitted to be set for a non bonded device.
Device Manager cab be compile time to suit the application. Configuration includes number of active peers, bonded device module should support, number of CCCDs in GATT Server, Application context size etc. Active refers to maximum connections that the module wants to be able to manage concurrently. Configurable parameters are described in device_manager_cnfg.h.
Initialization
Device manager should be initialized before using any of module APIs. Initialization should be done once.
- Note
- In case deleting all device context is requested during initialization DM_EVT_DEVICE_CONTEXT_DELETED events are not generated for each of the devices stored persistently.
-
pstorage module shall be initialized before initializing this module. Application shall be
uint32_t retval;
{
}
else
{
}
Associated Events
None. Asynchronous events from module are only received after module is successfully initialized and registered.
Associated Configuration Parameters
None. Initialization procedure is unaltered by configuration of the module.
Registration
The application should register with the device manager before using any other APIs of the module. Registration is done using the dm_register API. Sample code below demonstrate registration procedure with the module.
uint32_t retval;
param.ntf_cb = example_cm_event_handler;
{
}
else
{
}
Associated Events
None. Asynchronous events from module are only received after module is successfully initialized and registered. Once successfully registered, application will have one or more events associated with each procedure it requests. Few events could be triggered due to an action on the peer. An example of such an event is the disconnection event DM_EVT_DISCONNECTION.
Associated Configuration Parameters
- DEVICE_MANAGER_MAX_APPLICATIONS: Number of applications that can be registered with the module is determined by this configuration parameter. Currently only one application can be registered with the connection manager.
- DEVICE_MANAGER_MAX_CONNECTIONS: Maximum number of concurrent connection for which security procedures and contexts are managed by the application.
- Note
- for GAP Central, this should not exceed 8 and for GAP Peripheral this should not exceed 1.
- DEVICE_MANAGER_MAX_BONDS: Maximum number of bonds that the module should manage for the application.
- Note
- Currently module cannot handle more than 10 bonds.