xref: /aosp_15_r20/external/cronet/components/metrics/motherboard.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_METRICS_MOTHERBOARD_H_
6 #define COMPONENTS_METRICS_MOTHERBOARD_H_
7 
8 #include <optional>
9 #include <string>
10 
11 namespace metrics {
12 
13 class Motherboard final {
14  public:
15   enum class BiosType { kLegacy, kUefi };
16   Motherboard();
17   Motherboard(Motherboard&&);
18   Motherboard(const Motherboard&) = delete;
19   ~Motherboard();
20 
21   // The fields below provide details about Motherboard and BIOS on the system.
22   //
23   // A `nullopt_t` means that the property does not exist/could not be read.
24   // A valid value could be an UTF-8 string with characters or an empty string.
25   //
26   // This `std::optional` can be mapped directly to the optional proto message
27   // field, where the message field is added only if there is a valid value.
manufacturer()28   const std::optional<std::string>& manufacturer() const {
29     return manufacturer_;
30   }
model()31   const std::optional<std::string>& model() const { return model_; }
bios_manufacturer()32   const std::optional<std::string>& bios_manufacturer() const {
33     return bios_manufacturer_;
34   }
bios_version()35   const std::optional<std::string>& bios_version() const {
36     return bios_version_;
37   }
bios_type()38   std::optional<BiosType> bios_type() const { return bios_type_; }
39 
40  private:
41   std::optional<std::string> manufacturer_;
42   std::optional<std::string> model_;
43   std::optional<std::string> bios_manufacturer_;
44   std::optional<std::string> bios_version_;
45   std::optional<BiosType> bios_type_;
46 };
47 
48 }  // namespace metrics
49 
50 #endif  // COMPONENTS_METRICS_MOTHERBOARD_H_
51