Skip to content

Commit

Permalink
pw_bluetooth_sapphire: Add packet filtering consts to vendor protocol
Browse files Browse the repository at this point in the history
Original header: Add advertising packet filtering packet constants to vendor protocol

Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/983023
GitOrigin-RevId: e542cb53235024b3ea521e0afccf5c38cf59a05b
Change-Id: Ib4c8d86b08eb1956cb1b0127e239c1895df7e725
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/218978
Pigweed-Auto-Submit: Jason Graffius <[email protected]>
Lint: Lint 🤖 <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Reviewed-by: Faraaz Sareshwala <[email protected]>
  • Loading branch information
fsareshwala authored and CQ Bot Account committed Jul 9, 2024
1 parent a4580ad commit ebb087c
Showing 1 changed file with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
//
// NOTE: The definitions below are incomplete. They get added as needed. This
// list will grow as we support more vendor features.
//
// NOTE: Avoid casting raw buffer pointers to the packet payload structure types
// below; use as template parameter to PacketView::payload(),
// MutableBufferView::mutable_payload(), or CommandPacket::mutable_payload()
// instead. Take extra care when accessing flexible array members.

#include <pw_bluetooth/hci_android.emb.h>

Expand Down Expand Up @@ -71,4 +66,34 @@ constexpr uint8_t kLEMultiAdvtSetRandomAddrSubopcode = 0x4;
constexpr uint8_t kLEMultiAdvtEnableSubopcode = 0x05;
constexpr EventCode kLEMultiAdvtStateChangeSubeventCode = 0x55;

// ============================================================================
// Advertising Packet Content Filtering

// The kLEApcf opcode is shared across all advertising packet content filtering
// HCI commands. To differentiate between the multiple commands, a subopcode
// field is included in the command payload. These subopcode fields must be set
// to a specific value.
constexpr OpCode kLEApcf = VendorOpCode(0x157);
constexpr uint8_t kLEApcfEnableSubopcode = 0x00;
constexpr uint8_t kLEApcfSetFilteringParametersSubopcode = 0x01;
constexpr uint8_t kLEApcfBroadcastAddressSubopcode = 0x02;
constexpr uint8_t kLEApcfServiceUUIDSubopcode = 0x03;
constexpr uint8_t kLEApcfServiceSolicitationUUIDSubopcode = 0x04;
constexpr uint8_t kLEApcfLocalNameSubopcode = 0x05;
constexpr uint8_t kLEApcfManufacturerDataSubopcode = 0x06;
constexpr uint8_t kLEApcfServiceDataSubopcode = 0x07;
constexpr uint8_t kLEApcfTransportDiscoveryService = 0x08;
constexpr uint8_t kLEApcfAdTypeFilter = 0x09;
constexpr uint8_t kLEApcfReadExtendedFeatures = 0xFF;

// The maximum length of an advertising data field. The value 29 is selected
// because advertising data can be between 0 - 31 bytes wide.
//
// - Byte 0: length of the advertising data itself.
// - Byte 1: advertising data type (e.g. 0xFF for manufacturer data)
//
// With two bytes used, the rest of the payload size can only take up a maximum
// of 29 bytes.
constexpr uint8_t kLEApcfMaxPDUValueLength = 29;

} // namespace bt::hci_spec::vendor::android

0 comments on commit ebb087c

Please sign in to comment.