Commit Graph

46 Commits (040baa12c08b439f9a09f0c1594ac625e58e2ad1)

Author SHA1 Message Date
Joe Finney 040baa12c0 Add NRF event loop handler hook. 2017-03-01 16:53:28 +00:00
Joe Finney 0963f913e0 microbit: Added funciton to allow the size of the GATT table to be configuraed
from the user's application.

The default ble-nrf51822 library does not provide a mechanism for the user
application to define size of the GATT attribute table size. It is important as
over 1.5K of sram is statically alllocated for SD.
2016-02-08 01:01:53 +00:00
Joe Finney 2b2a9d0fab microbit: Remove restriction on GATT table size to permit larger profiles. 2016-02-07 20:39:57 +00:00
Joe Finney 12cc720955 BUGFIX: Add conditional compilation to support S110 only builds
S110 builds contian a conditional compilation option that compiles out
GattClient functionality, thereby saving several hundred bytes of unecessary
memory overhead.
2016-01-16 15:11:48 +00:00
Joe Finney 93dd3fcc5b microbit: Defined an initial GATT table size of 768 bytes.
Reduced GATT table size by 1K. 768 bytes is sufficient to hold the basic
micro:bit BLE services (Device Information, DFU, event service). The
additional 1K normally held by SoftDevice can then be reused for application
heap.
2016-01-12 22:12:37 +00:00
Joe Finney 2547adaa9c BUGFIX: Updated security requirements for notify/indicate descriptors to match the associated characteristic
Required to both ensure security is not circumvented, and also to initiate bonding via a notification request.
2016-01-12 22:10:47 +00:00
Andres Amaya Garcia 1e4d6f20fc Add initialization check before querying SD bond table 2016-01-11 09:32:59 +00:00
Andres Amaya Garcia 116eb8db8e Finish implementation of getAddressesFromBondTable
Finish the implementation of the new function getAddressesFromBondTable() in
SecurityManager that returns a table with a list of addresses from the peers
in the bond table.
2016-01-08 18:23:43 +00:00
Andres Amaya Garcia 9d0c6381d4 Add missing documentation to btle_security for whitelisting 2016-01-08 14:20:38 +00:00
Andres Amaya Garcia 2ebbcb08b5 Add documentation and fix style of SecurityManager 2016-01-08 14:20:38 +00:00
Andres Amaya Garcia c9b6bb9bbb Almost complete implementation of whitelisting API 2016-01-08 14:20:38 +00:00
Andres Amaya Garcia 0f76db4eed Add helper function to get whitelist from SD bond table 2016-01-08 14:20:38 +00:00
Vincent Coubard 19d1c40612 Merge branch 'develop' of https://github.com/ARMmbed/ble-nrf51822 into characteristicDescriptorDiscovery 2015-12-22 17:53:52 +00:00
Andres Amaya Garcia 7f02a2d51f Add check for return code of ble_init 2015-12-21 09:32:44 +00:00
Vincent Coubard fd8b73f914 Merge pull request #87 from andresag01/develop
Improve shutdown to clear BLE API and not just SD
2015-12-15 13:53:09 +00:00
Rohit Grover ca8b3d2135 replace instances of BLEProtocol::AddressType::Type with BLEProtocol::AddressType_t 2015-12-15 13:05:24 +00:00
Rohit Grover 52200b37bb follow the extraction of ddress related types from Gap.h into BLEProtocol.h 2015-12-14 17:09:28 +00:00
Andres Amaya Garcia 0bcc2e96c9 Modify shutdown due to BLE API change
The module is updated to comply with the changes to BLE API regarding correct
shutdown functionality. The following changes are introduced to ble-nrf51822:

* Calls to the old static function shutdown in Gap, GattClient, GattServer and
SecurityManager are removed.
* The cleanup function in Gap, GattClient, GattServer and SecurityManager is
renamed to `reset()` and made public.
* The static references inside nRF5xGap, nRF5xGattClient, nRF5xGattServer and
nRF5xSecurityManager to objects of their own class are moved to nRF5xn.
* The static getInstance accessors in nRF5xGap, nRF5xGattClient,
nRF5xGattServer and nRF5xSecurityManager are removed and their functionality is
moved to the implemented virtual accessors in nRF5xn i.e. getGap(),
getGattClient, etc.
* A static function Instance is added to nRF5xn class to make the transport
object accessible across the module.
2015-12-14 15:15:35 +00:00
Vincent Coubard 7e784e0e0c Merge branch 'develop' of https://github.com/ARMmbed/ble-nrf51822 into characteristicDescriptorDiscovery 2015-12-14 11:57:57 +00:00
Marcus Chang b2cb566312 Added SecurityManager::setLinkSecurity call for elevating security settings on a particular connection. 2015-12-10 15:09:00 +00:00
Marcus Chang e554200f5e Removed endian conversion in custom helper functions. 2015-12-02 15:39:06 +00:00
Andres Amaya Garcia 4b3a1c85b5 Allow GattAttributes to have fixed length
Previously the concepts of initLength and lenth were clearly separated.
However, this was at the cost of registering all characteristics in the
SoftDevice as having variable length. Clearly, this is not the desired
behaviour. Therefore, an additional field '_hasVariableLen' is added to the
GattAttribute to address the problem. Also, the GattAttribute and
GattCharacteristic constructors have been modified to take a boolean that
sets '_hasVariableLen'.

**NOTE:** Changes to this module will cause projects to fail the build stage
if changes to the BLE_API are not published first.
2015-12-02 10:41:01 +00:00
Andres Amaya Garcia 3fb32e167f Separate concept of minlen and len for BLE chars
In previous versions of BLE_API the GattCharacteristic initLen parameter is
named minLen as well. When the characteristic is committed to the SoftDevice
the value of initial length is also used as the minimum length of the
characteristic value. Furthermore, the test (max_length == min_length) is used
to determine whether the characteristic value has variable length. This is
slightly confusing and also causes problems if the user wishes to use a
characteristic with variable length but the initial lenght is equal to max
length.

To solve this problem the characteristic is now always committed to the
SoftDevice as variable. Furthermore, the API only maintains the current lenght
and the max length i.e. the field initialLen in the GattAttribute is removed.
In nRF5xGattServer all calls to getInitialLength() are removed and replaced
with getLength().

*NOTES:*
* This change requires updates to ble.
* Ideally we would like the characteristics to be declared as 'variable' only
when necessary, but this requires changing the signature of the
GattCharacteristic and GattAttribute constructors. Therefore, it will be part
of a separate pull request.
2015-11-27 17:25:58 +00:00
Vincent Coubard b795c29150 Terminate pending discoveries when a connection end.
Add accessor for ServiceDiscovery and CharacteristicDescriptorDiscover in
GattClient.

Remove friend relationship with bleGattcEventHandler
2015-11-19 08:31:43 +00:00
Liyou Zhou dfb6ac292f Remove magic hash defines which are used in nrf51-sdk
nrf51-sdk files are modified to include these defines.
2015-11-18 14:25:10 +00:00
Liyou Zhou 348c323d27 Take modification out of the nordic sdk files
and put them into ARM written files.
2015-11-18 14:25:10 +00:00
Vincent Coubard 8bd7bdfa88 Add ARM header into source/nRF5xGattClient.h.
Use const references for passing characteristic discovery callbacks
Fix a bug in btle_discovery.cpp, the discovered descriptors were captured
by value instead of reference.
2015-11-18 12:45:43 +00:00
Vincent Coubard dc2dfb0a95 Add status parameter in terminateCharacteristicDiscovery function.
Fix terminate discovery (the replacement of the discovery was done after
the call to terminate).
When searching for a running discovery, dismiss results where the
characteristic is equal to the default characteristic value
Add Discovery::operator!=
Add support of DiscoveredCharacteristic last handle in the characteristic
discovery process
2015-11-17 14:20:17 +00:00
Vincent Coubard cdd5b92193 Relaunch discovery operation when gatt event status is
BLE_GATT_STATUS_SUCCESS.
Report error in the Termination callback
2015-11-17 10:24:57 +00:00
Vincent Coubard e15d59a758 Add Characteristic Descriptor Discovery implementation 2015-11-13 14:53:46 +00:00
Andres Amaya Garcia 97a65815ed Introduced changes for memory savings
Moved GattSecurityManager and GattClient to be allocated dynamically and
reduced the size of some arrays to increase memory savings.
2015-10-29 11:39:00 +00:00
Jean-Philippe Brucker eab6631cb6 Update S110 detection macros again
The mbed SDK actually prefixes all labels from targets.py with "TARGET_".
Update our detection macros accordingly.
2015-10-05 18:05:55 +01:00
Jean-Philippe Brucker dc1d7893c4 Update S110 detection macros
Those macros are defined by mbed SDK in targets.py. They changed from
MCU_NORDIC_xxx_S110 to MCU_NRF51_xxx_S110. Update the #ifdefs accordingly.
2015-08-24 18:09:28 +01:00
Rohit Grover 74c707687b setup an event handler to post BLE events to Minar.
Stack and system events now get scheduled through minar.
2015-08-13 11:01:50 +01:00
Rohit Grover 1da1aa8622 fix #39: have a single call to SOFTDEVICE_HANDLER_INIT() to remove duplication of BLE_EVT_BUFFER. 2015-08-11 14:42:53 +01:00
Rohit Grover 2c01109786 Merge pull request #38 from jpbrucker/s110_compat
Disable GattClient features when using S110 SoftDevice
2015-08-11 14:21:33 +01:00
Jean-Philippe Brucker 3eabc779a0 Disable GattClient features when using S110 SoftDevice
S110 compatibility is already present, but this patch adds proper handling
of observer/central related features:
* Gap::startScan will return BLE_ERRROR_NOT_IMPLEMENTED (instead of
  PARAM_OUT_OF_RANGE)
* nRF5xGattClient uses the default GattClient implementation when S110 is
  in use. All if its methods return NOT_IMPLEMENTED.

Example: for an application that acts as both a central and a peripheral,
using S110 will make the ble.gap().startScan() call return
BLE_ERROR_NOT_IMPLEMENTED, and advertisement features will continue
running normally.
In addition, with GCC, this patch will free 344 bytes of RAM and 2504
bytes of flash.
2015-08-11 13:02:34 +01:00
Jean-Philippe Brucker 73147b41c2 Fill connection handle in Gatt callbacks parameters 2015-08-11 11:31:20 +01:00
Rohit Grover 692d7e08e8 minor cosmetic change to the previous commit. 2015-08-05 12:47:41 +01:00
Jean-Philippe Brucker b22c2e826f Select the clock source dynamically on SoftDevice initialisation
Instead of relying on build macros to know which oscillator we're
supposedly using, check the value of LFCLKSRC register. This way, we can
trust mbed's init code to fallback on the internal clock if the user
specified a wrong target.
This change, along with the mbed patch that selects clock source
dynamically, will allow lots of application to still run and provide
FOTA, when the wrong Nordic platform is specified.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
2015-08-03 18:56:22 +01:00
Jean-Philippe Brucker 20f4417724 Add SoftDevice s110 compatibility
This patch adds the ability to use the API with the s110 SoftDevice.
Only a minor change is needed so far, to support the absence of roles in
s110.
2015-07-22 11:29:25 +01:00
Rohit Grover 0eb58d86f5 rename nRF51... to nRF5x...
This prepares us to support nRF52.
2015-07-06 14:18:01 +01:00
Rohit Grover 57c99a5ac3 fix #22: add GattClient API for handling HVX Events (notifications and indications). 2015-07-06 09:23:17 +01:00
Rohit Grover 5370a5097e relocating the tree under ble-nrf51822/btle 2015-07-02 13:32:19 +01:00
Rohit Grover 094e94b9f8 Merge branch 'master' of https://github.com/autopulated/nRF51822 into autopulated-master 2015-07-02 12:56:29 +01:00
James Crosby 488e24620d restructure to yotta module, with a few tweaks to get things building 2015-06-23 18:15:41 +01:00