diff options
Diffstat (limited to 'libs/ui/include/ui/DeviceProductInfo.h')
-rw-r--r-- | libs/ui/include/ui/DeviceProductInfo.h | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/libs/ui/include/ui/DeviceProductInfo.h b/libs/ui/include/ui/DeviceProductInfo.h index 807a5d96a3..af00342c0c 100644 --- a/libs/ui/include/ui/DeviceProductInfo.h +++ b/libs/ui/include/ui/DeviceProductInfo.h @@ -19,12 +19,7 @@ #include <array> #include <cstdint> #include <optional> -#include <string> -#include <type_traits> #include <variant> -#include <vector> - -#include <utils/Flattenable.h> namespace android { @@ -34,7 +29,13 @@ using PnpId = std::array<char, 4>; // Product-specific information about the display or the directly connected device on the // display chain. For example, if the display is transitively connected, this field may contain // product information about the intermediate device. -struct DeviceProductInfo : LightFlattenable<DeviceProductInfo> { +struct DeviceProductInfo { + static constexpr size_t TEXT_BUFFER_SIZE = 20; + static constexpr size_t RELATIVE_ADDRESS_SIZE = 4; + + using RelativeAddress = std::array<uint8_t, RELATIVE_ADDRESS_SIZE>; + static constexpr RelativeAddress NO_RELATIVE_ADDRESS = {0xff, 0xff, 0xff, 0xff}; + struct ModelYear { uint32_t year; }; @@ -47,29 +48,21 @@ struct DeviceProductInfo : LightFlattenable<DeviceProductInfo> { }; // Display name. - std::string name; + std::array<char, TEXT_BUFFER_SIZE> name; // Manufacturer Plug and Play ID. PnpId manufacturerPnpId; // Manufacturer product ID. - std::string productId; + std::array<char, TEXT_BUFFER_SIZE> productId; using ManufactureOrModelDate = std::variant<ModelYear, ManufactureYear, ManufactureWeekAndYear>; - static_assert(std::is_trivially_copyable_v<ManufactureOrModelDate>); ManufactureOrModelDate manufactureOrModelDate; - // Relative address in the display network. Empty vector indicates that the - // address is unavailable. + // Relative address in the display network. Unavailable address is indicated + // by all elements equal to 255. // For example, for HDMI connected device this will be the physical address. - std::vector<uint8_t> relativeAddress; - - bool isFixedSize() const { return false; } - size_t getFlattenedSize() const; - status_t flatten(void* buffer, size_t size) const; - status_t unflatten(void const* buffer, size_t size); - - void dump(std::string& result) const; + RelativeAddress relativeAddress; }; } // namespace android |