1 // Copyright 2022 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 #pragma once 15 16 #include <cstdint> 17 18 #include "pw_bluetooth/types.h" 19 #include "pw_multibuf/multibuf.h" 20 #include "pw_span/span.h" 21 22 namespace pw::bluetooth::low_energy { 23 24 // A service data field in an advertising data payload. 25 struct ServiceData { 26 Uuid uuid; 27 span<const std::byte> data; 28 }; 29 30 // A manufacturer data field in an advertising data payload. 31 struct ManufacturerData { 32 uint16_t company_id = 0; 33 span<const std::byte> data; 34 }; 35 36 // Represents advertising and scan response data that are transmitted by a LE 37 // peripheral or broadcaster. 38 struct AdvertisingData { 39 // Long or short name of the device. 40 std::string_view name; 41 42 // The appearance of the local device. 43 Appearance appearance = Appearance::kUnknown; 44 45 span<const Uuid> service_uuids; 46 47 span<const ServiceData> service_data; 48 49 span<const ManufacturerData> manufacturer_data; 50 51 // String representing a URI to be advertised, as defined in IETF STD 66: 52 // https://tools.ietf.org/html/std66. Each entry should be a UTF-8 string 53 // including the scheme. For more information, see: 54 // https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml for allowed 55 // schemes; 56 // https://www.bluetooth.com/specifications/assigned-numbers/uri-scheme-name-string-mapping 57 // for code-points used by the system to compress the scheme to save space in 58 // the payload. 59 span<const std::string_view> uris; 60 61 // Indicates whether the current TX power level should be included in the 62 // advertising data. 63 bool include_tx_power_level = false; 64 }; 65 66 } // namespace pw::bluetooth::low_energy 67