Nordic stack and drivers for the mbed BLE API
Fork of nRF51822 by
Revision 639:823cb91436a8, committed 2017-03-28
- Comitter:
- cordonn2
- Date:
- Tue Mar 28 19:09:24 2017 +0000
- Parent:
- 638:c90ae1400bf2
- Commit message:
- Added ability to filter advertising channel programmatically
Changed in this revision
diff -r c90ae1400bf2 -r 823cb91436a8 TARGET_MCU_NRF51822/sdk/source/softdevice/s130/headers/ble_types.h --- a/TARGET_MCU_NRF51822/sdk/source/softdevice/s130/headers/ble_types.h Wed Sep 14 14:39:43 2016 +0100 +++ b/TARGET_MCU_NRF51822/sdk/source/softdevice/s130/headers/ble_types.h Tue Mar 28 19:09:24 2017 +0000 @@ -52,35 +52,35 @@ #define BLE_CONN_HANDLE_INVALID 0xFFFF /**< Invalid Connection Handle. */ #define BLE_CONN_HANDLE_ALL 0xFFFE /**< Applies to all Connection Handles. */ /** @} */ - - -#if 0 /* The following have been duplicated in blecommon.h */ -/** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs - * @{ */ -/* Generic UUIDs, applicable to all services */ -#define BLE_UUID_UNKNOWN 0x0000 /**< Reserved UUID. */ -#define BLE_UUID_SERVICE_PRIMARY 0x2800 /**< Primary Service. */ -#define BLE_UUID_SERVICE_SECONDARY 0x2801 /**< Secondary Service. */ -#define BLE_UUID_SERVICE_INCLUDE 0x2802 /**< Include. */ -#define BLE_UUID_CHARACTERISTIC 0x2803 /**< Characteristic. */ -#define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP 0x2900 /**< Characteristic Extended Properties Descriptor. */ -#define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC 0x2901 /**< Characteristic User Description Descriptor. */ -#define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG 0x2902 /**< Client Characteristic Configuration Descriptor. */ -#define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG 0x2903 /**< Server Characteristic Configuration Descriptor. */ -#define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT 0x2904 /**< Characteristic Presentation Format Descriptor. */ -#define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT 0x2905 /**< Characteristic Aggregate Format Descriptor. */ -/* GATT specific UUIDs */ -#define BLE_UUID_GATT 0x1801 /**< Generic Attribute Profile. */ -#define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED 0x2A05 /**< Service Changed Characteristic. */ -/* GAP specific UUIDs */ -#define BLE_UUID_GAP 0x1800 /**< Generic Access Profile. */ -#define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00 /**< Device Name Characteristic. */ -#define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01 /**< Appearance Characteristic. */ -#define BLE_UUID_GAP_CHARACTERISTIC_PPF 0x2A02 /**< Peripheral Privacy Flag Characteristic. */ -#define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03 /**< Reconnection Address Characteristic. */ -#define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */ -/** @} */ -#endif /* The following have been duplicated in blecommon.h */ +// +// +//#if 0 /* The following have been duplicated in blecommon.h */ +///** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs +// * @{ */ +///* Generic UUIDs, applicable to all services */ +//#define BLE_UUID_UNKNOWN 0x0000 /**< Reserved UUID. */ +//#define BLE_UUID_SERVICE_PRIMARY 0x2800 /**< Primary Service. */ +//#define BLE_UUID_SERVICE_SECONDARY 0x2801 /**< Secondary Service. */ +//#define BLE_UUID_SERVICE_INCLUDE 0x2802 /**< Include. */ +//#define BLE_UUID_CHARACTERISTIC 0x2803 /**< Characteristic. */ +//#define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP 0x2900 /**< Characteristic Extended Properties Descriptor. */ +//#define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC 0x2901 /**< Characteristic User Description Descriptor. */ +//#define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG 0x2902 /**< Client Characteristic Configuration Descriptor. */ +//#define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG 0x2903 /**< Server Characteristic Configuration Descriptor. */ +//#define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT 0x2904 /**< Characteristic Presentation Format Descriptor. */ +//#define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT 0x2905 /**< Characteristic Aggregate Format Descriptor. */ +///* GATT specific UUIDs */ +//#define BLE_UUID_GATT 0x1801 /**< Generic Attribute Profile. */ +//#define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED 0x2A05 /**< Service Changed Characteristic. */ +///* GAP specific UUIDs */ +//#define BLE_UUID_GAP 0x1800 /**< Generic Access Profile. */ +//#define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00 /**< Device Name Characteristic. */ +//#define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01 /**< Appearance Characteristic. */ +//#define BLE_UUID_GAP_CHARACTERISTIC_PPF 0x2A02 /**< Peripheral Privacy Flag Characteristic. */ +//#define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03 /**< Reconnection Address Characteristic. */ +//#define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */ +///** @} */ +//#endif /* The following have been duplicated in blecommon.h */ /** @defgroup BLE_UUID_TYPES Types of UUID
diff -r c90ae1400bf2 -r 823cb91436a8 TARGET_MCU_NRF51822/source/nRF5xGap.cpp --- a/TARGET_MCU_NRF51822/source/nRF5xGap.cpp Wed Sep 14 14:39:43 2016 +0100 +++ b/TARGET_MCU_NRF51822/source/nRF5xGap.cpp Tue Mar 28 19:09:24 2017 +0000 @@ -26,6 +26,8 @@ #include "ble_advdata.h" #include "ble_hci.h" +#include "config.h" + void radioNotificationStaticCallback(bool param) { nRF5xGap &gap = (nRF5xGap &) nRF5xn::Instance(BLE::DEFAULT_INSTANCE).getGap(); gap.processRadioNotificationEvent(param); @@ -195,6 +197,9 @@ adv_para.p_whitelist = &whitelist; adv_para.interval = params.getIntervalInADVUnits(); // advertising interval (in units of 0.625 ms) adv_para.timeout = params.getTimeout(); + adv_para.channel_mask.ch_37_off = CH_37_OFF; + adv_para.channel_mask.ch_38_off = CH_38_OFF; + adv_para.channel_mask.ch_39_off = CH_39_OFF; ASSERT(ERROR_NONE == sd_ble_gap_adv_start(&adv_para), BLE_ERROR_PARAM_OUT_OF_RANGE);
diff -r c90ae1400bf2 -r 823cb91436a8 TARGET_NRF5/source/nRF5xGap.cpp --- a/TARGET_NRF5/source/nRF5xGap.cpp Wed Sep 14 14:39:43 2016 +0100 +++ b/TARGET_NRF5/source/nRF5xGap.cpp Tue Mar 28 19:09:24 2017 +0000 @@ -26,6 +26,8 @@ #include "ble_advdata.h" #include "nrf_ble_hci.h" +#include "config.h" + void radioNotificationStaticCallback(bool param) { nRF5xGap &gap = (nRF5xGap &) nRF5xn::Instance(BLE::DEFAULT_INSTANCE).getGap(); gap.processRadioNotificationEvent(param); @@ -195,6 +197,9 @@ adv_para.p_whitelist = &whitelist; adv_para.interval = params.getIntervalInADVUnits(); // advertising interval (in units of 0.625 ms) adv_para.timeout = params.getTimeout(); + adv_para.channel_mask.ch_37_off = CH_37_OFF; + adv_para.channel_mask.ch_38_off = CH_38_OFF; + adv_para.channel_mask.ch_39_off = CH_39_OFF; uint32_t err = sd_ble_gap_adv_start(&adv_para); switch(err) {