Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7a2cb56 authored by Dennis Cheng's avatar Dennis Cheng Committed by Arman Uguray
Browse files

test_vendor_lib: Clean up controller documentation and address style

issues

This upload cleans up the command documentation in the controller's
header file and also fixes a few logical errors related to command
status event packets. Some style fixes are also included, such as
removing braces for single line conditionals to conform to remain
consistent with the rest of the project.

Bug: 21586676
Change-Id: Ife5e608e43c3030e76eff8ea79ce6cad0b2c10a3
parent 2c3d7eb9
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ class CommandPacket : public Packet {
  // See the Bluetooth Core Specification Version 4.2, Volume 2, Part E,
  // Section 7 for more information about each HCI commands and for a listing
  // of their specific opcodes/OGF and OCF values.
  std::uint16_t GetOpcode() const;
  uint16_t GetOpcode() const;

  // Returns the 6 bit opcode group field that specifies the general category of
  // the command. The OGF can be one of seven values:
@@ -62,11 +62,11 @@ class CommandPacket : public Packet {
  // - 0x06: Testing commands
  // - 0x08: Low energy controller commands
  // The upper 2 bits will be zero filled.
  std::uint8_t GetOGF() const;
  uint8_t GetOGF() const;

  // Returns the 10 bit opcode command field that specifies an exact command
  // within an opcode group field. The upper 6 bits will be zero filled.
  std::uint16_t GetOCF() const;
  uint16_t GetOCF() const;

  // Size in octets of a command packet header, which consists of a 2 octet
  // opcode and a 1 octet payload size.
+121 −236

File changed.

Preview size limit exceeded, changes collapsed.

+18 −19
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class EventPacket : public Packet {
 public:
  virtual ~EventPacket() override = default;

  std::uint8_t GetEventCode() const;
  uint8_t GetEventCode() const;

  // Static functions for creating event packets:

@@ -63,8 +63,8 @@ class EventPacket : public Packet {
  //     Contains any event specific parameters that should
  //     be sent to the host.
  static std::unique_ptr<EventPacket> CreateCommandCompleteEvent(
      std::uint8_t num_hci_command_packets, std::uint16_t command_opcode,
      const std::vector<std::uint8_t>& event_return_parameters);
      uint8_t num_hci_command_packets, uint16_t command_opcode,
      const std::vector<uint8_t>& event_return_parameters);

  // Creates and returns a command complete event packet. See the Bluetooth
  // Core Specification Version 4.2, Volume 2, Part E, Section 7.7.15 (page 862)
@@ -82,7 +82,7 @@ class EventPacket : public Packet {
  //   |command_opcode|
  //     The opcode of the command that caused this event.
  static std::unique_ptr<EventPacket> CreateCommandStatusEvent(
      std::uint8_t num_hci_command_packets, std::uint16_t command_opcode);
      uint8_t status, uint8_t num_hci_command_packets, uint16_t command_opcode);

  // Creates and returns an inquiry result event packet. See the Bluetooth
  // Core Specification Version 4.2, Volume 2, Part E, Section 7.7.2 (page 844)
@@ -107,12 +107,12 @@ class EventPacket : public Packet {
  //     Bits 14-0: Bits 16-2 of CLKNslave-CLK.
  //     Bits 15: Reserved.
  static std::unique_ptr<EventPacket> CreateInquiryResultEvent(
      std::uint8_t num_responses, const std::vector<std::uint8_t>& bd_addresses,
      const std::vector<std::uint8_t>& page_scan_repetition_mode,
      const std::vector<std::uint8_t>& page_scan_period_mode,
      const std::vector<std::uint8_t>& page_scan_mode,
      const std::vector<std::uint8_t>& class_of_device,
      const std::vector<std::uint8_t>& clock_offset);
      uint8_t num_responses, const std::vector<uint8_t>& bd_addresses,
      const std::vector<uint8_t>& page_scan_repetition_mode,
      const std::vector<uint8_t>& page_scan_period_mode,
      const std::vector<uint8_t>& page_scan_mode,
      const std::vector<uint8_t>& class_of_device,
      const std::vector<uint8_t>& clock_offset);

  // Creates and returns an inquiry result event packet. See the Bluetooth
  // Core Specification Version 4.2, Volume 2, Part E, Section 7.7.38 (page 896)
@@ -140,13 +140,13 @@ class EventPacket : public Packet {
  //    Defined in Volumne 2, Part C, Section 8. Also see the Supplement to the
  //    Bluetooth Core Specificiation for data type definitions and formats.
  static std::unique_ptr<EventPacket> CreateExtendedInquiryResultEvent(
      const std::vector<std::uint8_t>& bd_address,
      const std::vector<std::uint8_t>& page_scan_repetition_mode,
      const std::vector<std::uint8_t>& page_scan_period_mode,
      const std::vector<std::uint8_t>& class_of_device,
      const std::vector<std::uint8_t>& clock_offset,
      const std::vector<std::uint8_t>& rssi,
      const std::vector<std::uint8_t>& extended_inquiry_response);
      const std::vector<uint8_t>& bd_address,
      const std::vector<uint8_t>& page_scan_repetition_mode,
      const std::vector<uint8_t>& page_scan_period_mode,
      const std::vector<uint8_t>& class_of_device,
      const std::vector<uint8_t>& clock_offset,
      const std::vector<uint8_t>& rssi,
      const std::vector<uint8_t>& extended_inquiry_response);

  // Size in octets of a data packet header, which consists of a 1 octet
  // event code and a 1 octet payload size.
@@ -155,8 +155,7 @@ class EventPacket : public Packet {
 private:
  // Takes in the event parameters in |payload|. These parameters vary by event
  // and are detailed in the Bluetooth Core Specification.
  EventPacket(std::uint8_t event_code,
              const std::vector<std::uint8_t>& payload);
  EventPacket(uint8_t event_code, const std::vector<uint8_t>& payload);
};

}  // namespace test_vendor_lib
+8 −8

File changed.

Preview size limit exceeded, changes collapsed.

+3 −3

File changed.

Preview size limit exceeded, changes collapsed.

Loading