Interop/MiniDisplay.cs
author StephaneLenclud
Sat, 26 Sep 2015 11:45:26 +0200
changeset 39 c32f4955c166
parent 36 3b94d0640115
permissions -rw-r--r--
More fixes to our NuGet package targets file.
StephaneLenclud@36
     1
using System;
StephaneLenclud@36
     2
using System.Collections.Generic;
StephaneLenclud@36
     3
using System.Text;
StephaneLenclud@36
     4
using System.Runtime.InteropServices;
StephaneLenclud@36
     5
StephaneLenclud@37
     6
namespace MiniDisplayInterop
StephaneLenclud@36
     7
{
StephaneLenclud@37
     8
	public class MiniDisplay
StephaneLenclud@36
     9
    {
StephaneLenclud@36
    10
StephaneLenclud@36
    11
		//[Serializable]
StephaneLenclud@37
    12
		public enum Type
StephaneLenclud@36
    13
		{
StephaneLenclud@37
    14
			AutoDetect, /*Not yet implemented*/
StephaneLenclud@36
    15
			//[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")]
StephaneLenclud@37
    16
			FutabaGP1212A01,
StephaneLenclud@36
    17
			//[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")]
StephaneLenclud@37
    18
			FutabaGP1212A02
StephaneLenclud@36
    19
		};
StephaneLenclud@36
    20
StephaneLenclud@36
    21
		/// <summary>
StephaneLenclud@36
    22
		/// 
StephaneLenclud@36
    23
		/// </summary>
StephaneLenclud@37
    24
		public enum Request
StephaneLenclud@36
    25
		{
StephaneLenclud@37
    26
			None,
StephaneLenclud@37
    27
			DeviceId,
StephaneLenclud@37
    28
			FirmwareRevision,
StephaneLenclud@37
    29
			PowerSupplyStatus
StephaneLenclud@36
    30
		};
StephaneLenclud@36
    31
StephaneLenclud@36
    32
StephaneLenclud@36
    33
		/// <summary>
StephaneLenclud@36
    34
		/// Define the various type of icons we support.
StephaneLenclud@36
    35
		/// For binary compatibility new entries must be added at the end.
StephaneLenclud@36
    36
		/// </summary>
StephaneLenclud@37
    37
		public enum IconType
StephaneLenclud@36
    38
		{
StephaneLenclud@37
    39
			NetworkSignal = 0,
StephaneLenclud@37
    40
			Internet,
StephaneLenclud@37
    41
			Email,
StephaneLenclud@37
    42
			Mute,
StephaneLenclud@37
    43
			Volume,
StephaneLenclud@37
    44
			VolumeLabel,
StephaneLenclud@37
    45
			Play,
StephaneLenclud@37
    46
			Pause,
StephaneLenclud@37
    47
			Recording
StephaneLenclud@36
    48
		};
StephaneLenclud@36
    49
StephaneLenclud@37
    50
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayOpen", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    51
		public static extern IntPtr Open(Type aType);
StephaneLenclud@36
    52
StephaneLenclud@37
    53
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayClose", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    54
		public static extern void Close(IntPtr aDevice);
StephaneLenclud@36
    55
StephaneLenclud@37
    56
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayTypeCount", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    57
		public static extern int TypeCount();
StephaneLenclud@36
    58
StephaneLenclud@37
    59
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayTypeName", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    60
		public static extern IntPtr TypeName(Type aType);
StephaneLenclud@36
    61
StephaneLenclud@37
    62
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayClear", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    63
		public static extern void Clear(IntPtr aDevice);
StephaneLenclud@36
    64
StephaneLenclud@37
    65
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayFill", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    66
		public static extern void Fill(IntPtr aDevice);
StephaneLenclud@36
    67
StephaneLenclud@37
    68
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySwapBuffers", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    69
		public static extern void SwapBuffers(IntPtr aDevice);
StephaneLenclud@36
    70
StephaneLenclud@37
    71
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySetBrightness", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    72
		public static extern void SetBrightness(IntPtr aDevice, int aBrightness);
StephaneLenclud@36
    73
StephaneLenclud@37
    74
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayMinBrightness", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    75
		public static extern int MinBrightness(IntPtr aDevice);
StephaneLenclud@36
    76
StephaneLenclud@37
    77
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayMaxBrightness", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    78
		public static extern int MaxBrightness(IntPtr aDevice);
StephaneLenclud@36
    79
StephaneLenclud@37
    80
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayWidthInPixels", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    81
		public static extern int WidthInPixels(IntPtr aDevice);
StephaneLenclud@36
    82
StephaneLenclud@37
    83
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayHeightInPixels", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    84
		public static extern int HeightInPixels(IntPtr aDevice);
StephaneLenclud@36
    85
StephaneLenclud@37
    86
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySetPixel", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    87
		public static extern int SetPixel(IntPtr aDevice, int aX, int aY, uint aValue);
StephaneLenclud@36
    88
StephaneLenclud@37
    89
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayVendor", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    90
		public static extern IntPtr Vendor(IntPtr aDevice);
StephaneLenclud@36
    91
StephaneLenclud@37
    92
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayProduct", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    93
		public static extern IntPtr Product(IntPtr aDevice);
StephaneLenclud@36
    94
StephaneLenclud@37
    95
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySerialNumber", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    96
		public static extern IntPtr SerialNumber(IntPtr aDevice);
StephaneLenclud@36
    97
StephaneLenclud@37
    98
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayDeviceId", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
    99
		public static extern IntPtr DeviceId(IntPtr aDevice);
StephaneLenclud@36
   100
StephaneLenclud@37
   101
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayFirmwareRevision", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   102
		public static extern IntPtr FirmwareRevision(IntPtr aDevice);
StephaneLenclud@36
   103
StephaneLenclud@37
   104
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayPowerSupplyStatus", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@36
   105
		[return: MarshalAs(UnmanagedType.I1)]
StephaneLenclud@37
   106
		public static extern bool PowerSupplyStatus(IntPtr aDevice);
StephaneLenclud@36
   107
StephaneLenclud@37
   108
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayRequest", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   109
		public static extern void SendRequest(IntPtr aDevice, Request aRequest);
StephaneLenclud@36
   110
StephaneLenclud@37
   111
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayAttemptRequestCompletion", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   112
		public static extern Request AttemptRequestCompletion(IntPtr aDevice);
StephaneLenclud@36
   113
StephaneLenclud@37
   114
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayCurrentRequest", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   115
		public static extern Request CurrentRequest(IntPtr aDevice);
StephaneLenclud@36
   116
StephaneLenclud@37
   117
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayCancelRequest", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   118
		public static extern void CancelRequest(IntPtr aDevice);
StephaneLenclud@36
   119
StephaneLenclud@37
   120
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayClose", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   121
		public static extern void PowerOn(IntPtr aDevice);
StephaneLenclud@36
   122
StephaneLenclud@37
   123
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayPowerOff", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   124
		public static extern void PowerOff(IntPtr aDevice);
StephaneLenclud@36
   125
StephaneLenclud@37
   126
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySupportPowerOnOff", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@36
   127
		[return: MarshalAs(UnmanagedType.I1)]
StephaneLenclud@37
   128
		public static extern bool SupportPowerOnOff(IntPtr aDevice);
StephaneLenclud@36
   129
StephaneLenclud@37
   130
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayShowClock", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   131
		public static extern void ShowClock(IntPtr aDevice);
StephaneLenclud@36
   132
StephaneLenclud@37
   133
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayHideClock", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   134
		public static extern void HideClock(IntPtr aDevice);
StephaneLenclud@36
   135
StephaneLenclud@37
   136
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySupportClock", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@36
   137
		[return: MarshalAs(UnmanagedType.I1)]
StephaneLenclud@37
   138
		public static extern bool SupportClock(IntPtr aDevice);
StephaneLenclud@36
   139
StephaneLenclud@37
   140
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayIconCount", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   141
		public static extern int IconCount(IntPtr aDevice, IconType aIcon);
StephaneLenclud@36
   142
StephaneLenclud@37
   143
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayIconStatusCount", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   144
		public static extern int IconStatusCount(IntPtr aDevice, IconType aIcon);
StephaneLenclud@36
   145
StephaneLenclud@37
   146
		[DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySetIconStatus", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
StephaneLenclud@37
   147
		public static extern void SetIconStatus(IntPtr aDevice, IconType aIcon, int aIndex, int aStatus);
StephaneLenclud@36
   148
StephaneLenclud@36
   149
StephaneLenclud@36
   150
    }
StephaneLenclud@36
   151
}