MicroBit as BLE gamepad
Fork of nRF51822 by
Diff: source/btle/btle_discovery.cpp
- Revision:
- 575:7023a8204a1b
- Parent:
- 571:bbf6410b6a89
- Child:
- 590:3bdd5346ded1
--- a/source/btle/btle_discovery.cpp Mon Jan 11 10:19:23 2016 +0000 +++ b/source/btle/btle_discovery.cpp Mon Jan 11 10:19:24 2016 +0000 @@ -14,13 +14,15 @@ * limitations under the License. */ -#include "nRF5xServiceDiscovery.h" -#include "nRF5xGattClient.h" +#include "nRF5xn.h" #if !defined(TARGET_MCU_NRF51_16K_S110) && !defined(TARGET_MCU_NRF51_32K_S110) void bleGattcEventHandler(const ble_evt_t *p_ble_evt) { - nRF5xServiceDiscovery &sdSingleton = nRF5xGattClient::getInstance().discovery; + nRF5xn &ble = nRF5xn::Instance(BLE::DEFAULT_INSTANCE); + nRF5xGap &gap = (nRF5xGap &) ble.getGap(); + nRF5xGattClient &gattClient = (nRF5xGattClient &) ble.getGattClient(); + nRF5xServiceDiscovery &sdSingleton = gattClient.discovery; switch (p_ble_evt->header.evt_id) { case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: @@ -63,7 +65,7 @@ .len = p_ble_evt->evt.gattc_evt.params.read_rsp.len, .data = p_ble_evt->evt.gattc_evt.params.read_rsp.data, }; - nRF5xGattClient::getInstance().processReadResponse(&response); + gattClient.processReadResponse(&response); } break; @@ -76,7 +78,7 @@ .len = p_ble_evt->evt.gattc_evt.params.write_rsp.len, .data = p_ble_evt->evt.gattc_evt.params.write_rsp.data, }; - nRF5xGattClient::getInstance().processWriteResponse(&response); + gattClient.processWriteResponse(&response); } break; @@ -88,7 +90,7 @@ params.len = p_ble_evt->evt.gattc_evt.params.hvx.len; params.data = p_ble_evt->evt.gattc_evt.params.hvx.data; - nRF5xGattClient::getInstance().processHVXEvent(¶ms); + gattClient.processHVXEvent(¶ms); } break; }