MiniDisplay.h
author StephaneLenclud
Thu, 05 Feb 2015 14:02:27 +0100
changeset 28 0d426caeaefe
parent 24 9c233658ab28
child 31 0a2b658e0d56
permissions -rw-r--r--
MDM166AA: more accurate time setting and cleanup.
     1 //
     2 //
     3 //
     4 
     5 #ifndef MINI_DISPLAY_H
     6 #define MINI_DISPLAY_H
     7 
     8 /* Cmake will define MyLibrary_EXPORTS on Windows when it
     9 configures to build a shared library. If you are going to use
    10 another build system on windows or create the visual studio
    11 projects by hand you need to define MyLibrary_EXPORTS when
    12 building a DLL on windows.
    13 */
    14 // We are using the Visual Studio Compiler and building Shared libraries
    15 
    16 #if defined (_WIN32)
    17   #if defined(MiniDisplay_EXPORTS)
    18     #define  MDAPI __declspec(dllexport)
    19   #else
    20     #define  MDAPI __declspec(dllimport)
    21   #endif /* MyLibrary_EXPORTS */
    22 #else /* defined (_WIN32) */
    23  #define MDAPI
    24 #endif
    25 
    26 typedef void* MiniDisplayDevice;
    27 
    28 typedef enum
    29     {
    30 	EMiniDisplayAutoDetect=0,
    31     EMiniDisplayFutabaGP1212A01,
    32     EMiniDisplayFutabaGP1212A02,
    33 	EMiniDisplayFutabaMDM166AA,
    34 	EMiniDisplayAutoDetectFailed
    35     }
    36 TMiniDisplayType;
    37 
    38 typedef enum
    39     {
    40     EMiniDisplayRequestNone,
    41     EMiniDisplayRequestDeviceId,
    42     EMiniDisplayRequestFirmwareRevision,
    43     EMiniDisplayRequestPowerSupplyStatus
    44     }
    45 TMiniDisplayRequest;
    46 
    47 /**
    48 Attempt to establish a connection to with a display of the given type.
    49 Supports display auto-detection too.
    50 
    51 @param [IN] The display type we want to connect to.
    52 @return Handle to the device we connected to on success, null otherwise.
    53 */
    54 extern "C" MDAPI MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType);
    55 
    56 /**
    57 Close the connection with the given display device.
    58 
    59 @param [IN] The device to apply this command to.
    60 */
    61 extern "C" MDAPI void MiniDisplayClose(MiniDisplayDevice aDevice);
    62 
    63 /**
    64 Provides the number of display types supported.
    65 That includes the pseudo 'Auto-Detect' display.
    66 @return The number of display type supported.
    67 */
    68 extern "C" MDAPI int MiniDisplayTypeCount();
    69 
    70 /**
    71 Provides the human readable name of the given display type.
    72 
    73 @param [IN] The display type we want to get the name for.
    74 @return The name of the given display type.
    75 */
    76 extern "C" MDAPI wchar_t* MiniDisplayTypeName(TMiniDisplayType aType);
    77 
    78 /**
    79 Clear our MiniDisplay.
    80 @param [IN] The device to apply this command to.
    81 */
    82 extern "C" MDAPI void MiniDisplayClear(MiniDisplayDevice aDevice);
    83 
    84 /**
    85 Fill our MiniDisplay.
    86 @param [IN] The device to apply this command to.
    87 */
    88 extern "C" MDAPI void MiniDisplayFill(MiniDisplayDevice aDevice);
    89 
    90 /**
    91 Swap our MiniDisplay buffers committing our back buffer content to the screen.
    92 @param [IN] The device to apply this command to.
    93 */
    94 extern "C" MDAPI void MiniDisplaySwapBuffers(MiniDisplayDevice aDevice);
    95 
    96 /**
    97 Provide maximum brightness level for the given device.
    98 @param [IN] The device to apply this command to.
    99 @return Maximum brightness level.
   100 */
   101 extern "C" MDAPI int MiniDisplayMaxBrightness(MiniDisplayDevice aDevice);
   102 
   103 /**
   104 Provide minimum brightness level for the given device.
   105 @param [IN] The device to apply this command to.
   106 @return Minimum brightness level.
   107 */
   108 extern "C" MDAPI int MiniDisplayMinBrightness(MiniDisplayDevice aDevice);
   109 
   110 /**
   111 Set device brightness level.
   112 @param [IN] The device to apply this command to.
   113 @param [IN] Brightness level
   114 */
   115 extern "C" MDAPI void MiniDisplaySetBrightness(MiniDisplayDevice aDevice, int aBrightness);
   116 
   117 /**
   118 Provide pixels width of our display.
   119 @param [IN] The device to apply this command to.
   120 @return Width in pixels.
   121 */
   122 extern "C" MDAPI int MiniDisplayWidthInPixels(MiniDisplayDevice aDevice);
   123 
   124 /**
   125 Provide pixels height of our display.
   126 @param [IN] The device to apply this command to.
   127 @return Height in pixels.
   128 */
   129 extern "C" MDAPI int MiniDisplayHeightInPixels(MiniDisplayDevice aDevice);
   130 
   131 /**
   132 Set our given pixel.
   133 @param [IN] The device to apply this command to.
   134 @param [IN] Pixel X coordinate.
   135 @param [IN] Pixel Y coordinate.
   136 @param [IN] Pixel value.
   137 */
   138 extern "C" MDAPI void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, unsigned int aPixel);
   139 
   140 //TODO: Have an API to specify pixel depth
   141 
   142 /**
   143 Provide vendor name.
   144 @param [IN] The device to apply this command to.
   145 @return Vendor name.
   146 */
   147 extern "C" MDAPI wchar_t* MiniDisplayVendor(MiniDisplayDevice aDevice);
   148 
   149 /**
   150 Provide product name.
   151 @param [IN] The device to apply this command to.
   152 @return Product name.
   153 */
   154 extern "C" MDAPI wchar_t* MiniDisplayProduct(MiniDisplayDevice aDevice);
   155 
   156 /**
   157 Provide Serial number.
   158 @param [IN] The device to apply this command to.
   159 @return Serial number name.
   160 */
   161 extern "C" MDAPI wchar_t* MiniDisplaySerialNumber(MiniDisplayDevice aDevice);
   162 
   163 /**
   164 Request device ID.
   165 @param [IN] The device to apply this command to.
   166 */
   167 extern "C" MDAPI void MiniDisplayRequest(MiniDisplayDevice aDevice, TMiniDisplayRequest aRequest);
   168 
   169 /**
   170 Tell whether or not a request is pending.
   171 @param [IN] The device to apply this command to.
   172 @return true if we have a request pending, false otherwise.
   173 */
   174 extern "C" MDAPI bool MiniDisplayRequestPending(MiniDisplayDevice aDevice);
   175 
   176 
   177 /**
   178 Provide the current request if any.
   179 @param [IN] The device to apply this command to.
   180 @return The current request if any.
   181 */
   182 extern "C" MDAPI TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice);
   183 
   184 
   185 /**
   186 Cancel any pending request.
   187 @param [IN] The device to apply this command to.
   188 */
   189 extern "C" MDAPI void MiniDisplayCancelRequest(MiniDisplayDevice aDevice);
   190 
   191 /**
   192 Attempt request completion.
   193 @param [IN] The device to apply this command to.
   194 */
   195 extern "C" MDAPI TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(MiniDisplayDevice aDevice);
   196 
   197 /**
   198 Provide device ID.
   199 @param [IN] The device to apply this command to.
   200 @return Device ID name.
   201 */
   202 extern "C" MDAPI char* MiniDisplayDeviceId(MiniDisplayDevice aDevice);
   203 
   204 /**
   205 Provide firmware revision.
   206 @param [IN] The device to apply this command to.
   207 @return Firmware revision name.
   208 */
   209 extern "C" MDAPI char* MiniDisplayFirmwareRevision(MiniDisplayDevice aDevice);
   210 
   211 /**
   212 Get power supply status.
   213 @param [IN] The device to apply this command to.
   214 */
   215 extern "C" MDAPI bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice);
   216 
   217 /**
   218 Turn device Power ON.
   219 @param [IN] The device to apply this command to.
   220 */
   221 extern "C" MDAPI void MiniDisplayPowerOn(MiniDisplayDevice aDevice);
   222 
   223 /**
   224 Turn device Power OFF.
   225 @param [IN] The device to apply this command to.
   226 */
   227 extern "C" MDAPI void MiniDisplayPowerOff(MiniDisplayDevice aDevice);
   228 
   229 /**
   230 Specifies whether or not this display supports power ON/OFF functions.
   231 @param [IN] The device to apply this command to.
   232 @return True if one can turn display power on and off, false otherwise.
   233 */
   234 extern "C" MDAPI bool MiniDisplaySupportPowerOnOff(MiniDisplayDevice aDevice);
   235 
   236 /**
   237 Show built-in clock.
   238 @param [IN] The device to apply this command to.
   239 */
   240 extern "C" MDAPI void MiniDisplayShowClock(MiniDisplayDevice aDevice);
   241 
   242 /**
   243 Hide built-in clock.
   244 @param [IN] The device to apply this command to.
   245 */
   246 extern "C" MDAPI void MiniDisplayHideClock(MiniDisplayDevice aDevice);
   247 
   248 /**
   249 Specifies whether or not this display supports clock functions.
   250 @param [IN] The device to apply this command to.
   251 @return True if this display supports built-in clock, false otherwise.
   252 */
   253 extern "C" MDAPI bool MiniDisplaySupportClock(MiniDisplayDevice aDevice);
   254 
   255 
   256 #endif
   257