aboutsummaryrefslogtreecommitdiffstats
path: root/java/jni
Commit message (Collapse)AuthorAgeFilesLines
* DBTDevice::getEIRImpl(): Just copy instance w/o clear and setSven Gothel2022-01-181-2/+1
|
* DBTDevice.java/cxx: Reuse EInfoReport instance and clear before retrieving dataSven Gothel2022-01-181-1/+2
|
* Add EInfoReport::clear()Sven Gothel2022-01-181-0/+9
|
* BTDevice: Expose aggregated scanned EIRSven Gothel2022-01-181-30/+3
|
* Add EInfoReport::set(const EInfoReport&) to merger multiple scanned EIR; ↵Sven Gothel2022-01-181-0/+47
| | | | toString() only shows the set EIRDataType
* Add BTAdapter::setServerConnSecurity(..)Sven Gothel2022-01-131-0/+12
|
* BTDevice::setConnSecurity*(..): Consolidate write methods to ↵Sven Gothel2022-01-131-38/+14
| | | | | | | setConnSecurity() and setConnSecurityAuto() only Also revert change allowing BTDevice::setConnSecurity*(..) on connected devices, IF BTAdapter is server, i.e. method must be called pre-connection notification (commit f4118b41672c17b2f0845ea9a23c87cfaa04cf39).
* DBTAdapter.cxx: Use EUI48 reference and fix exception message (show EUI48 size).Sven Gothel2022-01-041-7/+7
|
* BTAdapter: Add startAdvertising(..) overload with user given EInfoReport and ↵Sven Gothel2022-01-041-4/+35
| | | | | | | | | EIRDataType[Set] AD masks .. .. allowing user to detail actual EIR AD (extended information advertising) instead of using the default. This is required to programmatically setup specific advertising information of the created server.
* EInfoReport: Add Java JNI mapping and support slave connection interval ↵Sven Gothel2022-01-043-2/+611
| | | | range; Add Java GAPFlags mapping.
* BTAdapter::pausing_discovery_devices: Use std::weak_ptr<BTDevice> list; Add ↵Sven Gothel2021-11-291-0/+25
| | | | | | | | | | | | | | | | BTAdapter::removeDevicePausingDiscovery() and getCurrentDiscoveryPolicy() Using a weak_ptr<BTDevice> list avoid stopping BTDevice destruction. BTAdapter::removeDevicePausingDiscovery() allows manual DiscoveryPolicy intervention point, allowing user to remove the ready device from the queue of pausing-discovery devices. Manual intervention might be desired, if using DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_DISCONNECTED, but allowing discovery at an earlier processing step from AdapterStatusListener::deviceReady(). +++ Further added removeDevicePausingDiscovery() call in BTAdapter::removeDevice() as a last resort.
* DBTAdapter.cxx: Fix AdapterStatusListener.discoveringChanged(..) signatureSven Gothel2021-11-291-1/+1
|
* DiscoveryPolicy: Implement Discovery Policy, covering HCI host OS's implied ↵Sven Gothel2021-11-281-5/+21
| | | | | | | | | | | | | | | | | | | | | | discovery-off and detailed 'keep alive' options API change (earmark version 2.5.0): - AdapterStatusListener::discoveringChanged() - BTAdapter::startDiscovery() BTAdapter::startDiscovery() takes DiscoveryPolicy instead of bool keep_alive, allowing fine tuned discovery keep-alive policy and covering HCI host OS's implied discovery turn-off when connected (BlueZ/Linux). dbt_scanner10.cpp and DBTScanner10.java covery the new DiscoveryPolicy and user may pass its integer value via '-discoveryPolicy <0-4>'. These example were further adjusted as follows: - Removed WHITELIST variation of connection w/o discovery, cleaning up and simplifying example code - Remove manual start- and stopDiscovery() handling, ending up in a single startDiscovery() call @ init (and power-on).
* BTAdapter::startDiscovery(..): Add 'bool filter_dup=true' as last parameter; ↵Sven Gothel2021-11-171-2/+3
| | | | Java: Same, but no default value possible (minor API change)
* Java JNI: Implement DBGattServer.Listener incl ↵Sven Gothel2021-11-151-0/+203
| | | | DBGattServer.[add|remove]Listener(..)
* DBGattServer.hpp: DBGatt[Desc|Char|Service|Server]: Use jau::JavaUplink for ↵Sven Gothel2021-11-151-16/+32
| | | | | | | | | | | | | | org.direct.bt.DBGattServer.Listener callbacks Finally bringing JavaUplink back, sorry for the earlier confusion of removing them. However, this commit better shows the C++/Java connection used here. The JavaUplink is used at manually ctor of the native counterpart from the Java object, as they will also dtor the native instance. This w/o DBTNativeDownlink, since we pass arguments directly for the native ctor. On the java side, close() properly synchronizes the atomic volatile nativeInstance swap, avoiding data races.
* DBTAdapter.cxx: jau::search_*(..) already validates results and throws ↵Sven Gothel2021-11-151-120/+13
| | | | | | | | | jau::InternalError(..), remove dead code Also: - Use jau::search_field(..) instead of copied-code - Use BTDeviceRef, instead of std::shared_ptr<BTDevice> (same) -
* Complete DBGattServer Lifecycle: Add DBGatt* dtor on Java side; Remove ↵Sven Gothel2021-11-141-0/+48
| | | | BTAdapter held reference on disconnect, align ref holding in Java BTAdapter; Add explicit shutdown test
* DBGatt[Desc|Char|Service].java: Working proxy for DBGattServer/Peripheral on ↵Sven Gothel2021-11-133-2/+462
| | | | Java side.
* Add BTDevice::send[Indication|Notification]() (Java); Note: Sending zero ↵Sven Gothel2021-11-091-0/+52
| | | | length -> Skip sending and return true
* Slave Peripheral / Gatt Server: Map DBGattServer.hpp types ↵Sven Gothel2021-11-091-0/+2
| | | | | | | | | | DBGatt[Server|Service|Char|Desc] to Java ; BTAdapter.startAdvertising(..) Adds DBGattServer arg - Implementation is not yet functional, i.e. types are not yet mapped to native instance. - DBGattChar and DBGattDesc value currently just a 'byte[]' and lacks capacity: - Its capacity defines the maximum writable variable length - and its size defines the maximum writable fixed length.
* Fix JNI DBTGattService_getCharsImpl(): Missed 'userDescriptionIndex' in ↵Sven Gothel2021-11-081-3/+4
| | | | _characteristicClazzCtorArgs
* BTDevice.java: Align API functions to C++: getServices() -> ↵Sven Gothel2021-11-081-1/+1
| | | | getGattServices(); connect() -> connectDefault()
* Add BTAdapter's Slave Peripheral SMP Key ManagementSven Gothel2021-10-291-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To have full SMP key persitency in peripheral slave mode, BTAdapter requires fine grained control over - Passing stored keys to BTDevice's PairingData (w/o uploading them) - Uploading BTDevice's PairingData to the adapter This required interaction in certain places, only enabled if adapter is BTRole::Slave (peripheral): - BTAdapter::mgmtEvDeviceConnectedHCI() Only issue unpairDevice() if not pre-paired. Unpairing is required for new pairing to avoid DHKey Check failures! - BTAdapter::mgmtEvDeviceDisconnectedHCI() - First unpairDevice() will be issued via notifyDisconnect() - Set and upload stored keys for disconnected device (if existing), preparing for next connect. - BTAdapter::sendDevicePairingState() - SMPPairingState::COMPLETED && not SMPPairingState::PRE_PAIRED: Store keys - SMPPairingState::COMPLETED && SMPPairingState::PRE_PAIRED: Refresh keys to BTDevice (set), no upload! - SMPPairingState::FAILED: Remove and delete keys +++ BTAdapter::setSMPKeyPath(path) allows user to enable the persistent key storage by setting its local filesystem path. It will also read all key files (SMPKeyBin) and if valid and matching with the adapter, uploads them for pre-pairing. See dbt_peripheral00.cpp: adapter->setSMPKeyPath(ADAPTER_KEY_PATH); +++
* Move SMPKeyBin 'apply' to BTDevice, splitting functionality: setting + ↵Sven Gothel2021-10-291-17/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | uploading keys (required for peripheral BTAdapter key management) SMPKeyBin has the key apply action revoked. SMPKeyBin is reduced to store keys, address and security settings, as well adding persistence (read/write to filesystem). BTDevice::setSMPKeyBin(SMPKeyBin&) shall be used copy the key data over and BTDevice::uploadKeys() to upload them to the adapter for pre-pairing. See dbt_scanner10.cpp's use of convenient API (same efficiency as before) device->uploadKeys(KEY_PATH, req_sec_level, true /* verbose_ */); BTDevice::setSMPKeyBin(SMPKeyBin&) fully restored BTDevice's PairingData - keys - key caps - user security level and IOCaps +++ The reduced 'set<Name>Key(..)' methods only - copy the key to BTDevice's PairingData - set the KeyType bit for keys_<role>_[init|resp], fully restoring key caps
* BTAdapter::[get|set]SecureConnections*() align and complete on Java sideSven Gothel2021-10-291-0/+11
|
* BTDevice: SMP Keys (C++/Java): Have setter update PairingData::keys_*_has; ↵Sven Gothel2021-10-271-2/+80
| | | | Expose SMPIdentityResolvingKey (IRK) adding get/set methods; Add setSignatureResolvingKey();
* Add BTAdapter::setSecureConnections(bool) (C++/Java): Allow testing ↵Sven Gothel2021-10-271-0/+11
| | | | peripheral with legacy mode
* [BT|DB]GattChar::getUserDescription() and userDescriptionIndex added (from ↵Sven Gothel2021-10-131-1/+3
| | | | | | descriptor) GattDesc.cpp: Convert TYPE* to std::shared_ptr<jau::uuid_t> (missed in prev commit)
* BTAdapter: Remove setDiscoverable() and setBondable() (-> startAdvertising() ↵Sven Gothel2021-10-101-22/+0
| | | | incl connectable)
* DBGattServer.hpp: Add and use DBGattServer, a complete list of Gatt Service ↵Sven Gothel2021-10-101-1/+1
| | | | objects for the Gatt Server database
* Remove DirectBTJNISettings: Always use uuid_t -> uuid128_t mapping, unifying ↵Sven Gothel2021-10-106-30/+4
| | | | | | uuid_t Equality and compare of uuid_t shall always be performed on uuid128_t if underlying types differ.
* Removed TinyB API artifacts, fix copyright notice. Add README.md 'Direct-BT ↵Sven Gothel2021-10-102-21/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Origins' Removed remaining TinyB API artifacts: - BTType.java and related search functions (class_type()) - Java's clone() - BTManager's device/gatt functionality, only covers adapter. +++ Direct-BT originated from TinyB. Major TinyB autors were: - Andrei Vasiliu <[email protected]> - Petre Eftime <[email protected]> TinyB Copyright (c) 2016 Intel Corporation. With the removal of TinyB from Direct-BT we removed all substantial parts (if not all, i.e. > 99.9%) of its copyright holder. This change removes remaining source file Intel (c) notices. This change does not disregard the author's original work, on the contrary, we keep attribution about Direct-BT's history in the README.md file 'Direct-BT Origins' section. The Intel (c) notice and TinyB authors stay in the COPYING file. We are grateful for their excellent work. This change is to clarify authorship and copyright of Direct-BT's work, as well as to not mislead association with the work of TinyB.
* BTAdapter/Device: Simplify set[DefaultConnected]LE_PHY(..): Remove bool args ↵Sven Gothel2021-10-052-4/+2
| | | | to simply reuse LE_PHYs bitmap zero to ignore either
* Renamed SMP*KeyInfo -> SMP*Key: Simplify language and namesSven Gothel2021-10-052-31/+31
|
* Adopt to jaulib v0.4.9; Fixes BTSecurityRegistry::getStartOf(..)Sven Gothel2021-10-054-12/+12
|
* BTGattService: Clarify fields; BTGatt*::toString(): Add type prefixSven Gothel2021-10-031-2/+2
|
* SMP SC (non-legacy): Add full Link Key (LK) support (SMP, SMPKeyBin, ..); ↵Sven Gothel2021-09-281-0/+51
| | | | Respect BTRole in SMP key handling: responder=slave, initiator=master.
* Java: BTAdapter/BTDevice: Add [get|set]ConnectedLE_PHY(..), ↵Sven Gothel2021-09-242-0/+112
| | | | | | | setDefaultLE_PHY(); Add LE_Features and LE_PHYs class Supporting added LE_PHYs features of commit 61bfb0757a1c337eaf86f9df8b0524bec1b7bc0f in Java
* BTAdapter::initialize() validates power-on state and fails if not ↵Sven Gothel2021-09-211-2/+2
| | | | | | | successful, same goes with BTAdapter::setPowered(bool) Adapting dbt_scanner10/DBTScanner10 and dbt_peripheral/DBTPeripheral10, while also adding notion of earmarking chosen BTAdapter to avoid initializing two adapter (cough cough).
* Add BTAdapter::isInitialized(): Allow to avoid re-initialization of an adapter.Sven Gothel2021-09-181-0/+11
|
* Refine BTRole and add GATTRole, throughout BTAdapter, BTDevice (C++/Java) ↵Sven Gothel2021-09-161-0/+11
| | | | and BTGattHandler (C++) incl. well referenced API doc
* Introduce BTRole: Bluetooth device roles from the perspective of the link ↵Sven Gothel2021-09-151-0/+22
| | | | layer (connection initiator): Initially for BTAdapter
* Add advertising support (start with set-data and -params, stop) via HCIHandlerSven Gothel2021-09-151-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reasonable default values have been chosen from the BT spec, which can be overriden using the HCIHandler and BTAdapter operations. The extended advertising operations are also supported (Bluetooth 5.0). +++ Successfully tested running: (0) Test machine with 2 adapter - adapter-1 DC:FB:48:00:90:19 (acting as client) - adapter-2 00:1A:7D:DA:71:08 (acting as peripheral) (1) Running dbt_peripheral00.cpp or DBTPeripheral.java as the advertising peripheral on the test machine. `direct_bt/dist-amd64$ ../scripts/run-dbt_peripheral00.sh -adapter 00:1A:7D:DA:71:08` or `direct_bt/dist-amd64$ ../scripts/run-java-peripheral00.sh -adapter 00:1A:7D:DA:71:08` (2) Running dbt_scanner10.cpp or DBTScanner10.java as the listeninig and connection-initiator client on the same test machine. `direct_bt/dist-amd64$ sh ../scripts/run-dbt_scanner10.sh -adapter DC:FB:48:00:90:19 -dev 00:1A:7D:DA:71:08 -seclevel 00:1A:7D:DA:71:08 1` or `direct_bt/dist-amd64$ sh ../scripts/run-java-scanner10.sh -adapter DC:FB:48:00:90:19 -dev 00:1A:7D:DA:71:08 -seclevel 00:1A:7D:DA:71:08 1`
* BTAdapter: Resolve name and short_name, both readable via get<Name>() and ↵Sven Gothel2021-09-151-5/+18
| | | | settable via setName(..) while powered-off.
* Multi Direct-BT application, each using 1 adapter: Have user explicitly ↵Sven Gothel2021-09-153-6/+18
| | | | | | | | | | | | | | | | | | | | | | initialize adapter with given BTMode, leave others untouched. Only mutating the desired adapter within one application allows running multiple Direct-BT applications on one platform, each using one selected adapter. BTMode: - Use byte value, matching native counterpart BTManager: - Remove (default) BTMode BTAdapter: - Add initialze(const BTMode btMode=BTMode::DUAL), must be called by user for desired adapter when found via ChangedAdapterSetFunc/BTManager.ChangedAdapterSetListener. AdapterInfo: - Expose mutable ops to public, remove friend decl.
* Properly expose runtime version C++ (DIRECT_BT_VERSION etc) and Java via ↵Sven Gothel2021-08-311-2/+15
| | | | BTFactory
* Direct-BT: Remove TinyB and Cleanup Java API (1)Sven Gothel2021-08-3119-3095/+41
| | | | | | | | | | | | | | | | | | Starting with version 2.3, the previously refactored *TinyB* has been removed completely. Motivation was lack of detailed Bluetooth support, inclusive increasing diversion with *Direct-BT*. Furthermore, work is underway for `BLE slave periphal and GATT server` support and its mapping to *BlueZ D-Bus* is questionable and would be resource intensive. Java API changed as follows: - Objects no more Clonable - Removed dead unsupported code - Removed deprecated code - Added 'GattCharPropertySet', representing property bit mask for BTGattChar, replacing the string array.
* DBTAdapter.cxx: Fix JNIAdapterStatusListener::deviceConnected(..): ↵v2.2.12Sven Gothel2021-08-251-38/+29
| | | | | | NewObject(.., deviceClazzCtor, ..) used wrong argument order. Aligned Java BTDevice ctor using private method for JNIAdapterStatusListener::deviceFound(..) and JNIAdapterStatusListener::deviceConnected(..).
* Java JNI: Exceptions: Use jau::RuntimeException derivatives for all ↵Sven Gothel2021-08-032-3/+3
| | | | exceptions to preserve the backtrace