Skip to content
Snippets Groups Projects
Commit 7a73f992 authored by schneider's avatar schneider
Browse files

feat(ble): Read device name from peer

parent 113177f4
No related branches found
No related tags found
1 merge request!407BLE: Show name of device which is connected / is trying to pair
......@@ -73,6 +73,8 @@ static const attcDiscCfg_t bleDiscCfgList[] =
/* Write: GATT service changed ccc descriptor */
{bleGattScCccVal, sizeof(bleGattScCccVal), (GATT_SC_CCC_HDL_IDX + BLE_DISC_GATT_START)},
{NULL, 0, (GAP_DN_HDL_IDX + BLE_DISC_GAP_START)},
/* Read: GAP central address resolution attribute */
{NULL, 0, (GAP_CAR_HDL_IDX + BLE_DISC_GAP_START)},
......
......@@ -35,6 +35,7 @@ extern "C" {
/*! \brief Enumeration of handle indexes of characteristics to be discovered */
enum
{
GAP_DN_HDL_IDX,
GAP_CAR_HDL_IDX, /*!< \brief Central Address Resolution */
GAP_RPAO_HDL_IDX, /*!< \brief Resolvable Private Address Only */
GAP_HDL_LIST_LEN /*!< \brief Handle list length */
......
......@@ -22,13 +22,24 @@
#include "wsf_trace.h"
#include "app_db.h"
#include "app_api.h"
#include "gap/gap_api.h"
#include "gap_api.h"
/* card10:
* copied from lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/profiles/gap/gap_main.c
*/
/* clang-format off */
/* clang-formet turned off for easier diffing against orginal file */
/**************************************************************************************************
Local Variables
**************************************************************************************************/
/*! GAP service characteristics for discovery */
static const attcDiscChar_t gapDn =
{
attDnChUuid,
0
};
/*! Central Address Resolution */
static const attcDiscChar_t gapCar =
......@@ -47,6 +58,7 @@ static const attcDiscChar_t gapRpao =
/*! List of characteristics to be discovered; order matches handle index enumeration */
static const attcDiscChar_t *gapDiscCharList[] =
{
&gapDn,
&gapCar, /* Central Address Resolution */
&gapRpao /* Resolvable Private Address Only */
};
......@@ -90,8 +102,12 @@ uint8_t GapValueUpdate(uint16_t *pHdlList, attEvt_t *pMsg)
{
uint8_t status = ATT_SUCCESS;
/* device name string */
if (pMsg->handle == pHdlList[GAP_DN_HDL_IDX])
{
}
/* Central Address Resolution */
if (pMsg->handle == pHdlList[GAP_CAR_HDL_IDX])
else if (pMsg->handle == pHdlList[GAP_CAR_HDL_IDX])
{
appDbHdl_t dbHdl;
......@@ -120,3 +136,4 @@ uint8_t GapValueUpdate(uint16_t *pHdlList, attEvt_t *pMsg)
return status;
}
/* clang-format on */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment