Adding support for fetching device types count and names.
authorStephaneLenclud
Wed, 04 Feb 2015 17:45:46 +0100
changeset 249c233658ab28
parent 22 ea9ccfdb5563
child 25 3fa4007c0b19
Adding support for fetching device types count and names.
MiniDisplay.cpp
MiniDisplay.h
     1.1 --- a/MiniDisplay.cpp	Sun Sep 21 19:10:08 2014 +0200
     1.2 +++ b/MiniDisplay.cpp	Wed Feb 04 17:45:46 2015 +0100
     1.3 @@ -4,6 +4,14 @@
     1.4  #include "FutabaGP1212A02.h"
     1.5  
     1.6  
     1.7 +wchar_t* KDisplayNames[]=
     1.8 +	{
     1.9 +	L"Auto-Detect",
    1.10 +	L"Futaba GP1212A01",
    1.11 +	L"Futaba GP1212A02",
    1.12 +	L"Unknown display device"
    1.13 +	};
    1.14 +
    1.15  MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType, bool aAutoDetect)
    1.16  	{
    1.17  	GraphicDisplay* device=NULL;
    1.18 @@ -54,8 +62,6 @@
    1.19  	}
    1.20  
    1.21  
    1.22 -
    1.23 -
    1.24  //
    1.25  
    1.26  void MiniDisplayClose(MiniDisplayDevice aDevice)
    1.27 @@ -64,6 +70,23 @@
    1.28  	}
    1.29  
    1.30  
    1.31 +int MiniDisplayTypeCount()
    1.32 +	{
    1.33 +	return EMiniDisplayAutoDetectFailed;
    1.34 +	}
    1.35 +
    1.36 +
    1.37 +wchar_t* MiniDisplayTypeName(TMiniDisplayType aType)
    1.38 +	{
    1.39 +		if (aType>=EMiniDisplayAutoDetectFailed)
    1.40 +		{
    1.41 +			return KDisplayNames[EMiniDisplayAutoDetectFailed];
    1.42 +		}
    1.43 +
    1.44 +		return KDisplayNames[aType];
    1.45 +	}
    1.46 +
    1.47 +
    1.48  void MiniDisplayClear(MiniDisplayDevice aDevice)
    1.49  	{
    1.50  	if (!aDevice)
     2.1 --- a/MiniDisplay.h	Sun Sep 21 19:10:08 2014 +0200
     2.2 +++ b/MiniDisplay.h	Wed Feb 04 17:45:46 2015 +0100
     2.3 @@ -27,9 +27,10 @@
     2.4  
     2.5  typedef enum
     2.6      {
     2.7 -	EMiniDisplayAutoDetect=0, /*Not yet implemented*/
     2.8 +	EMiniDisplayAutoDetect=0,
     2.9      EMiniDisplayFutabaGP1212A01,
    2.10      EMiniDisplayFutabaGP1212A02,
    2.11 +	//EMiniDisplayFutabaMDM166AA,
    2.12  	EMiniDisplayAutoDetectFailed
    2.13      }
    2.14  TMiniDisplayType;
    2.15 @@ -43,11 +44,38 @@
    2.16      }
    2.17  TMiniDisplayRequest;
    2.18  
    2.19 -//Open & Close functions
    2.20 +/**
    2.21 +Attempt to establish a connection to with a display of the given type.
    2.22 +Supports display auto-detection too.
    2.23 +
    2.24 +@param [IN] The display type we want to connect to.
    2.25 +@return Handle to the device we connected to on success, null otherwise.
    2.26 +*/
    2.27  extern "C" MDAPI MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType);
    2.28 +
    2.29 +/**
    2.30 +Close the connection with the given display device.
    2.31 +
    2.32 +@param [IN] The device to apply this command to.
    2.33 +*/
    2.34  extern "C" MDAPI void MiniDisplayClose(MiniDisplayDevice aDevice);
    2.35  
    2.36  /**
    2.37 +Provides the number of display types supported.
    2.38 +That includes the pseudo 'Auto-Detect' display.
    2.39 +@return The number of display type supported.
    2.40 +*/
    2.41 +extern "C" MDAPI int MiniDisplayTypeCount();
    2.42 +
    2.43 +/**
    2.44 +Provides the human readable name of the given display type.
    2.45 +
    2.46 +@param [IN] The display type we want to get the name for.
    2.47 +@return The name of the given display type.
    2.48 +*/
    2.49 +extern "C" MDAPI wchar_t* MiniDisplayTypeName(TMiniDisplayType aType);
    2.50 +
    2.51 +/**
    2.52  Clear our MiniDisplay.
    2.53  @param [IN] The device to apply this command to.
    2.54  */