aboutsummaryrefslogtreecommitdiffstats
path: root/examples/dbt_scanner10.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-10-22 05:47:20 +0200
committerSven Gothel <[email protected]>2023-10-22 05:47:20 +0200
commit116ce8e5a4672b963a4b2bbb2054158a77f8417b (patch)
tree7f388682118553ba2b7e344b25d6a03cb63b0205 /examples/dbt_scanner10.cpp
parent701ed7e6dbebbc2118726f203ae576df73ea5e2d (diff)
Adapter Random Address (WIP): Add BTAdapter::setPrivacy() and intercepting new-IRK
FIXME: Passing a HCILEOwnAddressType other than PUBLIC for "LE set scan Param" after setPrivacy(true) via BTManager results in failure. TBD: Seems like the mngr API and HCI is not aligned or my adapter revolts.
Diffstat (limited to 'examples/dbt_scanner10.cpp')
-rw-r--r--examples/dbt_scanner10.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/dbt_scanner10.cpp b/examples/dbt_scanner10.cpp
index bceb21ef..15c4ddd0 100644
--- a/examples/dbt_scanner10.cpp
+++ b/examples/dbt_scanner10.cpp
@@ -113,6 +113,7 @@ static uint64_t timestamp_t0;
static EUI48 useAdapter = EUI48::ALL_DEVICE;
static BTMode btMode = BTMode::DUAL;
+static bool use_privacy = false;
static DiscoveryPolicy discoveryPolicy = DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY; // default value
static bool le_scan_active = true; // default value
@@ -637,6 +638,7 @@ static bool initAdapter(std::shared_ptr<BTAdapter>& adapter) {
to_string(status).c_str(), adapter->toString().c_str());
return false;
}
+ adapter->setPrivacy(use_privacy);
}
if( !adapter->setPowered( true ) ) {
fprintf_td(stderr, "initAdapter: Adapter power-on failed:: %s\n", adapter->toString().c_str());
@@ -768,6 +770,8 @@ int main(int argc, char *argv[])
btMode = to_BTMode(argv[++i]);
} else if( !strcmp("-adapter", argv[i]) && argc > (i+1) ) {
useAdapter = EUI48( std::string(argv[++i]) );
+ } else if( !strcmp("-privacy", argv[i]) ) {
+ use_privacy = true;
} else if( !strcmp("-dev", argv[i]) && argc > (i+1) ) {
std::string addrOrNameSub = std::string(argv[++i]);
BTDeviceRegistry::addToWaitForDevices( addrOrNameSub );
@@ -819,6 +823,7 @@ int main(int argc, char *argv[])
"[-scanPassive] "
"[-resetEachCon connectionCount] "
"[-adapter <adapter_address>] "
+ "[-privacy] "
"(-dev <device_[address|name]_sub>)* "
"(-seclevel <device_[address|name]_sub> <int_sec_level>)* "
"(-iocap <device_[address|name]_sub> <int_iocap>)* "
@@ -840,7 +845,7 @@ int main(int argc, char *argv[])
fprintf_td(stderr, "REMOVE_DEVICE %d\n", REMOVE_DEVICE);
fprintf_td(stderr, "SHOW_UPDATE_EVENTS %d\n", SHOW_UPDATE_EVENTS);
fprintf_td(stderr, "QUIET %d\n", QUIET);
- fprintf_td(stderr, "adapter %s\n", useAdapter.toString().c_str());
+ fprintf_td(stderr, "adapter %s, privacy %d\n", useAdapter.toString().c_str(), use_privacy);
fprintf_td(stderr, "btmode %s\n", to_string(btMode).c_str());
fprintf_td(stderr, "discoveryPolicy %s\n", to_string(discoveryPolicy).c_str());
fprintf_td(stderr, "scanActive %s\n", to_string(le_scan_active).c_str());