# HG changeset patch # User StephaneLenclud # Date 1423313490 -3600 # Node ID ff1ed5f07d7e89bea3971e4f6df53b3736c064dd # Parent 7dd1d881c1423d6d86ad079d7fd8f15212f69981 MiniDisplay: Improved icon APIs. diff -r 7dd1d881c142 -r ff1ed5f07d7e Server/Display.cs --- a/Server/Display.cs Thu Feb 05 22:28:27 2015 +0100 +++ b/Server/Display.cs Sat Feb 07 13:51:30 2015 +0100 @@ -203,75 +203,35 @@ } // - public int IconEmailCount() + public int IconCount(TMiniDisplayIconType aIcon) { - return MiniDisplayIconEmailCount(iDevice); + return MiniDisplayIconCount(iDevice,aIcon); } - public void SetIconEmail(int aIndex, int aStatus) + public int IconStatusCount(TMiniDisplayIconType aIcon) { - MiniDisplaySetIconEmail(iDevice, aIndex, aStatus); + return MiniDisplayIconStatusCount(iDevice, aIcon); } - public int IconNetworkCount() + public void SetIconStatus(TMiniDisplayIconType aIcon, int aIndex, int aStatus) { - return MiniDisplayIconNetworkCount(iDevice); + MiniDisplaySetIconStatus(iDevice, aIcon, aIndex, aStatus); } - public void SetIconNetwork(int aIndex, int aStatus) + public void SetAllIconsStatus(int aStatus) { - MiniDisplaySetIconNetwork(iDevice, aIndex, aStatus); + foreach (TMiniDisplayIconType icon in Enum.GetValues(typeof(TMiniDisplayIconType))) + { + int count=IconCount(icon); + for (int i = 0; i < count; i++) + { + SetIconStatus(icon,i,aStatus); + } + } + } - public int IconVolumeCount() - { - return MiniDisplayIconVolumeCount(iDevice); - } - public void SetIconVolume(int aIndex, int aStatus) - { - MiniDisplaySetIconVolume(iDevice, aIndex, aStatus); - } - - public int IconPlayCount() - { - return MiniDisplayIconPlayCount(iDevice); - } - - public void SetIconPlay(int aIndex, int aStatus) - { - MiniDisplaySetIconPlay(iDevice, aIndex, aStatus); - } - - public int IconPauseCount() - { - return MiniDisplayIconPauseCount(iDevice); - } - - public void SetIconPause(int aIndex, int aStatus) - { - MiniDisplaySetIconPause(iDevice, aIndex, aStatus); - } - - public int IconRecordingCount() - { - return MiniDisplayIconRecordingCount(iDevice); - } - - public void SetIconRecording(int aIndex, int aStatus) - { - MiniDisplaySetIconRecording(iDevice, aIndex, aStatus); - } - - public int IconMuteCount() - { - return MiniDisplayIconMuteCount(iDevice); - } - - public void SetIconMute(int aIndex, int aStatus) - { - MiniDisplaySetIconMute(iDevice, aIndex, aStatus); - } public string Vendor() { @@ -318,7 +278,9 @@ EMiniDisplayFutabaGP1212A02 }; - + /// + /// + /// public enum TMiniDisplayRequest { EMiniDisplayRequestNone, @@ -327,6 +289,23 @@ EMiniDisplayRequestPowerSupplyStatus }; + + /// + /// Define the various type of icons we support. + /// For binary compatibility new entries must be added at the end. + /// + public enum TMiniDisplayIconType + { + EMiniDisplayIconNetwork=0, + EMiniDisplayIconEmail, + EMiniDisplayIconMute, + EMiniDisplayIconVolume, + EMiniDisplayIconVolumeLabel, + EMiniDisplayIconPlay, + EMiniDisplayIconPause, + EMiniDisplayIconRecording + }; + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr MiniDisplayOpen(TMiniDisplayType aType); @@ -418,46 +397,13 @@ public static extern bool MiniDisplaySupportClock(IntPtr aDevice); [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern int MiniDisplayIconNetworkCount(IntPtr aDevice); + public static extern int MiniDisplayIconCount(IntPtr aDevice, TMiniDisplayIconType aIcon); [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern int MiniDisplayIconEmailCount(IntPtr aDevice); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern int MiniDisplayIconMuteCount(IntPtr aDevice); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern int MiniDisplayIconVolumeCount(IntPtr aDevice); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern int MiniDisplayIconPlayCount(IntPtr aDevice); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern int MiniDisplayIconPauseCount(IntPtr aDevice); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern int MiniDisplayIconRecordingCount(IntPtr aDevice); + public static extern int MiniDisplayIconStatusCount(IntPtr aDevice, TMiniDisplayIconType aIcon); [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern void MiniDisplaySetIconNetwork(IntPtr aDevice, int aIndex, int aStatus); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern void MiniDisplaySetIconEmail(IntPtr aDevice, int aIndex, int aStatus); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern void MiniDisplaySetIconMute(IntPtr aDevice, int aIndex, int aStatus); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern void MiniDisplaySetIconVolume(IntPtr aDevice, int aIndex, int aStatus); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern void MiniDisplaySetIconPlay(IntPtr aDevice, int aIndex, int aStatus); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern void MiniDisplaySetIconPause(IntPtr aDevice, int aIndex, int aStatus); - - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - public static extern void MiniDisplaySetIconRecording(IntPtr aDevice, int aIndex, int aStatus); + public static extern void MiniDisplaySetIconStatus(IntPtr aDevice, TMiniDisplayIconType aIcon, int aIndex, int aStatus); } } diff -r 7dd1d881c142 -r ff1ed5f07d7e Server/MainForm.cs --- a/Server/MainForm.cs Thu Feb 05 22:28:27 2015 +0100 +++ b/Server/MainForm.cs Sat Feb 07 13:51:30 2015 +0100 @@ -169,7 +169,8 @@ #if DEBUG //Testing icon in debug, no arm done if icon not supported - iDisplay.SetIconRecording(0, 1); + //iDisplay.SetIconStatus(Display.TMiniDisplayIconType.EMiniDisplayIconRecording, 0, 1); + iDisplay.SetAllIconsStatus(1); #endif }