summaryrefslogtreecommitdiffstats
path: root/trial
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-02-07 02:52:21 +0100
committerSven Gothel <[email protected]>2022-02-07 02:52:21 +0100
commitc98ed0e3cb52aac1b7ce39647a23e1bbb3e3bac8 (patch)
tree5b182079abec43b12682b01a346a51fe67a43931 /trial
parent97d0ed973aaa62f5c138ff37428fbae03be6a667 (diff)
BTDevice: Replace EInfoReport when disconnected w/ empty one (avoid accumulation across connects w/o removeDevice), incl in unit test
Diffstat (limited to 'trial')
-rw-r--r--trial/java/trial/org/direct_bt/TestDBTClientServer10.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/trial/java/trial/org/direct_bt/TestDBTClientServer10.java b/trial/java/trial/org/direct_bt/TestDBTClientServer10.java
index 295c918a..cceeed9b 100644
--- a/trial/java/trial/org/direct_bt/TestDBTClientServer10.java
+++ b/trial/java/trial/org/direct_bt/TestDBTClientServer10.java
@@ -40,6 +40,8 @@ import org.direct_bt.BTManager;
import org.direct_bt.BTSecurityRegistry;
import org.direct_bt.BTUtils;
import org.direct_bt.DiscoveryPolicy;
+import org.direct_bt.EIRDataTypeSet;
+import org.direct_bt.EInfoReport;
import org.direct_bt.HCIStatusCode;
import org.direct_bt.PairingMode;
import org.direct_bt.SMPKeyBin;
@@ -80,6 +82,7 @@ public class TestDBTClientServer10 extends BaseDBTClientServer {
volatile BTDevice lastCompletedDevice = null;
volatile PairingMode lastCompletedDevicePairingMode = PairingMode.NONE;
volatile BTSecurityLevel lastCompletedDeviceSecurityLevel = BTSecurityLevel.NONE;
+ volatile EInfoReport lastCompletedDeviceEIR = null;
final void test8x_fullCycle(final String suffix,
final BTSecurityLevel secLevelServer, final boolean serverShallHaveKeys,
@@ -160,12 +163,14 @@ public class TestDBTClientServer10 extends BaseDBTClientServer {
lastCompletedDevice = null;
lastCompletedDevicePairingMode = PairingMode.NONE;
lastCompletedDeviceSecurityLevel = BTSecurityLevel.NONE;
+ lastCompletedDeviceEIR = null;
final AdapterStatusListener clientAdapterStatusListener = new AdapterStatusListener() {
@Override
public void deviceReady(final BTDevice device, final long timestamp) {
lastCompletedDevice = device;
lastCompletedDevicePairingMode = device.getPairingMode();
lastCompletedDeviceSecurityLevel = device.getConnSecurityLevel();
+ lastCompletedDeviceEIR = device.getEIR();
BTUtils.println(System.err, "XXXXXX Client Ready: "+device);
}
};
@@ -208,13 +213,16 @@ public class TestDBTClientServer10 extends BaseDBTClientServer {
while( 1 > server.servedConnections.get() ||
1 > client.completedMeasurements.get() ||
- null == lastCompletedDevice )
+ null == lastCompletedDevice ||
+ lastCompletedDevice.getConnected() )
{
try { Thread.sleep(500); } catch (final InterruptedException e) { e.printStackTrace(); }
}
Assert.assertEquals(1, server.servedConnections.get());
Assert.assertEquals(1, client.completedMeasurements.get());
Assert.assertNotNull(lastCompletedDevice);
+ Assert.assertNotNull(lastCompletedDeviceEIR);
+ Assert.assertFalse(lastCompletedDevice.getConnected());
Assert.assertEquals( HCIStatusCode.SUCCESS, client.stopDiscovery(client.getAdapter(), "test"+suffix+"_stopDiscovery") );
{
@@ -249,6 +257,18 @@ public class TestDBTClientServer10 extends BaseDBTClientServer {
}
}
+ Assert.assertNotEquals(0, lastCompletedDeviceEIR.getEIRDataMask().mask);
+ Assert.assertTrue( lastCompletedDeviceEIR.isSet(EIRDataTypeSet.DataType.FLAGS) );
+ Assert.assertTrue( lastCompletedDeviceEIR.isSet(EIRDataTypeSet.DataType.SERVICE_UUID) );
+ Assert.assertTrue( lastCompletedDeviceEIR.isSet(EIRDataTypeSet.DataType.NAME) );
+ Assert.assertTrue( lastCompletedDeviceEIR.isSet(EIRDataTypeSet.DataType.CONN_IVAL) );
+ Assert.assertEquals(serverName, lastCompletedDeviceEIR.getName());
+ {
+ final EInfoReport eir = lastCompletedDevice.getEIR();
+ Assert.assertEquals(0, eir.getEIRDataMask().mask);
+ Assert.assertEquals(0, lastCompletedDeviceEIR.getName().length());
+ }
+
final int count = manager.removeChangedAdapterSetListener(myChangedAdapterSetListener);
BTUtils.println(System.err, "****** EOL Removed ChangedAdapterSetCallback " + count);
}