Adding C# interop project and NuGet package.
authorStephaneLenclud
Wed, 06 May 2015 21:03:53 +0200
changeset 363b94d0640115
parent 35 638eb0763e20
child 37 d3b88ef66bfe
Adding C# interop project and NuGet package.
Interop/MiniDisplay.cs
Interop/MiniDisplayInterop.csproj
Interop/MiniDisplayInterop.sln
Interop/Properties/AssemblyInfo.cs
LibMiniDisplay.nuspec
LibMiniDisplay.targets
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Interop/MiniDisplay.cs	Wed May 06 21:03:53 2015 +0200
     1.3 @@ -0,0 +1,151 @@
     1.4 +using System;
     1.5 +using System.Collections.Generic;
     1.6 +using System.Text;
     1.7 +using System.Runtime.InteropServices;
     1.8 +
     1.9 +namespace MiniDisplay
    1.10 +{
    1.11 +    public class Interop
    1.12 +    {
    1.13 +
    1.14 +		//[Serializable]
    1.15 +		public enum TMiniDisplayType
    1.16 +		{
    1.17 +			EMiniDisplayAutoDetect, /*Not yet implemented*/
    1.18 +			//[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")]
    1.19 +			EMiniDisplayFutabaGP1212A01,
    1.20 +			//[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")]
    1.21 +			EMiniDisplayFutabaGP1212A02
    1.22 +		};
    1.23 +
    1.24 +		/// <summary>
    1.25 +		/// 
    1.26 +		/// </summary>
    1.27 +		public enum TMiniDisplayRequest
    1.28 +		{
    1.29 +			EMiniDisplayRequestNone,
    1.30 +			EMiniDisplayRequestDeviceId,
    1.31 +			EMiniDisplayRequestFirmwareRevision,
    1.32 +			EMiniDisplayRequestPowerSupplyStatus
    1.33 +		};
    1.34 +
    1.35 +
    1.36 +		/// <summary>
    1.37 +		/// Define the various type of icons we support.
    1.38 +		/// For binary compatibility new entries must be added at the end.
    1.39 +		/// </summary>
    1.40 +		public enum TMiniDisplayIconType
    1.41 +		{
    1.42 +			EMiniDisplayIconNetworkSignal = 0,
    1.43 +			EMiniDisplayIconInternet,
    1.44 +			EMiniDisplayIconEmail,
    1.45 +			EMiniDisplayIconMute,
    1.46 +			EMiniDisplayIconVolume,
    1.47 +			EMiniDisplayIconVolumeLabel,
    1.48 +			EMiniDisplayIconPlay,
    1.49 +			EMiniDisplayIconPause,
    1.50 +			EMiniDisplayIconRecording
    1.51 +		};
    1.52 +
    1.53 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.54 +		public static extern IntPtr MiniDisplayOpen(TMiniDisplayType aType);
    1.55 +
    1.56 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.57 +		public static extern void MiniDisplayClose(IntPtr aDevice);
    1.58 +
    1.59 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.60 +		public static extern int MiniDisplayTypeCount();
    1.61 +
    1.62 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.63 +		public static extern IntPtr MiniDisplayTypeName(TMiniDisplayType aType);
    1.64 +
    1.65 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.66 +		public static extern void MiniDisplayClear(IntPtr aDevice);
    1.67 +
    1.68 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.69 +		public static extern void MiniDisplayFill(IntPtr aDevice);
    1.70 +
    1.71 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.72 +		public static extern void MiniDisplaySwapBuffers(IntPtr aDevice);
    1.73 +
    1.74 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.75 +		public static extern void MiniDisplaySetBrightness(IntPtr aDevice, int aBrightness);
    1.76 +
    1.77 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.78 +		public static extern int MiniDisplayMinBrightness(IntPtr aDevice);
    1.79 +
    1.80 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.81 +		public static extern int MiniDisplayMaxBrightness(IntPtr aDevice);
    1.82 +
    1.83 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.84 +		public static extern int MiniDisplayWidthInPixels(IntPtr aDevice);
    1.85 +
    1.86 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.87 +		public static extern int MiniDisplayHeightInPixels(IntPtr aDevice);
    1.88 +
    1.89 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.90 +		public static extern int MiniDisplaySetPixel(IntPtr aDevice, int aX, int aY, uint aValue);
    1.91 +
    1.92 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.93 +		public static extern IntPtr MiniDisplayVendor(IntPtr aDevice);
    1.94 +
    1.95 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.96 +		public static extern IntPtr MiniDisplayProduct(IntPtr aDevice);
    1.97 +
    1.98 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.99 +		public static extern IntPtr MiniDisplaySerialNumber(IntPtr aDevice);
   1.100 +
   1.101 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.102 +		public static extern IntPtr MiniDisplayDeviceId(IntPtr aDevice);
   1.103 +
   1.104 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.105 +		public static extern IntPtr MiniDisplayFirmwareRevision(IntPtr aDevice);
   1.106 +
   1.107 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.108 +		[return: MarshalAs(UnmanagedType.I1)]
   1.109 +		public static extern bool MiniDisplayPowerSupplyStatus(IntPtr aDevice);
   1.110 +
   1.111 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.112 +		public static extern void MiniDisplayRequest(IntPtr aDevice, TMiniDisplayRequest aRequest);
   1.113 +
   1.114 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.115 +		public static extern TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(IntPtr aDevice);
   1.116 +
   1.117 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.118 +		public static extern TMiniDisplayRequest MiniDisplayCurrentRequest(IntPtr aDevice);
   1.119 +
   1.120 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.121 +		public static extern void MiniDisplayCancelRequest(IntPtr aDevice);
   1.122 +
   1.123 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.124 +		public static extern void MiniDisplayPowerOn(IntPtr aDevice);
   1.125 +
   1.126 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.127 +		public static extern void MiniDisplayPowerOff(IntPtr aDevice);
   1.128 +
   1.129 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.130 +		[return: MarshalAs(UnmanagedType.I1)]
   1.131 +		public static extern bool MiniDisplaySupportPowerOnOff(IntPtr aDevice);
   1.132 +
   1.133 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.134 +		public static extern void MiniDisplayShowClock(IntPtr aDevice);
   1.135 +
   1.136 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.137 +		public static extern void MiniDisplayHideClock(IntPtr aDevice);
   1.138 +
   1.139 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.140 +		[return: MarshalAs(UnmanagedType.I1)]
   1.141 +		public static extern bool MiniDisplaySupportClock(IntPtr aDevice);
   1.142 +
   1.143 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.144 +		public static extern int MiniDisplayIconCount(IntPtr aDevice, TMiniDisplayIconType aIcon);
   1.145 +
   1.146 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.147 +		public static extern int MiniDisplayIconStatusCount(IntPtr aDevice, TMiniDisplayIconType aIcon);
   1.148 +
   1.149 +		[DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
   1.150 +		public static extern void MiniDisplaySetIconStatus(IntPtr aDevice, TMiniDisplayIconType aIcon, int aIndex, int aStatus);
   1.151 +
   1.152 +
   1.153 +    }
   1.154 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Interop/MiniDisplayInterop.csproj	Wed May 06 21:03:53 2015 +0200
     2.3 @@ -0,0 +1,49 @@
     2.4 +<?xml version="1.0" encoding="utf-8"?>
     2.5 +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     2.6 +  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
     2.7 +  <PropertyGroup>
     2.8 +    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     2.9 +    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    2.10 +    <ProjectGuid>{C2328BBD-3B13-4E02-B967-A7283FEB22C9}</ProjectGuid>
    2.11 +    <OutputType>Library</OutputType>
    2.12 +    <AppDesignerFolder>Properties</AppDesignerFolder>
    2.13 +    <RootNamespace>MiniDisplayInterop</RootNamespace>
    2.14 +    <AssemblyName>MiniDisplayInterop</AssemblyName>
    2.15 +    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    2.16 +    <FileAlignment>512</FileAlignment>
    2.17 +  </PropertyGroup>
    2.18 +  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    2.19 +    <DebugSymbols>true</DebugSymbols>
    2.20 +    <DebugType>full</DebugType>
    2.21 +    <Optimize>false</Optimize>
    2.22 +    <OutputPath>bin\Debug\</OutputPath>
    2.23 +    <DefineConstants>DEBUG;TRACE</DefineConstants>
    2.24 +    <ErrorReport>prompt</ErrorReport>
    2.25 +    <WarningLevel>4</WarningLevel>
    2.26 +  </PropertyGroup>
    2.27 +  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    2.28 +    <DebugType>pdbonly</DebugType>
    2.29 +    <Optimize>true</Optimize>
    2.30 +    <OutputPath>bin\Release\</OutputPath>
    2.31 +    <DefineConstants>TRACE</DefineConstants>
    2.32 +    <ErrorReport>prompt</ErrorReport>
    2.33 +    <WarningLevel>4</WarningLevel>
    2.34 +  </PropertyGroup>
    2.35 +  <ItemGroup>
    2.36 +    <Reference Include="System" />
    2.37 +    <Reference Include="System.Data" />
    2.38 +    <Reference Include="System.Xml" />
    2.39 +  </ItemGroup>
    2.40 +  <ItemGroup>
    2.41 +    <Compile Include="MiniDisplay.cs" />
    2.42 +    <Compile Include="Properties\AssemblyInfo.cs" />
    2.43 +  </ItemGroup>
    2.44 +  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    2.45 +  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
    2.46 +       Other similar extension points exist, see Microsoft.Common.targets.
    2.47 +  <Target Name="BeforeBuild">
    2.48 +  </Target>
    2.49 +  <Target Name="AfterBuild">
    2.50 +  </Target>
    2.51 +  -->
    2.52 +</Project>
    2.53 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Interop/MiniDisplayInterop.sln	Wed May 06 21:03:53 2015 +0200
     3.3 @@ -0,0 +1,22 @@
     3.4 +
     3.5 +Microsoft Visual Studio Solution File, Format Version 12.00
     3.6 +# Visual Studio 2013
     3.7 +VisualStudioVersion = 12.0.31101.0
     3.8 +MinimumVisualStudioVersion = 10.0.40219.1
     3.9 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniDisplayInterop", "MiniDisplayInterop.csproj", "{C2328BBD-3B13-4E02-B967-A7283FEB22C9}"
    3.10 +EndProject
    3.11 +Global
    3.12 +	GlobalSection(SolutionConfigurationPlatforms) = preSolution
    3.13 +		Debug|Any CPU = Debug|Any CPU
    3.14 +		Release|Any CPU = Release|Any CPU
    3.15 +	EndGlobalSection
    3.16 +	GlobalSection(ProjectConfigurationPlatforms) = postSolution
    3.17 +		{C2328BBD-3B13-4E02-B967-A7283FEB22C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    3.18 +		{C2328BBD-3B13-4E02-B967-A7283FEB22C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
    3.19 +		{C2328BBD-3B13-4E02-B967-A7283FEB22C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
    3.20 +		{C2328BBD-3B13-4E02-B967-A7283FEB22C9}.Release|Any CPU.Build.0 = Release|Any CPU
    3.21 +	EndGlobalSection
    3.22 +	GlobalSection(SolutionProperties) = preSolution
    3.23 +		HideSolutionNode = FALSE
    3.24 +	EndGlobalSection
    3.25 +EndGlobal
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/Interop/Properties/AssemblyInfo.cs	Wed May 06 21:03:53 2015 +0200
     4.3 @@ -0,0 +1,36 @@
     4.4 +using System.Reflection;
     4.5 +using System.Runtime.CompilerServices;
     4.6 +using System.Runtime.InteropServices;
     4.7 +
     4.8 +// General Information about an assembly is controlled through the following 
     4.9 +// set of attributes. Change these attribute values to modify the information
    4.10 +// associated with an assembly.
    4.11 +[assembly: AssemblyTitle("MiniDisplayInterop")]
    4.12 +[assembly: AssemblyDescription("")]
    4.13 +[assembly: AssemblyConfiguration("")]
    4.14 +[assembly: AssemblyCompany("")]
    4.15 +[assembly: AssemblyProduct("MiniDisplayInterop")]
    4.16 +[assembly: AssemblyCopyright("Copyright ©  2015")]
    4.17 +[assembly: AssemblyTrademark("")]
    4.18 +[assembly: AssemblyCulture("")]
    4.19 +
    4.20 +// Setting ComVisible to false makes the types in this assembly not visible 
    4.21 +// to COM components.  If you need to access a type in this assembly from 
    4.22 +// COM, set the ComVisible attribute to true on that type.
    4.23 +[assembly: ComVisible(false)]
    4.24 +
    4.25 +// The following GUID is for the ID of the typelib if this project is exposed to COM
    4.26 +[assembly: Guid("5d6efa59-b758-4f09-884d-ef351cb279bc")]
    4.27 +
    4.28 +// Version information for an assembly consists of the following four values:
    4.29 +//
    4.30 +//      Major Version
    4.31 +//      Minor Version 
    4.32 +//      Build Number
    4.33 +//      Revision
    4.34 +//
    4.35 +// You can specify all the values or you can default the Build and Revision Numbers 
    4.36 +// by using the '*' as shown below:
    4.37 +// [assembly: AssemblyVersion("1.0.*")]
    4.38 +[assembly: AssemblyVersion("1.0.0.0")]
    4.39 +[assembly: AssemblyFileVersion("1.0.0.0")]
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/LibMiniDisplay.nuspec	Wed May 06 21:03:53 2015 +0200
     5.3 @@ -0,0 +1,22 @@
     5.4 +<?xml version="1.0" encoding="utf-8"?>
     5.5 +<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     5.6 +    <metadata>
     5.7 +        <id>LibMiniDisplay</id>
     5.8 +        <version>1.1.3</version>
     5.9 +        <title>Mini Display Library</title>
    5.10 +        <authors>Stéphane Lenclud</authors>
    5.11 +        <licenseUrl>https://www.gnu.org/copyleft/gpl.html</licenseUrl>
    5.12 +        <projectUrl>http://hg.slions.net/MiniDisplay</projectUrl>
    5.13 +        <requireLicenseAcceptance>false</requireLicenseAcceptance>
    5.14 +        <description>Provide a C interface to drive some Futaba VFD displays.</description>
    5.15 +        <summary>Currently only supports HID USB conections.</summary>
    5.16 +        <copyright>Stéphane Lenclud</copyright>
    5.17 +        <tags>VFD LCD display module Futaba</tags>
    5.18 +    </metadata>
    5.19 +    <files>
    5.20 +        <file src="LibMiniDisplay.targets" target="build\LibMiniDisplay.targets" />
    5.21 +        <file src="MiniDisplay.h" target="content\MiniDisplay.h" />
    5.22 +        <file src="Interop\bin\Release\MiniDisplayInterop.dll" target="lib\MiniDisplayInterop.dll" />
    5.23 +        <file src="..\bin\MiniDisplay\Release\MiniDisplay.dll" target="native\x86\MiniDisplay.dll" />
    5.24 +    </files>
    5.25 +</package>
    5.26 \ No newline at end of file
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/LibMiniDisplay.targets	Wed May 06 21:03:53 2015 +0200
     6.3 @@ -0,0 +1,33 @@
     6.4 +<!--
     6.5 +***********************************************************************************************
     6.6 +LibMiniDisplay.targets
     6.7 +
     6.8 +WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
     6.9 +          created a backup copy.  Incorrect changes to this file will make it
    6.10 +          impossible to load or build your projects from the command-line or the IDE.
    6.11 +
    6.12 +Copyright (c) Stephane Lenclud. All rights reserved.
    6.13 +***********************************************************************************************
    6.14 +-->
    6.15 +
    6.16 +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    6.17 +  <PropertyGroup>
    6.18 +    <LibMiniDisplayDllPath Condition=" '$(LibMiniDisplayPath)' == '' ">$(MSBuildThisFileDirectory)..\native\$(Platform)\MiniDisplay.dll</LibMiniDisplayDllPath>
    6.19 +  </PropertyGroup>  
    6.20 +
    6.21 +  <Target Name="CopyLibMiniDisplayNativeReference">
    6.22 +    <!-- Make sure the platform has been set appropriately before trying to copy the native reference. -->
    6.23 +    <Error Code="LH0001" Text="The project platform must be set to x86 or x64. Please change your target platform and try again." Condition=" !Exists('$(LibMiniDisplayDllPath)') " 
    6.24 +           File="$(MSBuildProjectFile)"/>
    6.25 +    
    6.26 +    <Copy SourceFiles="$(LibMiniDisplayDllPath)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true"/>
    6.27 +  </Target>
    6.28 +
    6.29 +  <PropertyGroup>
    6.30 +    <AfterBuildDependsOn>
    6.31 +      CopyLibMiniDisplayNativeReference;
    6.32 +    </AfterBuildDependsOn>
    6.33 +  </PropertyGroup>
    6.34 +  
    6.35 +  <Target Name="AfterBuild" DependsOnTargets="$(AfterBuildDependsOn)"/>
    6.36 +</Project>
    6.37 \ No newline at end of file