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

Commit b3ea5bc4 authored by Qasim Javed's avatar Qasim Javed Committed by Gerrit Code Review
Browse files

Merge changes I7fe4a9ee,I65e5688c,I0f04b289

* changes:
  rusty-gd: Update new constructor and add parse constructor.
  rusty-gd: Generate constructor for structs
  rusty-gd: Generate struct declarations and enums
parents b03a1aa5 69d56395
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -485,6 +485,12 @@ rust_library {
    srcs: ["rust/packets/lib.rs", ":BluetoothGeneratedPackets_rust"],
    edition: "2018",
    host_supported: true,
    proc_macros: ["libnum_derive"],
    rustlibs: [
        "libbytes",
        "libnum_traits",
        "libthiserror",
    ],
}

// Generates binary schema data to be bundled and source file generated
+1 −1
Original line number Diff line number Diff line
@@ -1107,7 +1107,7 @@ TEST_F(AclManagerWithConnectionTest, send_read_transmit_power_level) {
  auto packet = test_hci_layer_->GetCommandPacket(OpCode::READ_TRANSMIT_POWER_LEVEL);
  auto command_view = ReadTransmitPowerLevelView::Create(packet);
  ASSERT_TRUE(command_view.IsValid());
  ASSERT_EQ(command_view.GetType(), TransmitPowerLevelType::CURRENT);
  ASSERT_EQ(command_view.GetTransmitPowerLevelType(), TransmitPowerLevelType::CURRENT);

  EXPECT_CALL(mock_connection_management_callbacks_, OnReadTransmitPowerLevelComplete(0x07));
  uint8_t num_packets = 1;
+1 −1
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ class AclManagerFacadeService : public AclManagerFacade::Service, public Connect
      case OpCode::READ_TRANSMIT_POWER_LEVEL: {
        auto view = ReadTransmitPowerLevelView::Create(command_view);
        GET_CONNECTION(view);
        connection->second.connection_->ReadTransmitPowerLevel(view.GetType());
        connection->second.connection_->ReadTransmitPowerLevel(view.GetTransmitPowerLevelType());
        return ::grpc::Status::OK;
      }
      case OpCode::READ_LINK_SUPERVISION_TIMEOUT: {
+3 −3
Original line number Diff line number Diff line
@@ -1753,7 +1753,7 @@ enum TransmitPowerLevelType : 8 {
packet ReadTransmitPowerLevel : ConnectionManagementCommand (op_code = READ_TRANSMIT_POWER_LEVEL) {
  connection_handle : 12,
  _reserved_ : 4,
  type : TransmitPowerLevelType,
  transmit_power_level_type : TransmitPowerLevelType,

}

@@ -2487,7 +2487,7 @@ enum OwnAddressType : 8 {
packet LeSetAdvertisingParameters : LeAdvertisingCommand (op_code = LE_SET_ADVERTISING_PARAMETERS) {
  interval_min : 16,
  interval_max : 16,
  type : AdvertisingType,
  advt_type : AdvertisingType,
  own_address_type : OwnAddressType,
  peer_address_type : PeerAddressType,
  peer_address : Address,
@@ -3751,7 +3751,7 @@ packet LeMultiAdvtComplete : CommandComplete (command_op_code = LE_MULTI_ADVT) {
packet LeMultiAdvtParam : LeMultiAdvt (sub_cmd = SET_PARAM) {
  interval_min : 16,
  interval_max : 16,
  type : AdvertisingType,
  advt_type : AdvertisingType,
  own_address_type : OwnAddressType,
  peer_address_type : PeerAddressType,
  peer_address : Address,
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ void EnumGen::GenLogging(std::ostream& stream) {
}

void EnumGen::GenRustDef(std::ostream& stream) {
  stream << "#[derive(FromPrimitive, ToPrimitive)]\n";
  stream << "pub enum " << e_.name_ << " {";
  for (const auto& pair : e_.constants_) {
    stream << util::ConstantCaseToCamelCase(pair.second) << " = 0x" << std::hex << pair.first << std::dec << ",";
Loading