Class DisplayInfoImpl
java.lang.Object
oshi.hardware.DisplayInfoImpl
- All Implemented Interfaces:
DisplayInfo
The default
DisplayInfo implementation. This is not part of the OSHI public API and may change between minor
releases.
An instance is created either from a raw EDID byte array (fields decoded from the EDID on demand) or from individual
field values, in which case isEdidSynthetic() is true and getEdid() lazily synthesizes an
EDID from the supplied fields. The synthetic serial number must be in a form accepted by
EdidUtil.setSerialNo(byte[], String) (8 hex characters or 4 printable characters).
-
Constructor Summary
ConstructorsConstructorDescriptionDisplayInfoImpl(byte[] edid) Constructs aDisplayInfoImplfrom a raw EDID byte array.DisplayInfoImpl(String manufacturerID, String productID, String serialNo, byte week, int year, String version, boolean digital, int hcm, int vcm, String preferredResolution, String model, String productSerialNumber) Constructs a syntheticDisplayInfoImplfrom individual field values, for displays that report their attributes without providing an EDID. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getEdid()Gets the EDID byte array: the bytes reported by the display, or, whenDisplayInfo.isEdidSynthetic()istrue, an EDID synthesized from the display's reported attributes.intgetHcm()Gets the monitor width in cm.Gets the manufacturer ID.getModel()Gets the monitor model.Gets the preferred resolution.Gets the product ID.Gets the display product serial number, the text of the serial-number descriptor.Gets the serial number, the numeric ID serial number from bytes 12-15 of the EDID.intgetVcm()Gets the monitor height in cm.Gets the EDID version.bytegetWeek()Gets the week of manufacture.intgetYear()Gets the year of manufacture.booleanTests whether the display is digital.booleanIndicates whether the EDID returned byDisplayInfo.getEdid()was synthesized from reported attributes rather than read directly from the display.toString()
-
Constructor Details
-
DisplayInfoImpl
public DisplayInfoImpl(byte[] edid) Constructs aDisplayInfoImplfrom a raw EDID byte array. The fields are parsed from the EDID on demand.- Parameters:
edid- The raw EDID byte array as reported by the display.
-
DisplayInfoImpl
public DisplayInfoImpl(String manufacturerID, String productID, String serialNo, byte week, int year, String version, boolean digital, int hcm, int vcm, String preferredResolution, String model, String productSerialNumber) Constructs a syntheticDisplayInfoImplfrom individual field values, for displays that report their attributes without providing an EDID. The EDID returned bygetEdid()is synthesized on demand from these values, andisEdidSynthetic()returnstrue.- Parameters:
manufacturerID- The three-letter manufacturer ID (seeEdidUtil.getManufacturerID(byte[])).productID- The product ID as a hex string (seeEdidUtil.getProductID(byte[])).serialNo- The serial number, either 8 hex characters or 4 printable characters (seeEdidUtil.getSerialNo(byte[])).week- The week of manufacture.year- The four-digit year of manufacture.version- The EDID version as amajor.minorstring (e.g."1.4").digital- Whether the display is digital.hcm- The monitor width in cm.vcm- The monitor height in cm.preferredResolution- The preferred resolution as aWIDTHxHEIGHTstring (e.g."2560x1440").model- The monitor model.productSerialNumber- The display product serial number (the serial-number descriptor text, distinct fromserialNo);nullor empty if not available.
-
-
Method Details
-
getEdid
public byte[] getEdid()Description copied from interface:DisplayInfoGets the EDID byte array: the bytes reported by the display, or, whenDisplayInfo.isEdidSynthetic()istrue, an EDID synthesized from the display's reported attributes.- Specified by:
getEdidin interfaceDisplayInfo- Returns:
- A copy of the EDID byte array.
-
isEdidSynthetic
public boolean isEdidSynthetic()Description copied from interface:DisplayInfoIndicates whether the EDID returned byDisplayInfo.getEdid()was synthesized from reported attributes rather than read directly from the display.- Specified by:
isEdidSyntheticin interfaceDisplayInfo- Returns:
trueif the EDID is synthetic,falseif it is the display's raw EDID.
-
getManufacturerID
Description copied from interface:DisplayInfoGets the manufacturer ID.- Specified by:
getManufacturerIDin interfaceDisplayInfo- Returns:
- The manufacturer ID.
-
getProductID
Description copied from interface:DisplayInfoGets the product ID.- Specified by:
getProductIDin interfaceDisplayInfo- Returns:
- The product ID.
-
getSerialNo
Description copied from interface:DisplayInfoGets the serial number, the numeric ID serial number from bytes 12-15 of the EDID. This is distinct fromDisplayInfo.getProductSerialNumber().- Specified by:
getSerialNoin interfaceDisplayInfo- Returns:
- The serial number.
-
getWeek
public byte getWeek()Description copied from interface:DisplayInfoGets the week of manufacture.- Specified by:
getWeekin interfaceDisplayInfo- Returns:
- The week of manufacture.
-
getYear
public int getYear()Description copied from interface:DisplayInfoGets the year of manufacture.- Specified by:
getYearin interfaceDisplayInfo- Returns:
- The year of manufacture.
-
getVersion
Description copied from interface:DisplayInfoGets the EDID version.- Specified by:
getVersionin interfaceDisplayInfo- Returns:
- The EDID version.
-
isDigital
public boolean isDigital()Description copied from interface:DisplayInfoTests whether the display is digital.- Specified by:
isDigitalin interfaceDisplayInfo- Returns:
trueif the display is digital,falseotherwise.
-
getHcm
public int getHcm()Description copied from interface:DisplayInfoGets the monitor width in cm.- Specified by:
getHcmin interfaceDisplayInfo- Returns:
- The monitor width in cm.
-
getVcm
public int getVcm()Description copied from interface:DisplayInfoGets the monitor height in cm.- Specified by:
getVcmin interfaceDisplayInfo- Returns:
- The monitor height in cm.
-
getPreferredResolution
Description copied from interface:DisplayInfoGets the preferred resolution.- Specified by:
getPreferredResolutionin interfaceDisplayInfo- Returns:
- The preferred resolution (e.g.
"2560x1440").
-
getModel
Description copied from interface:DisplayInfoGets the monitor model.- Specified by:
getModelin interfaceDisplayInfo- Returns:
- The monitor model.
-
getProductSerialNumber
Description copied from interface:DisplayInfoGets the display product serial number, the text of the serial-number descriptor. This is distinct fromDisplayInfo.getSerialNo(), which returns the numeric ID serial number.- Specified by:
getProductSerialNumberin interfaceDisplayInfo- Returns:
- The display product serial number, or an empty string if not available.
-
toString
-