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

Commit c0d1b56a authored by Chris Manton's avatar Chris Manton
Browse files

Add dumpsys parser and printer

Bug: 157647700
Test: atest --host bluetooth_test_gd
Tag: #gd-refactor

Change-Id: If9b4419e6965cf37d28c0d403907456f6139574f
parent ff6cd418
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -204,9 +204,7 @@ cc_binary {
    ],
    generated_headers: [
        "BluetoothFacadeGeneratedStub_h",
        "BluetoothGeneratedBundlerSchema_h_bfbs",
        "BluetoothGeneratedDumpsysDataSchema_h",
        "BluetoothGeneratedDumpsysModuleSchema_h",
        "BluetoothGeneratedPackets_h",
        // Needed here to guarantee that generated zip file is created before
        // bluetooth_cert_tests.zip is packaged
@@ -350,9 +348,7 @@ cc_defaults {
    ],
    host_supported: true,
    generated_headers: [
        "BluetoothGeneratedBundlerSchema_h_bfbs",
        "BluetoothGeneratedDumpsysDataSchema_h",
        "BluetoothGeneratedDumpsysModuleSchema_h",
        "BluetoothGeneratedPackets_h",
    ],
    shared_libs: [
+11 −1
Original line number Diff line number Diff line
@@ -155,7 +155,17 @@ std::string Dumpsys::impl::PrintAsJson(std::string* dumpsys_data) const {
    snprintf(buf, sizeof(buf), "ERROR: Unable to find schema root name:%s\n", root_name->c_str());
    return std::string(buf);
  }
  return std::string("UNIMPLEMENTED\n");

  flatbuffers::Parser parser;
  if (!parser.Deserialize(schema)) {
    char buf[255];
    snprintf(buf, sizeof(buf), "ERROR: Unable to deserialize bundle root name:%s\n", root_name->c_str());
    return std::string(buf);
  }

  std::string jsongen;
  flatbuffers::GenerateText(parser, dumpsys_data->data(), &jsongen);
  return jsongen;
}

void Dumpsys::impl::DumpWithArgs(int fd, const char** args, std::promise<void> promise) {