mirror of https://github.com/ARMmbed/mbed-os.git
Update BLE library to latest version
parent
2dff8cf4f4
commit
5f2aec8bc7
|
@ -38,7 +38,7 @@ class GattServer
|
|||
/* These functions must be defined in the sub-class */
|
||||
virtual ble_error_t addService(GattService &) = 0;
|
||||
virtual ble_error_t readValue(uint16_t, uint8_t[], uint16_t) = 0;
|
||||
virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t) = 0;
|
||||
virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t, bool localOnly = false) = 0;
|
||||
|
||||
// ToDo: For updateValue, check the CCCD to see if the value we are
|
||||
// updating has the notify or indicate bits sent, and if BOTH are set
|
||||
|
|
|
@ -162,7 +162,7 @@ ble_error_t nRF51Gap::startAdvertising(GapAdvertisingParams & params)
|
|||
return BLE_ERROR_PARAM_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
/* ToDo: Start Advertising */
|
||||
/* Start Advertising */
|
||||
ble_gap_adv_params_t adv_para = { 0 };
|
||||
|
||||
adv_para.type = params.getAdvertisingType() ;
|
||||
|
@ -174,7 +174,7 @@ ble_error_t nRF51Gap::startAdvertising(GapAdvertisingParams & params)
|
|||
|
||||
ASSERT( ERROR_NONE == sd_ble_gap_adv_start(&adv_para), BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
|
||||
state.advertising = 1;
|
||||
state.advertising = 1;
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
@ -197,12 +197,10 @@ ble_error_t nRF51Gap::startAdvertising(GapAdvertisingParams & params)
|
|||
/**************************************************************************/
|
||||
ble_error_t nRF51Gap::stopAdvertising(void)
|
||||
{
|
||||
/* ToDo: Stop Advertising */
|
||||
/* Stop Advertising */
|
||||
ASSERT( ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
|
||||
/* ToDo: Check response */
|
||||
wait(0.1);
|
||||
|
||||
state.advertising = 0;
|
||||
state.advertising = 0;
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
@ -225,10 +223,11 @@ ble_error_t nRF51Gap::stopAdvertising(void)
|
|||
/**************************************************************************/
|
||||
ble_error_t nRF51Gap::disconnect(void)
|
||||
{
|
||||
/* ToDo: Disconnect if we are connected to a central device */
|
||||
|
||||
state.advertising = 0;
|
||||
state.connected = 0;
|
||||
/* Disconnect if we are connected to a central device */
|
||||
// ASSERT( ERROR_NONE == sd_ble_gap_disconnect(), BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
|
||||
state.advertising = 0;
|
||||
state.connected = 0;
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
|
|
@ -136,8 +136,13 @@ ble_error_t nRF51GattServer::readValue(uint16_t charHandle, uint8_t buffer[], ui
|
|||
@endcode
|
||||
*/
|
||||
/**************************************************************************/
|
||||
ble_error_t nRF51GattServer::updateValue(uint16_t charHandle, uint8_t buffer[], uint16_t len)
|
||||
ble_error_t nRF51GattServer::updateValue(uint16_t charHandle, uint8_t buffer[], uint16_t len, bool localOnly)
|
||||
{
|
||||
if (localOnly)
|
||||
{
|
||||
/* Only update locally regardless of notify/indicate */
|
||||
ASSERT_INT( ERROR_NONE, sd_ble_gatts_value_set(nrfCharacteristicHandles[charHandle].value_handle, 0, &len, buffer), BLE_ERROR_PARAM_OUT_OF_RANGE );
|
||||
}
|
||||
if ((p_characteristics[charHandle]->properties & (GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_INDICATE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY)) &&
|
||||
(m_connectionHandle != BLE_CONN_HANDLE_INVALID) )
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ class nRF51GattServer : public GattServer
|
|||
/* Functions that must be implemented from GattServer */
|
||||
virtual ble_error_t addService(GattService &);
|
||||
virtual ble_error_t readValue(uint16_t, uint8_t[], uint16_t);
|
||||
virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t);
|
||||
virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t, bool localOnly = false);
|
||||
|
||||
/* nRF51 Functions */
|
||||
void eventCallback(void);
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _NORDIC_GLOBAL_H_
|
||||
#define _NORDIC_GLOBAL_H_
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
|
||||
/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
|
||||
*
|
||||
* The information contained herein is property of Nordic Semiconductor ASA.
|
||||
* Terms and conditions of usage are described in detail in NORDIC
|
||||
|
|
Loading…
Reference in New Issue