diff options
author | Sven Gothel <[email protected]> | 2021-01-11 15:03:14 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-01-11 15:03:14 +0100 |
commit | 6dedd5a38eb3251958685d2c1823866456866a1e (patch) | |
tree | 983b90e2de14b764423956ebb9d791be50d2dc7d /api | |
parent | ea7bfd2669c5ed232272c1b7f38d5084d95f5bad (diff) |
Replace std::vector w/ jau::darray and jau::cow_vector with jau::cow_darray (performance and CoW correctness)
Merging jaulib's darray and cow_darray into direct_bt.
As explained in jaulib, motivation behing darray + cow_darray
is to allow fine grained controll over the CoW's storage
to have certain guarantess on its operation.
Iterator and push_back() enhancments are a few of these.
Fixes performed while replacing:
- DBTDevice getGATTServices(): Take the copy as it will be returned.
- GATTHandler removeAllAssociatedCharacteristicListener(): Try to delete all matching!
Don't stop loop after found and erased first, continue.
Also return number of erased elements, not just true.
- DBTManager ctor: Don't work on CoW snapshot, work on CoW
- Simplified many loops / iterations
Diffstat (limited to 'api')
-rw-r--r-- | api/direct_bt/BTTypes.hpp | 8 | ||||
-rw-r--r-- | api/direct_bt/DBTAdapter.hpp | 19 | ||||
-rw-r--r-- | api/direct_bt/DBTDevice.hpp | 11 | ||||
-rw-r--r-- | api/direct_bt/DBTManager.hpp | 10 | ||||
-rw-r--r-- | api/direct_bt/GATTCharacteristic.hpp | 5 | ||||
-rw-r--r-- | api/direct_bt/GATTDescriptor.hpp | 1 | ||||
-rw-r--r-- | api/direct_bt/GATTHandler.hpp | 22 | ||||
-rw-r--r-- | api/direct_bt/GATTNumbers.hpp | 7 | ||||
-rw-r--r-- | api/direct_bt/GATTService.hpp | 4 | ||||
-rw-r--r-- | api/direct_bt/GATTTypes.hpp | 1 | ||||
-rw-r--r-- | api/direct_bt/HCIHandler.hpp | 12 | ||||
-rw-r--r-- | api/direct_bt/L2CAPComm.hpp | 1 | ||||
-rw-r--r-- | api/direct_bt/MgmtTypes.hpp | 8 | ||||
-rw-r--r-- | api/direct_bt/OctetTypes.hpp | 1 | ||||
-rw-r--r-- | api/direct_bt/SMPHandler.hpp | 2 |
15 files changed, 55 insertions, 57 deletions
diff --git a/api/direct_bt/BTTypes.hpp b/api/direct_bt/BTTypes.hpp index 96396d03..641b5e20 100644 --- a/api/direct_bt/BTTypes.hpp +++ b/api/direct_bt/BTTypes.hpp @@ -30,9 +30,9 @@ #include <string> #include <memory> #include <cstdint> -#include <vector> #include <jau/basic_types.hpp> +#include <jau/darray.hpp> #include "OctetTypes.hpp" #include "BTAddress.hpp" @@ -641,7 +641,7 @@ namespace direct_bt { int8_t rssi = 127; // The core spec defines 127 as the "not available" value int8_t tx_power = 127; // The core spec defines 127 as the "not available" value std::shared_ptr<ManufactureSpecificData> msd = nullptr; - std::vector<std::shared_ptr<uuid_t>> services; + jau::darray<std::shared_ptr<uuid_t>> services; uint32_t device_class = 0; AppearanceCat appearance = AppearanceCat::UNKNOWN; POctets hash; @@ -687,7 +687,7 @@ namespace direct_bt { * https://www.bluetooth.com/specifications/archived-specifications/ * </p> */ - static std::vector<std::shared_ptr<EInfoReport>> read_ad_reports(uint8_t const * data, jau::nsize_t const data_length) noexcept; + static jau::darray<std::shared_ptr<EInfoReport>> read_ad_reports(uint8_t const * data, jau::nsize_t const data_length) noexcept; /** * Reads the Extended Inquiry Response (EIR) or Advertising Data (AD) segments @@ -732,7 +732,7 @@ namespace direct_bt { int8_t getTxPower() const noexcept { return tx_power; } std::shared_ptr<ManufactureSpecificData> getManufactureSpecificData() const noexcept { return msd; } - std::vector<std::shared_ptr<uuid_t>> getServices() const noexcept { return services; } + jau::darray<std::shared_ptr<uuid_t>> getServices() const noexcept { return services; } uint32_t getDeviceClass() const noexcept { return device_class; } AppearanceCat getAppearance() const noexcept { return appearance; } diff --git a/api/direct_bt/DBTAdapter.hpp b/api/direct_bt/DBTAdapter.hpp index 7aee541c..32aed98e 100644 --- a/api/direct_bt/DBTAdapter.hpp +++ b/api/direct_bt/DBTAdapter.hpp @@ -30,11 +30,11 @@ #include <string> #include <memory> #include <cstdint> -#include <vector> #include <mutex> #include <atomic> +#include <jau/darray.hpp> #include <jau/cow_darray.hpp> #include "DBTTypes.hpp" @@ -220,10 +220,11 @@ namespace direct_bt { std::mutex mtx_single_conn_device; std::condition_variable cv_single_conn_device; - std::vector<std::shared_ptr<DBTDevice>> connectedDevices; - std::vector<std::shared_ptr<DBTDevice>> discoveredDevices; // all discovered devices - std::vector<std::shared_ptr<DBTDevice>> sharedDevices; // All active shared devices. Final holder of DBTDevice lifecycle! - jau::cow_darray<std::shared_ptr<AdapterStatusListener>> statusListenerList; + jau::darray<std::shared_ptr<DBTDevice>> connectedDevices; + jau::darray<std::shared_ptr<DBTDevice>> discoveredDevices; // all discovered devices + jau::darray<std::shared_ptr<DBTDevice>> sharedDevices; // All active shared devices. Final holder of DBTDevice lifecycle! + typedef jau::cow_darray<std::shared_ptr<AdapterStatusListener>> statusListenerList_t; + statusListenerList_t statusListenerList; std::mutex mtx_discoveredDevices; std::mutex mtx_connectedDevices; std::mutex mtx_discovery; @@ -231,8 +232,8 @@ namespace direct_bt { bool validateDevInfo() noexcept; - static std::shared_ptr<DBTDevice> findDevice(std::vector<std::shared_ptr<DBTDevice>> & devices, const EUI48 & address, const BDAddressType addressType) noexcept; - std::shared_ptr<DBTDevice> findDevice(std::vector<std::shared_ptr<DBTDevice>> & devices, DBTDevice const & device) noexcept; + static std::shared_ptr<DBTDevice> findDevice(jau::darray<std::shared_ptr<DBTDevice>> & devices, const EUI48 & address, const BDAddressType addressType) noexcept; + std::shared_ptr<DBTDevice> findDevice(jau::darray<std::shared_ptr<DBTDevice>> & devices, DBTDevice const & device) noexcept; /** * Closes all device connections, stops discovery and cleans up all references. @@ -255,7 +256,7 @@ namespace direct_bt { friend bool DBTDevice::updatePairingState(std::shared_ptr<DBTDevice> sthis, const MgmtEvent& evt, const HCIStatusCode evtStatus, SMPPairingState claimed_state) noexcept; friend void DBTDevice::hciSMPMsgCallback(std::shared_ptr<DBTDevice> sthis, const SMPPDUMsg& msg, const HCIACLData::l2cap_frame& source) noexcept; friend void DBTDevice::processDeviceReady(std::shared_ptr<DBTDevice> sthis, const uint64_t timestamp); - friend std::vector<std::shared_ptr<GATTService>> DBTDevice::getGATTServices() noexcept; + friend jau::darray<std::shared_ptr<GATTService>> DBTDevice::getGATTServices() noexcept; bool lockConnect(const DBTDevice & device, const bool wait, const SMPIOCapability io_cap) noexcept; bool unlockConnect(const DBTDevice & device) noexcept; @@ -651,7 +652,7 @@ namespace direct_bt { * use 'DeviceStatusListener::deviceFound(..)' callback. * </p> */ - std::vector<std::shared_ptr<DBTDevice>> getDiscoveredDevices() const noexcept; + jau::darray<std::shared_ptr<DBTDevice>> getDiscoveredDevices() const noexcept; /** Discards all discovered devices. Returns number of removed discovered devices. */ int removeDiscoveredDevices() noexcept; diff --git a/api/direct_bt/DBTDevice.hpp b/api/direct_bt/DBTDevice.hpp index f40411c7..b1b111d4 100644 --- a/api/direct_bt/DBTDevice.hpp +++ b/api/direct_bt/DBTDevice.hpp @@ -30,10 +30,11 @@ #include <string> #include <memory> #include <cstdint> -#include <vector> #include <mutex> +#include <jau/darray.hpp> + #include "DBTTypes.hpp" #include "HCIIoctl.hpp" @@ -68,7 +69,7 @@ namespace direct_bt { jau::relaxed_atomic_uint16 hciConnHandle; jau::ordered_atomic<LEFeatures, std::memory_order_relaxed> le_features; std::shared_ptr<ManufactureSpecificData> advMSD = nullptr; - std::vector<std::shared_ptr<uuid_t>> advServices; + jau::darray<std::shared_ptr<uuid_t>> advServices; #if SMP_SUPPORTED_BY_OS std::shared_ptr<SMPHandler> smpHandler = nullptr; std::recursive_mutex mtx_smpHandler; @@ -118,7 +119,7 @@ namespace direct_bt { /** Add advertised service (GAP discovery) */ bool addAdvService(std::shared_ptr<uuid_t> const &uuid) noexcept; /** Add advertised service (GAP discovery) */ - bool addAdvServices(std::vector<std::shared_ptr<uuid_t>> const & services) noexcept; + bool addAdvServices(jau::darray<std::shared_ptr<uuid_t>> const & services) noexcept; /** * Find advertised service (GAP discovery) index * @return index >= 0 if found, otherwise -1 @@ -285,7 +286,7 @@ namespace direct_bt { * use {@link #getGATTServices()}. * </p> */ - std::vector<std::shared_ptr<uuid_t>> getAdvertisedServices() const noexcept; + jau::darray<std::shared_ptr<uuid_t>> getAdvertisedServices() const noexcept; std::string toString() const noexcept override { return toString(false); } @@ -739,7 +740,7 @@ namespace direct_bt { * In case no GATT connection has been established it will be created via connectGATT(). * </p> */ - std::vector<std::shared_ptr<GATTService>> getGATTServices() noexcept; + jau::darray<std::shared_ptr<GATTService>> getGATTServices() noexcept; /** * Returns the matching GATTService for the given uuid. diff --git a/api/direct_bt/DBTManager.hpp b/api/direct_bt/DBTManager.hpp index d3694a3f..f158f89d 100644 --- a/api/direct_bt/DBTManager.hpp +++ b/api/direct_bt/DBTManager.hpp @@ -29,8 +29,6 @@ #include <cstring> #include <string> #include <cstdint> -#include <array> -#include <vector> #include <mutex> #include <atomic> @@ -39,6 +37,7 @@ #include <jau/environment.hpp> #include <jau/ringbuffer.hpp> #include <jau/java_uplink.hpp> +#include <jau/darray.hpp> #include <jau/cow_darray.hpp> #include "BTTypes.hpp" @@ -208,7 +207,7 @@ namespace direct_bt { WhitelistElem(uint16_t dev_id_, BDAddressAndType address_and_type_, HCIWhitelistConnectType ctype_) : dev_id(dev_id_), address_and_type(address_and_type_), ctype(ctype_) { } }; - std::vector<std::shared_ptr<WhitelistElem>> whitelist; + jau::darray<std::shared_ptr<WhitelistElem>> whitelist; const MgmtEnv & env; const BTMode defaultBTMode; @@ -238,14 +237,15 @@ namespace direct_bt { ChangedAdapterSetCallbackList mgmtChangedAdapterSetCallbackList; - jau::cow_darray<std::shared_ptr<AdapterInfo>> adapterInfos; + typedef jau::cow_darray<std::shared_ptr<AdapterInfo>> adapterInfos_t; + adapterInfos_t adapterInfos; /** * Using defaultIOCapability on added AdapterInfo. * Sharing same dev_id <-> index mapping of adapterInfos using findAdapterInfoIndex(). * Piggy back reusing adapterInfos.get_write_mutex(). */ - std::vector<SMPIOCapability> adapterIOCapability; + jau::darray<SMPIOCapability> adapterIOCapability; void mgmtReaderThreadImpl() noexcept; diff --git a/api/direct_bt/GATTCharacteristic.hpp b/api/direct_bt/GATTCharacteristic.hpp index a7676b05..c663be02 100644 --- a/api/direct_bt/GATTCharacteristic.hpp +++ b/api/direct_bt/GATTCharacteristic.hpp @@ -30,7 +30,6 @@ #include <string> #include <memory> #include <cstdint> -#include <vector> #include <mutex> #include <atomic> @@ -105,7 +104,7 @@ namespace direct_bt { static std::string getPropertyString(const PropertyBitVal prop) noexcept; static std::string getPropertiesString(const PropertyBitVal properties) noexcept; - static std::vector<std::unique_ptr<std::string>> getPropertiesStringList(const PropertyBitVal properties) noexcept; + static jau::darray<std::unique_ptr<std::string>> getPropertiesStringList(const PropertyBitVal properties) noexcept; /** * Characteristics's Service Handle - key to service's handle range, retrieved from Characteristics data. @@ -138,7 +137,7 @@ namespace direct_bt { std::unique_ptr<const uuid_t> value_type; /** List of Characteristic Descriptions as shared reference */ - std::vector<GATTDescriptorRef> descriptorList; + jau::darray<GATTDescriptorRef> descriptorList; /* Optional Client Characteristic Configuration index within descriptorList */ int clientCharacteristicsConfigIndex = -1; diff --git a/api/direct_bt/GATTDescriptor.hpp b/api/direct_bt/GATTDescriptor.hpp index fb852113..0ee77667 100644 --- a/api/direct_bt/GATTDescriptor.hpp +++ b/api/direct_bt/GATTDescriptor.hpp @@ -30,7 +30,6 @@ #include <string> #include <memory> #include <cstdint> -#include <vector> #include <mutex> #include <atomic> diff --git a/api/direct_bt/GATTHandler.hpp b/api/direct_bt/GATTHandler.hpp index 2dd53019..1e2767e8 100644 --- a/api/direct_bt/GATTHandler.hpp +++ b/api/direct_bt/GATTHandler.hpp @@ -30,7 +30,6 @@ #include <string> #include <memory> #include <cstdint> -#include <vector> #include <mutex> #include <atomic> @@ -173,11 +172,12 @@ namespace direct_bt { /** send immediate confirmation of indication events from device, defaults to true. */ jau::relaxed_atomic_bool sendIndicationConfirmation = true; - jau::cow_darray<std::shared_ptr<GATTCharacteristicListener>> characteristicListenerList; + typedef jau::cow_darray<std::shared_ptr<GATTCharacteristicListener>> characteristicListenerList_t; + characteristicListenerList_t characteristicListenerList; uint16_t serverMTU; std::atomic<uint16_t> usedMTU; // concurrent use in ctor(set), send and l2capReaderThreadImpl - std::vector<GATTServiceRef> services; + jau::darray<GATTServiceRef> services; std::shared_ptr<GattGenericAccessSvc> genericAccess = nullptr; bool validateConnected() noexcept; @@ -281,7 +281,7 @@ namespace direct_bt { * Returns nullptr if not found. * </p> */ - GATTCharacteristicRef findCharacterisicsByValueHandle(const uint16_t charValueHandle, std::vector<GATTServiceRef> &services) noexcept; + GATTCharacteristicRef findCharacterisicsByValueHandle(const uint16_t charValueHandle, jau::darray<GATTServiceRef> &services) noexcept; /** * Find and return the GATTCharacterisicsDecl within given primary service @@ -303,7 +303,7 @@ namespace direct_bt { * @param shared_this shared pointer of this instance, used to forward a weak_ptr to GATTService for back-reference. Reference is validated. * @return GATTHandler's internal GATTService vector of discovered services */ - std::vector<GATTServiceRef> & discoverCompletePrimaryServices(std::shared_ptr<GATTHandler> shared_this); + jau::darray<GATTServiceRef> & discoverCompletePrimaryServices(std::shared_ptr<GATTHandler> shared_this); /** * Returns a reference of the internal kept GATTService list. @@ -311,7 +311,7 @@ namespace direct_bt { * The internal list will be populated via {@link #discoverCompletePrimaryServices()}. * </p> */ - inline std::vector<GATTServiceRef> & getServices() noexcept { return services; } + inline jau::darray<GATTServiceRef> & getServices() noexcept { return services; } /** * Returns the internal kept shared GattGenericAccessSvc instance. @@ -330,7 +330,7 @@ namespace direct_bt { * @param result vector containing all discovered primary services * @return true on success, otherwise false */ - bool discoverPrimaryServices(std::shared_ptr<GATTHandler> shared_this, std::vector<GATTServiceRef> & result); + bool discoverPrimaryServices(std::shared_ptr<GATTHandler> shared_this, jau::darray<GATTServiceRef> & result); /** * Discover all characteristics of a service and declaration attributes _only_. @@ -518,11 +518,11 @@ namespace direct_bt { /** Higher level semantic functionality **/ /*****************************************************/ - std::shared_ptr<GattGenericAccessSvc> getGenericAccess(std::vector<GATTServiceRef> & primServices); - std::shared_ptr<GattGenericAccessSvc> getGenericAccess(std::vector<GATTCharacteristicRef> & genericAccessCharDeclList); + std::shared_ptr<GattGenericAccessSvc> getGenericAccess(jau::darray<GATTServiceRef> & primServices); + std::shared_ptr<GattGenericAccessSvc> getGenericAccess(jau::darray<GATTCharacteristicRef> & genericAccessCharDeclList); - std::shared_ptr<GattDeviceInformationSvc> getDeviceInformation(std::vector<GATTServiceRef> & primServices); - std::shared_ptr<GattDeviceInformationSvc> getDeviceInformation(std::vector<GATTCharacteristicRef> & deviceInfoCharDeclList); + std::shared_ptr<GattDeviceInformationSvc> getDeviceInformation(jau::darray<GATTServiceRef> & primServices); + std::shared_ptr<GattDeviceInformationSvc> getDeviceInformation(jau::darray<GATTCharacteristicRef> & deviceInfoCharDeclList); /** * Issues a ping to the device, validating whether it is still reachable. diff --git a/api/direct_bt/GATTNumbers.hpp b/api/direct_bt/GATTNumbers.hpp index 437a757c..8b23ce38 100644 --- a/api/direct_bt/GATTNumbers.hpp +++ b/api/direct_bt/GATTNumbers.hpp @@ -29,6 +29,7 @@ #include <cstdint> #include <jau/basic_types.hpp> +#include <jau/darray.hpp> #include "UUID.hpp" #include "OctetTypes.hpp" @@ -184,7 +185,7 @@ struct GattCharacteristicSpec { BroadcastIdx }; /** Aggregated in PropertySpecIdx order */ - const std::vector<GattCharacteristicPropertySpec> propertySpec; + const jau::darray<GattCharacteristicPropertySpec> propertySpec; const GattClientCharacteristicConfigSpec clientConfig; @@ -193,7 +194,7 @@ struct GattCharacteristicSpec { struct GattServiceCharacteristic { const GattServiceType service; - const std::vector<GattCharacteristicSpec> characteristics; + const jau::darray<GattCharacteristicSpec> characteristics; std::string toString() const noexcept; }; @@ -206,7 +207,7 @@ struct GattServiceCharacteristic { extern const GattServiceCharacteristic GATT_GENERIC_ACCESS_SRVC; extern const GattServiceCharacteristic GATT_HEALTH_THERMOMETER_SRVC; extern const GattServiceCharacteristic GATT_DEVICE_INFORMATION_SRVC; -extern const std::vector<const GattServiceCharacteristic*> GATT_SERVICES; +extern const jau::darray<const GattServiceCharacteristic*> GATT_SERVICES; /** * Find the GattServiceCharacteristic entry by given uuid16, diff --git a/api/direct_bt/GATTService.hpp b/api/direct_bt/GATTService.hpp index 8506465e..f81f4661 100644 --- a/api/direct_bt/GATTService.hpp +++ b/api/direct_bt/GATTService.hpp @@ -30,12 +30,12 @@ #include <string> #include <memory> #include <cstdint> -#include <vector> #include <mutex> #include <atomic> #include <jau/java_uplink.hpp> +#include <jau/darray.hpp> #include "UUID.hpp" #include "BTTypes.hpp" @@ -94,7 +94,7 @@ namespace direct_bt { std::unique_ptr<const uuid_t> type; /** List of Characteristic Declarations as shared reference */ - std::vector<GATTCharacteristicRef> characteristicList; + jau::darray<GATTCharacteristicRef> characteristicList; GATTService(const std::shared_ptr<GATTHandler> &handler_, const bool isPrimary_, const uint16_t startHandle_, const uint16_t endHandle_, std::unique_ptr<const uuid_t> && type_) noexcept diff --git a/api/direct_bt/GATTTypes.hpp b/api/direct_bt/GATTTypes.hpp index 385f44b2..96c8f372 100644 --- a/api/direct_bt/GATTTypes.hpp +++ b/api/direct_bt/GATTTypes.hpp @@ -30,7 +30,6 @@ #include <string> #include <memory> #include <cstdint> -#include <vector> #include <mutex> #include <atomic> diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp index b42489c0..eca18053 100644 --- a/api/direct_bt/HCIHandler.hpp +++ b/api/direct_bt/HCIHandler.hpp @@ -29,12 +29,12 @@ #include <cstring> #include <string> #include <cstdint> -#include <array> #include <mutex> #include <atomic> #include <thread> +#include <jau/darray.hpp> #include <jau/environment.hpp> #include <jau/ringbuffer.hpp> #include <jau/java_uplink.hpp> @@ -251,8 +251,8 @@ namespace direct_bt { std::atomic<ScanType> currentScanType; - std::vector<HCIConnectionRef> connectionList; - std::vector<HCIConnectionRef> disconnectCmdList; + jau::darray<HCIConnectionRef> connectionList; + jau::darray<HCIConnectionRef> disconnectCmdList; std::recursive_mutex mtx_connectionList; // Recurses from disconnect -> findTrackerConnection, addOrUpdateTrackerConnection /** Exclusive [le] connection command (status + pending completed) one at a time */ @@ -270,7 +270,7 @@ namespace direct_bt { * @param addrType key to matching connection * @param handle ignored for existing tracker _if_ invalid, i.e. zero. */ - HCIConnectionRef addOrUpdateHCIConnection(std::vector<HCIConnectionRef> &list, + HCIConnectionRef addOrUpdateHCIConnection(jau::darray<HCIConnectionRef> &list, const BDAddressAndType& addressAndType, const uint16_t handle) noexcept; HCIConnectionRef addOrUpdateTrackerConnection(const BDAddressAndType& addressAndType, const uint16_t handle) noexcept { return addOrUpdateHCIConnection(connectionList, addressAndType, handle); @@ -279,7 +279,7 @@ namespace direct_bt { return addOrUpdateHCIConnection(disconnectCmdList, addressAndType, handle); } - HCIConnectionRef findHCIConnection(std::vector<HCIConnectionRef> &list, const BDAddressAndType& addressAndType) noexcept; + HCIConnectionRef findHCIConnection(jau::darray<HCIConnectionRef> &list, const BDAddressAndType& addressAndType) noexcept; HCIConnectionRef findTrackerConnection(const BDAddressAndType& addressAndType) noexcept { return findHCIConnection(connectionList, addressAndType); } @@ -291,7 +291,7 @@ namespace direct_bt { HCIConnectionRef removeTrackerConnection(const HCIConnectionRef conn) noexcept; int countPendingTrackerConnections() noexcept; - HCIConnectionRef removeHCIConnection(std::vector<HCIConnectionRef> &list, const uint16_t handle) noexcept; + HCIConnectionRef removeHCIConnection(jau::darray<HCIConnectionRef> &list, const uint16_t handle) noexcept; HCIConnectionRef removeTrackerConnection(const uint16_t handle) noexcept { return removeHCIConnection(connectionList, handle); } diff --git a/api/direct_bt/L2CAPComm.hpp b/api/direct_bt/L2CAPComm.hpp index 64979acf..01dbbefa 100644 --- a/api/direct_bt/L2CAPComm.hpp +++ b/api/direct_bt/L2CAPComm.hpp @@ -30,7 +30,6 @@ #include <string> #include <memory> #include <cstdint> -#include <vector> #include <mutex> #include <atomic> diff --git a/api/direct_bt/MgmtTypes.hpp b/api/direct_bt/MgmtTypes.hpp index ade7be2c..d304ad4c 100644 --- a/api/direct_bt/MgmtTypes.hpp +++ b/api/direct_bt/MgmtTypes.hpp @@ -609,7 +609,7 @@ namespace direct_bt { memcpy(pdu.get_wptr_nc(MGMT_HEADER_SIZE+1+2), &key, sizeof(MgmtLinkKeyInfo)); } - MgmtLoadLinkKeyCmd(const uint16_t dev_id, const bool debug_keys, const std::vector<MgmtLinkKeyInfo> &keys) + MgmtLoadLinkKeyCmd(const uint16_t dev_id, const bool debug_keys, const jau::darray<MgmtLinkKeyInfo> &keys) : MgmtCommand(Opcode::LOAD_LINK_KEYS, dev_id, 1 + 2 + keys.size() * sizeof(MgmtLinkKeyInfo)) { jau::nsize_t offset = MGMT_HEADER_SIZE; @@ -667,7 +667,7 @@ namespace direct_bt { memcpy(pdu.get_wptr_nc(MGMT_HEADER_SIZE+2), &key, sizeof(MgmtLongTermKeyInfo)); } - MgmtLoadLongTermKeyCmd(const uint16_t dev_id, const std::vector<MgmtLongTermKeyInfo> &keys) + MgmtLoadLongTermKeyCmd(const uint16_t dev_id, const jau::darray<MgmtLongTermKeyInfo> &keys) : MgmtCommand(Opcode::LOAD_LONG_TERM_KEYS, dev_id, 2 + keys.size() * sizeof(MgmtLongTermKeyInfo)) { jau::nsize_t offset = MGMT_HEADER_SIZE; @@ -757,7 +757,7 @@ namespace direct_bt { memcpy(pdu.get_wptr_nc(MGMT_HEADER_SIZE+2), &key, sizeof(MgmtIdentityResolvingKeyInfo)); } - MgmtLoadIdentityResolvingKeyCmd(const uint16_t dev_id, const std::vector<MgmtIdentityResolvingKeyInfo> &keys) + MgmtLoadIdentityResolvingKeyCmd(const uint16_t dev_id, const jau::darray<MgmtIdentityResolvingKeyInfo> &keys) : MgmtCommand(Opcode::LOAD_IRKS, dev_id, 2 + keys.size() * sizeof(MgmtIdentityResolvingKeyInfo)) { jau::nsize_t offset = MGMT_HEADER_SIZE; @@ -1055,7 +1055,7 @@ namespace direct_bt { memcpy(pdu.get_wptr_nc(MGMT_HEADER_SIZE+2), &connParam, sizeof(MgmtConnParam)); } - MgmtLoadConnParamCmd(const uint16_t dev_id, const std::vector<MgmtConnParam> &connParams) + MgmtLoadConnParamCmd(const uint16_t dev_id, const jau::darray<MgmtConnParam> &connParams) : MgmtCommand(Opcode::LOAD_CONN_PARAM, dev_id, 2 + connParams.size() * sizeof(MgmtConnParam)) { jau::nsize_t offset = MGMT_HEADER_SIZE; diff --git a/api/direct_bt/OctetTypes.hpp b/api/direct_bt/OctetTypes.hpp index c9ac6ca1..bdbc0e2e 100644 --- a/api/direct_bt/OctetTypes.hpp +++ b/api/direct_bt/OctetTypes.hpp @@ -30,7 +30,6 @@ #include <string> #include <memory> #include <cstdint> -#include <vector> #include <algorithm> #include <mutex> diff --git a/api/direct_bt/SMPHandler.hpp b/api/direct_bt/SMPHandler.hpp index 8e5d32fa..09e4e590 100644 --- a/api/direct_bt/SMPHandler.hpp +++ b/api/direct_bt/SMPHandler.hpp @@ -29,7 +29,6 @@ #include <cstring> #include <string> #include <cstdint> -#include <array> #include <mutex> #include <atomic> @@ -38,6 +37,7 @@ #include <jau/environment.hpp> #include <jau/ringbuffer.hpp> #include <jau/function_def.hpp> +#include <jau/darray.hpp> #include <jau/cow_darray.hpp> #include "UUID.hpp" |