summaryrefslogtreecommitdiffstats
path: root/java/jau/direct_bt/DBTManager.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-08-31 04:41:54 +0200
committerSven Gothel <[email protected]>2021-08-31 04:41:54 +0200
commitaef10f3cdec0fd698cfa7d913725b40d1513ce30 (patch)
treee36d6b2796e40c5d4f40e66d9cbb6b7259bd42f6 /java/jau/direct_bt/DBTManager.java
parent99ddbcee148144b3593adf4440d3fa3d06f229ab (diff)
Direct-BT: Remove TinyB and Cleanup Java API (1)
Starting with version 2.3, the previously refactored *TinyB* has been removed completely. Motivation was lack of detailed Bluetooth support, inclusive increasing diversion with *Direct-BT*. Furthermore, work is underway for `BLE slave periphal and GATT server` support and its mapping to *BlueZ D-Bus* is questionable and would be resource intensive. Java API changed as follows: - Objects no more Clonable - Removed dead unsupported code - Removed deprecated code - Added 'GattCharPropertySet', representing property bit mask for BTGattChar, replacing the string array.
Diffstat (limited to 'java/jau/direct_bt/DBTManager.java')
-rw-r--r--java/jau/direct_bt/DBTManager.java62
1 files changed, 8 insertions, 54 deletions
diff --git a/java/jau/direct_bt/DBTManager.java b/java/jau/direct_bt/DBTManager.java
index f2ca6746..9a943a8d 100644
--- a/java/jau/direct_bt/DBTManager.java
+++ b/java/jau/direct_bt/DBTManager.java
@@ -45,6 +45,7 @@ import org.direct_bt.BTManager;
import org.direct_bt.BTObject;
import org.direct_bt.BTType;
import org.direct_bt.HCIStatusCode;
+import org.direct_bt.ScanType;
public class DBTManager implements BTManager
{
@@ -142,7 +143,7 @@ public class DBTManager implements BTManager
* Enables or disables uuid128_t consolidation
* for native uuid16_t and uuid32_t values before string conversion.
* <p>
- * Default is {@code true}, as this represent compatibility with original TinyB D-Bus behavior.
+ * Default is {@code true}.
* </p>
* <p>
* If desired, this value should be set once before the first call of {@link #getManager()}!
@@ -173,38 +174,6 @@ public class DBTManager implements BTManager
}
@Override
- public <T extends BTObject> T find(final String name, final String identifier, final BTObject parent, final long timeoutMS) {
- // Due to generic type erasure, we cannot determine the matching BluetoothType for the return parameter,
- // hence this orig TinyB API method is rather misleading than useful.
- throw new UnsupportedOperationException("Generic return type 'find' won't be implemented.");
- // return (T) find(BluetoothType.NONE, name, identifier, parent, timeoutMS);
- }
-
- @Override
- public <T extends BTObject> T find(final String name, final String identifier, final BTObject parent) {
- // Due to generic type erasure, we cannot determine the matching BluetoothType for the return parameter,
- // hence this orig TinyB API method is rather misleading than useful.
- throw new UnsupportedOperationException("Generic return type 'find' won't be implemented.");
- // return (T) find(BluetoothType.NONE, name, identifier, parent, 0);
- }
-
- @Override
- public BTObject getObject(final BTType type, final String name,
- final String identifier, final BTObject parent) {
- return getObject(type.ordinal(), name, identifier, parent);
- }
- private BTObject getObject(final int type, final String name, final String identifier, final BTObject parent)
- { throw new UnsupportedOperationException(); } // FIXME
-
- @Override
- public List<BTObject> getObjects(final BTType type, final String name,
- final String identifier, final BTObject parent) {
- return getObjects(type.ordinal(), name, identifier, parent);
- }
- private List<BTObject> getObjects(final int type, final String name, final String identifier, final BTObject parent)
- { throw new UnsupportedOperationException(); } // FIXME
-
- @Override
public List<BTAdapter> getAdapters() { return new ArrayList<BTAdapter>(adapters); }
@Override
@@ -269,9 +238,6 @@ public class DBTManager implements BTManager
}
@Override
- public boolean startDiscovery() throws BTException { return HCIStatusCode.SUCCESS == startDiscovery(true, false); }
-
- @Override
public HCIStatusCode startDiscovery(final boolean keepAlive, final boolean le_scan_active) throws BTException {
return getDefaultAdapter().startDiscovery(keepAlive, le_scan_active);
}
@@ -279,9 +245,10 @@ public class DBTManager implements BTManager
@Override
public HCIStatusCode stopDiscovery() throws BTException { return getDefaultAdapter().stopDiscovery(); }
- @SuppressWarnings("deprecation")
@Override
- public boolean getDiscovering() throws BTException { return getDefaultAdapter().getDiscovering(); }
+ public final ScanType getCurrentScanType() {
+ return getDefaultAdapter().getCurrentScanType();
+ }
@Override
public final void addChangedAdapterSetListener(final ChangedAdapterSetListener l) {
@@ -413,27 +380,14 @@ public class DBTManager implements BTManager
} catch (final BTException be) {
be.printStackTrace();
}
- final boolean supCharValCacheNotify;
- {
- final String v = System.getProperty("jau.direct_bt.characteristic.compat", "false");
- supCharValCacheNotify = Boolean.valueOf(v);
- }
settings = new Settings() {
@Override
public final boolean isDirectBT() {
return true;
}
@Override
- public boolean isTinyB() {
- return false;
- }
- @Override
- public boolean isCharValueCacheNotificationSupported() {
- return supCharValCacheNotify;
- }
- @Override
public String toString() {
- return "Settings[dbt true, tinyb false, charValueCacheNotify "+isCharValueCacheNotificationSupported()+"]";
+ return "Settings[dbt true]";
}
};
}
@@ -516,13 +470,13 @@ public class DBTManager implements BTManager
if( ( anyType || adapterType ) ) {
if( null != name && null != identifier &&
adapter.getName().equals(name) &&
- adapter.getAddressString().equals(identifier)
+ adapter.getAddressAndType().address.toString().equals(identifier)
)
{
return adapter;
}
if( null != identifier &&
- adapter.getAddressString().equals(identifier)
+ adapter.getAddressAndType().address.toString().equals(identifier)
)
{
return adapter;