Skip to content
Snippets Groups Projects
Verified Commit ef7e8958 authored by schneider's avatar schneider Committed by rahix
Browse files

fix(ble): Add some static checking of the attribute group sizes

parent 048196e6
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "svc_core.h" #include "svc_core.h"
#include "svc_ch.h" #include "svc_ch.h"
#include "svc_cfg.h" #include "svc_cfg.h"
#include "wsf_assert.h"
/************************************************************************************************** /**************************************************************************************************
Macros Macros
...@@ -79,6 +80,9 @@ static const uint16_t gapLenCarCh = sizeof(gapValCarCh); ...@@ -79,6 +80,9 @@ static const uint16_t gapLenCarCh = sizeof(gapValCarCh);
/* central address resolution */ /* central address resolution */
static uint8_t gapValCar[] = {FALSE}; static uint8_t gapValCar[] = {FALSE};
static const uint16_t gapLenCar = sizeof(gapValCar); static const uint16_t gapLenCar = sizeof(gapValCar);
#if 0
/* TODO card10:
* Enable these if "privacy" is enabled. See svc_core.h lien 38 */
/* resolvable private address only characteristic */ /* resolvable private address only characteristic */
static const uint8_t gapValRpaoCh[] = {ATT_PROP_READ, UINT16_TO_BYTES(GAP_RPAO_HDL), UINT16_TO_BYTES(ATT_UUID_RPAO)}; static const uint8_t gapValRpaoCh[] = {ATT_PROP_READ, UINT16_TO_BYTES(GAP_RPAO_HDL), UINT16_TO_BYTES(ATT_UUID_RPAO)};
...@@ -87,6 +91,7 @@ static const uint16_t gapLenRpaoCh = sizeof(gapValRpaoCh); ...@@ -87,6 +91,7 @@ static const uint16_t gapLenRpaoCh = sizeof(gapValRpaoCh);
/* resolvable private address only */ /* resolvable private address only */
static uint8_t gapValRpao[] = {0}; static uint8_t gapValRpao[] = {0};
static const uint16_t gapLenRpao = sizeof(gapValRpao); static const uint16_t gapLenRpao = sizeof(gapValRpao);
#endif
/* Attribute list for GAP group */ /* Attribute list for GAP group */
static const attsAttr_t gapList[] = static const attsAttr_t gapList[] =
...@@ -147,6 +152,9 @@ static const attsAttr_t gapList[] = ...@@ -147,6 +152,9 @@ static const attsAttr_t gapList[] =
0, 0,
ATTS_PERMIT_READ ATTS_PERMIT_READ
}, },
#if 0
/* TODO card10:
* Enable these if "privacy" is enabled. See svc_core.h lien 38 */
{ {
attChUuid, attChUuid,
(uint8_t *) gapValRpaoCh, (uint8_t *) gapValRpaoCh,
...@@ -163,6 +171,7 @@ static const attsAttr_t gapList[] = ...@@ -163,6 +171,7 @@ static const attsAttr_t gapList[] =
0, 0,
ATTS_PERMIT_READ ATTS_PERMIT_READ
} }
#endif
}; };
/* GAP group structure */ /* GAP group structure */
...@@ -176,6 +185,7 @@ static attsGroup_t svcGapGroup = ...@@ -176,6 +185,7 @@ static attsGroup_t svcGapGroup =
GAP_END_HDL GAP_END_HDL
}; };
WSF_CT_ASSERT(((sizeof(gapList) / sizeof(gapList[0])) == GAP_END_HDL - GAP_START_HDL + 1));
/************************************************************************************************** /**************************************************************************************************
GATT group GATT group
**************************************************************************************************/ **************************************************************************************************/
...@@ -244,6 +254,8 @@ static attsGroup_t svcGattGroup = ...@@ -244,6 +254,8 @@ static attsGroup_t svcGattGroup =
GATT_END_HDL GATT_END_HDL
}; };
WSF_CT_ASSERT(((sizeof(gattList) / sizeof(gattList[0])) == GATT_END_HDL - GATT_START_HDL + 1));
/*************************************************************************************************/ /*************************************************************************************************/
/*! /*!
* \brief Add the services to the attribute server. * \brief Add the services to the attribute server.
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*/ */
#include "wsf_types.h" #include "wsf_types.h"
#include "att_api.h" #include "att_api.h"
#include "wsf_assert.h"
#include "wsf_trace.h" #include "wsf_trace.h"
#include "util/bstream.h" #include "util/bstream.h"
#include "svc_dis.h" #include "svc_dis.h"
...@@ -306,6 +307,7 @@ static attsGroup_t svcDisGroup = ...@@ -306,6 +307,7 @@ static attsGroup_t svcDisGroup =
DIS_END_HDL DIS_END_HDL
}; };
WSF_CT_ASSERT(((sizeof(disList) / sizeof(disList[0])) == DIS_END_HDL - DIS_START_HDL + 1));
/*************************************************************************************************/ /*************************************************************************************************/
/*! /*!
* \brief Add the services to the attribute server. * \brief Add the services to the attribute server.
......
...@@ -33,6 +33,8 @@ extern "C" { ...@@ -33,6 +33,8 @@ extern "C" {
Handle Ranges Handle Ranges
**************************************************************************************************/ **************************************************************************************************/
/** \name GAP Service Handles /** \name GAP Service Handles
* TODO card10:
* WTF!
* \note GAP -- RPAO characterstic added only when DM Privacy enabled * \note GAP -- RPAO characterstic added only when DM Privacy enabled
*/ */
/**@{*/ /**@{*/
......
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