StephaneLenclud@36: using System; StephaneLenclud@36: using System.Collections.Generic; StephaneLenclud@36: using System.Text; StephaneLenclud@36: using System.Runtime.InteropServices; StephaneLenclud@36: StephaneLenclud@37: namespace MiniDisplayInterop StephaneLenclud@36: { StephaneLenclud@37: public class MiniDisplay StephaneLenclud@36: { StephaneLenclud@36: StephaneLenclud@36: //[Serializable] StephaneLenclud@37: public enum Type StephaneLenclud@36: { StephaneLenclud@37: AutoDetect, /*Not yet implemented*/ StephaneLenclud@36: //[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")] StephaneLenclud@37: FutabaGP1212A01, StephaneLenclud@36: //[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")] StephaneLenclud@37: FutabaGP1212A02 StephaneLenclud@36: }; StephaneLenclud@36: StephaneLenclud@36: /// StephaneLenclud@36: /// StephaneLenclud@36: /// StephaneLenclud@37: public enum Request StephaneLenclud@36: { StephaneLenclud@37: None, StephaneLenclud@37: DeviceId, StephaneLenclud@37: FirmwareRevision, StephaneLenclud@37: PowerSupplyStatus StephaneLenclud@36: }; StephaneLenclud@36: StephaneLenclud@36: StephaneLenclud@36: /// StephaneLenclud@36: /// Define the various type of icons we support. StephaneLenclud@36: /// For binary compatibility new entries must be added at the end. StephaneLenclud@36: /// StephaneLenclud@37: public enum IconType StephaneLenclud@36: { StephaneLenclud@37: NetworkSignal = 0, StephaneLenclud@37: Internet, StephaneLenclud@37: Email, StephaneLenclud@37: Mute, StephaneLenclud@37: Volume, StephaneLenclud@37: VolumeLabel, StephaneLenclud@37: Play, StephaneLenclud@37: Pause, StephaneLenclud@37: Recording StephaneLenclud@36: }; StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayOpen", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern IntPtr Open(Type aType); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayClose", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void Close(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayTypeCount", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern int TypeCount(); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayTypeName", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern IntPtr TypeName(Type aType); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayClear", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void Clear(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayFill", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void Fill(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySwapBuffers", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void SwapBuffers(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySetBrightness", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void SetBrightness(IntPtr aDevice, int aBrightness); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayMinBrightness", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern int MinBrightness(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayMaxBrightness", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern int MaxBrightness(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayWidthInPixels", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern int WidthInPixels(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayHeightInPixels", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern int HeightInPixels(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySetPixel", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern int SetPixel(IntPtr aDevice, int aX, int aY, uint aValue); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayVendor", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern IntPtr Vendor(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayProduct", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern IntPtr Product(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySerialNumber", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern IntPtr SerialNumber(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayDeviceId", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern IntPtr DeviceId(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayFirmwareRevision", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern IntPtr FirmwareRevision(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayPowerSupplyStatus", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@36: [return: MarshalAs(UnmanagedType.I1)] StephaneLenclud@37: public static extern bool PowerSupplyStatus(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayRequest", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void SendRequest(IntPtr aDevice, Request aRequest); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayAttemptRequestCompletion", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern Request AttemptRequestCompletion(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayCurrentRequest", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern Request CurrentRequest(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayCancelRequest", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void CancelRequest(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayClose", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void PowerOn(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayPowerOff", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void PowerOff(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySupportPowerOnOff", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@36: [return: MarshalAs(UnmanagedType.I1)] StephaneLenclud@37: public static extern bool SupportPowerOnOff(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayShowClock", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void ShowClock(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayHideClock", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void HideClock(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySupportClock", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@36: [return: MarshalAs(UnmanagedType.I1)] StephaneLenclud@37: public static extern bool SupportClock(IntPtr aDevice); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayIconCount", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern int IconCount(IntPtr aDevice, IconType aIcon); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplayIconStatusCount", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern int IconStatusCount(IntPtr aDevice, IconType aIcon); StephaneLenclud@36: StephaneLenclud@37: [DllImport("MiniDisplay.dll", EntryPoint = "MiniDisplaySetIconStatus", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] StephaneLenclud@37: public static extern void SetIconStatus(IntPtr aDevice, IconType aIcon, int aIndex, int aStatus); StephaneLenclud@36: StephaneLenclud@36: StephaneLenclud@36: } StephaneLenclud@36: }