summaryrefslogtreecommitdiffstats
path: root/java/jni/helper_base.hpp
Commit message (Collapse)AuthorAgeFilesLines
* jni helper: Unique rename for 'convert_vector*(..)' template functionsSven Gothel2020-05-141-7/+7
|
* helper_base: Add generic getField(..), getObjectRef<T>(..) and ↵Sven Gothel2020-05-041-25/+45
| | | | | | | | | setObjectRef<T>(..) Generic getField(..) allows convenient fetching of object fields. getObjectRef<T>(..) and setObjectRef<T>(..) allows get/set of jlong references of any user type pointer (reference).
* Java: Utilize new EIRDataType in BluetoothDeviceStatusListener; ...Sven Gothel2020-05-031-4/+34
| | | | | | | | | | | | | | | | - Utilize new EIRDataType in BluetoothDeviceStatusListener - DBTAdapter: Add null checks for java callbacks - JNI: Adapt to EIRDataType on deviceUpdated. - DBTManager: Implement getAdapterListImpl(), supporting multiple adapter. JNI Implementation uses proper lambda for java-object ctor and fixed 'convert_vector_to_jobject'. - JNI: Fix 'convert_vector_to_jobject' using vector<unique_ptr<..>> as we cannot escape from a shared_ptr, i.e. no release() of ownership. - Working ScannerTinyB01 (discovery + connect using multiple adapter)
* JNI helper_base: Robustness: Add java_exception_check_and_throw(..) and use ↵Sven Gothel2020-05-021-5/+8
| | | | InternalError for exceptions.
* Refine: DBT API, HCISession/DBTAdapter lifecycle, API doc and C++ and ↵Sven Gothel2020-04-211-16/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++/JNI exception handling - HCISession: Handle multiple connections - DBTDevice holds le_conn_handle and provides the le_disconnect as well - HCISession maintains a vector of connected devices - HCISession/DBTAdapter: Cleanup shutdown and refine lifecycle - DBTDevice/DBTAdapter: Drop explicit HCISession argument, simply use the attached HCISession of DBTAdapter. - Refine API doc in general +++ - Device Java/JNI: Add a few more methods to test connect/disconnect. +++ Refine C++ and C++/JNI exception handling: - Use new java_exception_check_and_throw(..): Throw C++ exception on pending Java exception, retrieving toString() message. - Use new java_exception_check(..): Return immediately from JNI on pending Java exception. - Replace macro CATCH_EXCEPTION_AND_RAISE_JAVA(..) with new rethrow_and_raise_java_exception(..), re-trhowing exception and raising detailed Java exception.
* Initial working Java binding for the direct_bt C++ moduleSven Gothel2020-04-201-1/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* java jni: Split helper to helper_base + helper_tinyb (modularization)Sven Gothel2020-02-091-0/+117
C++ tinyb namespace is for the original D-Bus implementation, hence providing the base helper explicitly. Add static BluetoothFactory.getNativeAPIVersion().