test1
Diff: source/BlueNRGGap.cpp
- Branch:
- 83c30f290087a6f5a503812f507492e725a3b717
- Revision:
- 272:4639da7705e1
- Parent:
- 270:ca649990a830
- Child:
- 276:a20f4cad1d61
--- a/source/BlueNRGGap.cpp Thu Sep 15 10:51:33 2016 +0100 +++ b/source/BlueNRGGap.cpp Thu Sep 15 10:51:34 2016 +0100 @@ -765,9 +765,36 @@ /**************************************************************************/ ble_error_t BlueNRGGap::updateConnectionParams(Handle_t handle, const ConnectionParams_t *params) { - /* avoid compiler warnings about unused variables */ - (void) handle; - (void)params; + tBleStatus ret = BLE_STATUS_SUCCESS; + + if(gapRole == Gap::CENTRAL) { + ret = aci_gap_start_connection_update(handle, + params->minConnectionInterval, + params->maxConnectionInterval, + params->slaveLatency, + params->connectionSupervisionTimeout, + CONN_L1, CONN_L2); + } else { + ret = aci_l2cap_connection_parameter_update_request(handle, + params->minConnectionInterval, + params->maxConnectionInterval, + params->slaveLatency, + params->connectionSupervisionTimeout); + } + + if (BLE_STATUS_SUCCESS != ret){ + PRINTF("updateConnectionParams failed (ret=0x%x)!!\n\r", ret) ; + switch (ret) { + case ERR_INVALID_HCI_CMD_PARAMS: + case BLE_STATUS_INVALID_PARAMETER: + return BLE_ERROR_INVALID_PARAM; + case ERR_COMMAND_DISALLOWED: + case BLE_STATUS_NOT_ALLOWED: + return BLE_ERROR_OPERATION_NOT_PERMITTED; + default: + return BLE_ERROR_UNSPECIFIED; + } + } return BLE_ERROR_NONE; } @@ -1265,7 +1292,12 @@ { /* avoid compiler warnings about unused variables */ (void)connectionParams; - (void)scanParams; + + setScanParams(scanParams->getInterval(), + scanParams->getWindow(), + scanParams->getTimeout(), + scanParams->getActiveScanning() + ); // Save the peer address for(int i=0; i<BDADDR_SIZE; i++) { @@ -1382,4 +1414,9 @@ void BlueNRGGap::setConnectionInterval(uint16_t interval) { conn_min_interval = interval; conn_max_interval = interval; -} \ No newline at end of file +} + +void BlueNRGGap::setGapRole(Role_t role) +{ + gapRole = role; +}