Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Revision 951:2dc552be2b94, committed 2015-11-26
- Comitter:
- rgrover1
- Date:
- Thu Nov 26 12:52:09 2015 +0000
- Parent:
- 950:b576e5675a8c
- Child:
- 952:8a6c287de1be
- Commit message:
- Synchronized with git rev 6e837e3e
Changed in this revision
--- a/CONTRIBUTING.md Thu Nov 26 12:52:09 2015 +0000 +++ b/CONTRIBUTING.md Thu Nov 26 12:52:09 2015 +0000 @@ -1,7 +1,7 @@ # Hello! -We are an open source project of [ARM mbed](www.mbed.com). Contributions via [pull request](https://github.com/armmbed/yotta/pulls), and [bug reports](https://github.com/armmbed/yotta/issues) are welcome! +We are an open source project of [ARM mbed](https://www.mbed.com). Contributions via [pull request](https://github.com/ARMmbed/ble/pulls), and [bug reports](https://github.com/ARMmbed/ble/issues) are welcome! -Please submit your pull request to the 'develop' branch of this module. Commits to develop will merge into master at the time of the next release. +Please submit your pull request to the `develop` branch of [this module](https://github.com/ARMmbed/ble/tree/develop). Commits to develop will be merge into the master branch at the time of the next release. # Contributor agreement -For your pull request to be accepted, we will need you to agree to our [contributor agreement](http://developer.mbed.org/contributor_agreement/) to give us the necessary rights to use and distribute your contributions. (To click through the agreement create an account on mbed.com and log in.) \ No newline at end of file +For your pull request to be accepted, we will need you to agree to our [contributor agreement](https://developer.mbed.org/contributor_agreement/) to give us the necessary rights to use and distribute your contributions. (To click through the agreement create an account on mbed.com and log in.) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DOXYGEN_FRONTPAGE.md Thu Nov 26 12:52:09 2015 +0000 @@ -0,0 +1,15 @@ +#BLE API + +The BLE module within mbed OS offers a high abstraction level for using +Bluetooth Low Energy on multiple platforms. + +This documentation describes the internal structure of the mbed +[BLE API](https://github.com/armmbed/ble). It was automatically generated from +specially formatted comment blocks in BLE API's source code using Doxygen (see http://www.stack.nl/~dimitri/doxygen/ for more information on Doxygen). + +For getting started with BLE on mbed, check our [introduction +page](https://docs.mbed.com/docs/ble-intros/en/latest/). + +For mbed OS examples using BLE, check [this +repository](https://github.com/armmbed/ble-examples). For mbed-classic +examples, please refer to [code under mbed.org](https://developer.mbed.org/teams/Bluetooth-Low-Energy/code/). \ No newline at end of file
--- a/README.md Thu Nov 26 12:52:09 2015 +0000 +++ b/README.md Thu Nov 26 12:52:09 2015 +0000 @@ -1,21 +1,25 @@ # mbed Bluetooth Low Energy Stack -This is the github repo for the BLE_API used by developer.mbed.org. Please see [mbed BLE Homepage](http://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all documentation, code examples and general help. +This is the Github repo for the `BLE_API` used by developer.mbed.org. Please see the [mbed BLE Homepage](https://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all documentation, code examples and general help. # Supported Services -Supported GATT services and constantly being added and can be found in the /services folder. -Currently supported services include: -* Battery +Supported GATT services and constantly being added and can be found in the (`ble/ble/services/`)[https://github.com/ARMmbed/ble/tree/master/ble/services] folder. + +Currently supported services include: +* Battery * Device Firmware Update (DFU) -* Device Information +* Device Information +* Eddystone Configuration Service * Health Thermometer * Heart Rate +* Link Loss * UART * UriBeacon * iBeacon -# Getting Started -The mbed BLE API is meant to be used in projects on developer.mbed.org. Please see examples and sample project files there. +# Getting Started +The mbed BLE API is meant to be used in projects on developer.mbed.org. Please see examples and sample project files there. A good starting point are these pages: -* [mbed BLE Homepage](http://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all things BLE -* [mbed BLE Getting Started Guide](http://developer.mbed.org/forum/team-63-Bluetooth-Low-Energy-community/topic/5262/) a wonderful primer on using BLE with mbed -* [mbed BLE API page](http://developer.mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/docs/tip/) for the API in generated by doxygen \ No newline at end of file +* [mbed BLE Homepage](https://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all things BLE +* [mbed BLE Getting Started Guide](https://developer.mbed.org/forum/team-63-Bluetooth-Low-Energy-community/topic/5262/) a wonderful primer on using BLE with mbed +* [mbed BLE doc](https://docs.mbed.com/docs/ble-intros/en/latest/) for an introduction to mbed BLE +* [mbed BLE API page](https://developer.mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/docs/tip/) for the API in generated by doxygen \ No newline at end of file
--- a/ble/services/BatteryService.h Thu Nov 26 12:52:09 2015 +0000 +++ b/ble/services/BatteryService.h Thu Nov 26 12:52:09 2015 +0000 @@ -21,8 +21,8 @@ /** * @class BatteryService -* @brief BLE Battery Service. This service displays the battery level from 0%->100% represented as a 8bit number.<br> -* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml <br> +* @brief BLE Battery Service. This service displays the battery level from 0% to 100%, represented as an 8bit number. +* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml * Battery Level Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.battery_level.xml */ class BatteryService { @@ -45,11 +45,11 @@ } /** - * @brief Update the battery level with a new value. Valid values range from - * 0..100. Anything outside this range will be ignored. + * @brief Update the battery level with a new value. [Valid values lie between 0 and 100]; + * anything outside this range will be ignored. * * @param newLevel - * update to battery level. + * Update to battery level. */ void updateBatteryLevel(uint8_t newLevel) { batteryLevel = newLevel;
--- a/ble/services/DFUService.h Thu Nov 26 12:52:09 2015 +0000 +++ b/ble/services/DFUService.h Thu Nov 26 12:52:09 2015 +0000 @@ -20,9 +20,7 @@ #include "ble/BLE.h" #include "ble/UUID.h" -extern "C" { -#include "dfu_app_handler.h" -} +extern "C" void bootloader_start(void); extern const uint8_t DFUServiceBaseUUID[]; extern const uint16_t DFUServiceShortUUID; @@ -39,20 +37,20 @@ class DFUService { public: /** - * @brief Signature for the handover callback. The application may provide such a - * callback when setting up the DFU service, in which case it will be + * @brief Signature for the handover callback. The application may provide this + * callback when setting up the DFU service. The callback is then * invoked before handing control over to the bootloader. */ typedef void (*ResetPrepare_t)(void); public: /** - * @brief Adds Device Firmware Update service to an existing ble object. + * @brief Adds Device Firmware Update Service to an existing BLE object. * * @param[ref] _ble * BLE object for the underlying controller. * @param[in] _handoverCallback - * Application specific handover callback. + * Application-specific handover callback. */ DFUService(BLE &_ble, ResetPrepare_t _handoverCallback = NULL) : ble(_ble), @@ -61,12 +59,12 @@ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE), controlBytes(), packetBytes() { - static bool serviceAdded = false; /* We should only ever need to add the DFU service once. */ + static bool serviceAdded = false; /* We only add the DFU service once. */ if (serviceAdded) { return; } - /* Set an initial value for control bytes so that the application's DFUService can + /* Set an initial value for control bytes, so that the application's DFU service can * be distinguished from the real DFU service provided by the bootloader. */ controlBytes[0] = 0xFF; controlBytes[1] = 0xFF; @@ -82,7 +80,7 @@ } /** - * @brief get the handle for the value attribute of the control characteristic. + * @brief Get the handle for the value attribute of the control characteristic. */ uint16_t getControlHandle(void) const { return controlPoint.getValueHandle(); @@ -90,7 +88,7 @@ /** * @brief This callback allows the DFU service to receive the initial trigger to - * handover control to the bootloader; but first the application is given a + * hand control over to the bootloader. First, the application is given a * chance to clean up. * * @param[in] params @@ -98,20 +96,12 @@ */ virtual void onDataWritten(const GattWriteCallbackParams *params) { if (params->handle == controlPoint.getValueHandle()) { - /* At present, writing anything will do the trick--this needs to be improved. */ + /* At present, writing anything will do the trick - this needs to be improved. */ if (handoverCallback) { handoverCallback(); } - // Call bootloader_start implicitly trough a event handler call - // it is a work around for bootloader_start not being public in sdk 8.1 - ble_dfu_t p_dfu; - ble_dfu_evt_t p_evt; - - p_dfu.conn_handle = params->connHandle; - p_evt.ble_dfu_evt_type = BLE_DFU_START; - - dfu_app_on_dfu_evt(&p_dfu, &p_evt); + bootloader_start(); } } @@ -122,22 +112,22 @@ protected: BLE &ble; - /**< Writing to the control characteristic triggers the handover to dfu- - * bootloader. At present, writing anything will do the trick--this needs + /**< Writing to the control characteristic triggers the handover to DFU + * bootloader. At present, writing anything will do the trick - this needs * to be improved. */ WriteOnlyArrayGattCharacteristic<uint8_t, SIZEOF_CONTROL_BYTES> controlPoint; - /**< The packet characteristic in this service doesn't do anything meaningful, but - * is only a placeholder to mimic the corresponding characteristic in the + /**< The packet characteristic in this service doesn't do anything meaningful; + * it is only a placeholder to mimic the corresponding characteristic in the * actual DFU service implemented by the bootloader. Without this, some - * FOTA clients might get confused as service definitions change after + * FOTA clients might get confused, because service definitions change after * handing control over to the bootloader. */ GattCharacteristic packet; uint8_t controlBytes[SIZEOF_CONTROL_BYTES]; uint8_t packetBytes[SIZEOF_PACKET_BYTES]; - static ResetPrepare_t handoverCallback; /**< application specific handover callback. */ + static ResetPrepare_t handoverCallback; /**< Application-specific handover callback. */ }; #endif /* #ifndef __BLE_DFU_SERVICE_H__*/ \ No newline at end of file
--- a/ble/services/DeviceInformationService.h Thu Nov 26 12:52:09 2015 +0000 +++ b/ble/services/DeviceInformationService.h Thu Nov 26 12:52:09 2015 +0000 @@ -21,41 +21,30 @@ /** * @class DeviceInformationService -* @brief BLE Device Information Service <br> -* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.device_information.xml <br> +* @brief BLE Device Information Service +* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.device_information.xml * Manufacturer Name String Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.manufacturer_name_string.xml */ class DeviceInformationService { public: /** - * @brief Device Information Service Constructor. + * @brief Device Information Service Constructor: copies device-specific information + * into the BLE stack. * * @param[ref] _ble * BLE object for the underlying controller. * @param[in] manufacturersName - * This characteristic represents the name of the - * manufacturer of the device. The name is copied into the - * BLE stack during this constructor. + * The name of the manufacturer of the device. * @param[in] modelNumber - * This characteristic represents the model number that is - * assigned by the device vendor. The value is copied into - * the BLE stack during this constructor. + * The model number that is assigned by the device vendor. * @param[in] serialNumber - * This characteristic represents the serial number for a - * particular instance of the device. The value is copied - * into the BLE stack during this constructor. + * The serial number for a particular instance of the device. * @param[in] hardwareRevision - * This characteristic represents the hardware revision for - * the hardware within the device. The value is copied - * into the BLE stack during this constructor. + * The hardware revision for the hardware within the device. * @param[in] firmwareRevision - * This characteristic represents the firmware revision for - * the firmware within the device. The value is copied - * into the BLE stack during this constructor. + * The device's firmware version. * @param[in] softwareRevision - * This characteristic represents the software revision for - * the software within the device. The value is copied - * into the BLE stack during this constructor. + * The device's software version. */ DeviceInformationService(BLE &_ble, const char *manufacturersName = NULL, @@ -67,36 +56,36 @@ ble(_ble), manufacturersNameStringCharacteristic(GattCharacteristic::UUID_MANUFACTURER_NAME_STRING_CHAR, (uint8_t *)manufacturersName, - (manufacturersName != NULL) ? strlen(manufacturersName) : 0, /* minLength */ - (manufacturersName != NULL) ? strlen(manufacturersName) : 0, /* maxLength */ + (manufacturersName != NULL) ? strlen(manufacturersName) : 0, /* Min length */ + (manufacturersName != NULL) ? strlen(manufacturersName) : 0, /* Max length */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), modelNumberStringCharacteristic(GattCharacteristic::UUID_MODEL_NUMBER_STRING_CHAR, (uint8_t *)modelNumber, - (modelNumber != NULL) ? strlen(modelNumber) : 0, /* minLength */ - (modelNumber != NULL) ? strlen(modelNumber) : 0, /* maxLength */ + (modelNumber != NULL) ? strlen(modelNumber) : 0, /* Min length */ + (modelNumber != NULL) ? strlen(modelNumber) : 0, /* Max length */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), serialNumberStringCharacteristic(GattCharacteristic::UUID_SERIAL_NUMBER_STRING_CHAR, (uint8_t *)serialNumber, - (serialNumber != NULL) ? strlen(serialNumber) : 0, /* minLength */ - (serialNumber != NULL) ? strlen(serialNumber) : 0, /* maxLength */ + (serialNumber != NULL) ? strlen(serialNumber) : 0, /* Min length */ + (serialNumber != NULL) ? strlen(serialNumber) : 0, /* Max length */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), hardwareRevisionStringCharacteristic(GattCharacteristic::UUID_HARDWARE_REVISION_STRING_CHAR, (uint8_t *)hardwareRevision, - (hardwareRevision != NULL) ? strlen(hardwareRevision) : 0, /* minLength */ - (hardwareRevision != NULL) ? strlen(hardwareRevision) : 0, /* maxLength */ + (hardwareRevision != NULL) ? strlen(hardwareRevision) : 0, /* Min length */ + (hardwareRevision != NULL) ? strlen(hardwareRevision) : 0, /* Max length */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), firmwareRevisionStringCharacteristic(GattCharacteristic::UUID_FIRMWARE_REVISION_STRING_CHAR, (uint8_t *)firmwareRevision, - (firmwareRevision != NULL) ? strlen(firmwareRevision) : 0, /* minLength */ - (firmwareRevision != NULL) ? strlen(firmwareRevision) : 0, /* maxLength */ + (firmwareRevision != NULL) ? strlen(firmwareRevision) : 0, /* Min length */ + (firmwareRevision != NULL) ? strlen(firmwareRevision) : 0, /* Max length */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), softwareRevisionStringCharacteristic(GattCharacteristic::UUID_SOFTWARE_REVISION_STRING_CHAR, (uint8_t *)softwareRevision, - (softwareRevision != NULL) ? strlen(softwareRevision) : 0, /* minLength */ - (softwareRevision != NULL) ? strlen(softwareRevision) : 0, /* maxLength */ + (softwareRevision != NULL) ? strlen(softwareRevision) : 0, /* Min length */ + (softwareRevision != NULL) ? strlen(softwareRevision) : 0, /* Max length */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ) { - static bool serviceAdded = false; /* We should only ever need to add the information service once. */ + static bool serviceAdded = false; /* We only add the information service once. */ if (serviceAdded) { return; }
--- a/module.json Thu Nov 26 12:52:09 2015 +0000 +++ b/module.json Thu Nov 26 12:52:09 2015 +0000 @@ -13,7 +13,7 @@ "url": "https://github.com/ARMmbed/ble.git", "type": "git" }, - "homepage": "http://mbed.org/ble", + "homepage": "https://developer.mbed.org/teams/Bluetooth-Low-Energy/", "licenses": [ { "url": "https://spdx.org/licenses/Apache-2.0",