Trying to sort out our interop nicely.
2 using System.Collections.Generic;
4 using System.Runtime.InteropServices;
6 namespace MiniDisplayInterop
8 public class MiniDisplay
14 AutoDetect, /*Not yet implemented*/
15 //[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")]
17 //[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")]
34 /// Define the various type of icons we support.
35 /// For binary compatibility new entries must be added at the end.
50 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayOpen", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
51 public static extern IntPtr Open(Type aType);
53 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayClose", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
54 public static extern void Close(IntPtr aDevice);
56 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayTypeCount", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
57 public static extern int TypeCount();
59 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayTypeName", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
60 public static extern IntPtr TypeName(Type aType);
62 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayClear", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
63 public static extern void Clear(IntPtr aDevice);
65 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayFill", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
66 public static extern void Fill(IntPtr aDevice);
68 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySwapBuffers", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
69 public static extern void SwapBuffers(IntPtr aDevice);
71 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySetBrightness", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
72 public static extern void SetBrightness(IntPtr aDevice, int aBrightness);
74 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayMinBrightness", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
75 public static extern int MinBrightness(IntPtr aDevice);
77 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayMaxBrightness", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
78 public static extern int MaxBrightness(IntPtr aDevice);
80 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayWidthInPixels", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
81 public static extern int WidthInPixels(IntPtr aDevice);
83 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayHeightInPixels", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
84 public static extern int HeightInPixels(IntPtr aDevice);
86 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySetPixel", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
87 public static extern int SetPixel(IntPtr aDevice, int aX, int aY, uint aValue);
89 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayVendor", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
90 public static extern IntPtr Vendor(IntPtr aDevice);
92 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayProduct", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
93 public static extern IntPtr Product(IntPtr aDevice);
95 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySerialNumber", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
96 public static extern IntPtr SerialNumber(IntPtr aDevice);
98 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayDeviceId", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
99 public static extern IntPtr DeviceId(IntPtr aDevice);
101 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayFirmwareRevision", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
102 public static extern IntPtr FirmwareRevision(IntPtr aDevice);
104 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayPowerSupplyStatus", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
105 [return: MarshalAs(UnmanagedType.I1)]
106 public static extern bool PowerSupplyStatus(IntPtr aDevice);
108 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayRequest", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
109 public static extern void SendRequest(IntPtr aDevice, Request aRequest);
111 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayAttemptRequestCompletion", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
112 public static extern Request AttemptRequestCompletion(IntPtr aDevice);
114 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayCurrentRequest", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
115 public static extern Request CurrentRequest(IntPtr aDevice);
117 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayCancelRequest", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
118 public static extern void CancelRequest(IntPtr aDevice);
120 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayClose", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
121 public static extern void PowerOn(IntPtr aDevice);
123 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayPowerOff", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
124 public static extern void PowerOff(IntPtr aDevice);
126 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySupportPowerOnOff", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
127 [return: MarshalAs(UnmanagedType.I1)]
128 public static extern bool SupportPowerOnOff(IntPtr aDevice);
130 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayShowClock", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
131 public static extern void ShowClock(IntPtr aDevice);
133 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayHideClock", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
134 public static extern void HideClock(IntPtr aDevice);
136 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySupportClock", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
137 [return: MarshalAs(UnmanagedType.I1)]
138 public static extern bool SupportClock(IntPtr aDevice);
140 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayIconCount", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
141 public static extern int IconCount(IntPtr aDevice, IconType aIcon);
143 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayIconStatusCount", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
144 public static extern int IconStatusCount(IntPtr aDevice, IconType aIcon);
146 [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySetIconStatus", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
147 public static extern void SetIconStatus(IntPtr aDevice, IconType aIcon, int aIndex, int aStatus);