|
From: <rs...@us...> - 2010-07-29 15:58:27
|
Revision: 3676
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3676&view=rev
Author: rsenden
Date: 2010-07-29 15:58:19 +0000 (Thu, 29 Jul 2010)
Log Message:
-----------
Initial check-in of SPressoDisplayPlugin
Added Paths:
-----------
trunk/plugins/SPressoDisplayPlugin/Source/
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.cs
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.csproj
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.csproj.user
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AudioMixerHelper.cs
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/Properties/
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/Properties/AssemblyInfo.cs
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Debug/
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Debug/TempPE/
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Release/
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Release/AControl2.csproj.FileListAbsolute.txt
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Release/AControl2.exe
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Release/Refactor/
trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Release/TempPE/
trunk/plugins/SPressoDisplayPlugin/Source/Common/
trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.cs
trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.csproj
trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.csproj.user
trunk/plugins/SPressoDisplayPlugin/Source/Common/dummy/
trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/
trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Debug/
trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Debug/TempPE/
trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/
trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/AFPDHelper.csproj.FileListAbsolute.txt
trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/Common.csproj.FileListAbsolute.txt
trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/Common.exe
trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/Refactor/
trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/TempPE/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/Properties/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/Properties/AssemblyInfo.cs
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPresso.jpg
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPressoDisabled.jpg
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPressoDisplayPlugin.cs
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPressoDisplayPlugin.csproj
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPressoDisplayPlugin.csproj.user
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/Settings.cs
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SetupForm.Designer.cs
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SetupForm.cs
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SetupForm.resx
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/WindowId2ModeMappingForm.Designer.cs
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/WindowId2ModeMappingForm.cs
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/WindowId2ModeMappingForm.resx
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Debug/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Debug/TempPE/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Release/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Release/Refactor/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Release/ResolveAssemblyReference.cache
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Release/SPressoDisplayPlugin.SetupForm.resources
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Release/SPressoDisplayPlugin.WindowId2ModeMappingForm.resources
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Release/SPressoDisplayPlugin.csproj.FileListAbsolute.txt
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Release/SPressoDisplayPlugin.csproj.GenerateResource.Cache
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Release/SPressoDisplayPlugin.dll
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Release/SPressoMPPlugin.csproj.FileListAbsolute.txt
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/obj/Release/TempPE/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin.sln
trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin.suo
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/Properties/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/Properties/AssemblyInfo.cs
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/SPressoDisplayTest.csproj
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/SPressoDisplayTest.csproj.user
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/SPressoTest.cs
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/obj/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/obj/Debug/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/obj/Debug/TempPE/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/obj/Release/
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/obj/Release/SPressoDisplayTest.csproj.FileListAbsolute.txt
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/obj/Release/SPressoTest.csproj.FileListAbsolute.txt
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/obj/Release/SPressoTest.exe
trunk/plugins/SPressoDisplayPlugin/Source/SPressoTest/obj/Release/TempPE/
Added: trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.cs
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.cs (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.cs 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2006 Ruud Senden
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Use this program at your own risk, I can not be held responsible
+ * for any damage to your system.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading;
+using Microsoft.Win32;
+
+namespace SPresso
+{
+ class AControl2
+ {
+ private static bool stopRequested = false;
+ private static Thread[] threads;
+
+ static void Main(string[] args)
+ {
+ SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
+ doStart();
+
+ while (true)
+ {
+ Thread.Sleep(99999);
+ }
+
+ // SystemEvents.PowerModeChanged -= new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
+ }
+
+ private static void doStart()
+ {
+ stopRequested = false;
+ threads = new Thread[] {
+ new Thread(new ThreadStart(RunUpdateVolume)),
+ new Thread(new ThreadStart(RunUpdateTemp)) };
+
+ // Start all threads
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i].Start();
+ }
+ }
+
+ private static void doStop()
+ {
+ stopRequested = true;
+
+ for (int i = 0; i < threads.Length; i++)
+ {
+ threads[i].Join();
+ }
+
+ stopRequested = false;
+ }
+
+ private static void RunUpdateTemp()
+ {
+ while (!stopRequested)
+ {
+ try
+ {
+ AFPDHelper.CPUTemp();
+ AFPDHelper.SystemTemp();
+ Thread.Sleep(10000);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Thread[RunUpdateTemp] ex: " + ex.Message);
+ }
+ }
+ }
+
+ private static void RunUpdateVolume()
+ {
+
+ while (!stopRequested)
+ {
+ byte currentVolume = 0;
+ try
+ {
+ int volNew, volMin, volMax;
+ volNew = AudioMixerHelper.GetMinMaxVolume(out volMin, out volMax);
+ volNew = 9 * (volNew - volMin) / (volMax - volMin); // Normalize 1-9
+ if (currentVolume != volNew)
+ {
+ currentVolume = (byte)volNew;
+ AFPDHelper.SetIconVolume(currentVolume);
+ }
+ Thread.Sleep(150);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Thread[RunUpdateTemp] ex: " + ex.Message);
+ }
+ }
+ }
+
+ private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
+ {
+ switch (e.Mode)
+ {
+ case PowerModes.Suspend:
+ doStop();
+ break;
+ case PowerModes.Resume:
+ doStart();
+ break;
+ }
+ }
+ }
+}
Added: trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.csproj
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.csproj (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.csproj 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,80 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{6B479F7C-CC74-4FE9-947B-AB752F92ED5A}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SPresso</RootNamespace>
+ <AssemblyName>AControl2</AssemblyName>
+ <StartupObject>SPresso.AControl2</StartupObject>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.1.0.%2a</ApplicationVersion>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\..\Release\plugins\process</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\Common\AFPDHelper.cs">
+ <Link>AFPDHelper.cs</Link>
+ </Compile>
+ <Compile Include="AControl2.cs" />
+ <Compile Include="AudioMixerHelper.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.csproj.user
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.csproj.user (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AControl2.csproj.user 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,15 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <PublishUrlHistory>publish\</PublishUrlHistory>
+ <InstallUrlHistory>
+ </InstallUrlHistory>
+ <SupportUrlHistory>
+ </SupportUrlHistory>
+ <UpdateUrlHistory>
+ </UpdateUrlHistory>
+ <BootstrapperUrlHistory>
+ </BootstrapperUrlHistory>
+ <FallbackCulture>en-US</FallbackCulture>
+ <VerifyUploadedFiles>false</VerifyUploadedFiles>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
Added: trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AudioMixerHelper.cs
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AudioMixerHelper.cs (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/AControl2/AudioMixerHelper.cs 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,301 @@
+/*
+ * Copyright (C) 2005-2006 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// This file was copied from MediaPortal, such that AControl2.exe doesn't
+// depend on MediaPortal.
+using System;
+using System.Runtime.InteropServices;
+
+namespace SPresso
+{
+ public class AudioMixerHelper
+ {
+ public const int MMSYSERR_NOERROR = 0;
+ public const int MAXPNAMELEN = 32;
+ public const int MIXER_LONG_NAME_CHARS = 64;
+ public const int MIXER_SHORT_NAME_CHARS = 16;
+ public const int MIXER_GETLINEINFOF_COMPONENTTYPE = 0x3;
+ public const int MIXER_GETCONTROLDETAILSF_VALUE = 0x0;
+ public const int MIXER_GETLINECONTROLSF_ONEBYTYPE = 0x2;
+ public const int MIXER_SETCONTROLDETAILSF_VALUE = 0x0;
+ public const int MIXERLINE_COMPONENTTYPE_DST_FIRST = 0x0;
+ public const int MIXERLINE_COMPONENTTYPE_SRC_FIRST = 0x1000;
+ public const int MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4);
+ public const int MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE =(MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3);
+ public const int MIXERLINE_COMPONENTTYPE_SRC_LINE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2);
+ public const int MIXERCONTROL_CT_CLASS_FADER = 0x50000000;
+ public const int MIXERCONTROL_CT_UNITS_UNSIGNED = 0x30000;
+ public const int MIXERCONTROL_CONTROLTYPE_FADER = (MIXERCONTROL_CT_CLASS_FADER | MIXERCONTROL_CT_UNITS_UNSIGNED);
+ public const int MIXERCONTROL_CONTROLTYPE_VOLUME =(MIXERCONTROL_CONTROLTYPE_FADER + 1);
+
+ [DllImport("winmm.dll", CharSet=CharSet.Ansi)]
+ private static extern int mixerClose (int hmx);
+ [DllImport("winmm.dll", CharSet=CharSet.Ansi)]
+ private static extern int mixerGetControlDetailsA (int hmxobj,ref MIXERCONTROLDETAILS pmxcd , int fdwDetails);
+ [DllImport("winmm.dll", CharSet=CharSet.Ansi)]
+ private static extern int mixerGetDevCapsA(int uMxId, MIXERCAPS pmxcaps, int cbmxcaps);
+ [DllImport("winmm.dll", CharSet=CharSet.Ansi)]
+ private static extern int mixerGetID (int hmxobj, int pumxID, int fdwId);
+ [DllImport("winmm.dll", CharSet=CharSet.Ansi)]
+ private static extern int mixerGetLineControlsA (int hmxobj,ref MIXERLINECONTROLS pmxlc, int fdwControls);
+ [DllImport("winmm.dll", CharSet=CharSet.Ansi)]
+ private static extern int mixerGetLineInfoA (int hmxobj,ref MIXERLINE pmxl , int fdwInfo);
+ [DllImport("winmm.dll", CharSet=CharSet.Ansi)]
+ private static extern int mixerGetNumDevs();
+ [DllImport("winmm.dll", CharSet=CharSet.Ansi)]
+ private static extern int mixerMessage(int hmx , int uMsg , int dwParam1 , int dwParam2);
+ [DllImport("winmm.dll", CharSet=CharSet.Ansi)]
+ private static extern int mixerOpen (out int phmx , int uMxId , int dwCallback , int dwInstance , int fdwOpen);
+ [DllImport("winmm.dll", CharSet=CharSet.Ansi)]
+ private static extern int mixerSetControlDetails(int hmxobj ,ref MIXERCONTROLDETAILS pmxcd , int fdwDetails);
+
+ public struct MIXERCAPS
+ {
+ public int wMid;
+ public int wPid;
+ public int vDriverVersion;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=MAXPNAMELEN)]
+ public string szPname;
+ public int fdwSupport;
+ public int cDestinations;
+ }
+
+ public struct MIXERCONTROL
+ {
+ public int cbStruct;
+ public int dwControlID;
+ public int dwControlType;
+ public int fdwControl;
+ public int cMultipleItems;
+ [MarshalAs( UnmanagedType.ByValTStr, SizeConst=MIXER_SHORT_NAME_CHARS)]
+ public string szShortName ;
+ [MarshalAs( UnmanagedType.ByValTStr, SizeConst=MIXER_LONG_NAME_CHARS)]
+ public string szName;
+ public int lMinimum;
+ public int lMaximum;
+ [MarshalAs(UnmanagedType.U4, SizeConst=10)]
+ public int reserved;
+ }
+
+ public struct MIXERCONTROLDETAILS
+ {
+ public int cbStruct;
+ public int dwControlID;
+ public int cChannels;
+ public int item;
+ public int cbDetails;
+ public IntPtr paDetails;
+ }
+
+ public struct MIXERCONTROLDETAILS_UNSIGNED
+ {
+ public int dwValue;
+ }
+
+ public struct MIXERLINE
+ {
+ public int cbStruct;
+ public int dwDestination;
+ public int dwSource;
+ public int dwLineID;
+ public int fdwLine;
+ public int dwUser;
+ public int dwComponentType;
+ public int cChannels;
+ public int cConnections;
+ public int cControls;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=MIXER_SHORT_NAME_CHARS)]
+ public string szShortName;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=MIXER_LONG_NAME_CHARS )]
+ public string szName;
+ public int dwType;
+ public int dwDeviceID;
+ public int wMid;
+ public int wPid;
+ public int vDriverVersion ;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=MAXPNAMELEN)]
+ public string szPname ;
+ }
+
+ public struct MIXERLINECONTROLS
+ {
+ public int cbStruct;
+ public int dwLineID;
+
+ public int dwControl;
+ public int cControls;
+ public int cbmxctrl;
+ public IntPtr pamxctrl;
+ }
+
+ private static bool GetVolumeControl(int hmixer, int componentType, int ctrlType, out MIXERCONTROL mxc, out int vCurrentVol)
+ {
+ // This function attempts to obtain a mixer control.
+ // Returns True if successful.
+ MIXERLINECONTROLS mxlc = new MIXERLINECONTROLS();
+ MIXERLINE mxl = new MIXERLINE();
+ MIXERCONTROLDETAILS pmxcd = new MIXERCONTROLDETAILS();
+ MIXERCONTROLDETAILS_UNSIGNED du = new MIXERCONTROLDETAILS_UNSIGNED();
+ mxc = new MIXERCONTROL();
+ int rc;
+ bool retValue;
+ vCurrentVol = -1;
+
+ mxl.cbStruct = Marshal.SizeOf(mxl);
+ mxl.dwComponentType = componentType;
+
+ rc = mixerGetLineInfoA(hmixer,ref mxl,MIXER_GETLINEINFOF_COMPONENTTYPE );
+
+ if(MMSYSERR_NOERROR == rc)
+ {
+ int sizeofMIXERCONTROL = 152;
+ int ctrl = Marshal.SizeOf(typeof(MIXERCONTROL));
+ mxlc.pamxctrl = Marshal.AllocCoTaskMem(sizeofMIXERCONTROL);
+ mxlc.cbStruct = Marshal.SizeOf(mxlc);
+ mxlc.dwLineID = mxl.dwLineID;
+ mxlc.dwControl = ctrlType;
+ mxlc.cControls = 1;
+ mxlc.cbmxctrl = sizeofMIXERCONTROL;
+
+ // Allocate a buffer for the control
+ mxc.cbStruct = sizeofMIXERCONTROL;
+
+ // Get the control
+ rc = mixerGetLineControlsA(hmixer,ref mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE);
+
+ if(MMSYSERR_NOERROR == rc)
+ {
+ retValue = true;
+
+ // Copy the control into the destination structure
+ mxc = (MIXERCONTROL)Marshal.PtrToStructure(mxlc.pamxctrl,typeof(MIXERCONTROL));
+ }
+ else
+ {
+ retValue = false;
+ }
+ int sizeofMIXERCONTROLDETAILS = Marshal.SizeOf(typeof(MIXERCONTROLDETAILS));
+ int sizeofMIXERCONTROLDETAILS_UNSIGNED = Marshal.SizeOf(typeof(MIXERCONTROLDETAILS_UNSIGNED));
+ pmxcd.cbStruct = sizeofMIXERCONTROLDETAILS;
+ pmxcd.dwControlID = mxc.dwControlID;
+ pmxcd.paDetails =
+
+ Marshal.AllocCoTaskMem(sizeofMIXERCONTROLDETAILS_UNSIGNED) ;
+ pmxcd.cChannels = 1;
+ pmxcd.item = 0;
+ pmxcd.cbDetails = sizeofMIXERCONTROLDETAILS_UNSIGNED;
+
+ rc = mixerGetControlDetailsA(hmixer,ref pmxcd, MIXER_GETCONTROLDETAILSF_VALUE);
+
+ du = (MIXERCONTROLDETAILS_UNSIGNED)Marshal.PtrToStructure( pmxcd.paDetails, typeof(MIXERCONTROLDETAILS_UNSIGNED));
+
+ vCurrentVol = du.dwValue;
+
+ return retValue;
+ }
+
+ retValue = false;
+ return retValue;
+ }
+
+ private static bool SetVolumeControl(int hmixer, MIXERCONTROL mxc, int volume)
+ {
+ // This function sets the value for a volume control.
+ // Returns True if successful
+
+ bool retValue;
+ int rc;
+ MIXERCONTROLDETAILS mxcd = new MIXERCONTROLDETAILS();
+ MIXERCONTROLDETAILS_UNSIGNED vol = new MIXERCONTROLDETAILS_UNSIGNED();
+
+ mxcd.item = 0;
+ mxcd.dwControlID = mxc.dwControlID;
+ mxcd.cbStruct = Marshal.SizeOf(mxcd);
+ mxcd.cbDetails = Marshal.SizeOf(vol);
+
+ // Allocate a buffer for the control value buffer
+ mxcd.cChannels = 1;
+ vol.dwValue = volume;
+
+ // Copy the data into the control value buffer
+ mxcd.paDetails = Marshal.AllocCoTaskMem(Marshal.SizeOf( typeof(MIXERCONTROLDETAILS_UNSIGNED)));
+ Marshal.StructureToPtr(vol, mxcd.paDetails,false);
+
+ // Set the control value
+ rc = mixerSetControlDetails(hmixer,ref mxcd, MIXER_SETCONTROLDETAILSF_VALUE);
+
+ if(MMSYSERR_NOERROR == rc)
+ {
+ retValue = true;
+ }
+ else
+ {
+ retValue = false;
+ } return retValue;
+ }
+
+ public static int GetVolume()
+ {
+ int mixer;
+ MIXERCONTROL volCtrl = new MIXERCONTROL();
+ int currentVol;
+ mixerOpen(out mixer,0 ,0 ,0, 0);
+ int type = MIXERCONTROL_CONTROLTYPE_VOLUME;
+ GetVolumeControl(mixer, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,type,out volCtrl, out currentVol);
+ mixerClose(mixer);
+
+ return currentVol;
+ }
+
+ public static int GetMinMaxVolume(out int iMin, out int iMax)
+ {
+ int mixer;
+ MIXERCONTROL volCtrl = new MIXERCONTROL();
+ int currentVol;
+ mixerOpen(out mixer,0 ,0 ,0, 0);
+ int type = MIXERCONTROL_CONTROLTYPE_VOLUME;
+ GetVolumeControl(mixer, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,type,out volCtrl, out currentVol);
+ mixerClose(mixer);
+ iMin = volCtrl.lMinimum;
+ iMax = volCtrl.lMaximum;
+ return currentVol;
+ }
+
+ public static void SetVolume(int vVolume)
+ {
+ int mixer;
+ MIXERCONTROL volCtrl = new MIXERCONTROL();
+ int currentVol;
+ mixerOpen(out mixer,0 ,0 ,0, 0);
+ int type = MIXERCONTROL_CONTROLTYPE_VOLUME;
+ GetVolumeControl(mixer, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,type,out volCtrl, out currentVol);
+ if(vVolume > volCtrl.lMaximum) vVolume = volCtrl.lMaximum;
+ if(vVolume < volCtrl.lMinimum) vVolume = volCtrl.lMinimum;
+ SetVolumeControl(mixer, volCtrl, vVolume);
+ GetVolumeControl(mixer, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,type,out volCtrl, out currentVol);
+ if(vVolume != currentVol)
+ {
+ throw new Exception("Cannot Set Volume");
+ }
+ mixerClose(mixer);
+ }
+ }
+}
Added: trunk/plugins/SPressoDisplayPlugin/Source/AControl2/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/AControl2/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/AControl2/Properties/AssemblyInfo.cs 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("AControl2")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("AControl2")]
+[assembly: AssemblyCopyright("Copyright © Ruud Senden 2006-2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("4de7f669-be8e-453e-8753-0f9943e044be")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("2.1.0.0")]
+[assembly: AssemblyFileVersion("2.1.0.0")]
Added: trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Release/AControl2.csproj.FileListAbsolute.txt
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Release/AControl2.csproj.FileListAbsolute.txt (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Release/AControl2.csproj.FileListAbsolute.txt 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,10 @@
+D:\Develop\MediaPortal\SPresso\Release\AControl2.exe
+D:\Develop\MediaPortal\SPresso\Source\AControl2\obj\Release\ResolveAssemblyReference.cache
+D:\Develop\MediaPortal\SPresso\Source\AControl2\obj\Release\AControl2.exe
+D:\Develop\MediaPortal\SPressoDisplayPlugin\Release\AControl2.exe
+D:\Develop\MediaPortal\SPressoDisplayPlugin\Source\AControl2\obj\Release\ResolveAssemblyReference.cache
+D:\Develop\MediaPortal\SPressoDisplayPlugin\Source\AControl2\obj\Release\AControl2.exe
+D:\Develop\MediaPortal\SPressoDisplayPlugin\Release\plugins\process\AControl2.exe
+D:\Development\MediaPortal\Plugins\SPressoDisplayPlugin\Release\plugins\process\AControl2.exe
+D:\Development\MediaPortal\Plugins\SPressoDisplayPlugin\Source\AControl2\obj\Release\ResolveAssemblyReference.cache
+D:\Development\MediaPortal\Plugins\SPressoDisplayPlugin\Source\AControl2\obj\Release\AControl2.exe
Added: trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Release/AControl2.exe
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/SPressoDisplayPlugin/Source/AControl2/obj/Release/AControl2.exe
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.cs
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.cs (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.cs 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2006 Ruud Senden
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Use this program at your own risk, I can not be held responsible
+ * for any damage to your system.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/*
+ * The DllImport declarations in this file are based on information
+ * found on the Internet and by analyzing calls made by other applications
+ * (e.g. Asus Home Theater and AControl.exe) to AFPD.DLL. These declarations
+ * may not be correct, if you have any recommendations please let me know.
+ */
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace SPresso
+{
+ public class AFPDHelper
+ {
+ public enum Mode : short
+ {
+ NONE = 0,
+ FM = 1,
+ MP3 = 2,
+ MUSIC = 3,
+ PHOTO = 4,
+ DVD = 5,
+ VCD = 6,
+ TV = 7
+ }
+
+ public enum ColonPos : short
+ {
+ NONE = 0,
+ RIGHT = 1,
+ LEFT = 2,
+ BOTH = 3,
+ }
+
+ public enum TextTimePos : short
+ {
+ LEFT = 2,
+ MIDDLE = 1,
+ RIGHT = 0
+ }
+
+ public enum Button : byte
+ {
+ PLAY = 64,
+ MODE = 32,
+ STOP = 16,
+ PREV = 8,
+ NEXT = 4,
+ VOL_DOWN = 2,
+ VOL_UP = 1,
+ NONE = 0
+ }
+
+ public enum ExtendedButton : short
+ {
+ NONE = 0,
+ PLAY = 1,
+ STOP = 2,
+ PREV = 3,
+ NEXT = 4,
+ VOL_UP = 5,
+ VOL_DOWN = 6,
+ MODE_NONE = 10,
+ MODE_FM = 11,
+ MODE_MP3 = 12,
+ MODE_MUSIC = 13,
+ MODE_PHOTO = 14,
+ MODE_DVD = 15,
+ MODE_VCD = 16,
+ MODE_TV = 17
+ }
+
+ public class TextTime
+ {
+ public string left = " ", middle= " ", right = " ";
+ }
+
+ public class MainDisplayState
+ {
+ public Mode mode = Mode.NONE;
+ public ColonPos colonPos = ColonPos.NONE;
+ public bool iconPlay = false, iconPause = false, iconRecord = false;
+ public TextTime textTime = new TextTime();
+ public string textD1_4 = " ";
+ public char textD5 = ' ';
+ }
+
+ public static void ClearDisplay()
+ {
+ ShowText();
+ UpdateDisplay(new MainDisplayState(),null);
+ }
+
+ public static void ShowDateTime()
+ {
+ WritePIC(41, 1);
+ }
+
+ public static void ShowText()
+ {
+ WritePIC(41, 0);
+ }
+
+ // TextD1_4 and TextD5 not supported yet
+ public static MainDisplayState UpdateDisplay(MainDisplayState newState, MainDisplayState oldState)
+ {
+ if (oldState == null || oldState.textTime.left != newState.textTime.left)
+ {
+ SetTextTime(TextTimePos.LEFT, newState.textTime.left);
+ }
+ if (oldState == null || oldState.textTime.middle != newState.textTime.middle)
+ {
+ SetTextTime(TextTimePos.MIDDLE, newState.textTime.middle);
+ }
+ if (oldState == null || oldState.textTime.right != newState.textTime.right)
+ {
+ SetTextTime(TextTimePos.RIGHT, newState.textTime.right);
+ }
+ if (oldState == null || oldState.colonPos != newState.colonPos)
+ {
+ SetIconColon(newState.colonPos);
+ }
+ if (oldState == null || oldState.mode != newState.mode)
+ {
+ SetIconMode(newState.mode);
+ }
+ if (oldState == null || oldState.iconPause != newState.iconPause)
+ {
+ SetIconPause(newState.iconPause);
+ }
+ if (oldState == null || oldState.iconPlay != newState.iconPlay)
+ {
+ SetIconPlay(newState.iconPlay);
+ }
+ if (oldState == null || oldState.iconRecord != newState.iconRecord)
+ {
+ SetIconRecord(newState.iconRecord);
+ }
+ return newState;
+ }
+
+ public static Mode GetIconMode()
+ {
+ Mode result = Mode.NONE;
+ switch (ReadPIC(8))
+ {
+ case 1:
+ result = Mode.FM;
+ break;
+ case 2:
+ result = Mode.MP3;
+ break;
+ case 4:
+ result = Mode.MUSIC;
+ break;
+ case 8:
+ result = Mode.PHOTO;
+ break;
+ case 16:
+ result = Mode.DVD;
+ break;
+ case 32:
+ result = Mode.VCD;
+ break;
+ case 64:
+ result = Mode.TV;
+ break;
+ }
+ return result;
+ }
+
+ public static ExtendedButton GetExtendedButton()
+ {
+ Button button = GetButton();
+ if ( button == Button.MODE ) {
+ Mode mode = AFPDHelper.GetIconMode();
+ return (ExtendedButton)Enum.Parse(typeof(ExtendedButton), "MODE_"+mode.ToString());
+ } else {
+ return (ExtendedButton)Enum.Parse(typeof(ExtendedButton), button.ToString());
+ }
+ }
+
+ #region Interop declarations
+
+ [DllImport("AFPD.dll", EntryPoint = "GetFirmwareVersion")]
+ public static extern long GetFirmwareVersion();
+
+ [DllImport("AFPD.dll", EntryPoint = "Text_D1_4")]
+ public static extern long SetTextD1_4(string line);
+
+ [DllImport("AFPD.dll", EntryPoint = "Text_D5")]
+ public static extern long SetTextD5(string line);
+
+ [DllImport("AFPD.dll", EntryPoint = "Text_Time")]
+ public static extern long SetTextTime(TextTimePos pos, string val);
+
+ [DllImport("AFPD.dll", EntryPoint = "Text_Msas")]
+ public static extern long SetTextMsas();
+
+ [DllImport("AFPD.dll", EntryPoint = "WritePIC")]
+ public static extern long WritePIC(byte register, byte value);
+
+ [DllImport("AFPD.dll", EntryPoint = "ReadPIC")]
+ public static extern short ReadPIC(byte register);
+
+ [DllImport("AFPD.dll", EntryPoint = "Icon_Record")]
+ public static extern long SetIconRecord(bool enable);
+
+ [DllImport("AFPD.dll", EntryPoint = "Icon_Play")]
+ public static extern long SetIconPlay(bool enable);
+
+ [DllImport("AFPD.dll", EntryPoint = "Icon_Pause")]
+ public static extern long SetIconPause(bool enable);
+
+ [DllImport("AFPD.dll", EntryPoint = "Icon_Stereo")]
+ public static extern long SetIconStereo(bool enable);
+
+ [DllImport("AFPD.dll", EntryPoint = "Icon_Colon")]
+ public static extern long SetIconColon(ColonPos status);
+
+ [DllImport("AFPD.dll", EntryPoint = "Icon_Mode")]
+ public static extern long SetIconMode(Mode mode);
+
+ [DllImport("AFPD.dll", EntryPoint = "Icon_Volume")]
+ public static extern long SetIconVolume(byte level);
+
+ [DllImport("AFPD.dll", EntryPoint = "Rotation")]
+ public static extern long SetRotation(byte x,byte y);
+
+ [DllImport("AFPD.dll", EntryPoint = "Get_Btn")]
+ public static extern Button GetButton();
+
+ [DllImport("AFPD.dll", EntryPoint = "CPUTemp")]
+ public static extern long CPUTemp();
+
+ [DllImport("AFPD.dll", EntryPoint = "SystemTemp")]
+ public static extern long SystemTemp();
+
+ #endregion
+ }
+}
Added: trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.csproj
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.csproj (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.csproj 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{0974B628-332F-492D-9027-B6C2FE4D1478}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SPresso</RootNamespace>
+ <AssemblyName>Common</AssemblyName>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <PublishUrl>http://localhost/Common/</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Web</InstallFrom>
+ <UpdateEnabled>true</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>true</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>dummy\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <ItemGroup>
+ <Compile Include="AFPDHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+</Project>
\ No newline at end of file
Added: trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.csproj.user
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.csproj.user (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/Common/AFPDHelper.csproj.user 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,15 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <PublishUrlHistory>publish\</PublishUrlHistory>
+ <InstallUrlHistory>
+ </InstallUrlHistory>
+ <SupportUrlHistory>
+ </SupportUrlHistory>
+ <UpdateUrlHistory>
+ </UpdateUrlHistory>
+ <BootstrapperUrlHistory>
+ </BootstrapperUrlHistory>
+ <FallbackCulture>en-US</FallbackCulture>
+ <VerifyUploadedFiles>false</VerifyUploadedFiles>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
Added: trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/AFPDHelper.csproj.FileListAbsolute.txt
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/AFPDHelper.csproj.FileListAbsolute.txt (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/AFPDHelper.csproj.FileListAbsolute.txt 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,3 @@
+D:\Develop\MediaPortal\SPressoDisplayPlugin\Source\Common\dummy\Common.exe
+D:\Develop\MediaPortal\SPressoDisplayPlugin\Source\Common\obj\Release\ResolveAssemblyReference.cache
+D:\Develop\MediaPortal\SPressoDisplayPlugin\Source\Common\obj\Release\Common.exe
Added: trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/Common.csproj.FileListAbsolute.txt
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/Common.csproj.FileListAbsolute.txt (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/Common.csproj.FileListAbsolute.txt 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,6 @@
+D:\Develop\MediaPortal\SPresso\Source\Common\dummy\Common.exe
+D:\Develop\MediaPortal\SPresso\Source\Common\obj\Release\ResolveAssemblyReference.cache
+D:\Develop\MediaPortal\SPresso\Source\Common\obj\Release\Common.exe
+D:\Develop\MediaPortal\SPressoDisplayPlugin\Source\Common\dummy\Common.exe
+D:\Develop\MediaPortal\SPressoDisplayPlugin\Source\Common\obj\Release\ResolveAssemblyReference.cache
+D:\Develop\MediaPortal\SPressoDisplayPlugin\Source\Common\obj\Release\Common.exe
Added: trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/Common.exe
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/SPressoDisplayPlugin/Source/Common/obj/Release/Common.exe
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/Properties/AssemblyInfo.cs 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SPressoDisplayPlugin")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SPressoDisplayPlugin")]
+[assembly: AssemblyCopyright("Copyright © 2006-2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("5d9a6d4c-b24f-4798-92f0-1fb1aa50e4a7")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("2.1.0.0")]
+[assembly: AssemblyFileVersion("2.1.0.0")]
Added: trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPresso.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPresso.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPressoDisabled.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPressoDisabled.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPressoDisplayPlugin.cs
===================================================================
--- trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPressoDisplayPlugin.cs (rev 0)
+++ trunk/plugins/SPressoDisplayPlugin/Source/SPressoDisplayPlugin/SPressoDisplayPlugin.cs 2010-07-29 15:58:19 UTC (rev 3676)
@@ -0,0 +1,464 @@
+/*
+ * Copyright (C) 2006 Ruud Senden
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Use this program at your own risk, I can not be held responsible
+ * for any damage to your system.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using System.Threading;
+using System.Diagnostics;
+using System.Reflection;
+using MediaPortal.Configuration;
+using MediaPortal.GUI.Library;
+using MediaPortal.Player;
+using MediaPortal.InputDevices;
+using MediaPortal.Util;
+using Microsoft.Win32;
+using SPresso;
+using Mode = SPresso.AFPDHelper.Mode;
+using ColonPos = SPresso.AFPDHelper.ColonPos;
+using TextTimePos = SPresso.AFPDHelper.TextTimePos;
+using ExtendedButton = SPresso.AFPDHelper.ExtendedButton;
+using MainDisplayState = SPresso.AFPDHelper.MainDisplayState;
+
+namespace SPressoDisplayPlugin
+{
+ [PluginIcons("SPressoDisplayPlugin.SPresso.jpg", "SPressoDisplayPlugin.SPressoDisabled.jpg")]
+ public class SPressoDisplayPlugin : IPlugin, ISetupForm
+ {
+ private bool extensiveLogging = Settings.Instance.ExtensiveLogging;
+ private IDictionary<int,Mode> windowId2ModeMap = Settings.Instance.WindowId2ModeMap;
+ private InputHandler _inputHandler = Settings.Instance.InputHandler;
+ private bool stopRequested = false;
+ private Thread processButtonsThread, updateDisplayThread = null;
+ private Object tvServer = null;
+ private MethodInfo tvServerIsRecordingMethod = null;
+
+ #region ISetupForm Members
+
+ // Returns the name of the plugin which is shown in the plugin menu
+ public string PluginName()
+ {
+ return "SPressoDisplayPlugin";
+ }
+
+ // Returns the description of the plugin is shown in the plugin menu
+ public string Description()
+ {
+ return "Asus SPresso Display Driver";
+ }
+
+ // Returns the author of the plugin which is shown in the plugin menu
+ public string Author()
+ {
+ return "Ruud Senden";
+ }
+
+ // show the setup dialog
+ public void ShowPlugin()
+ {
+ Form settings = new SetupForm();
+ settings.ShowDialog();
+ }
+
+ // Indicates whether plugin can be enabled/disabled
+ public bool CanEnable()
+ {
+ return true;
+ }
+
+ // get ID of windowplugin belonging to this setup
+ public int GetWindowId()
+ {
+ return 9563;
+ }
+
+ // Indicates if plugin is enabled by default;
+ public bool DefaultEnabled()
+ {
+ return true;
+ }
+
+ // indicates if a plugin has its own setup screen
+ public bool HasSetup()
+ {
+ return true;
+ }
+
+ /// <summary>
+ /// If the plugin should have its own button on the main menu of Media Portal then it
+ /// should return true to this method, otherwise if it should not be on home
+ /// it should return false
+ /// </summary>
+ /// <param name="strButtonText">text the button should have</param>
+ /// <param name="strButtonImage">image for the button, or empty for default</param>
+ /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
+ /// <param name="strPictureImage">subpicture for the button or empty for none</param>
+ /// <returns>true : plugin needs its own button on home
+ /// false : plugin does not need its own button on home</returns>
+ public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText=String.Empty;
+ strButtonImage=String.Empty;
+ strButtonImageFocus=String.Empty;
+ strPictureImage=String.Empty;
+ return false;
+ }
+
+ #endregion
+
+ #region IPlugin Members
+
+ public void Start()
+ {
+ Log.Info(GetLogMessage("Extensive logging enabled: " + extensiveLogging));
+ if (extensiveLogging) { Log.Debug(GetLogMessage(GetLogMessage("Registering PowerModeChangedEventHandler"))); }
+ SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Performing plugin startup processing")); }
+ DoStart();
+ }
+
+ private void DoStart()
+ {
+ Log.Info(GetLogMessage("Starting..."));
+ Log.Info(GetLogMessage("Firmware version: " + AFPDHelper.GetFirmwareVersion()));
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Clearing display")); }
+ AFPDHelper.ClearDisplay();
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Initializing TvServer support")); }
+ InitializeTvServerSupport();
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Starting threads")); }
+ startThreads();
+ }
+
+ private void InitializeTvServerSupport()
+ {
+ try
+ {
+ Assembly tvControlAssembly = getTvControlAssembly();
+ if (tvControlAssembly == null)
+ {
+ Log.Info(GetLogMessage("TvControl assembly not found; disabling TvServer support"));
+ }
+ else if (!IsConnectedToTvServer(tvControlAssembly))
+ {
+ Log.Info(GetLogMessage("Not connected to TvServer; disabling TvServer support"));
+ }
+ else
+ {
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Loading type TvControl.TvServer")); }
+ Type tvServerType = tvControlAssembly.GetType("TvControl.TvServer", true);
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Creating instance of "+tvServerType.Name)); }
+ this.tvServer = Activator.CreateInstance(tvServerType);
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Retrieving IsAnyCardRecording method from "+tvServerType.Name)); }
+ this.tvServerIsRecordingMethod = tvServerType.GetMethod("IsAnyCardRecording");
+ Log.Info(GetLogMessage("Connected to TvServer; enabling TvServer support"));
+ }
+ }
+ catch (Exception e)
+ {
+ Log.Error(GetLogMessage("Exception while initializing TvServer support; disabling TvServer support. Exception: "+e));
+ this.tvServer = null;
+ this.tvServerIsRecordingMethod = null;
+ }
+ }
+
+ private Assembly getTvControlAssembly()
+ {
+ try {
+ return Assembly.Load("TvControl");
+ } catch (System.IO.FileNotFoundException) {
+ return null;
+ }
+ }
+
+ private bool IsConnectedToTvServer(Assembly tvControlAssembly)
+ {
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Loading type TvControl.RemoteControl")); }
+ Type remoteControlType = tvControlAssembly.GetType("TvControl.RemoteControl", true);
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Getting IsConnected field value from " + remoteControlType.Name)); }
+ bool result = (bool)remoteControlType.GetProperty("IsConnected").GetValue(null,null);
+ if (extensiveLogging) { Log.Debug(GetLogMessage("IsConnected field value: " + result)); }
+ return result;
+ }
+
+ public void Stop()
+ {
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Unregistering PowerModeChangedEventHandler")); }
+ SystemEvents.PowerModeChanged -= new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Performing plugin shutdown processing")); }
+ DoStop();
+ }
+
+ private void DoStop()
+ {
+ try
+ {
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Stopping threads")); }
+ stopThreads();
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Clearing display")); }
+ AFPDHelper.ClearDisplay();
+ }
+ catch (Exception ex)
+ {
+ Log.Error(GetLogMessage("SPressoDisplay.Stop: " + ex.Message));
+ }
+ Log.Info(GetLogMessage("SPressoDisplay plugin stopped..."));
+ }
+
+ #endregion
+
+ #region Thread Management
+
+ private void startThreads()
+ {
+ stopRequested = false;
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Starting updateDisplayThread")); }
+ updateDisplayThread = startThread("UpdateDisplay", updateDisplayThread, new ThreadStart(RunUpdateDisplay));
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Starting processButtonsThread")); }
+ processButtonsThread = startThread("ProcessButtons", processButtonsThread, new ThreadStart(RunProcessButtons));
+ }
+
+ private Thread startThread(String name, Thread t, ThreadStart f)
+ {
+ if (t == null || !t.IsAlive)
+ {
+ try
+ {
+ t = new Thread(f);
+ t.Name = name;
+ t.Start();
+ }
+ catch (Exception ex)
+ {
+ Log.Error(GetLogMessage("couldn't start thread " + f.Method.Name + ", Ex: "+ex));
+ }
+ }
+ return t;
+ }
+
+ private void stopThreads()
+ {
+ stopRequested = true;
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Ending updateDisplayThread")); }
+ waitForStop(updateDisplayThread);
+ if (extensiveLogging) { Log.Debug(GetLogMessage("Ending processButtonsThread")); }
+ waitForStop(processButtonsThread);
+ }
+
+ private void waitForStop(Thread t)
+ {
+ try
+ {
+ if (t == null || !t.IsAlive)
+ {
+ return;
+ }
+ while (t.IsAlive)
+ {
+ Application.DoEvents();
+ Thread.Sleep(100);
+ }
+ }
+ catch (Exception ex)
+ {
+ Log.Error(GetLogMessage("SPressoDisplay.Stop: " + ex.Message));
+ }
+ }
+
+ #endregion
+
+ #region Display Updates
+
+ ...
[truncated message content] |