Skip to content

Commit

Permalink
switch to a yotta layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohit Grover committed Jun 19, 2015
1 parent 1bb021e commit 75beb80
Show file tree
Hide file tree
Showing 40 changed files with 69 additions and 42 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef __BLE_BATTERY_SERVICE_H__
#define __BLE_BATTERY_SERVICE_H__

#include "BLE.h"
#include "ble/BLE.h"

/**
* @class BatteryService
Expand Down
4 changes: 2 additions & 2 deletions services/DFUService.h → ble/services/DFUService.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#ifndef __BLE_DFU_SERVICE_H__
#define __BLE_DFU_SERVICE_H__

#include "BLE.h"
#include "UUID.h"
#include "ble/BLE.h"
#include "ble/UUID.h"

extern "C" void bootloader_start(void);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef __BLE_DEVICE_INFORMATION_SERVICE_H__
#define __BLE_DEVICE_INFORMATION_SERVICE_H__

#include "BLE.h"
#include "ble/BLE.h"

/**
* @class DeviceInformationService
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef __BLE_HEART_RATE_SERVICE_H__
#define __BLE_HEART_RATE_SERVICE_H__

#include "BLE.h"
#include "ble/BLE.h"

/**
* @class HeartRateService
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions services/UARTService.h → ble/services/UARTService.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "mbed.h"
#include "Stream.h"

#include "UUID.h"
#include "BLE.h"
#include "ble/UUID.h"
#include "ble/BLE.h"

extern const uint8_t UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID];
extern const uint16_t UARTServiceShortUUID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef SERVICES_URIBEACONCONFIGSERVICE_H_
#define SERVICES_URIBEACONCONFIGSERVICE_H_

#include "BLE.h"
#include "ble/BLE.h"
#include "mbed.h"

extern const uint8_t UUID_URI_BEACON_SERVICE[UUID::LENGTH_OF_LONG_UUID];
Expand Down Expand Up @@ -159,26 +159,26 @@ class URIBeaconConfigService {
{
const char DEVICE_NAME[] = "mUriBeacon Config";

ble.clearAdvertisingPayload();
ble.gap().clearAdvertisingPayload();

ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);

// UUID is in different order in the ADV frame (!)
uint8_t reversedServiceUUID[sizeof(UUID_URI_BEACON_SERVICE)];
for (unsigned int i = 0; i < sizeof(UUID_URI_BEACON_SERVICE); i++) {
reversedServiceUUID[i] = UUID_URI_BEACON_SERVICE[sizeof(UUID_URI_BEACON_SERVICE) - i - 1];
}
ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS, reversedServiceUUID, sizeof(reversedServiceUUID));
ble.accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_TAG);
ble.accumulateScanResponse(GapAdvertisingData::COMPLETE_LOCAL_NAME, reinterpret_cast<const uint8_t *>(&DEVICE_NAME), sizeof(DEVICE_NAME));
ble.accumulateScanResponse(GapAdvertisingData::TX_POWER_LEVEL,
reinterpret_cast<uint8_t *>(&defaultAdvPowerLevels[URIBeaconConfigService::TX_POWER_MODE_LOW]),
sizeof(uint8_t));

ble.setTxPower(params.advPowerLevels[params.txPowerMode]);
ble.setDeviceName(reinterpret_cast<const uint8_t *>(&DEVICE_NAME));
ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
ble.setAdvertisingInterval(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(ADVERTISING_INTERVAL_MSEC));
ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS, reversedServiceUUID, sizeof(reversedServiceUUID));
ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_TAG);
ble.gap().accumulateScanResponse(GapAdvertisingData::COMPLETE_LOCAL_NAME, reinterpret_cast<const uint8_t *>(&DEVICE_NAME), sizeof(DEVICE_NAME));
ble.gap().accumulateScanResponse(GapAdvertisingData::TX_POWER_LEVEL,
reinterpret_cast<uint8_t *>(&defaultAdvPowerLevels[URIBeaconConfigService::TX_POWER_MODE_LOW]),
sizeof(uint8_t));

ble.gap().setTxPower(params.advPowerLevels[params.txPowerMode]);
ble.gap().setDeviceName(reinterpret_cast<const uint8_t *>(&DEVICE_NAME));
ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
ble.gap().setAdvertisingInterval(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(ADVERTISING_INTERVAL_MSEC));
}

/* Helper function to switch to the non-connectible normal mode for URIBeacon. This gets called after a timeout. */
Expand All @@ -202,12 +202,12 @@ class URIBeaconConfigService {
extern void saveURIBeaconConfigParams(const Params_t *paramsP); /* forward declaration; necessary to avoid a circular dependency. */
saveURIBeaconConfigParams(&params);

ble.clearAdvertisingPayload();
ble.setTxPower(params.advPowerLevels[params.txPowerMode]);
ble.setAdvertisingType(GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED);
ble.setAdvertisingInterval(beaconPeriod);
ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, BEACON_UUID, sizeof(BEACON_UUID));
ble.gap().clearAdvertisingPayload();
ble.gap().setTxPower(params.advPowerLevels[params.txPowerMode]);
ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED);
ble.gap().setAdvertisingInterval(beaconPeriod);
ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, BEACON_UUID, sizeof(BEACON_UUID));

serviceData[serviceDataLen++] = BEACON_UUID[0];
serviceData[serviceDataLen++] = BEACON_UUID[1];
Expand All @@ -216,7 +216,7 @@ class URIBeaconConfigService {
for (unsigned j = 0; j < uriDataLength; j++) {
serviceData[serviceDataLen++] = uriData[j];
}
ble.accumulateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA, serviceData, serviceDataLen);
ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA, serviceData, serviceDataLen);
}

private:
Expand Down Expand Up @@ -259,11 +259,11 @@ class URIBeaconConfigService {
/* Re-map beaconPeriod to within permissible bounds if necessary. */
if (params.beaconPeriod != 0) {
bool paramsUpdated = false;
if (params.beaconPeriod < ble.getMinAdvertisingInterval()) {
params.beaconPeriod = ble.getMinAdvertisingInterval();
if (params.beaconPeriod < ble.gap().getMinAdvertisingInterval()) {
params.beaconPeriod = ble.gap().getMinAdvertisingInterval();
paramsUpdated = true;
} else if (params.beaconPeriod > ble.getMaxAdvertisingInterval()) {
params.beaconPeriod = ble.getMaxAdvertisingInterval();
} else if (params.beaconPeriod > ble.gap().getMaxAdvertisingInterval()) {
params.beaconPeriod = ble.gap().getMaxAdvertisingInterval();
paramsUpdated = true;
}
if (paramsUpdated) {
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion common/readme.txt

This file was deleted.

29 changes: 29 additions & 0 deletions module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "ble",
"version": "0.0.0",
"description": "The BLE module offers a high level abstraction for using Bluetooth Low Energy on multiple platforms.",
"keywords": [
"Bluetooth",
"BLE"
],
"author": "Rohit Grover",
"repository": {
"url": "[email protected]:mbedmicro/BLE_API.git",
"type": "git"
},
"homepage": "http://mbed.org/ble",
"licenses": [
{
"url": "https://spdx.org/licenses/Apache-2.0",
"type": "Apache-2.0"
}
],
"dependencies": {
"mbed": "^3.0.2"
},
"targetDependencies": {
"nrf51822": {
"ble-nrf51822":"~0.0.1"
}
}
}
1 change: 0 additions & 1 deletion public/readme.txt

This file was deleted.

2 changes: 1 addition & 1 deletion common/BLEDevice.cpp → source/BLE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "BLE.h"
#include "ble/BLE.h"

#if defined(TARGET_OTA_ENABLED)
#include "DFUService.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "DiscoveredCharacteristic.h"
#include "GattClient.h"
#include "ble/DiscoveredCharacteristic.h"
#include "ble/GattClient.h"

GattClient::ReadCallback_t DiscoveredCharacteristic::onDataReadCallback;
GattClient::WriteCallback_t DiscoveredCharacteristic::onDataWriteCallback;
Expand Down
4 changes: 2 additions & 2 deletions common/GapScanningParams.cpp → source/GapScanningParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include "Gap.h"
#include "GapScanningParams.h"
#include "ble/Gap.h"
#include "ble/GapScanningParams.h"

GapScanningParams::GapScanningParams(uint16_t interval, uint16_t window, uint16_t timeout, bool activeScanning) :
_interval(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(interval)),
Expand Down
2 changes: 1 addition & 1 deletion services/DFUService.cpp → source/services/DFUService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "DFUService.h"
#include "ble/services/DFUService.h"

const uint8_t DFUServiceBaseUUID[] = {
0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0xEF, 0xDE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "UARTService.h"
#include "ble/services/UARTService.h"

const uint8_t UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID] = {
0x6E, 0x40, 0x00, 0x00, 0xB5, 0xA3, 0xF3, 0x93,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "URIBeaconConfigService.h"
#include "ble/services/URIBeaconConfigService.h"

#define UUID_URI_BEACON(FIRST, SECOND) { \
0xee, 0x0c, FIRST, SECOND, 0x87, 0x86, 0x40, 0xba, \
Expand Down

0 comments on commit 75beb80

Please sign in to comment.