# HG changeset patch # User StephaneLenclud # Date 1423068346 -3600 # Node ID 9c233658ab280f30bc0774db48ac81ab7d97e6f9 # Parent ea9ccfdb5563e73e9612e0c5dfe323fd9c93aea2 Adding support for fetching device types count and names. diff -r ea9ccfdb5563 -r 9c233658ab28 MiniDisplay.cpp --- a/MiniDisplay.cpp Sun Sep 21 19:10:08 2014 +0200 +++ b/MiniDisplay.cpp Wed Feb 04 17:45:46 2015 +0100 @@ -4,6 +4,14 @@ #include "FutabaGP1212A02.h" +wchar_t* KDisplayNames[]= + { + L"Auto-Detect", + L"Futaba GP1212A01", + L"Futaba GP1212A02", + L"Unknown display device" + }; + MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType, bool aAutoDetect) { GraphicDisplay* device=NULL; @@ -54,8 +62,6 @@ } - - // void MiniDisplayClose(MiniDisplayDevice aDevice) @@ -64,6 +70,23 @@ } +int MiniDisplayTypeCount() + { + return EMiniDisplayAutoDetectFailed; + } + + +wchar_t* MiniDisplayTypeName(TMiniDisplayType aType) + { + if (aType>=EMiniDisplayAutoDetectFailed) + { + return KDisplayNames[EMiniDisplayAutoDetectFailed]; + } + + return KDisplayNames[aType]; + } + + void MiniDisplayClear(MiniDisplayDevice aDevice) { if (!aDevice) diff -r ea9ccfdb5563 -r 9c233658ab28 MiniDisplay.h --- a/MiniDisplay.h Sun Sep 21 19:10:08 2014 +0200 +++ b/MiniDisplay.h Wed Feb 04 17:45:46 2015 +0100 @@ -27,9 +27,10 @@ typedef enum { - EMiniDisplayAutoDetect=0, /*Not yet implemented*/ + EMiniDisplayAutoDetect=0, EMiniDisplayFutabaGP1212A01, EMiniDisplayFutabaGP1212A02, + //EMiniDisplayFutabaMDM166AA, EMiniDisplayAutoDetectFailed } TMiniDisplayType; @@ -43,11 +44,38 @@ } TMiniDisplayRequest; -//Open & Close functions +/** +Attempt to establish a connection to with a display of the given type. +Supports display auto-detection too. + +@param [IN] The display type we want to connect to. +@return Handle to the device we connected to on success, null otherwise. +*/ extern "C" MDAPI MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType); + +/** +Close the connection with the given display device. + +@param [IN] The device to apply this command to. +*/ extern "C" MDAPI void MiniDisplayClose(MiniDisplayDevice aDevice); /** +Provides the number of display types supported. +That includes the pseudo 'Auto-Detect' display. +@return The number of display type supported. +*/ +extern "C" MDAPI int MiniDisplayTypeCount(); + +/** +Provides the human readable name of the given display type. + +@param [IN] The display type we want to get the name for. +@return The name of the given display type. +*/ +extern "C" MDAPI wchar_t* MiniDisplayTypeName(TMiniDisplayType aType); + +/** Clear our MiniDisplay. @param [IN] The device to apply this command to. */