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