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