summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/direct_bt/BTTypes0.hpp2
-rw-r--r--api/direct_bt/HCIHandler.hpp8
-rw-r--r--api/direct_bt/MgmtTypes.hpp22
3 files changed, 19 insertions, 13 deletions
diff --git a/api/direct_bt/BTTypes0.hpp b/api/direct_bt/BTTypes0.hpp
index a9b5c3f5..fe56c986 100644
--- a/api/direct_bt/BTTypes0.hpp
+++ b/api/direct_bt/BTTypes0.hpp
@@ -699,7 +699,7 @@ namespace direct_bt {
* https://www.bluetooth.com/specifications/archived-specifications/
* </p>
*/
- static jau::darray<std::shared_ptr<EInfoReport>> read_ad_reports(uint8_t const * data, jau::nsize_t const data_length) noexcept;
+ static jau::darray<std::unique_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
diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp
index a4dcd8dc..b1467c82 100644
--- a/api/direct_bt/HCIHandler.hpp
+++ b/api/direct_bt/HCIHandler.hpp
@@ -126,6 +126,14 @@ namespace direct_bt {
*/
const bool DEBUG_EVENT;
+ /**
+ * Debug all scanned HCI 'Advertising Data' (AD) 'Extended Inquiry Response' (EIR) packages.
+ * <p>
+ * Environment variable is 'direct_bt.debug.hci.scan_ad_eir'.
+ * </p>
+ */
+ const bool DEBUG_SCAN_AD_EIR;
+
private:
/** Maximum number of packets to wait for until matching a sequential command. Won't block as timeout will limit. */
const int32_t HCI_READ_PACKET_MAX_RETRY;
diff --git a/api/direct_bt/MgmtTypes.hpp b/api/direct_bt/MgmtTypes.hpp
index c1d53c95..90382539 100644
--- a/api/direct_bt/MgmtTypes.hpp
+++ b/api/direct_bt/MgmtTypes.hpp
@@ -1769,7 +1769,7 @@ namespace direct_bt {
class MgmtEvtDeviceFound : public MgmtEvent
{
private:
- std::shared_ptr<EInfoReport> eireport;
+ std::unique_ptr<EInfoReport> eireport;
protected:
std::string baseString() const noexcept override {
@@ -1785,24 +1785,22 @@ namespace direct_bt {
public:
MgmtEvtDeviceFound(const uint8_t* buffer, const jau::nsize_t buffer_len)
- : MgmtEvent(buffer, buffer_len, 14)
+ : MgmtEvent(buffer, buffer_len, 14), eireport(nullptr)
{
checkOpcode(getOpcode(), Opcode::DEVICE_FOUND);
- eireport = nullptr;
}
- MgmtEvtDeviceFound(const uint16_t dev_id, std::shared_ptr<EInfoReport> eir)
- : MgmtEvent(Opcode::DEVICE_FOUND, dev_id, 6+1+1+4+2+0)
+ MgmtEvtDeviceFound(const uint16_t dev_id, std::unique_ptr<EInfoReport> && eir)
+ : MgmtEvent(Opcode::DEVICE_FOUND, dev_id, 6+1+1+4+2+0), eireport(std::move(eir))
{
- pdu.put_eui48_nc(MGMT_HEADER_SIZE, eir->getAddress());
- pdu.put_uint8_nc(MGMT_HEADER_SIZE+6, direct_bt::number(eir->getAddressType()));
- pdu.put_int8_nc(MGMT_HEADER_SIZE+6+1, eir->getRSSI());
- pdu.put_uint32_nc(MGMT_HEADER_SIZE+6+1+1, eir->getFlags()); // EIR flags only 8bit, Mgmt uses 32bit?
+ pdu.put_eui48_nc(MGMT_HEADER_SIZE, eireport->getAddress());
+ pdu.put_uint8_nc(MGMT_HEADER_SIZE+6, direct_bt::number(eireport->getAddressType()));
+ pdu.put_int8_nc(MGMT_HEADER_SIZE+6+1, eireport->getRSSI());
+ pdu.put_uint32_nc(MGMT_HEADER_SIZE+6+1+1, eireport->getFlags()); // EIR flags only 8bit, Mgmt uses 32bit?
pdu.put_uint16_nc(MGMT_HEADER_SIZE+6+1+1+4, 0); // eir_len
- eireport = eir;
}
- /** Returns the EInfoReport, assuming creation occurred via HCIHandler. Otherwise nullptr. */
- std::shared_ptr<EInfoReport> getEIR() const noexcept { return eireport; }
+ /** Returns reference to the immutable EInfoReport, assuming creation occurred via HCIHandler. Otherwise nullptr. */
+ const EInfoReport* getEIR() const noexcept { return eireport.get(); }
const EUI48& getAddress() const noexcept { return *reinterpret_cast<const EUI48 *>( pdu.get_ptr_nc(MGMT_HEADER_SIZE + 0) ); } // mgmt_addr_info
BDAddressType getAddressType() const noexcept { return static_cast<BDAddressType>(pdu.get_uint8_nc(MGMT_HEADER_SIZE+6)); } // mgmt_addr_info