MiniDisplay.h
author StephaneLenclud
Tue, 10 Feb 2015 15:38:27 +0100
changeset 34 892f755c2612
parent 32 2c844ef1ff4b
child 35 638eb0763e20
permissions -rw-r--r--
MDM166AA: Clock and Clear adjustments.
     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=0,
    41     EMiniDisplayRequestDeviceId,
    42     EMiniDisplayRequestFirmwareRevision,
    43     EMiniDisplayRequestPowerSupplyStatus
    44     }
    45 TMiniDisplayRequest;
    46 
    47 /**
    48 Define the various type of icons we support.
    49 For binary compatibility new entries must be added at the end.
    50 */
    51 typedef enum
    52     {
    53     EMiniDisplayIconNetworkSignal=0,
    54 	EMiniDisplayIconInternet,
    55     EMiniDisplayIconEmail,
    56     EMiniDisplayIconMute,
    57     EMiniDisplayIconVolume,
    58 	EMiniDisplayIconVolumeLabel,
    59 	EMiniDisplayIconPlay,
    60 	EMiniDisplayIconPause,
    61 	EMiniDisplayIconRecording
    62     }
    63 TMiniDisplayIconType;
    64 
    65 /**
    66 Attempt to establish a connection to with a display of the given type.
    67 Supports display auto-detection too.
    68 
    69 @param [IN] The display type we want to connect to.
    70 @return Handle to the device we connected to on success, null otherwise.
    71 */
    72 extern "C" MDAPI MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType);
    73 
    74 /**
    75 Close the connection with the given display device.
    76 
    77 @param [IN] The device to apply this command to.
    78 */
    79 extern "C" MDAPI void MiniDisplayClose(MiniDisplayDevice aDevice);
    80 
    81 /**
    82 Provides the number of display types supported.
    83 That includes the pseudo 'Auto-Detect' display.
    84 @return The number of display type supported.
    85 */
    86 extern "C" MDAPI int MiniDisplayTypeCount();
    87 
    88 /**
    89 Provides the human readable name of the given display type.
    90 
    91 @param [IN] The display type we want to get the name for.
    92 @return The name of the given display type.
    93 */
    94 extern "C" MDAPI wchar_t* MiniDisplayTypeName(TMiniDisplayType aType);
    95 
    96 /**
    97 Clear our MiniDisplay.
    98 @param [IN] The device to apply this command to.
    99 */
   100 extern "C" MDAPI void MiniDisplayClear(MiniDisplayDevice aDevice);
   101 
   102 /**
   103 Fill our MiniDisplay.
   104 @param [IN] The device to apply this command to.
   105 */
   106 extern "C" MDAPI void MiniDisplayFill(MiniDisplayDevice aDevice);
   107 
   108 /**
   109 Swap our MiniDisplay buffers committing our back buffer content to the screen.
   110 @param [IN] The device to apply this command to.
   111 */
   112 extern "C" MDAPI void MiniDisplaySwapBuffers(MiniDisplayDevice aDevice);
   113 
   114 /**
   115 Provide maximum brightness level for the given device.
   116 @param [IN] The device to apply this command to.
   117 @return Maximum brightness level.
   118 */
   119 extern "C" MDAPI int MiniDisplayMaxBrightness(MiniDisplayDevice aDevice);
   120 
   121 /**
   122 Provide minimum brightness level for the given device.
   123 @param [IN] The device to apply this command to.
   124 @return Minimum brightness level.
   125 */
   126 extern "C" MDAPI int MiniDisplayMinBrightness(MiniDisplayDevice aDevice);
   127 
   128 /**
   129 Set device brightness level.
   130 @param [IN] The device to apply this command to.
   131 @param [IN] Brightness level
   132 */
   133 extern "C" MDAPI void MiniDisplaySetBrightness(MiniDisplayDevice aDevice, int aBrightness);
   134 
   135 /**
   136 Provide pixels width of our display.
   137 @param [IN] The device to apply this command to.
   138 @return Width in pixels.
   139 */
   140 extern "C" MDAPI int MiniDisplayWidthInPixels(MiniDisplayDevice aDevice);
   141 
   142 /**
   143 Provide pixels height of our display.
   144 @param [IN] The device to apply this command to.
   145 @return Height in pixels.
   146 */
   147 extern "C" MDAPI int MiniDisplayHeightInPixels(MiniDisplayDevice aDevice);
   148 
   149 /**
   150 Set our given pixel.
   151 @param [IN] The device to apply this command to.
   152 @param [IN] Pixel X coordinate.
   153 @param [IN] Pixel Y coordinate.
   154 @param [IN] Pixel value.
   155 */
   156 extern "C" MDAPI void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, unsigned int aPixel);
   157 
   158 //TODO: Have an API to specify pixel depth
   159 
   160 /**
   161 Provide vendor name.
   162 @param [IN] The device to apply this command to.
   163 @return Vendor name.
   164 */
   165 extern "C" MDAPI wchar_t* MiniDisplayVendor(MiniDisplayDevice aDevice);
   166 
   167 /**
   168 Provide product name.
   169 @param [IN] The device to apply this command to.
   170 @return Product name.
   171 */
   172 extern "C" MDAPI wchar_t* MiniDisplayProduct(MiniDisplayDevice aDevice);
   173 
   174 /**
   175 Provide Serial number.
   176 @param [IN] The device to apply this command to.
   177 @return Serial number name.
   178 */
   179 extern "C" MDAPI wchar_t* MiniDisplaySerialNumber(MiniDisplayDevice aDevice);
   180 
   181 /**
   182 Request device ID.
   183 @param [IN] The device to apply this command to.
   184 */
   185 extern "C" MDAPI void MiniDisplayRequest(MiniDisplayDevice aDevice, TMiniDisplayRequest aRequest);
   186 
   187 /**
   188 Tell whether or not a request is pending.
   189 @param [IN] The device to apply this command to.
   190 @return true if we have a request pending, false otherwise.
   191 */
   192 extern "C" MDAPI bool MiniDisplayRequestPending(MiniDisplayDevice aDevice);
   193 
   194 
   195 /**
   196 Provide the current request if any.
   197 @param [IN] The device to apply this command to.
   198 @return The current request if any.
   199 */
   200 extern "C" MDAPI TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice);
   201 
   202 
   203 /**
   204 Cancel any pending request.
   205 @param [IN] The device to apply this command to.
   206 */
   207 extern "C" MDAPI void MiniDisplayCancelRequest(MiniDisplayDevice aDevice);
   208 
   209 /**
   210 Attempt request completion.
   211 @param [IN] The device to apply this command to.
   212 */
   213 extern "C" MDAPI TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(MiniDisplayDevice aDevice);
   214 
   215 /**
   216 Provide device ID.
   217 @param [IN] The device to apply this command to.
   218 @return Device ID name.
   219 */
   220 extern "C" MDAPI char* MiniDisplayDeviceId(MiniDisplayDevice aDevice);
   221 
   222 /**
   223 Provide firmware revision.
   224 @param [IN] The device to apply this command to.
   225 @return Firmware revision name.
   226 */
   227 extern "C" MDAPI char* MiniDisplayFirmwareRevision(MiniDisplayDevice aDevice);
   228 
   229 /**
   230 Get power supply status.
   231 @param [IN] The device to apply this command to.
   232 */
   233 extern "C" MDAPI bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice);
   234 
   235 /**
   236 Turn device Power ON.
   237 @param [IN] The device to apply this command to.
   238 */
   239 extern "C" MDAPI void MiniDisplayPowerOn(MiniDisplayDevice aDevice);
   240 
   241 /**
   242 Turn device Power OFF.
   243 @param [IN] The device to apply this command to.
   244 */
   245 extern "C" MDAPI void MiniDisplayPowerOff(MiniDisplayDevice aDevice);
   246 
   247 /**
   248 Specifies whether or not this display supports power ON/OFF functions.
   249 @param [IN] The device to apply this command to.
   250 @return True if one can turn display power on and off, false otherwise.
   251 */
   252 extern "C" MDAPI bool MiniDisplaySupportPowerOnOff(MiniDisplayDevice aDevice);
   253 
   254 /**
   255 Show built-in clock.
   256 @param [IN] The device to apply this command to.
   257 */
   258 extern "C" MDAPI void MiniDisplayShowClock(MiniDisplayDevice aDevice);
   259 
   260 /**
   261 Hide built-in clock.
   262 @param [IN] The device to apply this command to.
   263 */
   264 extern "C" MDAPI void MiniDisplayHideClock(MiniDisplayDevice aDevice);
   265 
   266 /**
   267 Specifies whether or not this display supports clock functions.
   268 @param [IN] The device to apply this command to.
   269 @return True if this display supports built-in clock, false otherwise.
   270 */
   271 extern "C" MDAPI bool MiniDisplaySupportClock(MiniDisplayDevice aDevice);
   272 
   273 /**
   274 Tells how many icons of the given are supported by the specified device.
   275 Typically icons on a VFD hardware have several segments that can be light up separately.
   276 @param [IN] The device to apply this command to.
   277 @param [IN] The type of icon we are interested in.
   278 @return The number of icons of this kind this display supports.
   279 */
   280 extern "C" MDAPI int MiniDisplayIconCount(MiniDisplayDevice aDevice, TMiniDisplayIconType aIcon);
   281 
   282 /**
   283 Tells how many status the icon of the specified type supports for the given device.
   284 Status are typically brightness level on VFD hardware.
   285 Most icon will just support 2 status: 0 for Off and 1 for On.
   286 @param [IN] The device to apply this command to.
   287 @param [IN] The type of icon we are interested in.
   288 @return The number of icons of this kind this display supports.
   289 */
   290 extern "C" MDAPI int MiniDisplayIconStatusCount(MiniDisplayDevice aDevice, TMiniDisplayIconType aIcon);
   291 
   292 /**
   293 Set the status of the given icon for the specified device.
   294 @param [IN] The device to apply this command to.
   295 @param [IN] The type of icon we are interested in.
   296 @param [IN] The index of the icon of the given type.
   297 @param [IN] The status the icon is to assume.
   298 */
   299 extern "C" MDAPI void MiniDisplaySetIconStatus(MiniDisplayDevice aDevice, TMiniDisplayIconType aIcon, int aIndex, int aStatus);
   300 
   301 
   302 #endif
   303