Merge pull request #28 from jpbrucker/s110_compat

Add S110 SoftDevice compatibility
master
Rohit Grover 2015-07-24 12:44:36 +01:00
commit 723c701b95
2 changed files with 9 additions and 1 deletions

View File

@ -113,12 +113,18 @@ static void btle_handler(ble_evt_t *p_ble_evt)
switch (p_ble_evt->header.evt_id) {
case BLE_GAP_EVT_CONNECTED: {
Gap::Handle_t handle = p_ble_evt->evt.gap_evt.conn_handle;
#if defined(MCU_NORDIC_16K_S110) || defined(MCU_NORDIC_32K_S110)
/* Only peripheral role is supported by S110 */
Gap::Role_t role = Gap::PERIPHERAL;
#else
Gap::Role_t role = static_cast<Gap::Role_t>(p_ble_evt->evt.gap_evt.params.connected.role);
#endif
nRF5xGap::getInstance().setConnectionHandle(handle);
const Gap::ConnectionParams_t *params = reinterpret_cast<Gap::ConnectionParams_t *>(&(p_ble_evt->evt.gap_evt.params.connected.conn_params));
const ble_gap_addr_t *peer = &p_ble_evt->evt.gap_evt.params.connected.peer_addr;
const ble_gap_addr_t *own = &p_ble_evt->evt.gap_evt.params.connected.own_addr;
nRF5xGap::getInstance().processConnectionEvent(handle,
static_cast<Gap::Role_t>(p_ble_evt->evt.gap_evt.params.connected.role),
role,
static_cast<Gap::AddressType_t>(peer->addr_type), peer->addr,
static_cast<Gap::AddressType_t>(own->addr_type), own->addr,
params);

View File

@ -547,7 +547,9 @@ typedef struct
{
ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. */
ble_gap_addr_t own_addr; /**< Bluetooth address of the local device used during connection setup. */
#if !defined(MCU_NORDIC_16K_S110) && !defined(MCU_NORDIC_32K_S110)
uint8_t role; /**< BLE role for this connection, see @ref BLE_GAP_ROLES */
#endif
uint8_t irk_match :1; /**< If 1, peer device's address resolved using an IRK. */
uint8_t irk_match_idx :7; /**< Index in IRK list where the address was matched. */
ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */