File indexing completed on 2024-05-19 16:34:57

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "kwin_export.h"
0013 
0014 #include <QByteArray>
0015 #include <QSize>
0016 
0017 namespace KWin
0018 {
0019 
0020 /**
0021  * Helper class that can be used for parsing EDID blobs.
0022  *
0023  * http://read.pudn.com/downloads110/ebook/456020/E-EDID%20Standard.pdf
0024  */
0025 class KWIN_EXPORT Edid
0026 {
0027 public:
0028     Edid();
0029     Edid(const void *data, uint32_t size);
0030 
0031     /**
0032      * Whether this instance of EDID is valid.
0033      */
0034     bool isValid() const;
0035 
0036     /**
0037      * Returns physical dimensions of the monitor, in millimeters.
0038      */
0039     QSize physicalSize() const;
0040 
0041     /**
0042      * Returns EISA ID of the manufacturer of the monitor.
0043      */
0044     QByteArray eisaId() const;
0045 
0046     /**
0047      * Returns the product name of the monitor.
0048      */
0049     QByteArray monitorName() const;
0050 
0051     /**
0052      * Returns the serial number of the monitor.
0053      */
0054     QByteArray serialNumber() const;
0055 
0056     /**
0057      * Returns the name of the vendor.
0058      */
0059     QByteArray vendor() const;
0060 
0061     /**
0062      * Returns the raw edid
0063      */
0064     QByteArray raw() const;
0065 
0066     /**
0067      * returns the vendor if included, the EISA ID if not
0068      */
0069     QString manufacturerString() const;
0070 
0071     /**
0072      * returns a string representing the monitor name
0073      * Can be a serial number or "unknown" if the name is empty
0074      */
0075     QString nameString() const;
0076 
0077 private:
0078     QSize m_physicalSize;
0079     QByteArray m_vendor;
0080     QByteArray m_eisaId;
0081     QByteArray m_monitorName;
0082     QByteArray m_serialNumber;
0083 
0084     QByteArray m_raw;
0085     bool m_isValid = false;
0086 };
0087 
0088 } // namespace KWin