summaryrefslogtreecommitdiffstats
path: root/java/jau/direct_bt/DBTGattService.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-10-10 04:44:45 +0200
committerSven Gothel <[email protected]>2021-10-10 04:44:45 +0200
commitb8a7f626fadcf6b21e5df67cdf0df4369885a6b8 (patch)
treeeb2a05fabe63e8b8ccb61bcdb019459a69eaa251 /java/jau/direct_bt/DBTGattService.java
parent5295208f805a3389a6a3d91b5cd27404fe3fa01c (diff)
Removed TinyB API artifacts, fix copyright notice. Add README.md 'Direct-BT Origins'
Removed remaining TinyB API artifacts: - BTType.java and related search functions (class_type()) - Java's clone() - BTManager's device/gatt functionality, only covers adapter. +++ Direct-BT originated from TinyB. Major TinyB autors were: - Andrei Vasiliu <[email protected]> - Petre Eftime <[email protected]> TinyB Copyright (c) 2016 Intel Corporation. With the removal of TinyB from Direct-BT we removed all substantial parts (if not all, i.e. > 99.9%) of its copyright holder. This change removes remaining source file Intel (c) notices. This change does not disregard the author's original work, on the contrary, we keep attribution about Direct-BT's history in the README.md file 'Direct-BT Origins' section. The Intel (c) notice and TinyB authors stay in the COPYING file. We are grateful for their excellent work. This change is to clarify authorship and copyright of Direct-BT's work, as well as to not mislead association with the work of TinyB.
Diffstat (limited to 'java/jau/direct_bt/DBTGattService.java')
-rw-r--r--java/jau/direct_bt/DBTGattService.java73
1 files changed, 10 insertions, 63 deletions
diff --git a/java/jau/direct_bt/DBTGattService.java b/java/jau/direct_bt/DBTGattService.java
index e63cc2e4..97630a80 100644
--- a/java/jau/direct_bt/DBTGattService.java
+++ b/java/jau/direct_bt/DBTGattService.java
@@ -33,7 +33,6 @@ import org.direct_bt.BTGattChar;
import org.direct_bt.BTGattDesc;
import org.direct_bt.BTGattService;
import org.direct_bt.BTObject;
-import org.direct_bt.BTType;
public class DBTGattService extends DBTObject implements BTGattService
{
@@ -72,20 +71,23 @@ public class DBTGattService extends DBTObject implements BTGattService
public String getUUID() { return type_uuid; }
@Override
- public BTType getBluetoothType() { return class_type(); }
-
- static BTType class_type() { return BTType.GATT_SERVICE; }
-
- @Override
public final BTGattService clone()
{ throw new UnsupportedOperationException(); } // FIXME
@Override
public BTGattChar findGattChar(final String char_uuid) {
- if( !checkServiceCache() ) {
+ final DBTDevice device = wbr_device.get();
+ if( null != device ) {
return null;
}
- return (DBTGattChar) findInCache(char_uuid, BTType.GATT_CHARACTERISTIC);
+ final int characteristicSize = charList.size();
+ for(int charIdx = 0; charIdx < characteristicSize; charIdx++ ) {
+ final DBTGattChar characteristic = (DBTGattChar) charList.get(charIdx);
+ if( characteristic.getUUID().equals(char_uuid) ) {
+ return characteristic;
+ }
+ }
+ return null;
}
@Override
@@ -129,59 +131,4 @@ public class DBTGattService extends DBTObject implements BTGattService
@Override
protected native void deleteImpl(long nativeInstance);
-
- /* local functionality */
-
- /* pp */ boolean checkServiceCache() {
- final DBTDevice device = wbr_device.get();
- return null != device && device.checkServiceCache(false);
- }
-
- /**
- * Returns the matching {@link DBTObject} from the internal cache if found,
- * otherwise {@code null}.
- * <p>
- * The returned {@link DBTObject} may be of type
- * <ul>
- * <li>{@link DBTGattChar}</li>
- * <li>{@link DBTGattDesc}</li>
- * </ul>
- * or alternatively in {@link BTObject} space
- * <ul>
- * <li>{@link BTType#GATT_CHARACTERISTIC} -> {@link BTGattChar}</li>
- * <li>{@link BTType#GATT_DESCRIPTOR} -> {@link BTGattDesc}</li>
- * </ul>
- * </p>
- * @param uuid UUID of the desired
- * {@link BTType#GATT_CHARACTERISTIC characteristic} or {@link BTType#GATT_DESCRIPTOR descriptor} to be found.
- * Maybe {@code null}, in which case the first object of the desired type is being returned - if existing.
- * @param type specify the type of the object to be found, either
- * {@link BTType#GATT_CHARACTERISTIC characteristic}
- * or {@link BTType#GATT_DESCRIPTOR descriptor}.
- * {@link BTType#NONE none} means anything.
- */
- /* pp */ DBTObject findInCache(final String uuid, final BTType type) {
- final boolean anyType = BTType.NONE == type;
- final boolean charType = BTType.GATT_CHARACTERISTIC== type;
- final boolean descType = BTType.GATT_DESCRIPTOR == type;
-
- if( !anyType && !charType && !descType ) {
- return null;
- }
- final int characteristicSize = charList.size();
- for(int charIdx = 0; charIdx < characteristicSize; charIdx++ ) {
- final DBTGattChar characteristic = (DBTGattChar) charList.get(charIdx);
- if( ( anyType || charType ) && ( null == uuid || characteristic.getUUID().equals(uuid) ) ) {
- return characteristic;
- }
- if( anyType || descType ) {
- final DBTObject dbtObj = characteristic.findInCache(uuid, type);
- if( null != dbtObj ) {
- return dbtObj;
- }
- }
- }
- return null;
- }
-
}