aboutsummaryrefslogtreecommitdiffstats
path: root/java/tinyb
Commit message (Collapse)AuthorAgeFilesLines
* DBTDevice/BluetoothDevice: Expose getCreationTimestamp() and add ↵Sven Gothel2020-05-281-1/+10
| | | | BluetoothAddressType getAddressType()
* BluetoothDevice: Add connect(..) w/ LE connection parameterSven Gothel2020-05-251-0/+7
| | | | This exposes a technical detail similar to BluetoothAdapter.addDeviceToWhitelist(..) .
* Expose Whitelist (auto-)connect management to BluetoothAdapter.java, impl in ↵Sven Gothel2020-05-251-0/+26
| | | | | | | | | | | | | | DBTAdapter.java only at this point. Instead of using the "string definition" of addressType, we introduce a universal BluetoothAddressType (java) which corresponds with BDAddressType (C++). BluetoothAddressType (java) supports a string conversion, which also accepts the D-Bus names "", "public" and "random" - as also used in TinyB. ++++ Further adds HCIWhitelistConnectType (java) representing the same C++ type.
* AdapterStatusListener (C++/Java): Add discoveringChanged(..), converge ↵Sven Gothel2020-05-241-0/+6
| | | | | | | | | | | | | | | | | | | | | deviceConnected/deviceDisconnected Add discoveringChanged(..), as it is of high interest to the user to adjust connect/disconnect and GATT operations. Hence add it to this central adapter listener, also being used to synthesize the old fashion TinyB 'discovering' callback. We also expose the 'keepAlive' flag in this callback to the user. Converge deviceConnected(..)/deviceDisconnected(..) -> deviceConnectionChanged(..) to be a bit more efficient. +++ DBTAdapter: keepAlive in startDiscovery defaults to false, aligned w/ TinyB. A new startDiscovery(..) method has been added to the Java API, also adding keepAlive. +++ Java TODO: Add the whitelist add/remove functionality
* Working GATT Java Side; GATT Types made fully functional for user to avoid ↵Sven Gothel2020-05-173-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'technical' GATTHandler GATT Types made fully functional for user to avoid 'technical' GATTHandler (C++) > GATTService, GATTCharacteristic, GATTDescriptor -- Reside in their own respective files -- Added semantic methods (readValue(), ..) implemented using DBTDevice -> GATTHandler -- GATTDescriptor owns its value -- GATTHandler setSendIndicationConfirmation(..) defaults to true -- Allow user to cirvumvent using GATTHandler manually completely, device 1--*> services 1--*> characteristics 1--*> descriptor -- C++ GATT types aligned 1:1 to TinyB (Java) > Merged GATTIndicationListener + GATTNotificationListener -> GATTCharacteristicListener -- Simplifying usage, unifying notification and indication -- Now using a list of shared_ptr<GATTCharacteristicListener> allowing multiple actors instead of just a one shot entry. Similar to AdapterStatusListener, we utilize this also on the Java side to implement the TinyB notifications. See dbt_scanner00.cpp: Simplified high-level usage. See dbt_scanner01.cpp: Lower-level technical usage w/ GATTHandler. +++ > Simplified more names > Removed redundancy in listener callbacks, -- don't pass adapter when device is already given. device <*--1> adapter -- don't pass GATT handle explicitly when characteristic is passed > Comparison of all GATT types are done by their respective unique handle Attribute handles are unique for each device (server) (BT Core Spec v5.2: Vol 3, Part F Protocol..: 3.2.2 Attribute Handle) > GATTHandler: Own L2CAPComm instance directly, instead of shared_ptr. > JNIMem: Added JNICriticalArray class for RAII style release ++++ ++++ Working GATT Java Side > All toString() methods return the C++ toString() via JNI for better representation. > DBTDevice.java/JNI: Resolved the odd 'adapter' reference issue: -- Was not passing the jobject of DBTAdapter, but its shared container refeference ;-) > All GATT types receive their GATT handler for equal test and identity @ ctor > GATT read/write Value update the cached value as well as issue the notifyValue on change, including GATTCharacteristic notification/indication listener
* [Bluetooth]AdapterStatusListener: Renamed; Using a list instead of one-shot ↵Sven Gothel2020-05-101-2/+7
| | | | | | | | | | | | | | | | | callback; Mutable callbacks for_each... [Bluetooth]AdapterStatusListener: - Renamed BluetoothAdapterStatusListener -> AdapterStatusListener - Using a list instead of one-shot callback: Allows utilizing information from multiple actors, which also allows a more efficient implementation of the tinyb interfaces. - Mutable callbacks for_each...: BasicAlgos.hpp adds for_each_idx_mtx(..) template algos, allowing to perform one UnaryFunction via indices and utilizing mutex lock for thread safety. This pattern reduces code complexity, as we need to use the visitor model for the listener multiple times. - Java: DBTDevice's AdapterStatusListener hook performs certain TinyB one-shot callbacks
* Extend BluetoothDeviceStatusListener -> BluetoothAdapterStatusListener; Enum ↵Sven Gothel2020-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | bit field mask: Add AdapterSettings , fix EIRDataType -> EIRDataTypeSet Extend Java BluetoothDeviceStatusListener -> BluetoothAdapterStatusListener and C++ DBTDeviceStatusListener -> DBTAdapterStatusListener - BluetoothAdapterStatusListener shall be (ab)used for anything adapter event related, user may utilize it (optional) - Added callback method adapterSettingsChanged(..) in DBTAdapterStatusListener - An internal listener further produces more detailed callbacks, used on the Java side. +++ Java enum bit field mask: Add AdapterSettings , fix EIRDataType -> EIRDataTypeSet - In Java, we cannot have an indivudual enum instance (like in C++) ;-) - Hence 'enum EIRDataType' -> EIRDataTypeSet.DataType and having the 'bit mask' implemented in EIRDataTypeSet. - Adding similar AdapterSettings bit field, utilized in DBTAdapter's internal BluetoothAdapterStatusListener to produce fine grained callbacks.
* DBTManager / DBTDeviceStatusListener: Refine events; java: Keep alive ↵Sven Gothel2020-04-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | discovery; Remove discovery thread (1) DBTAdapter: Keep alive discovery DBTDeviceStatusListener (incl Java binding: - DBTDeviceDiscoveryListener -> DBTDeviceStatusListener to cover more functionality - Rename deviceAdded -> deviceFound, to match BlueZ event naming - Rename deviceRemoved -> deviceDisconnected - Add deviceConnected HCIComm/DBTAdapter: Use HCIAddressType where applicable for clarity MgmtEvent: Add timestamp MgmtEvent: Add MgmtEvtDeviceConnectFailed, MgmtEvtDeviceAdded, MgmtEvtDeviceRemoved, MgmtEvtDeviceUnpaired +++ DBTAdapter.java remove discovery thread (part 1) - Use events, no more discovery polling required - TODO: Same for native DBTAdapter.cpp!
* Direct-BT: Fix BluetoothFactory; Renaming using 'DBT' prefixSven Gothel2020-04-201-7/+1
| | | | | - Fix BluetoothFactory: Group implementation identification (class-name and lib-names) - Renaming using 'DBT' prefix, easing identification (java and HCITypes -> DBTTypes)
* Initial working Java binding for the direct_bt C++ moduleSven Gothel2020-04-2010-1011/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example ScannerTinyB01 demonstrates efficient scanning devices using the new BluetoothDeviceDiscoveryListener interface. The C++ HCIObject extends JavaUplink, which handles the java object references via 'std::shared_ptr<JavaAnonObj>', where JavaAnonObj relies on later polymorph specialization. JavaAnonObj gets derived in the java/jni of direct_bt, where the JNI header + libraries are available. +++ The java inplementing NativeDownlink implementations store the nativeInstance to the C++ instances as well as handle their java references within the native instances. The C++ JavaUplink and Java NativeDownlink interfaces are complete the cross referencing java <-> native. +++ Native libraries are now split into pairs: - tinyb + javatinyb - direct_bt + javadirect_bt TODO: BluetoothFactory must chose the proper bundle! +++ The Java Adapter received a BluetoothDeviceDiscoveryListener hook, matching C++ Adapter's HCIDeviceDiscoveryListener. Since the Java Adapter implements its own discovery thread, using the BluetoothDeviceDiscoveryListener is more efficient then polling over a list of Devices fetched. ++++ TODO: Align Java and C++ class names, foremost in the C++ direct_bt space. TODO: Bind the whole C++ GATT functionality More testing.
* C++ tinyb_hci: Working HCIScanner showing AD packets, demonstrating new HCI ↵Sven Gothel2020-02-159-4/+1011
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | classes See scripts/build-x86_64.sh and README.md for build instructions. See scripts/run-hci_scanner.sh to start new HCI scanner (C++). New HCI C++ implementation redised in libtinyb_hci.so w/o GLIB/DBus dependencies, but 'libbluetooth.so' dependency. Following Class datastructures are complete: - HCIUtil: Exception types, uint128_t and endian conversions - General UUID interface and its efficient UUID16, UUID32 + UUID128 implementation. Conversion 'toString', respecting endianess, and UUID* -> UUID128 conversion. Requird member comparison operations due to using interface - HCIAdapter with its opened HCISession, as well as its discovered HCIDevices - HCIAdapter discover includes multiple advertising AD records, up to 25 according to the spec. - HCIAdapter parses full AD segment. TODO: Handle few more AD types API/Impl Details: - Datastructures utilize 'vector<shares_ptr<T>>' collections. - Most attributes are specified 'const' -> immutable for efficancy - Convenient collection access member operations - etc .. RESULTS: - Fast AD scanning of multiple devices w/ UUID and RSSI - Proper integration into tinyb project TODO: - Handle few more AD types - Test multiple parallel HCISession from HCIAdapter - HCIAdapter.connect() - Represent GATT Service, Characteristics and Description - Catch up with the Java binding step by step
* BluetoothFactory handles API verification via native-API and Manifest ↵v2.0.0Sven Gothel2020-02-092-31/+6
| | | | | | | attributes; Fix manifest.txt.in ... Also show Manifest specification + implementation details incl git-commit-sha1 when run in '-Dorg.tinyb.verbose=true' mode.
* Java Refactory: Expose intefaces via org.tinyb.* and D-Bus implementation ↵Sven Gothel2020-02-0920-1561/+815
| | | | | | | | | | | | | | | | | | | | via tinyb.dbus.* Allows alternative interface implementations and delegated wrapper implementations for debug and tracing. Original D-Bus implementation can be retrieved via: 'BluetoothManager org.tinyb.BluetoothFactory.getDBusBluetoothManager()' A HCI native implementation will follow up w/o use of D-Bus. Otherwise the Java API is unchanged and this tinyb can replace previous implementation. Due to the major API change (despite interface is unchanged but BluetoothManager instantiation) the jar file has been renamed from 'tinyb.jar' to 'tinyb2.jar'. Same goes with the version number, which will be set to 'v2.0.0'. The native library and class definition is kept unchanged using the original names so far.
* Move java classes to package sub folderSven Gothel2020-02-0815-0/+1730