aboutsummaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Fix unit tests' config for mainSven Gothel2021-01-114-4/+8
|
* Convert unit test: cppunit -> catch2Sven Gothel2020-12-237-175/+143
|
* cmake: Move jaucpp -> jaulib (source locations and add_subdirectory(jaulib))Sven Gothel2020-12-211-1/+1
|
* test/direct_bt/CMakeList.txt: Use more fancy generic cmake recipe, add ↵Sven Gothel2020-12-211-12/+22
| | | | catch2 dependency (not done yet)
* Move jaucpp -> jaulib; Full integration of jaulib's unit tests (TODO: Use ↵Sven Gothel2020-12-211-0/+0
| | | | | | | Catch2 for own unit tests) Also: cmake: Add "null-dereference" to NO_ERROR, as it causes trouble with jau::get_uint8(..) with "-O3" See jaulib commit db34007f905dab9feeba16e95c16d84bfb0ff11a
* cmake: Drop all sub-folder CXX settings. Use root CMakeLists.txt global ↵Sven Gothel2020-10-202-25/+0
| | | | settings for all, avoiding confusion.
* direct_bt::DBTManager, ieee11073::DataTypes: Fix WarningsSven Gothel2020-10-171-0/+2
|
* re-add cut-down test_basictypes01.cppSven Gothel2020-10-161-0/+37
|
* Extract common C++ Support Library inclusive Java JNI Binding to sub-project ↵Sven Gothel2020-10-167-1465/+6
| | | | jaucpp, namespace jau
* Fixing SC-DRF tests (working): test_mm_sc_drf_00 (atomic + spin-lock) and ↵Sven Gothel2020-10-042-78/+130
| | | | | | | | | | | | | | | | | | | | | | | | | test_mm_sc_drf_01 (mutex lock + condition-wait) Turns out SC-DRF does work very well on modified non-atomic memory within an atomic or locked-mutex acquire/release critical block. Issues were within the test code itself. Both tests follow the same 'waiting for their turn' semantics. - test_mm_sc_drf_00 using atomic + spin-lock - test_mm_sc_drf_01 using mutex lock + condition-wait +++ On raspi4b-aarch64 (4 cores, 1.5GHz, loops=100, DEBUG=OFF, -O3) 'test_mm_sc_drf_00' is extremely slow using ~18s, while 'test_mm_sc_drf_01' uses ~0.6s only. On raspi3b-arm32 (4 cores, 1.4GHz, loops=100, DEBUG=OFF, -O3) 'test_mm_sc_drf_00' is extremely slow using ~36s, while 'test_mm_sc_drf_01' uses ~0.9s only. "./build-*/test/direct_bt/test_mm_sc_drf_00 -loop 100"
* Add test_mm_sc_drf01: Using mutex locking and wait instead of atomic and ↵Sven Gothel2020-10-033-8/+230
| | | | | | spinlock to test SC-DRF Renamed atomic SC-DRF test_mm_sc_drf -> test_mm_sc_drf00
* Add test_mm_sc_drf: Testing SC-DRF Claim on non-atomic global read and ↵Sven Gothel2020-10-032-0/+228
| | | | | | | | | | | written within an atomic acquire/release Seemingly the non-atomic read and write operation encapsuled in critical section of atomic acquire/release is not consistent with the atomic value (using multiple write threads?) Compare to Herb Sutter's 2013-12-23 slides p19, first box "It must be impossible for the assertion to fail – wouldn’t be SC.". Hence we probably need to lock a mutex for this synchronization
* test_lfringbuffer11: Add @suppress for C++ Code Analysis tool (Eclipse)Sven Gothel2020-10-031-17/+25
|
* CMake: Support full parallel build by adding target dependenciesSven Gothel2020-09-151-18/+27
| | | | | | | | | | | | | | | | C++ Libs -> none (2x) Java Jar -> none Java JNI Libs -> C++ Lib + Java Jar (2x) C++ Examples -> C++ Libs Java Examples -> Java Jar Test -> C++ Lib +++ scripts/[re]build.sh uses `getconf _NPROCESSORS_ONLN` for the make -j <number of parallel processes>.
* C++ noexcept: uuid_t and its implementations; Make uuid_t::TypeSize and ↵Sven Gothel2020-09-142-12/+12
| | | | | | 'enum class' type In case of an internal error, simply ERR_PRINT and abort, usually the toString() implementations.
* CMake Build: Use C++17 (C++20 not yet supported on all target platforms, ↵Sven Gothel2020-09-122-7/+15
| | | | | | | | | i.e. Debian 10 Buster with GCC 8.3) GCC 10.1 mostly covers C++20 and is default on Debian 11 Bullseye, we will move there when established. For now let's use C++17 at least, especially since GCC C++ ABI fixes a few code generation issues and we intend to further simplify our C++ codebase.
* cmake: Fix set_target_properties(..) use proper target name and add ↵Sven Gothel2020-08-258-5/+52
| | | | declaration where needed; Fix source accordingly.
* FunctionDef: Enhance efficiency and create InvocationFunc<..>::clone() and ↵Sven Gothel2020-05-041-29/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | FunctionDef<..>::cloneFunction() ... Enhance efficiency - Equality: Check pointer first - CaptureInvocationFunc function spec uses 'I& data', by reference - CaptureInvocationFunc ctor supports 'I&& data' move-ctor and 'const I& data' copy-ctor w/ later copy (instead relying of in place) - Added FunctionDef ctor for naked InvocationFunc<..> for convenience - Added FunctionDef getFunction(), allowing user to 'see' the InvocationFunc<..> shared instance. +++ FunctionDef: Create InvocationFunc<..>::clone() and FunctionDef<..>::cloneFunction() ... - This allows user to reproduce an identical InvocationFunc<..> polymorph instance (copy-ctor) - Such instance can be used to reproduce an identical FunctionDef later on, here intended for a listener vector equality test for removal. Allowing not to use any intermediate data types.
* FunctionDef: Add CaptureInvocationFunc supporting lambdas w/ an explicit ↵Sven Gothel2020-05-033-110/+228
| | | | | | | | | | | | | | | | | | | | capture instance Commit efa490bc3f55b1af072b5159d075afece018991f introduced StdInvocationFunc, which utilized std:function for capturing lambdas. Since it requires to pass a unique key for equality operation, it is rather a poor workaround for capturing lambdas. CaptureInvocationFunc allows one explicit capture data type to be stored, which will be implicitly passed to the custom function @ invoke. The bindCaptureFunc(..) allows to set dataIsIdentity=false (defaults to true), i.e. ignore the capturing data to be compared in the equality operation. CaptureInvocationFunc allows producing FunctionDef using lambdas on-the-fly, w/o specifying an explicit unique key and dropping the usage of a more complex std::function instance.
* FunctionDef: Add StdInvocationFunc supporting std::function for capturing ↵Sven Gothel2020-05-031-0/+42
| | | | | | | | | | | | lambdas StdInvocationFunc wraps std::function, while using a given unique uint64_t identifier used for equality operations, as std::function doesn't support the very same. std::function support allows using capturing lambdas in C++11, which we require for on the fly callbacks. Since we haven't figured out yet how to properly wrap capturing lambdas otherwise via PlainInvocationFunc, StdInvocationFunc must do it until.
* ClassFunction -> FunctionDef generalization, adding plain function ↵Sven Gothel2020-05-031-7/+30
| | | | | | | | | | | (non-class-member) support To support on-the-fly lambda non-member functions for callbacks, we need to bind to same non-member plain functions. Hence rename ClassFunction -> FunctionDef and add PlainInvocationFunc for this purpose. Tested via C++ unit test test_basictypes01.cpp
* Use Kernel BlueZ Manager for Discovery, Connect, etc. (Initial Commit - Java ↵Sven Gothel2020-04-251-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | part probably broken) We have experienced the following using the official HCI communication channel: - Lower connect performance with discovery enabled - Instability with enabled discovery and breaking general BT adapter state requiring a 'hciconfig hci0 reset' - Lack of notifications: start/stop discovery/connect/... - Lack of certain settings in general: pin, .. This commit implements discovery including listening to all BlueZ kernel events from the BlueZ Manager channel using DBTManager. TODO: Figure out how to enforce quick connect! - EInfoReport (EIR) added: FLAGS, DEVICE_CLASS, APPEARANCE, HASH, RANDOMIZER and DEVICE_ID - including parsing new segments in read_data(..) and dataSetToString(..) exposure - DBTManager adds: - manager-reader thread, putting all command status/completes to its ringbuffer and sending out all other events to its listener. - Respecting the chosen BTMode (side-effect to discovery etc) - add: start/stop discovery - add: connect/disconnect (incomplete) - DBTAdapter: - discoverDevices -> discoverDevicesMgmt is becoming redundant, now simply waiting for the DeviceFound event. Will be deleted - TODO! - mgmtEvDeviceFoundCB shall perform remaining EIR parsing and enqueing the devices plus issuing respective discovery callbacks! TODO. - DBTDevice adds: - BDAddressType - HCISession's HCIComm is now no more used (to be deleted!) - HCIComm adds generic read/write methods, mutex free. - Remaining HCI 'managment' methods are also subject to deletion! - GATTHandler / DBTManager: only use a mtx_write for communication, as reading is performed on their respective threads using a ringbuffer. Here only concurrent write access needs to be managed. (DBTManager uses its own HCIComm's mutex.) - MgmtTypes adds: - BTMode for dual, BREDR or LE only. - MgmtRequest -> MgmtCommand - Unifies the command opcodes to global 'MgmtOpcode', removing duplicate MgmtCommand::Opcode (which was also incomplete) - Adding MgmtDisconnectCmd, MgmtEvtDiscovering, MgmtEvtDeviceFound MgmtEvtDeviceConnected, MgmtEvtDeviceDisconnected - TOctets adding get_int8(..) and get_eui48(..) - TOctets adding put_eui48(..) ++++++++++++++ New ClassFunction: Introducing versatile C++ function-method type used for our DBTManager callbacks. In contrast to std::function and std::bind, ClassFunction allows using its specific type (return- and argument types) and offering the equality operation to test its identity. The latter is essential to remove a callback ClassFunction from a list of callbacks. +++++++++++++++++ Further code cleanup is also included - Address_T -> BDAddressType(incl string presentation) + HCIAddressType - ManufactureSpecificData using POctets - Convenient default param: uint*HexString(.., const bool leading0X=true); - MgmtTypes's get/put for events and commands use MGMT_HEADER_SIZE offset - MgmtTypes: Remove doubled 'btohs', as the pdu.get* commands already perform endian conversion. - EInfoReport::read_data(..) validate segment size before type conversion
* Direct-BT: Fix BluetoothFactory; Renaming using 'DBT' prefixSven Gothel2020-04-201-1/+1
| | | | | - Fix BluetoothFactory: Group implementation identification (class-name and lib-names) - Renaming using 'DBT' prefix, easing identification (java and HCITypes -> DBTTypes)
* Warnings: Remove -Wextra warningsSven Gothel2020-04-111-0/+9
|
* Implement direct_bt: Direct Bluetooth access via Linux's Kernel BlueZ ↵Sven Gothel2020-04-099-0/+801
protocol stack w/o D-Bus bluetoothd. By dropping BlueZ userspace D-Bus bluetoothd, we target high-performance reliable bluetooth support with least dependencies for embedded device configurations. See COPYING, describing which Linux Kernel BlueZ IOCTL information has been included in the source tree. We claim Linus Torvalds's Linux Kernel license exception regarding kernel syscalls (ioctl): <https://github.com/torvalds/linux/blob/master/LICENSES/exceptions/Linux-syscall-note> and hence maintain this project's license. The new direct_bt feature set is organized as follows - include/cppunit - api/direct_bt - api/ieee11073 - src/direct_bt - examples/direct_bt Note that the C++ direct_bt layer is not backward compatible to tinyb. Since the Java layer still needs to be completed, it has to be seen whether we will achieve compatibility or drop the original D-Bus tinyb module altogether in favor of a more streamlined API and implementation. Current state allows scanning for LE devices, connecting and parsing GATT plus receiving notifications and indications. See examples/direct_bt_scanner/dbt_scanner.cpp. The Linux Kernel BlueZ is configured via module MgmtComm.[hpp/cpp]