Skip to content

Commit

Permalink
pw_bluetooth: Add more emboss definitions
Browse files Browse the repository at this point in the history
Add emboss CommandComplete event definitions for:
  - READ_SCAN_ENABLE
  - READ_ENCRYPTION_KEY_SIZE

Also, move ScanEnableBits into hci_common.emb so it can be used
by both commands and events.

Bug: b/42167863
Test: pw presubmit --step gn_chre_googletest_nanopb_sapphire_build
Change-Id: I608c3b8398dbd1db19e38fc7747cc8c40b89782c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/228671
Reviewed-by: Faraaz Sareshwala <[email protected]>
Commit-Queue: Josh Conner <[email protected]>
Lint: Lint 🤖 <[email protected]>
  • Loading branch information
josh-conner authored and CQ Bot Account committed Aug 12, 2024
1 parent 1725228 commit 7ee36ee
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
13 changes: 2 additions & 11 deletions pw_bluetooth/public/pw_bluetooth/hci_commands.emb
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,6 @@ enum OobDataPresent:
P192_AND_P256 = 0x03


bits ScanEnableBits:
-- Bitmask Values for the Scan_Enable parameter in a HCI_(Read,Write)_Scan_Enable command.
0 [+1] Flag inquiry
-- Inquiry scan enabled

1 [+1] Flag page
-- Page scan enabled


enum InquiryScanType:
[maximum_bits: 8]
STANDARD = 0x00
Expand Down Expand Up @@ -1224,9 +1215,9 @@ struct WriteScanEnableCommand:
-- 7.3.18 Write Scan Enable command (v1.1) (BR/EDR)
-- HCI_Write_Scan_Enable
let hdr_size = hci.CommandHeader.$size_in_bytes
0 [+hdr_size] hci.CommandHeader header
0 [+hdr_size] hci.CommandHeader header
$next [+1] bits:
0 [+ScanEnableBits.$size_in_bits] ScanEnableBits scan_enable
0 [+hci.ScanEnableBits.$size_in_bits] hci.ScanEnableBits scan_enable


struct ReadPageScanActivityCommand:
Expand Down
9 changes: 9 additions & 0 deletions pw_bluetooth/public/pw_bluetooth/hci_common.emb
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,15 @@ bits ClassOfDevice:
$next [+11] MajorServiceClasses major_service_classes


bits ScanEnableBits:
-- Bitmask Values for the Scan_Enable parameter in a HCI_(Read,Write)_Scan_Enable command.
0 [+1] Flag inquiry
-- Inquiry scan enabled

1 [+1] Flag page
-- Page scan enabled


enum ConnectionRole:
[maximum_bits: 8]
CENTRAL = 0x00
Expand Down
21 changes: 21 additions & 0 deletions pw_bluetooth/public/pw_bluetooth/hci_events.emb
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,15 @@ struct WritePinTypeCommandCompleteEvent:
$next [+1] hci.StatusCode status


struct ReadScanEnableCommandCompleteEvent:
-- 7.7.14 Command Complete event (7.3.17 Read Scan Enable command)
let hdr_size = hci.CommandCompleteEvent.$size_in_bytes
0 [+hdr_size] hci.CommandCompleteEvent command_complete
$next [+1] hci.StatusCode status
$next [+1] bits:
0 [+hci.ScanEnableBits.$size_in_bits] hci.ScanEnableBits scan_enable


struct ReadLocalVersionInfoCommandCompleteEvent:
-- 7.7.14 Command Complete event (7.4.1 Read Local Version Information command)
let hdr_size = hci.CommandCompleteEvent.$size_in_bytes
Expand Down Expand Up @@ -1024,6 +1033,18 @@ struct ReadRssiCommandCompleteEvent:
-- LE (Range: -127 to 20, 127, Units: dBm)


struct ReadEncryptionKeySizeCommandCompleteEvent:
-- 7.7.14 Command Complete event (7.5.7 Read Encryption Key Size command)
let hdr_size = hci.CommandCompleteEvent.$size_in_bytes
0 [+hdr_size] hci.CommandCompleteEvent command_complete
$next [+1] hci.StatusCode status
$next [+2] UInt connection_handle
[requires: 0x0000 <= this <= 0x0EFF]

$next [+1] UInt key_size
-- Encryption key size


struct LEReadBufferSizeV1CommandCompleteEvent:
-- 7.7.14 Command Complete event (7.8.2 LE Read Buffer Size [v1] command)
let hdr_size = hci.CommandCompleteEvent.$size_in_bytes
Expand Down

0 comments on commit 7ee36ee

Please sign in to comment.