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

Commit 75f52e9a authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "RootCanal: Read supported commands from config file"

parents 470f0240 7e193981
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#   limitations under the License.

import importlib
import os
import traceback

from functools import wraps
@@ -53,6 +54,10 @@ class GdBaseTestClass(BaseTestClass):
            generate_coverage_report_for_host(self.cert_coverage_info)
            self.cert_coverage_info = None

    def set_controller_properties_path(self, path):
        GD_DIR = os.path.join(os.getcwd(), os.pardir)
        self.controller_properties_file = os.path.join(GD_DIR, path)

    def setup_test(self):
        self.log_path_base = get_current_context().get_full_output_path()
        self.verbose_mode = bool(self.user_params.get('verbose_mode', False))
+6 −0
Original line number Diff line number Diff line
{
    "supported_commands" : ["b3", "ff", "ef", "01", "ce", "fd", "81", "ff", "3f", "0f",
                            "40", "1e", "f0", "03", "e8", "02", "03", "d6", "81", "9f",
                            "1c", "00", "00", "00", "40", "f7", "ff", "a7", "0f", "20",
                            "00", "00", "4a", "80", "78", "0e", "00", "00", "00", "00",],
}
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ class LeScanningManagerTest(GdBaseTestClass, LeScanningManagerTestBase):
        GdBaseTestClass.setup_class(self, dut_module='HCI_INTERFACES', cert_module='HCI_INTERFACES')

    def setup_test(self):
        GdBaseTestClass.set_controller_properties_path(self, 'hci/cert/le_legacy_config.json')
        GdBaseTestClass.setup_test(self)
        LeScanningManagerTestBase.setup_test(self, self.cert)

+9 −8
Original line number Diff line number Diff line
@@ -39,12 +39,6 @@ static void ParseUint16t(Json::Value value, uint16_t* field) {
    *field = value.asUInt();
}

static void ParseBool(Json::Value value, bool* field) {
  if (value.isBool()) {
    *field = value.asBool();
  }
}

namespace test_vendor_lib {

DeviceProperties::DeviceProperties(const std::string& file_name)
@@ -107,8 +101,15 @@ DeviceProperties::DeviceProperties(const std::string& file_name)
  ParseUint8t(root["LmpPalVersion"], &lmp_pal_version_);
  ParseUint16t(root["ManufacturerName"], &manufacturer_name_);
  ParseUint16t(root["LmpPalSubversion"], &lmp_pal_subversion_);
  ParseBool(root["use_supported_commands_from_file"],
            &use_supported_commands_from_file_);
  Json::Value supported_commands = root["supported_commands"];
  if (supported_commands.size() > 0) {
    use_supported_commands_from_file_ = true;
    for (int i = 0; i < supported_commands.size(); i++) {
      std::string out = supported_commands[i].asString();
      uint8_t number = stoi(out, 0, 16);
      supported_commands_[i] = number;
    }
  }
}

}  // namespace test_vendor_lib