summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-04-20 09:25:02 +0200
committerSven Gothel <[email protected]>2022-04-20 09:25:02 +0200
commit557c3e221fea05533c8c4cde555c35f795fc0191 (patch)
tree0770f07d5b2625581342dc88ebd912445c621357 /examples
parentb8d4c5817aeb2ec92c97be6fef44f40d280a614c (diff)
Expose original AD_IND and AD_SCAN_RSP EIR in BTDevice, uniquely indicated by its EInfoReport::Source and use it to complete exact advertising in dbt_repeater00
Diffstat (limited to 'examples')
-rw-r--r--examples/dbt_repeater00.cpp12
-rw-r--r--examples/dbt_scanner10.cpp4
-rw-r--r--examples/java/DBTScanner10.java4
3 files changed, 13 insertions, 7 deletions
diff --git a/examples/dbt_repeater00.cpp b/examples/dbt_repeater00.cpp
index e8c04471..62293d40 100644
--- a/examples/dbt_repeater00.cpp
+++ b/examples/dbt_repeater00.cpp
@@ -433,7 +433,9 @@ static void connectToDiscoveredServer(BTDeviceRef device) {
}
}
std::shared_ptr<const EInfoReport> eir = device->getEIR();
- fprintf_td(stderr, "To Server: Using EIR %s\n", eir->toString().c_str());
+ fprintf_td(stderr, "To Server: EIR-1 %s\n", device->getEIRInd()->toString().c_str());
+ fprintf_td(stderr, "To Server: EIR-2 %s\n", device->getEIRScanRsp()->toString().c_str());
+ fprintf_td(stderr, "To Server: EIR-+ %s\n", eir->toString().c_str());
uint16_t conn_interval_min = (uint16_t)12;
uint16_t conn_interval_max = (uint16_t)12;
@@ -741,8 +743,8 @@ static bool startAdvertisingToClient(BTAdapterRef a, std::string msg) {
}
EInfoReport eir = *devToServer->getEIR();
- EIRDataType adv_mask = EIRDataType::FLAGS | EIRDataType::SERVICE_UUID;
- EIRDataType scanrsp_mask = EIRDataType::NAME | EIRDataType::CONN_IVAL;
+ const EIRDataType ind_mask = EIR_DATA_TYPE_MASK & devToServer->getEIRInd()->getEIRDataMask();
+ const EIRDataType scanrsp_mask = EIR_DATA_TYPE_MASK & devToServer->getEIRScanRsp()->getEIRDataMask();
DBGattServerRef dbGattServer( new DBGattServer( devToServer ) );
fprintf_td(stderr, "To Client: Start advertising: GattServer %s\n", dbGattServer->toString().c_str());
@@ -755,9 +757,9 @@ static bool startAdvertisingToClient(BTAdapterRef a, std::string msg) {
}
fprintf_td(stderr, "****** To Client: Start advertising (%s): EIR %s\n", msg.c_str(), eir.toString().c_str());
- fprintf_td(stderr, "****** To Client: Start advertising (%s): adv %s, scanrsp %s\n", msg.c_str(), to_string(adv_mask).c_str(), to_string(scanrsp_mask).c_str());
+ fprintf_td(stderr, "****** To Client: Start advertising (%s): adv %s, scanrsp %s\n", msg.c_str(), to_string(ind_mask).c_str(), to_string(scanrsp_mask).c_str());
- HCIStatusCode status = a->startAdvertising(dbGattServer, eir, adv_mask, scanrsp_mask,
+ HCIStatusCode status = a->startAdvertising(dbGattServer, eir, ind_mask, scanrsp_mask,
adv_interval_min, adv_interval_max,
adv_type, adv_chan_map, filter_policy);
fprintf_td(stderr, "****** To Client: Start advertising (%s) result: %s: %s\n", msg.c_str(), to_string(status).c_str(), a->toString().c_str());
diff --git a/examples/dbt_scanner10.cpp b/examples/dbt_scanner10.cpp
index a4d61020..0c5857e7 100644
--- a/examples/dbt_scanner10.cpp
+++ b/examples/dbt_scanner10.cpp
@@ -398,7 +398,9 @@ static void connectDiscoveredDevice(BTDeviceRef device) {
}
}
std::shared_ptr<const EInfoReport> eir = device->getEIR();
- fprintf_td(stderr, "Using EIR %s\n", eir->toString().c_str());
+ fprintf_td(stderr, "EIR-1 %s\n", device->getEIRInd()->toString().c_str());
+ fprintf_td(stderr, "EIR-2 %s\n", device->getEIRScanRsp()->toString().c_str());
+ fprintf_td(stderr, "EIR-+ %s\n", eir->toString().c_str());
uint16_t conn_interval_min = (uint16_t)8; // 10ms
uint16_t conn_interval_max = (uint16_t)12; // 15ms
diff --git a/examples/java/DBTScanner10.java b/examples/java/DBTScanner10.java
index 3d81900e..e4aa18a0 100644
--- a/examples/java/DBTScanner10.java
+++ b/examples/java/DBTScanner10.java
@@ -367,7 +367,9 @@ public class DBTScanner10 {
}
}
final EInfoReport eir = device.getEIR();
- BTUtils.println(System.err, "Using EIR "+eir.toString());
+ BTUtils.println(System.err, "EIR-1 "+device.getEIRInd().toString());
+ BTUtils.println(System.err, "EIR-2 "+device.getEIRScanRsp().toString());
+ BTUtils.println(System.err, "EIR-+ "+eir.toString());
short conn_interval_min = (short)8; // 10ms
short conn_interval_max = (short)12; // 15ms