summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-05-06 10:54:01 +0200
committerSven Gothel <[email protected]>2022-05-06 10:54:01 +0200
commit7b1b83bfa1041c4c93cb6eac0c4994c2bd44f6b8 (patch)
tree33c627e75ca4d65c17836c8d49a5684f0a3489ed
parentb3d62d2336744481bc83377d780d9ac79f534207 (diff)
API Change: AdapterStatusListener::deviceConnected(): `const uint16_t handle` -> `const bool discovered`
Motivation: - the connection handle is known to the device already and can be retrieved, redundant information - the flag discovered gives information whether BTAdapter has sent out a deviceFound message, i.e. the user actually issued the connection (default). We like to detect issues where devices are automatically connected by the underlying host implementation, i.e. BlueZ/kernel's whitelist mechanism or otherwise - an unsusal and undesired situation. In such case, no `DEVICE FOUND` advertising is promoted and the underlying BlueZ/kernel issues the connection itself. Here `discovered` will be `false`.
-rw-r--r--api/direct_bt/BTAdapter.hpp7
-rw-r--r--examples/dbt_peripheral00.cpp6
-rw-r--r--examples/dbt_repeater00.cpp13
-rw-r--r--examples/dbt_scanner10.cpp6
-rw-r--r--examples/dbt_test_gattcharlifecycle01.cpp12
-rw-r--r--examples/java/DBTPeripheral00.java4
-rw-r--r--examples/java/DBTScanner10.java8
-rw-r--r--java/jau/direct_bt/DBTAdapter.java4
-rw-r--r--java/jni/direct_bt/DBTAdapter.cxx8
-rw-r--r--java/org/direct_bt/AdapterStatusListener.java5
-rw-r--r--src/direct_bt/BTAdapter.cpp23
-rw-r--r--trial/direct_bt/dbt_client00.hpp6
-rw-r--r--trial/direct_bt/dbt_client01.hpp6
-rw-r--r--trial/direct_bt/dbt_server00.hpp6
-rw-r--r--trial/direct_bt/dbt_server01.hpp6
-rw-r--r--trial/java/trial/org/direct_bt/DBTClient00.java4
-rw-r--r--trial/java/trial/org/direct_bt/DBTClient01.java4
-rw-r--r--trial/java/trial/org/direct_bt/DBTServer00.java4
-rw-r--r--trial/java/trial/org/direct_bt/DBTServer01.java4
19 files changed, 73 insertions, 63 deletions
diff --git a/api/direct_bt/BTAdapter.hpp b/api/direct_bt/BTAdapter.hpp
index dc8c0ae1..c5d9fe4e 100644
--- a/api/direct_bt/BTAdapter.hpp
+++ b/api/direct_bt/BTAdapter.hpp
@@ -216,13 +216,14 @@ namespace direct_bt {
* If a BTRole::Master BTDevice gets connected, BTDevice::unpair() has been called already.
*
* @param device the remote device which has been connected, holding the new connection handle.
- * @param handle the new connection handle, which has been assigned to the device already
+ * @param discovered `true` if discovered before connected and deviceFound() has been sent (default), otherwise `false`.
* @param timestamp the time in monotonic milliseconds when this event occurred. See BasicTypes::getCurrentMilliseconds().
* @see BTDevice::unpair()
+ * @since 2.6.6
*/
- virtual void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) {
+ virtual void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) {
(void)device;
- (void)handle;
+ (void)discovered;
(void)timestamp;
}
diff --git a/examples/dbt_peripheral00.cpp b/examples/dbt_peripheral00.cpp
index 98d791fc..667d3de2 100644
--- a/examples/dbt_peripheral00.cpp
+++ b/examples/dbt_peripheral00.cpp
@@ -249,14 +249,14 @@ class MyAdapterStatusListener : public AdapterStatusListener {
(void)timestamp;
}
- void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override {
- fprintf_td(stderr, "****** CONNECTED: %s\n", device->toString(true).c_str());
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ fprintf_td(stderr, "****** CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
const bool available = nullptr == getDevice();
if( available ) {
setDevice(device);
BTDeviceRegistry::addToProcessingDevices(device->getAddressAndType(), device->getName());
}
- (void)handle;
+ (void)discovered;
(void)timestamp;
}
diff --git a/examples/dbt_repeater00.cpp b/examples/dbt_repeater00.cpp
index 62293d40..76bb9ad6 100644
--- a/examples/dbt_repeater00.cpp
+++ b/examples/dbt_repeater00.cpp
@@ -174,9 +174,9 @@ class AdapterToServerStatusListener : public AdapterStatusListener {
}
}
- void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override {
- fprintf_td(stderr, "****** To Server: CONNECTED: %s\n", device->toString(true).c_str());
- (void)handle;
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ fprintf_td(stderr, "****** To Server: CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
+ (void)discovered;
(void)timestamp;
}
@@ -612,10 +612,9 @@ class AdapterToClientStatusListener : public AdapterStatusListener {
return false;
}
- void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override {
- fprintf_td(stderr, "****** To Client: CONNECTED: %s\n", device->toString(true).c_str());
-
- (void)handle;
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ fprintf_td(stderr, "****** To Client: CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
+ (void)discovered;
(void)timestamp;
}
diff --git a/examples/dbt_scanner10.cpp b/examples/dbt_scanner10.cpp
index 0aee218e..1721be24 100644
--- a/examples/dbt_scanner10.cpp
+++ b/examples/dbt_scanner10.cpp
@@ -213,9 +213,9 @@ class MyAdapterStatusListener : public AdapterStatusListener {
(void)timestamp;
}
- void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override {
- fprintf_td(stderr, "****** CONNECTED: %s\n", device->toString(true).c_str());
- (void)handle;
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ fprintf_td(stderr, "****** CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
+ (void)discovered;
(void)timestamp;
}
diff --git a/examples/dbt_test_gattcharlifecycle01.cpp b/examples/dbt_test_gattcharlifecycle01.cpp
index 6db8d339..f38b044a 100644
--- a/examples/dbt_test_gattcharlifecycle01.cpp
+++ b/examples/dbt_test_gattcharlifecycle01.cpp
@@ -136,9 +136,9 @@ class MyAdapterStatusListener : public AdapterStatusListener {
(void)timestamp;
}
- void deviceConnected(std::shared_ptr<BTDevice> device, const uint16_t handle, const uint64_t timestamp) override {
- fprintf_td(stderr, "****** CONNECTED: %s\n", device->toString(true).c_str());
- (void)handle;
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ fprintf_td(stderr, "****** CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
+ (void)discovered;
(void)timestamp;
}
@@ -277,9 +277,9 @@ static void connectDiscoveredDevice(std::shared_ptr<BTDevice> device) {
fprintf_td(stderr, "****** UPDATED(2): %s of %s\n", to_string(updateMask).c_str(), device->toString(true).c_str());
(void)timestamp;
}
- void deviceConnected(std::shared_ptr<BTDevice> device, const uint16_t handle, const uint64_t timestamp) override {
- fprintf_td(stderr, "****** CONNECTED(2): %s\n", device->toString(true).c_str());
- (void)handle;
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ fprintf_td(stderr, "****** CONNECTED(2) (discovered %d): %s\n", discovered, device->toString(true).c_str());
+ (void)discovered;
(void)timestamp;
}
std::string toString() const override {
diff --git a/examples/java/DBTPeripheral00.java b/examples/java/DBTPeripheral00.java
index df4ac622..00b3f7ad 100644
--- a/examples/java/DBTPeripheral00.java
+++ b/examples/java/DBTPeripheral00.java
@@ -272,8 +272,8 @@ public class DBTPeripheral00 {
}
@Override
- public void deviceConnected(final BTDevice device, final short handle, final long timestamp) {
- BTUtils.println(System.err, "****** CONNECTED: "+device.toString());
+ public void deviceConnected(final BTDevice device, final boolean discovered, final long timestamp) {
+ BTUtils.println(System.err, "****** CONNECTED (discovered "+discovered+"): "+device.toString());
final boolean available = null == getDevice();
if( available ) {
setDevice(device);
diff --git a/examples/java/DBTScanner10.java b/examples/java/DBTScanner10.java
index 10b61082..2845f9e0 100644
--- a/examples/java/DBTScanner10.java
+++ b/examples/java/DBTScanner10.java
@@ -175,8 +175,8 @@ public class DBTScanner10 {
}
@Override
- public void deviceConnected(final BTDevice device, final short handle, final long timestamp) {
- BTUtils.println(System.err, "****** CONNECTED: "+device.toString());
+ public void deviceConnected(final BTDevice device, final boolean discovered, final long timestamp) {
+ BTUtils.println(System.err, "****** CONNECTED (discovered "+discovered+"): "+device.toString());
}
@Override
@@ -321,8 +321,8 @@ public class DBTScanner10 {
}
}
@Override
- public void deviceConnected(final BTDevice device, final short handle, final long timestamp) {
- BTUtils.println(System.err, "****** CONNECTED(2): "+device.toString());
+ public void deviceConnected(final BTDevice device, final boolean discovered, final long timestamp) {
+ BTUtils.println(System.err, "****** CONNECTED(2) (discovered "+discovered+"): "+device.toString());
}
@Override
diff --git a/java/jau/direct_bt/DBTAdapter.java b/java/jau/direct_bt/DBTAdapter.java
index 61b4d57f..09515531 100644
--- a/java/jau/direct_bt/DBTAdapter.java
+++ b/java/jau/direct_bt/DBTAdapter.java
@@ -615,9 +615,9 @@ public class DBTAdapter extends DBTObject implements BTAdapter
}
@Override
- public void deviceConnected(final BTDevice device, final short handle, final long timestamp) {
+ public void deviceConnected(final BTDevice device, final boolean discovered, final long timestamp) {
if( DEBUG ) {
- BTUtils.println(System.err, "Adapter.CONNECTED: "+device+" on "+device.getAdapter());
+ BTUtils.println(System.err, "Adapter.CONNECTED (discovered "+discovered+"): "+device+" on "+device.getAdapter());
}
final DBTDevice device_ = (DBTDevice)device;
if( device_.isConnected.compareAndSet(false, true) ) {
diff --git a/java/jni/direct_bt/DBTAdapter.cxx b/java/jni/direct_bt/DBTAdapter.cxx
index 38edf168..6ffea073 100644
--- a/java/jni/direct_bt/DBTAdapter.cxx
+++ b/java/jni/direct_bt/DBTAdapter.cxx
@@ -56,7 +56,7 @@ static const std::string _adapterSettingsChangedMethodArgs("(Lorg/direct_bt/BTAd
static const std::string _discoveringChangedMethodArgs("(Lorg/direct_bt/BTAdapter;Lorg/direct_bt/ScanType;Lorg/direct_bt/ScanType;ZLorg/direct_bt/DiscoveryPolicy;J)V");
static const std::string _deviceFoundMethodArgs("(Lorg/direct_bt/BTDevice;J)Z");
static const std::string _deviceUpdatedMethodArgs("(Lorg/direct_bt/BTDevice;Lorg/direct_bt/EIRDataTypeSet;J)V");
-static const std::string _deviceConnectedMethodArgs("(Lorg/direct_bt/BTDevice;SJ)V");
+static const std::string _deviceConnectedMethodArgs("(Lorg/direct_bt/BTDevice;ZJ)V");
static const std::string _devicePairingStateMethodArgs("(Lorg/direct_bt/BTDevice;Lorg/direct_bt/SMPPairingState;Lorg/direct_bt/PairingMode;J)V");
static const std::string _deviceReadyMethodArgs("(Lorg/direct_bt/BTDevice;J)V");
static const std::string _deviceDisconnectedMethodArgs("(Lorg/direct_bt/BTDevice;Lorg/direct_bt/HCIStatusCode;SJ)V");
@@ -328,7 +328,7 @@ class JNIAdapterStatusListener : public AdapterStatusListener {
env->DeleteLocalRef(eirDataTypeSet);
}
- void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override {
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
JNIEnv *env = *jau::jni_env;
jobject jdevice;
@@ -339,14 +339,14 @@ class JNIAdapterStatusListener : public AdapterStatusListener {
} else {
jdevice = newJavaBTDevice(env, device, timestamp);
}
- env->SetShortField(jdevice, deviceClazzConnectionHandleField, (jshort)handle);
+ env->SetShortField(jdevice, deviceClazzConnectionHandleField, (jshort)device->getConnectionHandle());
jau::java_exception_check_and_throw(env, E_FILE_LINE);
env->SetLongField(jdevice, deviceClazzTSLastDiscoveryField, (jlong)device->getLastDiscoveryTimestamp());
jau::java_exception_check_and_throw(env, E_FILE_LINE);
env->SetLongField(jdevice, deviceClazzTSLastUpdateField, (jlong)timestamp);
jau::java_exception_check_and_throw(env, E_FILE_LINE);
- env->CallVoidMethod(listenerObjRef.getObject(), mDeviceConnected, jdevice, (jshort)handle, (jlong)timestamp);
+ env->CallVoidMethod(listenerObjRef.getObject(), mDeviceConnected, jdevice, (jboolean)discovered, (jlong)timestamp);
jau::java_exception_check_and_throw(env, E_FILE_LINE);
}
void devicePairingState(BTDeviceRef device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
diff --git a/java/org/direct_bt/AdapterStatusListener.java b/java/org/direct_bt/AdapterStatusListener.java
index 0c3513b4..c9d33001 100644
--- a/java/org/direct_bt/AdapterStatusListener.java
+++ b/java/org/direct_bt/AdapterStatusListener.java
@@ -127,11 +127,12 @@ public abstract class AdapterStatusListener {
* If a {@link BTRole#Master} {@link BTDevice} gets connected, {@link BTDevice#unpair()} has been called already.
*
* @param device the remote device which has been connected, holding the new connection handle.
- * @param handle the new connection handle, which has been assigned to the device already
+ * @param discovered `true` if discovered before connected and {@link #deviceFound(BTDevice, long)}has been sent (default), otherwise `false`.
* @param timestamp the time in monotonic milliseconds when this event occurred. See {@link BTUtils#currentTimeMillis()}.
* @see BTDevice#unpair()
+ * @since 2.6.6
*/
- public void deviceConnected(final BTDevice device, final short handle, final long timestamp) { }
+ public void deviceConnected(final BTDevice device, final boolean discovered, final long timestamp) { }
/**
* An already connected remote {@link BTDevice}'s {@link SMPPairingState} has changed.
diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp
index 71e1b002..77c666d0 100644
--- a/src/direct_bt/BTAdapter.cpp
+++ b/src/direct_bt/BTAdapter.cpp
@@ -1906,9 +1906,9 @@ bool BTAdapter::mgmtEvDeviceConnectedHCI(const MgmtEvent& e) noexcept {
ad_report.setAddress( event.getAddress() );
ad_report.read_data(event.getData(), event.getDataSize());
}
- DBG_PRINT("BTAdapter:hci:DeviceConnected(dev_id %d): %s: %s", dev_id, e.toString().c_str(), ad_report.toString().c_str());
int new_connect = 0;
+ bool device_discovered = true;
bool slave_unpair = false;
BTDeviceRef device = findConnectedDevice(event.getAddress(), event.getAddressType());
if( nullptr == device ) {
@@ -1924,28 +1924,37 @@ bool BTAdapter::mgmtEvDeviceConnectedHCI(const MgmtEvent& e) noexcept {
addDiscoveredDevice(device); // connected devices must be in shared + discovered list
new_connect = 2;
slave_unpair = BTRole::Slave == getRole();
+ // Re device_discovered: Even though device was not in discoveredDevices list above,
+ // it once was hence the device is in the shared device list.
+ // Note that discoveredDevices is flushed w/ startDiscovery()!
}
}
if( nullptr == device ) {
// (new_connect = 3) a whitelist auto-connect w/o previous discovery, or
// (new_connect = 4) we are a peripheral being connected by a remote client
+ device_discovered = false;
device = BTDevice::make_shared(*this, ad_report);
addDiscoveredDevice(device);
addSharedDevice(device);
new_connect = BTRole::Master == getRole() ? 3 : 4;
slave_unpair = BTRole::Slave == getRole();
}
- bool has_smp_key;
+ bool has_smp_keys;
if( BTRole::Slave == getRole() ) {
- has_smp_key = nullptr != findSMPKeyBin( device->getAddressAndType() ); // PERIPHERAL_ADAPTER_MANAGES_SMP_KEYS
+ has_smp_keys = nullptr != findSMPKeyBin( device->getAddressAndType() ); // PERIPHERAL_ADAPTER_MANAGES_SMP_KEYS
} else {
- has_smp_key = false;
+ has_smp_keys = false;
}
+
+ DBG_PRINT("BTAdapter:hci:DeviceConnected(dev_id %d): state[role %s, new %d, discovered %d, unpair %d, has_keys %d], %s: %s",
+ dev_id, to_string(getRole()).c_str(), new_connect, device_discovered, slave_unpair, has_smp_keys,
+ e.toString().c_str(), ad_report.toString().c_str());
+
if( slave_unpair ) {
/**
* Without unpair in SC mode (or key pre-pairing), the peripheral fails the DHKey Check.
*/
- if( !has_smp_key ) {
+ if( !has_smp_keys ) {
// No pre-pairing -> unpair
HCIStatusCode res = mgmt.unpairDevice(dev_id, device->getAddressAndType(), false /* disconnect */);
if( HCIStatusCode::SUCCESS != res && HCIStatusCode::NOT_PAIRED != res ) {
@@ -1973,7 +1982,7 @@ bool BTAdapter::mgmtEvDeviceConnectedHCI(const MgmtEvent& e) noexcept {
device->toString().c_str());
}
- if( BTRole::Slave == getRole() && !has_smp_key ) {
+ if( BTRole::Slave == getRole() && !has_smp_keys ) {
// Skipped if has_smp_key,
// where BTDevice::uploadKeys() -> BTDevice::setSMPKeyBin() was performed at disconnected tuning the security setup.
device->setConnSecurity(sec_level_server, io_cap_server);
@@ -1992,7 +2001,7 @@ bool BTAdapter::mgmtEvDeviceConnectedHCI(const MgmtEvent& e) noexcept {
p.listener->deviceUpdated(device, updateMask, ad_report.getTimestamp());
}
if( 0 < new_connect ) {
- p.listener->deviceConnected(device, event.getHCIHandle(), event.getTimestamp());
+ p.listener->deviceConnected(device, device_discovered, event.getTimestamp());
}
}
} catch (std::exception &except) {
diff --git a/trial/direct_bt/dbt_client00.hpp b/trial/direct_bt/dbt_client00.hpp
index 047a8f3b..e0fe8145 100644
--- a/trial/direct_bt/dbt_client00.hpp
+++ b/trial/direct_bt/dbt_client00.hpp
@@ -121,9 +121,9 @@ class DBTClient00 : public DBTClientTest {
(void)timestamp;
}
- void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override {
- fprintf_td(stderr, "****** Client CONNECTED: %s\n", device->toString(true).c_str());
- (void)handle;
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ fprintf_td(stderr, "****** Client CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
+ (void)discovered;
(void)timestamp;
}
diff --git a/trial/direct_bt/dbt_client01.hpp b/trial/direct_bt/dbt_client01.hpp
index ce05e392..8d8c78db 100644
--- a/trial/direct_bt/dbt_client01.hpp
+++ b/trial/direct_bt/dbt_client01.hpp
@@ -131,9 +131,9 @@ class DBTClient01 : public DBTClientTest {
(void)timestamp;
}
- void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override {
- fprintf_td(stderr, "****** Client CONNECTED: %s\n", device->toString(true).c_str());
- (void)handle;
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ fprintf_td(stderr, "****** Client CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
+ (void)discovered;
(void)timestamp;
}
diff --git a/trial/direct_bt/dbt_server00.hpp b/trial/direct_bt/dbt_server00.hpp
index 9565e0b1..67ce53f2 100644
--- a/trial/direct_bt/dbt_server00.hpp
+++ b/trial/direct_bt/dbt_server00.hpp
@@ -210,14 +210,14 @@ class DBTServer00 : public DBTServerTest {
(void)timestamp;
}
- void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override {
- fprintf_td(stderr, "****** Server CONNECTED: %s\n", device->toString(true).c_str());
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ fprintf_td(stderr, "****** Server CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
const bool available = nullptr == parent.getDevice();
if( available ) {
parent.setDevice(device);
BTDeviceRegistry::addToProcessingDevices(device->getAddressAndType(), device->getName());
}
- (void)handle;
+ (void)discovered;
(void)timestamp;
}
diff --git a/trial/direct_bt/dbt_server01.hpp b/trial/direct_bt/dbt_server01.hpp
index 911aaf4d..9bcbe984 100644
--- a/trial/direct_bt/dbt_server01.hpp
+++ b/trial/direct_bt/dbt_server01.hpp
@@ -210,14 +210,14 @@ class DBTServer01 : public DBTServerTest {
(void)timestamp;
}
- void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override {
- fprintf_td(stderr, "****** Server CONNECTED: %s\n", device->toString(true).c_str());
+ void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ fprintf_td(stderr, "****** Server CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
const bool available = nullptr == parent.getDevice();
if( available ) {
parent.setDevice(device);
BTDeviceRegistry::addToProcessingDevices(device->getAddressAndType(), device->getName());
}
- (void)handle;
+ (void)discovered;
(void)timestamp;
}
diff --git a/trial/java/trial/org/direct_bt/DBTClient00.java b/trial/java/trial/org/direct_bt/DBTClient00.java
index 91aa9029..10da69b1 100644
--- a/trial/java/trial/org/direct_bt/DBTClient00.java
+++ b/trial/java/trial/org/direct_bt/DBTClient00.java
@@ -207,8 +207,8 @@ public class DBTClient00 implements DBTClientTest {
}
@Override
- public void deviceConnected(final BTDevice device, final short handle, final long timestamp) {
- BTUtils.println(System.err, "****** Client CONNECTED: "+device.toString());
+ public void deviceConnected(final BTDevice device, final boolean discovered, final long timestamp) {
+ BTUtils.println(System.err, "****** Client CONNECTED (discovered "+discovered+"): "+device.toString());
}
@Override
diff --git a/trial/java/trial/org/direct_bt/DBTClient01.java b/trial/java/trial/org/direct_bt/DBTClient01.java
index 3d53b2ff..2f4d89b2 100644
--- a/trial/java/trial/org/direct_bt/DBTClient01.java
+++ b/trial/java/trial/org/direct_bt/DBTClient01.java
@@ -201,8 +201,8 @@ public class DBTClient01 implements DBTClientTest {
}
@Override
- public void deviceConnected(final BTDevice device, final short handle, final long timestamp) {
- BTUtils.println(System.err, "****** Client CONNECTED: "+device.toString());
+ public void deviceConnected(final BTDevice device, final boolean discovered, final long timestamp) {
+ BTUtils.println(System.err, "****** Client CONNECTED (discovered "+discovered+"): "+device.toString());
}
@Override
diff --git a/trial/java/trial/org/direct_bt/DBTServer00.java b/trial/java/trial/org/direct_bt/DBTServer00.java
index 62483ee4..463a1852 100644
--- a/trial/java/trial/org/direct_bt/DBTServer00.java
+++ b/trial/java/trial/org/direct_bt/DBTServer00.java
@@ -294,8 +294,8 @@ public class DBTServer00 implements DBTServerTest {
}
@Override
- public void deviceConnected(final BTDevice device, final short handle, final long timestamp) {
- BTUtils.println(System.err, "****** Server CONNECTED (served "+disconnectCount.get()+", left "+servingProtocolSessionsLeft.get()+"): handle 0x"+Integer.toHexString(handle)+": "+device+" on "+device.getAdapter());
+ public void deviceConnected(final BTDevice device, final boolean discovered, final long timestamp) {
+ BTUtils.println(System.err, "****** Server CONNECTED (served "+disconnectCount.get()+", left "+servingProtocolSessionsLeft.get()+"): discovered "+discovered+": "+device+" on "+device.getAdapter());
final boolean available = null == getDevice();
if( available ) {
setDevice(device);
diff --git a/trial/java/trial/org/direct_bt/DBTServer01.java b/trial/java/trial/org/direct_bt/DBTServer01.java
index 54d316be..2134d55a 100644
--- a/trial/java/trial/org/direct_bt/DBTServer01.java
+++ b/trial/java/trial/org/direct_bt/DBTServer01.java
@@ -298,8 +298,8 @@ public class DBTServer01 implements DBTServerTest {
}
@Override
- public void deviceConnected(final BTDevice device, final short handle, final long timestamp) {
- BTUtils.println(System.err, "****** Server CONNECTED (served "+disconnectCount.get()+", left "+servingProtocolSessionsLeft.get()+"): handle 0x"+Integer.toHexString(handle)+": "+device+" on "+device.getAdapter());
+ public void deviceConnected(final BTDevice device, final boolean discovered, final long timestamp) {
+ BTUtils.println(System.err, "****** Server CONNECTED (served "+disconnectCount.get()+", left "+servingProtocolSessionsLeft.get()+"): discovered "+discovered+": "+device+" on "+device.getAdapter());
final boolean available = null == getDevice();
if( available ) {
setDevice(device);