Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 915d45d

Browse filesBrowse files
syonborime-no-dev
authored andcommitted
Defined BLE setAdvertisementType (espressif#3535)
Currently we have no way to set BLE Advertisement Type. We have an initial value of ADV_TYPE_IND and the member is private. iBeacon should advertise with ADV_TYPE_NONCONN_IND. esp-idf's example code specifies this value. https://github.com/espressif/esp-idf/blob/93a8603c545fb8e54741d6685146e2f3b874378d/examples/bluetooth/bluedroid/ble/ble_ibeacon/main/ibeacon_demo.c#L57
1 parent c2b37d9 commit 915d45d
Copy full SHA for 915d45d

File tree

Expand file treeCollapse file tree

3 files changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+7
-1
lines changed

‎libraries/BLE/examples/BLE_iBeacon/BLE_iBeacon.ino

Copy file name to clipboardExpand all lines: libraries/BLE/examples/BLE_iBeacon/BLE_iBeacon.ino
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void setBeacon() {
6565

6666
pAdvertising->setAdvertisementData(oAdvertisementData);
6767
pAdvertising->setScanResponseData(oScanResponseData);
68+
pAdvertising->setAdvertisementType(ADV_TYPE_NONCONN_IND);
6869

6970
}
7071

‎libraries/BLE/src/BLEAdvertising.cpp

Copy file name to clipboardExpand all lines: libraries/BLE/src/BLEAdvertising.cpp
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ void BLEAdvertising::setAppearance(uint16_t appearance) {
8585
m_advData.appearance = appearance;
8686
} // setAppearance
8787

88+
void BLEAdvertising::setAdvertisementType(esp_ble_adv_type_t adv_type){
89+
m_advParams.adv_type = adv_type;
90+
} // setAdvertisementType
91+
8892
void BLEAdvertising::setMinInterval(uint16_t mininterval) {
8993
m_advParams.adv_int_min = mininterval;
9094
} // setMinInterval

‎libraries/BLE/src/BLEAdvertising.h

Copy file name to clipboardExpand all lines: libraries/BLE/src/BLEAdvertising.h
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class BLEAdvertising {
5252
void start();
5353
void stop();
5454
void setAppearance(uint16_t appearance);
55+
void setAdvertisementType(esp_ble_adv_type_t adv_type);
5556
void setMaxInterval(uint16_t maxinterval);
5657
void setMinInterval(uint16_t mininterval);
5758
void setAdvertisementData(BLEAdvertisementData& advertisementData);
@@ -76,4 +77,4 @@ class BLEAdvertising {
7677

7778
};
7879
#endif /* CONFIG_BT_ENABLED */
79-
#endif /* COMPONENTS_CPP_UTILS_BLEADVERTISING_H_ */
80+
#endif /* COMPONENTS_CPP_UTILS_BLEADVERTISING_H_ */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.