MiniDisplay: Improved icon APIs.
1.1 --- a/Server/Display.cs Thu Feb 05 22:28:27 2015 +0100
1.2 +++ b/Server/Display.cs Sat Feb 07 13:51:30 2015 +0100
1.3 @@ -203,75 +203,35 @@
1.4 }
1.5
1.6 //
1.7 - public int IconEmailCount()
1.8 + public int IconCount(TMiniDisplayIconType aIcon)
1.9 {
1.10 - return MiniDisplayIconEmailCount(iDevice);
1.11 + return MiniDisplayIconCount(iDevice,aIcon);
1.12 }
1.13
1.14 - public void SetIconEmail(int aIndex, int aStatus)
1.15 + public int IconStatusCount(TMiniDisplayIconType aIcon)
1.16 {
1.17 - MiniDisplaySetIconEmail(iDevice, aIndex, aStatus);
1.18 + return MiniDisplayIconStatusCount(iDevice, aIcon);
1.19 }
1.20
1.21 - public int IconNetworkCount()
1.22 + public void SetIconStatus(TMiniDisplayIconType aIcon, int aIndex, int aStatus)
1.23 {
1.24 - return MiniDisplayIconNetworkCount(iDevice);
1.25 + MiniDisplaySetIconStatus(iDevice, aIcon, aIndex, aStatus);
1.26 }
1.27
1.28 - public void SetIconNetwork(int aIndex, int aStatus)
1.29 + public void SetAllIconsStatus(int aStatus)
1.30 {
1.31 - MiniDisplaySetIconNetwork(iDevice, aIndex, aStatus);
1.32 + foreach (TMiniDisplayIconType icon in Enum.GetValues(typeof(TMiniDisplayIconType)))
1.33 + {
1.34 + int count=IconCount(icon);
1.35 + for (int i = 0; i < count; i++)
1.36 + {
1.37 + SetIconStatus(icon,i,aStatus);
1.38 + }
1.39 + }
1.40 +
1.41 }
1.42
1.43 - public int IconVolumeCount()
1.44 - {
1.45 - return MiniDisplayIconVolumeCount(iDevice);
1.46 - }
1.47
1.48 - public void SetIconVolume(int aIndex, int aStatus)
1.49 - {
1.50 - MiniDisplaySetIconVolume(iDevice, aIndex, aStatus);
1.51 - }
1.52 -
1.53 - public int IconPlayCount()
1.54 - {
1.55 - return MiniDisplayIconPlayCount(iDevice);
1.56 - }
1.57 -
1.58 - public void SetIconPlay(int aIndex, int aStatus)
1.59 - {
1.60 - MiniDisplaySetIconPlay(iDevice, aIndex, aStatus);
1.61 - }
1.62 -
1.63 - public int IconPauseCount()
1.64 - {
1.65 - return MiniDisplayIconPauseCount(iDevice);
1.66 - }
1.67 -
1.68 - public void SetIconPause(int aIndex, int aStatus)
1.69 - {
1.70 - MiniDisplaySetIconPause(iDevice, aIndex, aStatus);
1.71 - }
1.72 -
1.73 - public int IconRecordingCount()
1.74 - {
1.75 - return MiniDisplayIconRecordingCount(iDevice);
1.76 - }
1.77 -
1.78 - public void SetIconRecording(int aIndex, int aStatus)
1.79 - {
1.80 - MiniDisplaySetIconRecording(iDevice, aIndex, aStatus);
1.81 - }
1.82 -
1.83 - public int IconMuteCount()
1.84 - {
1.85 - return MiniDisplayIconMuteCount(iDevice);
1.86 - }
1.87 -
1.88 - public void SetIconMute(int aIndex, int aStatus)
1.89 - {
1.90 - MiniDisplaySetIconMute(iDevice, aIndex, aStatus);
1.91 - }
1.92
1.93 public string Vendor()
1.94 {
1.95 @@ -318,7 +278,9 @@
1.96 EMiniDisplayFutabaGP1212A02
1.97 };
1.98
1.99 -
1.100 + /// <summary>
1.101 + ///
1.102 + /// </summary>
1.103 public enum TMiniDisplayRequest
1.104 {
1.105 EMiniDisplayRequestNone,
1.106 @@ -327,6 +289,23 @@
1.107 EMiniDisplayRequestPowerSupplyStatus
1.108 };
1.109
1.110 +
1.111 + /// <summary>
1.112 + /// Define the various type of icons we support.
1.113 + /// For binary compatibility new entries must be added at the end.
1.114 + /// </summary>
1.115 + public enum TMiniDisplayIconType
1.116 + {
1.117 + EMiniDisplayIconNetwork=0,
1.118 + EMiniDisplayIconEmail,
1.119 + EMiniDisplayIconMute,
1.120 + EMiniDisplayIconVolume,
1.121 + EMiniDisplayIconVolumeLabel,
1.122 + EMiniDisplayIconPlay,
1.123 + EMiniDisplayIconPause,
1.124 + EMiniDisplayIconRecording
1.125 + };
1.126 +
1.127 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.128 public static extern IntPtr MiniDisplayOpen(TMiniDisplayType aType);
1.129
1.130 @@ -418,46 +397,13 @@
1.131 public static extern bool MiniDisplaySupportClock(IntPtr aDevice);
1.132
1.133 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.134 - public static extern int MiniDisplayIconNetworkCount(IntPtr aDevice);
1.135 + public static extern int MiniDisplayIconCount(IntPtr aDevice, TMiniDisplayIconType aIcon);
1.136
1.137 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.138 - public static extern int MiniDisplayIconEmailCount(IntPtr aDevice);
1.139 -
1.140 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.141 - public static extern int MiniDisplayIconMuteCount(IntPtr aDevice);
1.142 -
1.143 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.144 - public static extern int MiniDisplayIconVolumeCount(IntPtr aDevice);
1.145 -
1.146 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.147 - public static extern int MiniDisplayIconPlayCount(IntPtr aDevice);
1.148 -
1.149 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.150 - public static extern int MiniDisplayIconPauseCount(IntPtr aDevice);
1.151 -
1.152 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.153 - public static extern int MiniDisplayIconRecordingCount(IntPtr aDevice);
1.154 + public static extern int MiniDisplayIconStatusCount(IntPtr aDevice, TMiniDisplayIconType aIcon);
1.155
1.156 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.157 - public static extern void MiniDisplaySetIconNetwork(IntPtr aDevice, int aIndex, int aStatus);
1.158 -
1.159 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.160 - public static extern void MiniDisplaySetIconEmail(IntPtr aDevice, int aIndex, int aStatus);
1.161 -
1.162 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.163 - public static extern void MiniDisplaySetIconMute(IntPtr aDevice, int aIndex, int aStatus);
1.164 -
1.165 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.166 - public static extern void MiniDisplaySetIconVolume(IntPtr aDevice, int aIndex, int aStatus);
1.167 -
1.168 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.169 - public static extern void MiniDisplaySetIconPlay(IntPtr aDevice, int aIndex, int aStatus);
1.170 -
1.171 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.172 - public static extern void MiniDisplaySetIconPause(IntPtr aDevice, int aIndex, int aStatus);
1.173 -
1.174 - [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
1.175 - public static extern void MiniDisplaySetIconRecording(IntPtr aDevice, int aIndex, int aStatus);
1.176 + public static extern void MiniDisplaySetIconStatus(IntPtr aDevice, TMiniDisplayIconType aIcon, int aIndex, int aStatus);
1.177
1.178 }
1.179 }
2.1 --- a/Server/MainForm.cs Thu Feb 05 22:28:27 2015 +0100
2.2 +++ b/Server/MainForm.cs Sat Feb 07 13:51:30 2015 +0100
2.3 @@ -169,7 +169,8 @@
2.4
2.5 #if DEBUG
2.6 //Testing icon in debug, no arm done if icon not supported
2.7 - iDisplay.SetIconRecording(0, 1);
2.8 + //iDisplay.SetIconStatus(Display.TMiniDisplayIconType.EMiniDisplayIconRecording, 0, 1);
2.9 + iDisplay.SetAllIconsStatus(1);
2.10 #endif
2.11
2.12 }