21 uint16_t _companyId{};
22 std::vector<uint8_t> _data{};
37 const std::vector<uint8_t>&
data()
const {
return _data; }
44 : _companyId{
companyId }, _data{ Internal::dataBufferToBytesVector(
data) } {}
54 uint16_t _shortUuid{};
55 std::vector<uint8_t> _data{};
70 const std::vector<uint8_t>&
data()
const {
return _data; }
77 : _shortUuid(0), _data{ Internal::dataBufferToBytesVector(
data) }
79 if (_data.size() >= 2)
81 _shortUuid = _data[0] | ((uint16_t)_data[1] << 8);
82 _data.erase(_data.begin(), _data.begin() + 2);
95 std::vector<uint8_t> _data{};
110 const std::vector<uint8_t>&
data()
const {
return _data; }
117 : _dataType{
dataType }, _data{ Internal::dataBufferToBytesVector(
data) } {}
134 using DateTime = winrt::Windows::Foundation::DateTime;
136 DateTime _timestamp{};
138 std::wstring _name{};
139 bool _isConnectable{};
142 std::vector<winrt::guid> _services{};
143 std::vector<ManufacturerData> _manufacturersData{};
144 std::vector<ServiceData> _servicesData{};
145 std::vector<AdvertisementData> _advertisingData{};
154 const DateTime&
timestamp()
const {
return _timestamp; }
175 const std::wstring&
name()
const {
return _name; }
196 int rssi()
const {
return _rssi; }
217 const std::vector<winrt::guid>&
services()
const {
return _services; }
237 const std::vector<ServiceData>&
servicesData()
const {
return _servicesData; }
247 const std::vector<AdvertisementData>&
advertisingData()
const {
return _advertisingData; }
255 const std::wstring&
name,
259 const std::vector<winrt::guid>&
services,
277 const ScannedPeripheral& peripheral,
281 const std::vector<winrt::guid>&
services,
287 _address{ peripheral.
address() },
288 _name{
name.empty() ? peripheral._name :
name },
292 _services{ concat(peripheral._services,
services) },
294 _servicesData{ concat(peripheral._servicesData,
servicesData) },
295 _advertisingData{ concat(peripheral._advertisingData,
advertisingData) } {}
297 template <
typename T>
298 std::vector<T> concat(
const std::vector<T> a,
const std::vector<T>& b)
300 std::vector<T> out{ a };
301 out.insert(out.end(), b.begin(), b.end());
Common types used across the Systemic::BluetoothLE namespace.
Stores an advertisement packet data type and it's associated binary data.
Definition: ScannedPeripheral.h:93
uint8_t dataType() const
Gets this advertisement packet data type.
Definition: ScannedPeripheral.h:103
const std::vector< uint8_t > & data() const
Gets this advertisement packet binary data.
Definition: ScannedPeripheral.h:110
Stores a company id and it's associated binary data.
Definition: ScannedPeripheral.h:20
const std::vector< uint8_t > & data() const
Gets the binary data associated with the company id.
Definition: ScannedPeripheral.h:37
uint16_t companyId() const
Gets the company id.
Definition: ScannedPeripheral.h:30
Holds the information from advertisement packet(s) received from a peripheral.
Definition: ScannedPeripheral.h:133
const DateTime & timestamp() const
Gets the time at which the last advertisement packet used for initializing this instance was received...
Definition: ScannedPeripheral.h:154
int txPowerLevel() const
Gets the received transmit power of the advertisement packet.
Definition: ScannedPeripheral.h:207
const std::vector< AdvertisementData > & advertisingData() const
Gets the list of binary advertisement data contained in the advertisement packet(s).
Definition: ScannedPeripheral.h:247
const std::vector< winrt::guid > & services() const
Gets the list of services contained in the advertisement packet(s).
Definition: ScannedPeripheral.h:217
bool isConnectable() const
Indicates whether the received advertisement is connectable.
Definition: ScannedPeripheral.h:185
bluetooth_address_t address() const
Gets the Bluetooth address of the peripheral that send the advertisement packet(s).
Definition: ScannedPeripheral.h:164
int rssi() const
Gets the received signal strength indicator (RSSI) value, in dBm, of the advertisement packet.
Definition: ScannedPeripheral.h:196
const std::vector< ManufacturerData > & manufacturersData() const
Gets the list of manufacturer data contained in the advertisement packet(s).
Definition: ScannedPeripheral.h:227
const std::wstring & name() const
The name of the peripheral as advertised.
Definition: ScannedPeripheral.h:175
const std::vector< ServiceData > & servicesData() const
Gets the list of service data contained in the advertisement packet(s).
Definition: ScannedPeripheral.h:237
Implements scanning of Bluetooth Low Energy (BLE) peripherals. It stores and notifies of discovered p...
Definition: Scanner.h:21
Stores a company id and it's associated binary data.
Definition: ScannedPeripheral.h:53
uint16_t shortUuid() const
Gets the service short id (16 bits).
Definition: ScannedPeripheral.h:63
const std::vector< uint8_t > & data() const
Gets the binary data associated with the service.
Definition: ScannedPeripheral.h:70
A collection of C++ classes that provides a simplified access to Bluetooth Low Energy peripherals.
Definition: BleTypes.h:38
std::uint64_t bluetooth_address_t
Type for a Bluetooth address.
Definition: BleTypes.h:40