Skip to content

Commit 4b4240e

Browse files
sgbihuSidLeung
authored andcommitted
Jira #758, Add scan response support for central role, git 370
Feature added: 1. GIT#370 Add scan response support for central role Arduino request that the BLE library, in Peripheral mode, to support Scan Response Data request from a Central. 2. Arduino expects the reply similar to an Apple device. They have provide a policy for the construction of the Scan Response data message. 3. Jira 836 BLE Central scan does not enumerate peripherals that are non connectable. In Central mode, the BLE library should enumerate Peripheral that are non-connectable (eg beacon). Code mods: BLEDevice.cpp: 1. Add the call to get Manufacturer Data info from a Peripheral. Non-connectable device may only broadcast this info. BLEDeviceManager.cpp: 1. Added setAdvertiseData() for the creation of the Scan Response Data message. 2. In advDataInit(), follows the policy (defined by Arduino) to add Adv data to the Scan Response Data message using setAdvertiseData(). 3. Delete the filter about non-connectable advertisement. 4. Added APIs, hasManufacturerData(), setManufacturerData(), hasManufacturerData(), to gain access to adv info of non-connectable Peripherals. BLEDeviceManager.h: BLEDevice.h: Prototyping.
1 parent d818a3a commit 4b4240e

File tree

4 files changed

+566
-224
lines changed

4 files changed

+566
-224
lines changed

libraries/CurieBLE/src/BLEDevice.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ void BLEDevice::setManufacturerData(const unsigned char manufacturerData[],
133133
BLEDeviceManager::instance()->setManufacturerData(manufacturerData, manufacturerDataLength);
134134
}
135135

136+
bool BLEDevice::getManufacturerData (unsigned char* manu_data,
137+
unsigned char& manu_data_len) const
138+
{
139+
return BLEDeviceManager::instance()->getManufacturerData(this, manu_data, manu_data_len);
140+
}
141+
142+
bool BLEDevice::hasManufacturerData() const
143+
{
144+
return BLEDeviceManager::instance()->hasManufacturerData(this);
145+
}
146+
136147
void BLEDevice::setLocalName(const char *localName)
137148
{
138149
BLEDeviceManager::instance()->setLocalName(localName);

libraries/CurieBLE/src/BLEDevice.h

+5
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ class BLEDevice
191191
void setManufacturerData(const unsigned char manufacturerData[],
192192
unsigned char manufacturerDataLength);
193193

194+
bool getManufacturerData (unsigned char* manu_data,
195+
unsigned char& manu_data_len) const;
196+
197+
bool hasManufacturerData() const;
198+
194199
/**
195200
* Set the local name that the BLE Peripheral Device advertises
196201
*

0 commit comments

Comments
 (0)