19 uint16_t _companyId{};
20 std::vector<uint8_t> _data{};
35 const std::vector<uint8_t>&
data()
const {
return _data; }
42 : _companyId{
companyId }, _data{ Internal::dataBufferToBytesVector(
data) } {}
52 uint16_t _shortUuid{};
53 std::vector<uint8_t> _data{};
68 const std::vector<uint8_t>&
data()
const {
return _data; }
75 : _shortUuid(0), _data{ Internal::dataBufferToBytesVector(
data) }
77 if (_data.size() >= 2)
79 _shortUuid = _data[0] | ((uint16_t)_data[1] << 8);
80 _data.erase(_data.begin(), _data.begin() + 2);
93 std::vector<uint8_t> _data{};
108 const std::vector<uint8_t>&
data()
const {
return _data; }
115 : _dataType{
dataType }, _data{ Internal::dataBufferToBytesVector(
data) } {}
132 using DateTime = winrt::Windows::Foundation::DateTime;
134 DateTime _timestamp{};
136 std::wstring _name{};
137 bool _isConnectable{};
140 std::vector<winrt::guid> _services{};
141 std::vector<ManufacturerData> _manufacturersData{};
142 std::vector<ServiceData> _servicesData{};
143 std::vector<AdvertisementData> _advertisingData{};
152 const DateTime&
timestamp()
const {
return _timestamp; }
173 const std::wstring&
name()
const {
return _name; }
194 int rssi()
const {
return _rssi; }
215 const std::vector<winrt::guid>&
services()
const {
return _services; }
235 const std::vector<ServiceData>&
servicesData()
const {
return _servicesData; }
245 const std::vector<AdvertisementData>&
advertisingData()
const {
return _advertisingData; }
253 const std::wstring&
name,
257 const std::vector<winrt::guid>&
services,
275 const ScannedPeripheral& peripheral,
279 const std::vector<winrt::guid>&
services,
285 _address{ peripheral.
address() },
286 _name{
name.empty() ? peripheral._name :
name },
290 _services{ concat(peripheral._services,
services) },
292 _servicesData{ concat(peripheral._servicesData,
servicesData) },
293 _advertisingData{ concat(peripheral._advertisingData,
advertisingData) } {}
295 template <
typename T>
296 std::vector<T> concat(
const std::vector<T> a,
const std::vector<T>& b)
298 std::vector<T> out{ a };
299 out.insert(out.end(), b.begin(), b.end());
Stores an advertisement packet data type and it's associated binary data.
Definition ScannedPeripheral.h:91
uint8_t dataType() const
Gets this advertisement packet data type.
Definition ScannedPeripheral.h:101
const std::vector< uint8_t > & data() const
Gets this advertisement packet binary data.
Definition ScannedPeripheral.h:108
Stores a company id and it's associated binary data.
Definition ScannedPeripheral.h:18
const std::vector< uint8_t > & data() const
Gets the binary data associated with the company id.
Definition ScannedPeripheral.h:35
uint16_t companyId() const
Gets the company id.
Definition ScannedPeripheral.h:28
Holds the information from advertisement packet(s) received from a peripheral.
Definition ScannedPeripheral.h:131
const DateTime & timestamp() const
Gets the time at which the last advertisement packet used for initializing this instance was received...
Definition ScannedPeripheral.h:152
int txPowerLevel() const
Gets the received transmit power of the advertisement packet.
Definition ScannedPeripheral.h:205
const std::vector< AdvertisementData > & advertisingData() const
Gets the list of binary advertisement data contained in the advertisement packet(s).
Definition ScannedPeripheral.h:245
const std::vector< winrt::guid > & services() const
Gets the list of services contained in the advertisement packet(s).
Definition ScannedPeripheral.h:215
bool isConnectable() const
Indicates whether the received advertisement is connectable.
Definition ScannedPeripheral.h:183
bluetooth_address_t address() const
Gets the Bluetooth address of the peripheral that send the advertisement packet(s).
Definition ScannedPeripheral.h:162
int rssi() const
Gets the received signal strength indicator (RSSI) value, in dBm, of the advertisement packet.
Definition ScannedPeripheral.h:194
const std::vector< ManufacturerData > & manufacturersData() const
Gets the list of manufacturer data contained in the advertisement packet(s).
Definition ScannedPeripheral.h:225
const std::wstring & name() const
The name of the peripheral as advertised.
Definition ScannedPeripheral.h:173
const std::vector< ServiceData > & servicesData() const
Gets the list of service data contained in the advertisement packet(s).
Definition ScannedPeripheral.h:235
Implements scanning of Bluetooth Low Energy (BLE) peripherals. It stores and notifies of discovered p...
Definition Scanner.h:23
Stores a company id and it's associated binary data.
Definition ScannedPeripheral.h:51
uint16_t shortUuid() const
Gets the service short id (16 bits).
Definition ScannedPeripheral.h:61
const std::vector< uint8_t > & data() const
Gets the binary data associated with the service.
Definition ScannedPeripheral.h:68
A collection of C++ classes that provides a simplified access to Bluetooth Low Energy peripherals.
Definition bletypes.h:36
std::uint64_t bluetooth_address_t
Type for a Bluetooth address.
Definition bletypes.h:54