summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* noexcept: BTGattHandler::send*(): Fix BTDevice::getGattService(): Return ↵Sven Gothel2022-05-155-57/+84
| | | | | | | | | | | | | | | | | | | | 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-153-24/+22
| | | | native send[Notification|Indication]() method.
* C++/JNI Lifecycle Fix: BTManager must be passed as shared_ptr<> and hold as ↵Sven Gothel2022-05-1419-164/+295
| | | | | | | | 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.
* C++ Trial / Example: Server: Use robust jau::service_runner, ensuring ↵Sven Gothel2022-05-133-130/+122
| | | | service start and stop is completed
* Add scripts/run-native-trial*.sh, split valgrind-jvm.supp from valgrind.suppSven Gothel2022-05-136-72/+152
|
* Bump jaulib v0.9.3-21-ge6ada60, jau::call_on_release 'use after free' fixSven Gothel2022-05-131-0/+0
|
* DBTServerTest::stop(): Remove `current_exp_advertising_state`, due to ↵Sven Gothel2022-05-1310-10/+10
| | | | closing and listener this state might not be 'on time'
* Trial: Server01::disconnectDevice(): Catch an already deleted device (null ↵Sven Gothel2022-05-122-4/+12
| | | | check) in this error provoking method
* Trial C++: Query BaseDBTClientServer::is_timedout() having an atomic flag ↵Sven Gothel2022-05-122-7/+11
| | | | set by timout_func() instead of abort() producing a core dump
* Trial C++: trial/direct_bt/dbt_client_server1x.hpp: Only use ↵Sven Gothel2022-05-121-2/+1
| | | | DBTServerTest::stop(), which calls close()
* Trial C++: Move `static BaseDBTClientServer& base_test_framework` into ↵Sven Gothel2022-05-128-21/+3
| | | | common test file dbt_client_server1x, ..
* Trial: Server: Unify stop + close, ensuring AdapterStatusListener is removed ↵Sven Gothel2022-05-127-80/+59
| | | | | | | | | first; Native dtor must check for pulseSenderThread and join if still running Ensuring AdapterStatusListener is removed first, otherwise it may kick off another 'action off-thread' for disconnect. Native dtor must check for pulseSenderThread and join if still running, otherwise C++ gives us a terminate.
* Trials: Client: Detect BTGattChar::[add|remove]CharListener() errors, ↵Sven Gothel2022-05-124-19/+82
| | | | forward them via success==false, no direct off-thread Assert/REQUIRE causing issues
* C++ Trial: Complete file_stats and file_utils in dbt_utils.hpp (namely mkdir ↵Sven Gothel2022-05-111-96/+110
| | | | and remove)
* 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.
* README: Add note about AdapterStatusListener, BTGattCharListener changesSven Gothel2022-05-101-0/+1
|
* JNI Lifecycle Fix: BTGattCharListener: Adopt full Java/Native link via ↵Sven Gothel2022-05-1028-751/+610
| | | | | | | | | | | | | | | | | | | | | | | | 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-093-44/+22
| | | | impl::StatusListenerPair for BTDevice::addStatusListener() only -> Simplifying API
* Bump README for next v2.7.0: Passing ↵Sven Gothel2022-05-091-0/+5
| | | | `trial.org.direct_bt.TestDBTProvokeClientServer_i470` w/o crash, using `std::shared_ptr<T>`
* JNI Lifecycle Fix: Make Java/Native object relation inherently thread safe ↵Sven Gothel2022-05-098-520/+657
| | | | by using shared_ptr_ref<T>
* Use typedef of shared_pre<T> 'TRef' and pass `const shared_pre<T>&` where ↵Sven Gothel2022-05-095-36/+41
| | | | possible
* JNI Lifecycle Fix: Have AdapterStatusListener derive from ↵Sven Gothel2022-05-0913-135/+207
| | | | | | | 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()`
* Examples: Simplify CMakeLists.txt, remove unused ↵Sven Gothel2022-05-092-718/+1
| | | | examples/dbt_test_gattcharlifecycle01.cpp (we have our new trial tests)
* BTManager: Call `jau::root_environment::set_terminating()` at dtor. Due to ↵Sven Gothel2022-05-092-1/+7
| | | | its static singleton instance nature, dtor only called at shutdown/exit
* Bump jaulib v0.9.3-20-ge5421ffSven Gothel2022-05-091-0/+0
|
* Bump jaulibSven Gothel2022-05-071-0/+0
|
* trial i470 test_provoke (C++) / TestDBTProvoke (Java) demonstrating C++ ↵Sven Gothel2022-05-079-390/+439
| | | | survives while Java crashes (known issue)
* 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}
* BTObject::checkValidInstance(): Can't call toString() on invalid object, ↵Sven Gothel2022-05-061-1/+1
| | | | already reading unallocated memory.
* README.md: cmake: Mention -DUSE_LIBUNWIND and reformat spacingSven Gothel2022-05-061-12/+5
|
* BTAdapter::mgmtEvDeviceFoundHCI(): Drop deviceFound() if already connected, ↵Sven Gothel2022-05-061-17/+21
| | | | a paranoid safeguard - should never happen
* API Change: AdapterStatusListener::deviceConnected(): `const uint16_t ↵Sven Gothel2022-05-0619-63/+73
| | | | | | | | | | | | | | | 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`.
* Trial (Java + C++): DBTEndpoint, DBTClientTest, DBTServerTest: Add ↵Sven Gothel2022-05-0532-441/+2098
| | | | | | abstraction to plug-in any client/server instance into DBTClientServer1x Further add TestDBTProvokeClientServer_i470 (java trial, copied from native trial)
* Adopt to JavaUplink::checkValidInstance(): ↵Sven Gothel2022-05-055-20/+21
| | | | BTObject::{isValid()->isValidInstance()} for clarity; BTAdapter adds `adapter_operational` flag for its own isValid()
* jaulib: JavaUplink::{checkValid() -> checkValidInstance()} changeSven Gothel2022-05-052-0/+0
|
* C++ Trial: DBTServer*: Remove unused sync_data atomicSven Gothel2022-05-052-18/+0
|
* C++ Trial: DBTClient*: Mark all virtual functions override for consistency ↵Sven Gothel2022-05-052-4/+4
| | | | and mark super virtual requirement
* Use fraction_i64::to_ms() w/ PRIi64 in printfSven Gothel2022-05-053-12/+12
|
* .gitignore doc/log/*Sven Gothel2022-05-051-0/+1
|
* Bump jaulib fe0ce262d0081396d618e816d61fa8efcbc494f1Sven Gothel2022-05-051-0/+0
|
* JavaUplink Derivations: Match virtual signature with override (requirement ↵Sven Gothel2022-05-055-10/+10
| | | | | | | | | to JavaUplink super class) instead of virtual and honor noexcept - don't inline overrides JavaUplink Specializations Involved: - BTAdapter - BTDevice - BTManager
* 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
|
* Bump jaulib 9f8fe05537e184391117b7604fcdaa722ac98374Sven Gothel2022-05-051-0/+0
|
* JNI on DBT*: Hold the JNIGlobalRef shared_ptr<JavaAnon> while inside JNI ↵Sven Gothel2022-05-044-14/+29
| | | | | | call, avoiding their destructions This is added for GATT retrieval functions only .. for now.
* Bump jaulib c09cfe41013dc1167c8e98cba919402b2f77e7fdSven Gothel2022-05-041-0/+0
|
* Trial C++: Add 'provoke_' native test to be run manually, provoking issues ..Sven Gothel2022-05-039-10/+1736
| | | | | | | | | | | | | | | Here we use a new custom client and server code, where client: - does not filter found devices whether they are already connected and server: - disconnects 100 ms after Gatt MTU change, disrupting client's getGattServices discovery process +++ Note: Usage of dbt_client* and dbt_server* has been untangled in the header files, i.e. included at top level.