Download a stream of data to a peripheral over BLE.
Dependencies: BLE_API mbed nRF51822
A simple demonstration of downloading a stream onto a peripheral over BLE. There's a corresponding Python script to driver the client.
Diff: main.cpp
- Revision:
- 3:d58f3a5bd66c
- Parent:
- 1:d623a5792ce5
- Child:
- 4:29ae814ca55e
--- a/main.cpp Fri Aug 29 10:41:56 2014 +0200 +++ b/main.cpp Tue Sep 02 16:30:18 2014 +0000 @@ -30,16 +30,18 @@ void bluetoothInit(); -void disconnectionCallback(Gap::Handle_t handle) +void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason) { DEBUG("Disconnected\n\r"); ble.startAdvertising(); DEBUG("Advertising...\r\n"); } -void onConnectionCallback(Gap::Handle_t handle) +void onConnectionCallback(Gap::Handle_t handle, const Gap::ConnectionParams_t *params) { DEBUG("____[ Connected ]______________________________________\r\n"); + DEBUG("Conn. params => min=%d, max=%d, slave=%d, supervision=%d\r\n", + params->minConnectionInterval, params->maxConnectionInterval, params->slaveLatency, params->connectionSupervisionTimeout); connectionParams.minConnectionInterval = Config::minConnectionInterval; connectionParams.maxConnectionInterval = Config::maxConnectionInterval; @@ -57,10 +59,10 @@ DEBUG("Notifications enabled for %d\r\n", handle); } -void onDataWritten(Gap::Handle_t handle) +void onDataWritten(Gap::Handle_t handle, const GattCharacteristicWriteCBParams *params) { // bubble up to services, they will emit callbacks if handle matches - Transfer::handleDataWritten(handle); + Transfer::handleDataWritten(handle, params); } void bluetoothInit()