# HG changeset patch # User sl # Date 1404848970 -7200 # Node ID 54671755add3f314467f92ff164f1c0e8f213355 # Parent 7c363a7a975edea7cc21ef5510b8921e4f7eba0d Adding support for vendor, product and serial number. Strating to add support for requests. diff -r 7c363a7a975e -r 54671755add3 Display.cs --- a/Display.cs Tue Jul 08 20:02:12 2014 +0200 +++ b/Display.cs Tue Jul 08 21:49:30 2014 +0200 @@ -85,11 +85,38 @@ MiniDisplaySetPixel(iDevice,aX,aY,aValue); } + public string Vendor() + { + IntPtr ptr = MiniDisplayVendor(iDevice); + string str = Marshal.PtrToStringUni(ptr); + return str; + } + public string Product() + { + IntPtr ptr = MiniDisplayProduct(iDevice); + string str = Marshal.PtrToStringUni(ptr); + return str; + } + + public string SerialNumber() + { + IntPtr ptr = MiniDisplaySerialNumber(iDevice); + string str = Marshal.PtrToStringUni(ptr); + return str; + } //Our display device handle IntPtr iDevice; + public enum TMiniDisplayRequest + { + EMiniDisplayRequestNone, + EMiniDisplayRequestDeviceId, + EMiniDisplayRequestFirmwareRevision, + EMiniDisplayRequestPowerSupplyStatus + } + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr MiniDisplayOpen(); @@ -123,6 +150,46 @@ [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] public static extern int MiniDisplaySetPixel(IntPtr aDevice, int aX, int aY, int aValue); + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr MiniDisplayVendor(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr MiniDisplayProduct(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr MiniDisplaySerialNumber(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr MiniDisplayDeviceId(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr MiniDisplayFirmwareRevision(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern bool MiniDisplayPowerSupplyStatus(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern void MiniDisplayRequestDeviceId(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern void MiniDisplayRequestFirmwareRevision(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern void MiniDisplayRequestPowerSupplyStatus(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern TMiniDisplayRequest MiniDisplayCurrentRequest(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern void MiniDisplayCancelRequest(IntPtr aDevice); + + + + + } } diff -r 7c363a7a975e -r 54671755add3 MainForm.cs --- a/MainForm.cs Tue Jul 08 20:02:12 2014 +0200 +++ b/MainForm.cs Tue Jul 08 21:49:30 2014 +0200 @@ -162,7 +162,8 @@ trackBarBrightness.SmallChange = 1; iDisplay.SetBrightness(Properties.Settings.Default.DisplayBrightness); - toolStripStatusLabelConnect.Text = "Connected"; + toolStripStatusLabelConnect.Text = "Connected - " + iDisplay.Vendor() + " - " + iDisplay.Product(); + //+ " - " + iDisplay.SerialNumber(); } else {