Adding support for vendor, product and serial number.
authorsl
Tue, 08 Jul 2014 21:49:30 +0200
changeset 1054671755add3
parent 9 7c363a7a975e
child 11 de55741d90f0
Adding support for vendor, product and serial number.
Strating to add support for requests.
Display.cs
MainForm.cs
     1.1 --- a/Display.cs	Tue Jul 08 20:02:12 2014 +0200
     1.2 +++ b/Display.cs	Tue Jul 08 21:49:30 2014 +0200
     1.3 @@ -85,11 +85,38 @@
     1.4              MiniDisplaySetPixel(iDevice,aX,aY,aValue);
     1.5          }
     1.6  
     1.7 +        public string Vendor()
     1.8 +        {
     1.9 +            IntPtr ptr = MiniDisplayVendor(iDevice);
    1.10 +            string str = Marshal.PtrToStringUni(ptr);
    1.11 +            return str;
    1.12 +        }
    1.13  
    1.14 +        public string Product()
    1.15 +        {
    1.16 +            IntPtr ptr = MiniDisplayProduct(iDevice);
    1.17 +            string str = Marshal.PtrToStringUni(ptr);
    1.18 +            return str;
    1.19 +        }
    1.20 +
    1.21 +        public string SerialNumber()
    1.22 +        {
    1.23 +            IntPtr ptr = MiniDisplaySerialNumber(iDevice);
    1.24 +            string str = Marshal.PtrToStringUni(ptr);
    1.25 +            return str;
    1.26 +        }
    1.27  
    1.28          //Our display device handle
    1.29          IntPtr iDevice;
    1.30  
    1.31 +        public enum TMiniDisplayRequest
    1.32 +        {
    1.33 +            EMiniDisplayRequestNone,
    1.34 +            EMiniDisplayRequestDeviceId,
    1.35 +            EMiniDisplayRequestFirmwareRevision,
    1.36 +            EMiniDisplayRequestPowerSupplyStatus
    1.37 +        }
    1.38 +
    1.39          [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.40          public static extern IntPtr MiniDisplayOpen();
    1.41  
    1.42 @@ -123,6 +150,46 @@
    1.43          [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.44          public static extern int MiniDisplaySetPixel(IntPtr aDevice, int aX, int aY, int aValue);
    1.45  
    1.46 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.47 +        public static extern IntPtr MiniDisplayVendor(IntPtr aDevice);
    1.48 +
    1.49 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.50 +        public static extern IntPtr MiniDisplayProduct(IntPtr aDevice);
    1.51 +
    1.52 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.53 +        public static extern IntPtr MiniDisplaySerialNumber(IntPtr aDevice);
    1.54 +
    1.55 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.56 +        public static extern IntPtr MiniDisplayDeviceId(IntPtr aDevice);
    1.57 +
    1.58 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.59 +        public static extern IntPtr MiniDisplayFirmwareRevision(IntPtr aDevice);
    1.60 +
    1.61 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.62 +        public static extern bool MiniDisplayPowerSupplyStatus(IntPtr aDevice);
    1.63 +
    1.64 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.65 +        public static extern void MiniDisplayRequestDeviceId(IntPtr aDevice);
    1.66 +
    1.67 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.68 +        public static extern void MiniDisplayRequestFirmwareRevision(IntPtr aDevice);
    1.69 +
    1.70 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.71 +        public static extern void MiniDisplayRequestPowerSupplyStatus(IntPtr aDevice);
    1.72 +
    1.73 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.74 +        public static extern TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(IntPtr aDevice);
    1.75 +
    1.76 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.77 +        public static extern TMiniDisplayRequest MiniDisplayCurrentRequest(IntPtr aDevice);
    1.78 +
    1.79 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.80 +        public static extern void MiniDisplayCancelRequest(IntPtr aDevice);
    1.81 +
    1.82 +
    1.83 +        
    1.84 +        
    1.85 +
    1.86  
    1.87      }
    1.88  }
     2.1 --- a/MainForm.cs	Tue Jul 08 20:02:12 2014 +0200
     2.2 +++ b/MainForm.cs	Tue Jul 08 21:49:30 2014 +0200
     2.3 @@ -162,7 +162,8 @@
     2.4                  trackBarBrightness.SmallChange = 1;
     2.5                  iDisplay.SetBrightness(Properties.Settings.Default.DisplayBrightness);
     2.6  
     2.7 -                toolStripStatusLabelConnect.Text = "Connected";
     2.8 +                toolStripStatusLabelConnect.Text = "Connected - " + iDisplay.Vendor() + " - " + iDisplay.Product();
     2.9 +                //+ " - " + iDisplay.SerialNumber();
    2.10              }
    2.11              else
    2.12              {