MiniDisplay.h
author StephaneLenclud
Wed, 06 May 2015 21:03:53 +0200
changeset 36 3b94d0640115
parent 33 fc42477ae80b
permissions -rw-r--r--
Adding C# interop project and NuGet package.
     1 //
     2 // Copyright (C) 2014-2015 Stéphane Lenclud.
     3 //
     4 // This file is part of MiniDisplay.
     5 //
     6 // MiniDisplay is free software: you can redistribute it and/or modify
     7 // it under the terms of the GNU General Public License as published by
     8 // the Free Software Foundation, either version 3 of the License, or
     9 // (at your option) any later version.
    10 //
    11 // MiniDisplay is distributed in the hope that it will be useful,
    12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14 // GNU General Public License for more details.
    15 //
    16 // You should have received a copy of the GNU General Public License
    17 // along with MiniDisplay.  If not, see <http://www.gnu.org/licenses/>.
    18 //
    19 
    20 #ifndef MINI_DISPLAY_H
    21 #define MINI_DISPLAY_H
    22 
    23 /* Cmake will define MyLibrary_EXPORTS on Windows when it
    24 configures to build a shared library. If you are going to use
    25 another build system on windows or create the visual studio
    26 projects by hand you need to define MyLibrary_EXPORTS when
    27 building a DLL on windows.
    28 */
    29 // We are using the Visual Studio Compiler and building Shared libraries
    30 
    31 #if defined (_WIN32)
    32   #if defined(MiniDisplay_EXPORTS)
    33     #define  MDAPI __declspec(dllexport)
    34   #else
    35     #define  MDAPI __declspec(dllimport)
    36   #endif /* MyLibrary_EXPORTS */
    37 #else /* defined (_WIN32) */
    38  #define MDAPI
    39 #endif
    40 
    41 typedef void* MiniDisplayDevice;
    42 
    43 typedef enum
    44     {
    45 	EMiniDisplayAutoDetect=0,
    46     EMiniDisplayFutabaGP1212A01,
    47     EMiniDisplayFutabaGP1212A02,
    48 	EMiniDisplayFutabaMDM166AA,
    49 	EMiniDisplayAutoDetectFailed
    50     }
    51 TMiniDisplayType;
    52 
    53 typedef enum
    54     {
    55     EMiniDisplayRequestNone=0,
    56     EMiniDisplayRequestDeviceId,
    57     EMiniDisplayRequestFirmwareRevision,
    58     EMiniDisplayRequestPowerSupplyStatus
    59     }
    60 TMiniDisplayRequest;
    61 
    62 /**
    63 Define the various type of icons we support.
    64 For binary compatibility new entries must be added at the end.
    65 */
    66 typedef enum
    67     {
    68     EMiniDisplayIconNetworkSignal=0,
    69 	EMiniDisplayIconInternet,
    70     EMiniDisplayIconEmail,
    71     EMiniDisplayIconMute,
    72     EMiniDisplayIconVolume,
    73 	EMiniDisplayIconVolumeLabel,
    74 	EMiniDisplayIconPlay,
    75 	EMiniDisplayIconPause,
    76 	EMiniDisplayIconRecording
    77     }
    78 TMiniDisplayIconType;
    79 
    80 /**
    81 Attempt to establish a connection to with a display of the given type.
    82 Supports display auto-detection too.
    83 
    84 @param [IN] The display type we want to connect to.
    85 @return Handle to the device we connected to on success, null otherwise.
    86 */
    87 extern "C" MDAPI MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType);
    88 
    89 /**
    90 Close the connection with the given display device.
    91 
    92 @param [IN] The device to apply this command to.
    93 */
    94 extern "C" MDAPI void MiniDisplayClose(MiniDisplayDevice aDevice);
    95 
    96 /**
    97 Provides the number of display types supported.
    98 That includes the pseudo 'Auto-Detect' display.
    99 @return The number of display type supported.
   100 */
   101 extern "C" MDAPI int MiniDisplayTypeCount();
   102 
   103 /**
   104 Provides the human readable name of the given display type.
   105 
   106 @param [IN] The display type we want to get the name for.
   107 @return The name of the given display type.
   108 */
   109 extern "C" MDAPI wchar_t* MiniDisplayTypeName(TMiniDisplayType aType);
   110 
   111 /**
   112 Clear our MiniDisplay.
   113 @param [IN] The device to apply this command to.
   114 */
   115 extern "C" MDAPI void MiniDisplayClear(MiniDisplayDevice aDevice);
   116 
   117 /**
   118 Fill our MiniDisplay.
   119 @param [IN] The device to apply this command to.
   120 */
   121 extern "C" MDAPI void MiniDisplayFill(MiniDisplayDevice aDevice);
   122 
   123 /**
   124 Swap our MiniDisplay buffers committing our back buffer content to the screen.
   125 @param [IN] The device to apply this command to.
   126 */
   127 extern "C" MDAPI void MiniDisplaySwapBuffers(MiniDisplayDevice aDevice);
   128 
   129 /**
   130 Provide maximum brightness level for the given device.
   131 @param [IN] The device to apply this command to.
   132 @return Maximum brightness level.
   133 */
   134 extern "C" MDAPI int MiniDisplayMaxBrightness(MiniDisplayDevice aDevice);
   135 
   136 /**
   137 Provide minimum brightness level for the given device.
   138 @param [IN] The device to apply this command to.
   139 @return Minimum brightness level.
   140 */
   141 extern "C" MDAPI int MiniDisplayMinBrightness(MiniDisplayDevice aDevice);
   142 
   143 /**
   144 Set device brightness level.
   145 @param [IN] The device to apply this command to.
   146 @param [IN] Brightness level
   147 */
   148 extern "C" MDAPI void MiniDisplaySetBrightness(MiniDisplayDevice aDevice, int aBrightness);
   149 
   150 /**
   151 Provide pixels width of our display.
   152 @param [IN] The device to apply this command to.
   153 @return Width in pixels.
   154 */
   155 extern "C" MDAPI int MiniDisplayWidthInPixels(MiniDisplayDevice aDevice);
   156 
   157 /**
   158 Provide pixels height of our display.
   159 @param [IN] The device to apply this command to.
   160 @return Height in pixels.
   161 */
   162 extern "C" MDAPI int MiniDisplayHeightInPixels(MiniDisplayDevice aDevice);
   163 
   164 /**
   165 Set our given pixel.
   166 @param [IN] The device to apply this command to.
   167 @param [IN] Pixel X coordinate.
   168 @param [IN] Pixel Y coordinate.
   169 @param [IN] Pixel value.
   170 */
   171 extern "C" MDAPI void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, unsigned int aPixel);
   172 
   173 //TODO: Have an API to specify pixel depth
   174 
   175 /**
   176 Provide vendor name.
   177 @param [IN] The device to apply this command to.
   178 @return Vendor name.
   179 */
   180 extern "C" MDAPI wchar_t* MiniDisplayVendor(MiniDisplayDevice aDevice);
   181 
   182 /**
   183 Provide product name.
   184 @param [IN] The device to apply this command to.
   185 @return Product name.
   186 */
   187 extern "C" MDAPI wchar_t* MiniDisplayProduct(MiniDisplayDevice aDevice);
   188 
   189 /**
   190 Provide Serial number.
   191 @param [IN] The device to apply this command to.
   192 @return Serial number name.
   193 */
   194 extern "C" MDAPI wchar_t* MiniDisplaySerialNumber(MiniDisplayDevice aDevice);
   195 
   196 /**
   197 Request device ID.
   198 @param [IN] The device to apply this command to.
   199 */
   200 extern "C" MDAPI void MiniDisplayRequest(MiniDisplayDevice aDevice, TMiniDisplayRequest aRequest);
   201 
   202 /**
   203 Tell whether or not a request is pending.
   204 @param [IN] The device to apply this command to.
   205 @return true if we have a request pending, false otherwise.
   206 */
   207 extern "C" MDAPI bool MiniDisplayRequestPending(MiniDisplayDevice aDevice);
   208 
   209 
   210 /**
   211 Provide the current request if any.
   212 @param [IN] The device to apply this command to.
   213 @return The current request if any.
   214 */
   215 extern "C" MDAPI TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice);
   216 
   217 
   218 /**
   219 Cancel any pending request.
   220 @param [IN] The device to apply this command to.
   221 */
   222 extern "C" MDAPI void MiniDisplayCancelRequest(MiniDisplayDevice aDevice);
   223 
   224 /**
   225 Attempt request completion.
   226 @param [IN] The device to apply this command to.
   227 */
   228 extern "C" MDAPI TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(MiniDisplayDevice aDevice);
   229 
   230 /**
   231 Provide device ID.
   232 @param [IN] The device to apply this command to.
   233 @return Device ID name.
   234 */
   235 extern "C" MDAPI char* MiniDisplayDeviceId(MiniDisplayDevice aDevice);
   236 
   237 /**
   238 Provide firmware revision.
   239 @param [IN] The device to apply this command to.
   240 @return Firmware revision name.
   241 */
   242 extern "C" MDAPI char* MiniDisplayFirmwareRevision(MiniDisplayDevice aDevice);
   243 
   244 /**
   245 Get power supply status.
   246 @param [IN] The device to apply this command to.
   247 */
   248 extern "C" MDAPI bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice);
   249 
   250 /**
   251 Turn device Power ON.
   252 @param [IN] The device to apply this command to.
   253 */
   254 extern "C" MDAPI void MiniDisplayPowerOn(MiniDisplayDevice aDevice);
   255 
   256 /**
   257 Turn device Power OFF.
   258 @param [IN] The device to apply this command to.
   259 */
   260 extern "C" MDAPI void MiniDisplayPowerOff(MiniDisplayDevice aDevice);
   261 
   262 /**
   263 Specifies whether or not this display supports power ON/OFF functions.
   264 @param [IN] The device to apply this command to.
   265 @return True if one can turn display power on and off, false otherwise.
   266 */
   267 extern "C" MDAPI bool MiniDisplaySupportPowerOnOff(MiniDisplayDevice aDevice);
   268 
   269 /**
   270 Show built-in clock.
   271 @param [IN] The device to apply this command to.
   272 */
   273 extern "C" MDAPI void MiniDisplayShowClock(MiniDisplayDevice aDevice);
   274 
   275 /**
   276 Hide built-in clock.
   277 @param [IN] The device to apply this command to.
   278 */
   279 extern "C" MDAPI void MiniDisplayHideClock(MiniDisplayDevice aDevice);
   280 
   281 /**
   282 Specifies whether or not this display supports clock functions.
   283 @param [IN] The device to apply this command to.
   284 @return True if this display supports built-in clock, false otherwise.
   285 */
   286 extern "C" MDAPI bool MiniDisplaySupportClock(MiniDisplayDevice aDevice);
   287 
   288 /**
   289 Tells how many icons of the given are supported by the specified device.
   290 Typically icons on a VFD hardware have several segments that can be light up separately.
   291 @param [IN] The device to apply this command to.
   292 @param [IN] The type of icon we are interested in.
   293 @return The number of icons of this kind this display supports.
   294 */
   295 extern "C" MDAPI int MiniDisplayIconCount(MiniDisplayDevice aDevice, TMiniDisplayIconType aIcon);
   296 
   297 /**
   298 Tells how many status the icon of the specified type supports for the given device.
   299 Status are typically brightness level on VFD hardware.
   300 Most icon will just support 2 status: 0 for Off and 1 for On.
   301 @param [IN] The device to apply this command to.
   302 @param [IN] The type of icon we are interested in.
   303 @return The number of icons of this kind this display supports.
   304 */
   305 extern "C" MDAPI int MiniDisplayIconStatusCount(MiniDisplayDevice aDevice, TMiniDisplayIconType aIcon);
   306 
   307 /**
   308 Set the status of the given icon for the specified device.
   309 @param [IN] The device to apply this command to.
   310 @param [IN] The type of icon we are interested in.
   311 @param [IN] The index of the icon of the given type.
   312 @param [IN] The status the icon is to assume.
   313 */
   314 extern "C" MDAPI void MiniDisplaySetIconStatus(MiniDisplayDevice aDevice, TMiniDisplayIconType aIcon, int aIndex, int aStatus);
   315 
   316 
   317 #endif
   318