summaryrefslogtreecommitdiffstats
path: root/java
Commit message (Collapse)AuthorAgeFilesLines
* jaulib: Bump and adopt to enum type name changes, added '_t'Sven Göthel2024-05-124-7/+7
|
* Cleanup/Fix: C++20, clang-16 + clang-tidy-16, gcc 12.2, latest jaulib, ↵Sven Göthel2024-05-042-2/+4
| | | | passing all tests w/ gcc + clang + java17 build
* Bump jaulib and adopt to jaulib byte_util API change (commit ↵Sven Göthel2024-03-024-7/+7
| | | | 147e17b0b41a123b2f4040cbd6df5b73b7e97164)
* BTDevice: Properly expose isPrePaired() to Javav3.2.3Sven Gothel2023-11-243-0/+26
|
* BTDevice: API Doc: Detail RSSI and Tx Power LevelSven Gothel2023-11-241-6/+33
|
* BTDevice::setSMPKeyBin: Align C++/Java code using setSMPKeyBin()Sven Gothel2023-11-242-1/+21
|
* DBTAdapter.deviceUpdated(): Debug: Only show update events w/o EVT_TYPE, ↵Sven Gothel2023-11-242-2/+5
| | | | RSSI, BDADDR* change (java)
* DBGattServer/Value: Add convenience make[_gatt]() for initializer list (byte ↵v3.2.2Sven Gothel2023-10-281-0/+8
| | | | array) with extra capacity and size
* DBGattServer/Value: Add convenience make[_gatt]() for initializer list (byte ↵Sven Gothel2023-10-281-0/+5
| | | | array)
* BTGattCmd: Response: Add DataCallback, add setting minimum response size, ↵Sven Gothel2023-10-281-20/+57
| | | | add sendOnly(..) to skip waiting for response
* BTGattHandler::BTGattHandler: Pick BTAdapter::getGATTServerData() also in ↵Sven Gothel2023-10-273-10/+21
| | | | | | | | | | | | | GATTRole::Client; BTAdapter::startDiscovery() add DBGattServerRef ref A GattServerHandler(DBGattServer) is also possible for LL master (GATT client) connections where the server inquires certain data points within the client's GATT. User can pass DBGattServer to BTAdapter::startDiscovery() to enable the GattServerHandler for such cause. Test case: Avalun's LabPad device - DBTLabPadClient01.java - dbt_labpadclient01.cpp
* Convenience: Add DBGattValue.make(..) for java and 'POctets make_gvalue(..)' ↵Sven Gothel2023-10-271-0/+27
| | | | for C++ for general use (commonly used to ctor a DBGattServer)
* GATT Server Auth: SMPPairingState: Add missing PASSKEY_NOTIFY on byte -> ↵Sven Gothel2023-10-251-3/+4
| | | | enum conversion, fix byte values
* LE Resolvable Address: Handle identity- and resolvale-private-address (RPA), ↵Sven Gothel2023-10-255-6/+108
| | | | | | | | | | | | | | | | | | | using RPA/IRK crypto matcher for HCI events (passing RPA) HCIConnectionRef and BTDevice store both address pairs, naming the potential RPA as 'visibleAddressAndType'. BTAdapter's findDevice*() method seeks through all device's address first and if the potential RPA is not found queries each device whether it matches with its IRK (if existing). In case the latter is positive, the identity address has been found. Naturally, to have this work, the adapter (in server mode) needs to upload all keys to the host adapter to allow resolving as well as instantiating all devices per key-set. This concept has already been implemented, hence the IRK resolution change-set is not too dramatic. Trial unit tests passed.
* LE Resolvable Address: Support IRK: SMPIdentityResolvingKey (IRK w/ added ↵Sven Gothel2023-10-254-22/+47
| | | | id_address), SMPKeyBin storage and host upload, w/ clearing all IRKs on startup
* GATT Server Auth: Expose PASSKEY_NOTIFY from BTManager -> BTDevice; App ↵Sven Gothel2023-10-235-3/+48
| | | | using AdapterStatusListener::devicePairingState() + SMPPairingState::PASSKEY_NOTIFY to display generated PassKey
* Sync Java with C++ and tag API changes; All trial unit tests passedSven Gothel2023-10-223-36/+36
| | | | | | | | API Changes for v3.2.0: - BTAdapter: - setPrivacy(bool) added - initialize() w/o args or default args removed - initialize(final BTMode btMode, boolean powerOn) added
* Adopt to jaulib java changes PlatformProps -> RuntimeProps for native ↵Sven Gothel2023-01-231-2/+2
| | | | lib-loading
* Replace remaining std::function with jau::functionSven Gothel2022-11-284-4/+4
|
* clang-tidy fixes part-4 / 4: Use 'const T&' for arguments on listener typesSven Gothel2022-11-281-10/+10
| | | | | | - AdapterStatusListener - BTGattHandler::NativeGattCharListener - DBGattServer::Listener
* clang-tidy fixes part-3 / 4, adding Check `performance-*`Sven Gothel2022-11-283-11/+11
| | | | | | | | | | | | | | See also jaulib commit 9160f9a4b74f5e5ae07f715025ea4d3aafdf6ab3 Details: - Using 'const T&' as method argument type where applicable, i.e. not when required to pass value off-thread. - Notable: Can also hold a default value! - Using `const T&` in range-loop where applicable - Drop std::move for trivial types - ...
* clang-tidy: cover modernize-pass-by-value, handle modernize-use-equals-deleteSven Gothel2022-11-271-1/+1
|
* clang-tidy fixes part-1Sven Gothel2022-11-278-59/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Details - Use 'size_type' instead of 'int', propagate same 'size_type' into 'darray' etc. - Use 'std::make_shared', 'std::make_unique' - Use range-based for loops - Remove redundant 'virtual', use 'override' in derived classes - Use 'nullptr' - Use default impl for dtor, ctor (incomplete) - Use copy and std::move (incomplete) - Explcitly catch std::bad_alloc in 'new' in 'noexcept' -> 'abort' - 'abort' was issued implicitly in noexcept methods - L2CAPServer, L2CAPClient, NopGattServerHandler, DBGattServerHandler, FwdGattServerHandler - Use local close_impl(), usable in virtual destructor - L2CAPClient::read, HCIComm::read - preset 'poll' result 'n', avoid garbage comparison - BTAdapter::enableListening - loop through addMgmtEventCallback() result - JNI code - explicit size_type is cast to jsize or jint w/o check - unchanged semantics
* Change all callback return type: dummy 'bool' -> 'void', now enabled by ↵Sven Gothel2022-09-161-4/+3
| | | | jau::function<void(A...)>
* Adopt to jau::function<R(A...)> from jau::FunctionDef<>Sven Gothel2022-09-161-2/+2
|
* Use jaulib's BasicTypes, PrintUtil and Clock, drop duplicates in BTUtilSven Gothel2022-07-0815-302/+103
|
* BTFactory: Fix exception messagesSven Gothel2022-07-071-2/+2
|
* BTAdapter::setDefaultConnParam() may fail w/ UNKNOWN_COMMAND on GNU/Linux < ↵Sven Gothel2022-06-182-2/+4
| | | | 5.9 (Ubuntu 20.04), tolerate it.
* Adopt to jaulib jau::jni namespace changesSven Gothel2022-06-0615-726/+731
|
* BTFactory: Show Productname in capitals in VERBOSE modeSven Gothel2022-06-031-3/+3
|
* JNI: Move BTFactory.cxx and BTUtils.cxx in direct_bt subfolderSven Gothel2022-06-033-2/+2
|
* Adding C++ module/groups to separate the C++ API levels for the user; Adding ↵v2.7.1Sven Gothel2022-05-2211-21/+84
| | | | reference to perihperal-server mode to overview.
* Remove BTDeviceRegistry's 'device processing' listSven Gothel2022-05-161-27/+0
| | | | | | See commits - cc53af990263bfa09947ad3127e0de6a6ffcb493 - ca228cd0512be4642a41468ff92e688dbf296fcd
* Removes using the 'device processing' list, as already the case for the ↵Sven Gothel2022-05-161-1/+1
| | | | | | | | | | trial tests Commit ca228cd0512be4642a41468ff92e688dbf296fcd defined that AdapterstatusListener::deviceFound() is only called if not already connected and if initially found . This change removes using the 'device processing' list, as already the case for the trial tests.
* Trial C++/Java: Fix BaseDBTClientServer::setupTest(): Add ↵Sven Gothel2022-05-162-0/+14
| | | | | | | | | | | | | | | | a.removeAllStatusListener() and new mngr.removeAllChangedAdapterSet{Callbacks|Listener}() ensuring clean state even if previous test failed. On the C++ trials using Catch2, not having issued at test launch via setupTest(): - adapter.removeAllStatusListener() - manager.removeAllChangedAdapterSetCallbacks() and if first test failed, the second tests had two ChangedAdapterSetCallbacks registered and hence added the AdapterStatusListener twice as well still had the previous test listener included. This in turn lead to a SIGSEGV when the previous AdapterStatusListener::deviceDisconnected() has been called in the server's processDisconnectedDevice()
* noexcept: BTGattHandler::send*(): Fix BTDevice::getGattService(): Return ↵Sven Gothel2022-05-151-10/+13
| | | | | | | | | | | | | | | | | | | | zero sized array of BTGattServices on error BTGattHandler::discoverCompletePrimaryServices(): - just discover the services and its characteristics and descriptors - return bool, success of failor as returned by discovery methods (incl. their send*() command) BTGattHandler::initClientGatt(): - clear services before retrieval and on error - error response on - BTGattHandler::discoverCompletePrimaryServices() failure - no services - no GenericAccess services - only return true and leave services if no error BTDevice::getGattService(): - perform BTGattHandler::initClientGatt() error checks as well - update method API doc, describing failure included no GenericAccess service
* noexcept: BTGattHandler::send*(): JNI: Return the boolean result of actual ↵Sven Gothel2022-05-151-4/+2
| | | | native send[Notification|Indication]() method.
* C++/JNI Lifecycle Fix: BTManager must be passed as shared_ptr<> and hold as ↵Sven Gothel2022-05-142-24/+28
| | | | | | | | such in BTAdapter, ... (API CHANGE) BTAdapter removes itself from BTManager, hence needs to ensure BTManager is not yet destructed. This goes well along with our new JNI mapping, holding the shared_ptr reference in nativeInstance.
* DBTNativeDownlink, AdapterStatusListener, BTGattCharListener: Allow `false ↵Sven Gothel2022-05-104-19/+37
| | | | | | | | | | | | | | | | | | | | == BTFactory.isInitialized()` in ctor, i.e. use w/o native libraries DBTNativeDownlink: - remove `static { BTFactory.checkInitialized() }`, not allowing constructing any specialization instance AdapterStatusListener, BTGattCharListener: - check BTFactory.isInitialized() in ctor and drop the nativeInstance w/ a System.err note BTFactory: - Fix isInitialized() query (duh!) - Have initializedID be atomic and drop 'synchronized' locking on - checkInitialized() - isInitialized() This tolerance is required to establish the behavior before fixing the JNI lifecycle of AdapterStatusListener, BTGattCharListener, i.e. allow testing using BTGattCharListener w/o a real BT subsystem.
* JNI Lifecycle Fix: BTGattCharListener: Adopt full Java/Native link via ↵Sven Gothel2022-05-1010-221/+140
| | | | | | | | | | | | | | | | | | | | | | | | DBTNativeDownlink and JavaUplink like AdapterStatusListener change, clean listener API + impl. AdapterStatusListener adopted fully linked via DBTNativeDownlink (java->native) and JavaUplink (native->java). This allows intrinsic lifecycle management. Native destruction leads to its reference removal from the java object and destruction of the java object removes its reference from the native object. Both reference removals may lead to their destruction if reaching zero. (was commit 9c5f25ccd1637728d6e79592279e4b38ecd32f59) Same applies to BTGattCharListener: - This removed BTGattChar::Listener, simply use BTGattCharListener - Using private BTGattHandler::GattCharListenerPair struct for BTGattChar mapping - No more manual or exposed BTGattChar mapping - Java: An added BTGattCharListener instance can be used for removal now, no more wrapper object magic returned. Further: - moved removed `namespace impl`, moved StatusListenerPair into private BTAdapter - have all add/remove*Listener methods noexcept Unit tests validating BTGattCharListener add and remove.
* AdapterStatusListener.java: Constructor must be publicSven Gothel2022-05-091-1/+1
|
* AdapterStatusListener.java restrictions removed since having ↵Sven Gothel2022-05-091-14/+0
| | | | | | AdapterStatusListener derive from JavaUplink/DBTNativeDownlink Was done in commit 9c5f25ccd1637728d6e79592279e4b38ecd32f59 to fix JNI Lifecycle
* Remove AdapterStatusListener::matchDevice(), moved to ↵Sven Gothel2022-05-091-19/+4
| | | | impl::StatusListenerPair for BTDevice::addStatusListener() only -> Simplifying API
* JNI Lifecycle Fix: Make Java/Native object relation inherently thread safe ↵Sven Gothel2022-05-098-520/+657
| | | | by using shared_ptr_ref<T>
* JNI Lifecycle Fix: Have AdapterStatusListener derive from ↵Sven Gothel2022-05-092-109/+168
| | | | | | | JavaUplink/DBTNativeDownlink, resolving BTAdapter::removeAllStatusListener() and use shared_ptr_ref<T> - AdapterStatusListener's native instance is now created at java object construction, etc .. same pattern like BTDevice .. - Java/Native object relation is inherently thread safe due to using use shared_ptr_ref<T>
* JNI Lifecycle Fix: DBTNativeDownlink: Allow pending `initDownlink(..)`, use ↵Sven Gothel2022-05-097-18/+51
| | | | | | | shared_ptr_ref<T>; Made is{->Native}Valid() final for clarity - Currently `initDownlink(..)` is intended for AdapterStatusListener - Clarity `protected boolean isValid()` -> `protected final boolean isNativeValid()`
* Add BTUtils.toUUID128() and mention it and existing UUID16 definition from ↵Sven Gothel2022-05-067-15/+38
| | | | DBGatt{Service,Char,Desc} in BTGatt{Service,Char,Desc}
* API Change: AdapterStatusListener::deviceConnected(): `const uint16_t ↵Sven Gothel2022-05-063-8/+9
| | | | | | | | | | | | | | | handle` -> `const bool discovered` Motivation: - the connection handle is known to the device already and can be retrieved, redundant information - the flag discovered gives information whether BTAdapter has sent out a deviceFound message, i.e. the user actually issued the connection (default). We like to detect issues where devices are automatically connected by the underlying host implementation, i.e. BlueZ/kernel's whitelist mechanism or otherwise - an unsusal and undesired situation. In such case, no `DEVICE FOUND` advertising is promoted and the underlying BlueZ/kernel issues the connection itself. Here `discovered` will be `false`.
* JNI: Lock jobject instance as JNIGlobalRef first, then move it to ↵Sven Gothel2022-05-053-8/+13
| | | | | | std::make_shared<jau::JavaGlobalObj>() ctor @ javaUplink->setJavaObject() This avoids any jjobject destruction in-between
* Adopt to jni_mem -> namespace jauSven Gothel2022-05-055-62/+62
|