@@ -51,11 +51,9 @@ extern "C" {
51
51
}
52
52
53
53
#include " nrf_ble_hci.h"
54
- #include " btle_discovery.h"
55
54
56
- #include " nRF5xGattClient.h"
57
- #include " nRF5xServiceDiscovery.h"
58
- #include " nRF5xCharacteristicDescriptorDiscoverer.h"
55
+ #include " nRF5XPalGattClient.h"
56
+
59
57
60
58
61
59
bool isEventsSignaled = false ;
@@ -67,23 +65,6 @@ extern "C" void SD_EVT_IRQHandler(void); // export the softdevice event handler
67
65
68
66
static void btle_handler (ble_evt_t *p_ble_evt);
69
67
70
- #if 0
71
- #define CENTRAL_LINK_COUNT (YOTTA_CFG_NORDIC_BLE_CENTRAL_LINKS) /**<number of central links used by the application. When changing this number remember to adjust the RAM settings */
72
- /** If value for YOTTA_CFG_NORDIC_BLE_PERIPHERAL_LINKS was used, ram settings are adjusted by the yotta target module. */
73
- #define PERIPHERAL_LINK_COUNT (YOTTA_CFG_NORDIC_BLE_PERIPHERAL_LINKS) /**<number of peripheral links used by the application. When changing this number remember to adjust the RAM settings*/
74
- /** If value for YOTTA_CFG_NORDIC_BLE_CENTRAL_LINKS was used, ram settings are adjusted by the yotta target module. */
75
- #define GATTS_ATTR_TAB_SIZE (YOTTA_CFG_NORDIC_BLE_GATTS_ATTR_TAB_SIZE) /**< GATTS attribite table size. */
76
- /** If value for YOTTA_CFG_NORDIC_BLE_GATTS_ATTR_TAB_SIZE was used, ram settings are adjusted by the yotta target module. */
77
- #else
78
- #define CENTRAL_LINK_COUNT 3 /* *<number of central links used by the application. When changing this number remember to adjust the RAM settings */
79
- /* * If value for YOTTA_CFG_NORDIC_BLE_PERIPHERAL_LINKS was used, ram settings are adjusted by the yotta target module. */
80
- #define PERIPHERAL_LINK_COUNT 1 /* *<number of peripheral links used by the application. When changing this number remember to adjust the RAM settings*/
81
- /* * If value for YOTTA_CFG_NORDIC_BLE_CENTRAL_LINKS was used, ram settings are adjusted by the yotta target module. */
82
- #define GATTS_ATTR_TAB_SIZE 0x600 /* *< GATTS attribite table size. */
83
- /* * If value for YOTTA_CFG_NORDIC_BLE_GATTS_ATTR_TAB_SIZE was used, ram settings are adjusted by the yotta target module. */
84
-
85
- #endif
86
-
87
68
static void sys_evt_dispatch (uint32_t sys_evt)
88
69
{
89
70
#if (IS_LEGACY_DEVICE_MANAGER_ENABLED)
@@ -121,7 +102,7 @@ error_t btle_init(void)
121
102
122
103
// register softdevice handler vector
123
104
NVIC_SetVector (SD_EVT_IRQn, (uint32_t ) SD_EVT_IRQHandler);
124
-
105
+
125
106
// Configure the LF clock according to values provided by btle_clock.h.
126
107
// It is input from the chain of the yotta configuration system.
127
108
clockConfiguration.source = LFCLK_CONF_SOURCE;
@@ -189,6 +170,8 @@ error_t btle_init(void)
189
170
190
171
static void btle_handler (ble_evt_t *p_ble_evt)
191
172
{
173
+ using ble::pal::vendor::nordic::nRF5XGattClient;
174
+
192
175
/* Library service handlers */
193
176
#if SDK_CONN_PARAMS_MODULE_ENABLE
194
177
ble_conn_params_on_ble_evt (p_ble_evt);
@@ -206,7 +189,7 @@ static void btle_handler(ble_evt_t *p_ble_evt)
206
189
#endif
207
190
208
191
#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110)
209
- bleGattcEventHandler (p_ble_evt);
192
+ nRF5XGattClient::handle_events (p_ble_evt);
210
193
#endif
211
194
212
195
nRF5xn &ble = nRF5xn::Instance (BLE::DEFAULT_INSTANCE);
@@ -229,7 +212,7 @@ static void btle_handler(ble_evt_t *p_ble_evt)
229
212
const ble_gap_addr_t *peer = &p_ble_evt->evt .gap_evt .params .connected .peer_addr ;
230
213
#if (NRF_SD_BLE_API_VERSION <= 2)
231
214
const ble_gap_addr_t *own = &p_ble_evt->evt .gap_evt .params .connected .own_addr ;
232
-
215
+
233
216
gap.processConnectionEvent (handle,
234
217
role,
235
218
static_cast <BLEProtocol::AddressType_t>(peer->addr_type ), peer->addr ,
@@ -275,9 +258,7 @@ static void btle_handler(ble_evt_t *p_ble_evt)
275
258
276
259
#if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110)
277
260
// Close all pending discoveries for this connection
278
- nRF5xGattClient& gattClient = ble.getGattClient ();
279
- gattClient.characteristicDescriptorDiscoverer ().terminate (handle, BLE_ERROR_INVALID_STATE);
280
- gattClient.discovery ().terminate (handle);
261
+ nRF5XGattClient::handle_connection_termination (handle);
281
262
#endif
282
263
283
264
gap.processDisconnectionEvent (handle, reason);
0 commit comments