aboutsummaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Moved EUI48, EUI48Sub (C++/Java) and uuid_t, *Octets (C++) to jaulib for ↵Sven Gothel2021-09-186-367/+13
| | | | | | | | | general use. Notable, the java classes EUI48, EUI48Sub and BasicTypes are included in direct_bt's jar file to avoid any inconvenience. Hence BTUtils's byte[s]HexString(..) simply uses jaulib's BasicTypes s' implementation.
* Add EInfoReport::write_data(..), preparing AD EIR memory blob for HCI ↵Sven Gothel2021-09-152-0/+175
| | | | | | | | | | | | | | | | | | advertising - EInfoReport: Add write_data(..), producing an AD EIR memory blob compatible with read_data(..). - Tested via test_adeir01.cpp Misc - GAP_T: Add NONE and number(..) - GAPFlags: Shorten names, add `ALL` - ManufactureSpecificData: Make it fully functional - EInfoReport: Expose mutable operations to public - EInfoReport: Add operator==(..) operation to test results
* uuid_t: static factory return unique_ptr<uuid_t> (drop const); Have uuid_t ↵Sven Gothel2021-09-151-3/+3
| | | | | | | | | | as pure virtual; Add clone() and put(..) member; .. .. and use immutable `const uuid_t` on client side. EInfoReport::addService(..): Add missing set(EIRDataType::SERVICE_UUID); EInfoReport::read_data(..): Add `[[fallthrough]]` and add missing break in switch block.
* uuid_t: Add ctor(string) for all specialisations and add ↵Sven Gothel2021-09-031-0/+41
| | | | uuid_t::create(const string&) for convenience
* std::error_code HCIStatusCode: Refine HCIStatusCodeCategory::message(..)Sven Gothel2021-09-011-3/+3
| | | | | | Well, the overloaded '<<' operator uses HCIStatusCodeCategory::name() + ':' + (int)value. Nonetheless, have message() show the actual string value.
* Support std::error_code for 'enum class HCIStatusCode'Sven Gothel2021-09-012-1/+36
|
* Relocate ieee11073 -> direct_bt/ieee11073 to simplify deployment of header filesSven Gothel2021-09-011-1/+1
|
* Fix EUI48Sub::scanEUI48Sub(..): Fail on missing expected colon, i.e. after ↵Sven Gothel2021-08-252-0/+46
| | | | each two digits
* Fix EUI48Sub Tests: An empty input string EUI48Sub results in a toString() ↵Sven Gothel2021-08-062-14/+22
| | | | ':', hinting its type.
* Have BTFactory.main(..) show version info and available adapter, also ↵Sven Gothel2021-01-272-7/+3
| | | | | | whether jaulib is used or not; BTFactory: Shorten names (API) direct_bt.jar: Don't use jaulib.jar in its Class-Path (manifest)
* Adapt to jaulib changes: Jar naming convention (dash, not underscore for ↵Sven Gothel2021-01-266-29/+28
| | | | | | | extras) ..; direct-bt-fat* includes jaulib-fat (standalone) direct-bt-fat.jar is with Tinyb direct-bt-fat2.jar is ex Tinyb (merely testing size and encapsulation)
* Added EUI48Sub and EUI48::indexOf(const EUI48Sub& other) and contains(const ↵v2.2.0Sven Gothel2021-01-252-0/+171
| | | | EUI48Sub& other) (C++ and Java, both w/ unit tests)
* Complete build change: Using jaulib[_fat] if available (for Java) incl. ↵Sven Gothel2021-01-252-0/+63
| | | | native lib loading. Added junit test facility (Java).
* Java: New API Layout: Shorten named [Bluetooth -> BT], [Characteristic -> ↵Sven Gothel2021-01-251-1/+1
| | | | Char] etc (align naming with direct_bt == java; reduce java code footprint and too long code lines)
* 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]