diff options
| author | Luke <[email protected]> | 2017-11-28 00:22:11 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-11-28 00:22:11 -0800 |
| commit | 79bbbca2f6e37d94fbbbd60d12c5c1e7dde650da (patch) | |
| tree | 793ff943b8b641f95d05401156badd42da4a0f12 /general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp | |
| parent | ed1df9a8b80b154b71b79635e40af75f4f19001c (diff) | |
| parent | 2817004092cee784d4aaf36c045fdb5b0bc09f7e (diff) | |
Merge pull request #1 from Microsoft/master
Updating Local
Diffstat (limited to 'general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp')
20 files changed, 2563 insertions, 0 deletions
diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.SCCD b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.SCCD new file mode 100644 index 00000000..cad58db2 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.SCCD @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<CustomCapabilityDescriptor xmlns="http://schemas.microsoft.com/appx/2016/sccd" xmlns:s="http://schemas.microsoft.com/appx/2016/sccd"> + <CustomCapabilities> + <CustomCapability Name="microsoft.hsaTestCustomCapability_q536wpkpf5cy2"></CustomCapability> + </CustomCapabilities> + <AuthorizedEntities> + <AuthorizedEntity AppPackageFamilyName="Microsoft.SDKSamples.CustomCapability.CPP_8wekyb3d8bbwe" CertificateSignatureHash="ca9fc964db7e0c2938778f4559946833e7a8cfde0f3eaa07650766d4764e86c4"></AuthorizedEntity> + <AuthorizedEntity AppPackageFamilyName="Microsoft.SDKSamples.CustomCapability.CPP_8wekyb3d8bbwe" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity> + </AuthorizedEntities> + <Catalog>xxxx</Catalog> +</CustomCapabilityDescriptor> diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj new file mode 100644 index 00000000..8efaa78d --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj @@ -0,0 +1,287 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Label="Globals"> + <ProjectGuid>{0213712b-62e6-5546-8d25-79b90244ffa9}</ProjectGuid> + <RootNamespace>SDKTemplate</RootNamespace> + <DefaultLanguage>en-US</DefaultLanguage> + <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> + <AppContainerApplication>true</AppContainerApplication> + <ApplicationType>Windows Store</ApplicationType> + <WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion> + <WindowsTargetPlatformMinVersion>10.0.15063.0</WindowsTargetPlatformMinVersion> + <ApplicationTypeRevision>10.0</ApplicationTypeRevision> + <ProjectName>CustomCapability</ProjectName> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|ARM"> + <Configuration>Debug</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v141</PlatformToolset> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v141</PlatformToolset> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v141</PlatformToolset> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <IncludePath>$(IncludePath);..\..\..\SharedContent\cpp</IncludePath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>false</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>false</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>false</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="ServiceViewModel.h" /> + <ClInclude Include="pch.h" /> + <ClInclude Include="..\..\..\SharedContent\cpp\App.xaml.h"> + <DependentUpon>..\..\..\SharedContent\xaml\App.xaml</DependentUpon> + </ClInclude> + <ClInclude Include="..\..\..\SharedContent\cpp\MainPage.xaml.h"> + <DependentUpon>..\..\..\SharedContent\cpp\MainPage.xaml</DependentUpon> + </ClInclude> + <ClInclude Include="Scenario1_MeteringData.xaml.h"> + <DependentUpon>Scenario1_MeteringData.xaml</DependentUpon> + </ClInclude> + <ClInclude Include="RpcClient.h" /> + <ClInclude Include="SampleConfiguration.h" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="..\..\..\SharedContent\xaml\App.xaml"> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Page Include="..\..\..\SharedContent\xaml\Styles.xaml"> + <Link>Styles\Styles.xaml</Link> + </Page> + <Page Include="..\..\..\SharedContent\cpp\MainPage.xaml"> + <SubType>Designer</SubType> + </Page> + <Page Include="Scenario1_MeteringData.xaml"> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest"> + <SubType>Designer</SubType> + </AppxManifest> + </ItemGroup> + <ItemGroup> + <Image Include="..\..\..\SharedContent\media\microsoft-sdk.png"> + <Link>Assets\microsoft-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\smalltile-sdk.png"> + <Link>Assets\smalltile-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\splash-sdk.png"> + <Link>Assets\splash-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\squaretile-sdk.png"> + <Link>Assets\squaretile-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\storelogo-sdk.png"> + <Link>Assets\storelogo-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\tile-sdk.png"> + <Link>Assets\tile-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\windows-sdk.png"> + <Link>Assets\windows-sdk.png</Link> + </Image> + </ItemGroup> + <ItemGroup> + <ClCompile Include="RpcInterface.c"> + <CompileAsWinRT>false</CompileAsWinRT> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + </ClCompile> + <ClCompile Include="..\..\..\SharedContent\cpp\App.xaml.cpp"> + <DependentUpon>..\..\..\SharedContent\xaml\App.xaml</DependentUpon> + </ClCompile> + <ClCompile Include="..\..\..\SharedContent\cpp\MainPage.xaml.cpp"> + <DependentUpon>..\..\..\SharedContent\cpp\MainPage.xaml</DependentUpon> + </ClCompile> + <ClCompile Include="ServiceViewModel.cpp" /> + <ClCompile Include="Scenario1_MeteringData.xaml.cpp"> + <DependentUpon>Scenario1_MeteringData.xaml</DependentUpon> + </ClCompile> + <ClCompile Include="SampleConfiguration.cpp" /> + <ClCompile Include="pch.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> + </ClCompile> + <ClCompile Include="RpcClient.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader> + </ClCompile> + </ItemGroup> + <ItemGroup> + <SDKReference Include="WindowsDesktop, Version=10.0.15063.0" /> + </ItemGroup> + <ItemGroup> + <None Include="..\..\..\..\Toaster Driver\Service\RpcInterface.acf" /> + </ItemGroup> + <ItemGroup> + <Midl Include="..\..\..\..\Toaster Driver\Service\RpcInterface.Idl" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj.filters b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj.filters new file mode 100644 index 00000000..af84bc38 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj.filters @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Common"> + <UniqueIdentifier>81d95eea-286c-4a5e-98f1-eef612020bf0</UniqueIdentifier> + </Filter> + <Filter Include="Assets"> + <UniqueIdentifier>85b464d3-9e56-4242-b58b-1f226dd034b4</UniqueIdentifier> + <Extensions>bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png</Extensions> + </Filter> + <Filter Include="ViewModel"> + <UniqueIdentifier>{1c0f2943-52c2-4a54-93a2-971c14e7c8ec}</UniqueIdentifier> + </Filter> + <Filter Include="Model"> + <UniqueIdentifier>{33085be2-4c37-4eab-8f6e-6add0cffe2d4}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="..\..\..\SharedContent\xaml\App.xaml" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="pch.cpp" /> + <ClCompile Include="RpcClient.cpp"> + <Filter>Model</Filter> + </ClCompile> + <ClCompile Include="SampleConfiguration.cpp"> + <Filter>Common</Filter> + </ClCompile> + <ClCompile Include="Scenario1_MeteringData.xaml.cpp" /> + <ClCompile Include="..\..\..\SharedContent\cpp\App.xaml.cpp" /> + <ClCompile Include="..\..\..\SharedContent\cpp\MainPage.xaml.cpp" /> + <ClCompile Include="ServiceViewModel.cpp"> + <Filter>ViewModel</Filter> + </ClCompile> + <ClCompile Include="RpcInterface.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="pch.h" /> + <ClInclude Include="RpcClient.h"> + <Filter>Model</Filter> + </ClInclude> + <ClInclude Include="SampleConfiguration.h"> + <Filter>Common</Filter> + </ClInclude> + <ClInclude Include="Scenario1_MeteringData.xaml.h" /> + <ClInclude Include="..\..\..\SharedContent\cpp\App.xaml.h" /> + <ClInclude Include="..\..\..\SharedContent\cpp\MainPage.xaml.h" /> + <ClInclude Include="ServiceViewModel.h"> + <Filter>ViewModel</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Image Include="..\..\..\SharedContent\media\microsoft-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\smalltile-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\splash-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\squaretile-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\storelogo-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\tile-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\windows-sdk.png"> + <Filter>Assets</Filter> + </Image> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest" /> + </ItemGroup> + <ItemGroup> + <Page Include="Scenario1_MeteringData.xaml" /> + <Page Include="..\..\..\SharedContent\xaml\Styles.xaml" /> + <Page Include="..\..\..\SharedContent\cpp\MainPage.xaml" /> + </ItemGroup> + <ItemGroup> + <None Include="..\..\..\..\Toaster Driver\Service\RpcInterface.acf" /> + </ItemGroup> + <ItemGroup> + <Midl Include="..\..\..\..\Toaster Driver\Service\RpcInterface.Idl" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/DeviceList.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/DeviceList.cpp new file mode 100644 index 00000000..cb3a7a8e --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/DeviceList.cpp @@ -0,0 +1,244 @@ +#include "pch.h" +#include "DeviceList.h" +#include "MainPage.xaml.h" +#include "App.xaml.h" + +using namespace SDKTemplate; + +using namespace Platform; +using namespace Platform::Collections; +using namespace Windows::ApplicationModel; +using namespace Windows::Devices::Enumeration; +using namespace Windows::Devices::Custom; +using namespace Windows::Foundation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Documents; + +DeviceList^ DeviceList::_Current = nullptr; + +DeviceList^ DeviceList::Current::get() +{ + if (DeviceList::_Current == nullptr) + { + DeviceList::_Current = ref new DeviceList(); + } + return DeviceList::_Current; +} + +DeviceList::DeviceList() : m_WatcherStarted(false), m_WatcherSuspended(false) +{ + m_Fx2Watcher = nullptr; + m_List = ref new Vector<DeviceListEntry^>(); + InitDeviceWatcher(); + + // Register for app suspend/resume handlers + App::Current->Suspending += ref new SuspendingEventHandler(this, &DeviceList::SuspendDeviceWatcher); + App::Current->Resuming += ref new EventHandler<Object^>(this, &DeviceList::ResumeDeviceWatcher); +} + +void DeviceList::InitDeviceWatcher() +{ + // Define the selector to enumerate all of the fx2 device interface class instances. + // Use the DeviceInterfaceGuid provided by the driver (Fx2Driver, in this case). + auto selector = CustomDevice::GetDeviceSelector(Fx2Driver::DeviceInterfaceGuid); + + // Set of properties to retrieve + auto properties = ref new Vector<String^>({ "System.Devices.DeviceInstanceId" }); + + // Create a device watcher to look for instances of the fx2 device interface. + m_Fx2Watcher = DeviceInformation::CreateWatcher(selector, properties); + + m_Fx2Watcher->Added += ref new TypedEventHandler<DeviceWatcher^, DeviceInformation^>(this, &DeviceList::OnFx2Added); + m_Fx2Watcher->Removed += ref new TypedEventHandler<DeviceWatcher^, DeviceInformationUpdate^>(this, &DeviceList::OnFx2Removed); + m_Fx2Watcher->EnumerationCompleted += ref new TypedEventHandler<DeviceWatcher^, Object^>(this, &DeviceList::OnFx2EnumerationComplete); +} + +void DeviceList::StartFx2Watcher() +{ + MainPage::Current->NotifyUser("starting device watcher", NotifyType::StatusMessage); + + std::for_each( + begin(m_List), + end(m_List), + [](DeviceListEntry^ Entry) { + Entry->Matched = false; + }); + + WatcherStarted = true; + m_Fx2Watcher->Start(); +} + +void DeviceList::StopFx2Watcher() +{ + MainPage::Current->NotifyUser("stopping fx2 watcher", NotifyType::StatusMessage); + m_Fx2Watcher->Stop(); + WatcherStarted = false; +} + +void DeviceList::CreateBooleanTable( + InlineCollection^ Table, + const Platform::Array<bool>^ NewValues, + const Platform::Array<bool>^ OldValues, + String^ /* IndexTitle */, + String^ /* ValueTitle */, + String^ TrueValue, + String^ FalseValue) +{ + Table->Clear(); + + for (int i = 0; i < (int)NewValues->Length; i += 1) + { + auto line = ref new Span(); + auto block = ref new Run(); + block->Text = (i + 1).ToString(); + line->Inlines->Append(block); + + block = ref new Run(); + block->Text = " "; + line->Inlines->Append(block); + + block = ref new Run(); + block->Text = NewValues[i] ? TrueValue : FalseValue; + + if ((OldValues != nullptr) && (OldValues[i] != NewValues[i])) + { + auto bold = ref new Bold(); + bold->Inlines->Append(block); + line->Inlines->Append(bold); + } + else + { + line->Inlines->Append(block); + } + + line->Inlines->Append(ref new LineBreak()); + + Table->Append(line); + } +} + +DeviceListEntry^ DeviceList::FindDevice(String^ Id) +{ + auto i = std::find_if( + begin(m_List), + end(m_List), + [Id](DeviceListEntry^ e) {return e->Id == Id; }); + + if (i == end(m_List)) + { + return nullptr; + } + else + { + return *i; + } +} + +void DeviceList::OnFx2Added(DeviceWatcher ^ /* Sender */, DeviceInformation^ DevInterface) +{ + MainPage::Current->Dispatcher->RunAsync( + CoreDispatcherPriority::Normal, + ref new DispatchedHandler( + [this, DevInterface]()->void + { + MainPage::Current->NotifyUser("OnFx2Added: " + DevInterface->Id, NotifyType::StatusMessage); + + // search the device list for a device with a matching interface ID + auto match = FindDevice(DevInterface->Id); + + // If we found a match then mark it as verified and return + if (match != nullptr) + { + match->Matched = true; + return; + } + + // Create a new elemetn for this device interface, and queue up the query of its + // device information + match = ref new DeviceListEntry(DevInterface); + + // Add the new element to the end of the list of devices + m_List->Append(match); + })); +} + +void DeviceList::OnFx2Removed(DeviceWatcher ^ /* Sender */, DeviceInformationUpdate^ DevInterface) +{ + auto deviceId = DevInterface->Id; + + MainPage::Current->Dispatcher->RunAsync( + CoreDispatcherPriority::Normal, + ref new DispatchedHandler( + [this, deviceId]() + { + MainPage::Current->NotifyUser("OnFx2Removed: " + deviceId, NotifyType::StatusMessage); + + // Search the list of devices for one with a matching ID. Move the matched + // item to the end of the list. + auto i = std::remove_if( + begin(m_List), + end(m_List), + [deviceId](DeviceListEntry^ e) {return e->Id == deviceId; }); + + // if there's no match return. + if (i == end(m_List)) + { + return; + } + + // Remove the last item from the list. + MainPage::Current->NotifyUser("OnFx2Removed: " + deviceId + " removed", NotifyType::StatusMessage); + m_List->RemoveAtEnd(); + })); +} + +void DeviceList::OnFx2EnumerationComplete(DeviceWatcher ^ /* Sender */, Object ^ /* o */) +{ + MainPage::Current->Dispatcher->RunAsync( + CoreDispatcherPriority::Normal, + ref new DispatchedHandler( + [this]() + { + MainPage::Current->NotifyUser("OnFx2EnumerationComplete", NotifyType::StatusMessage); + + DeviceList^ me = this; + + // Move all the unmatched elements to the end of the list + auto i = std::remove_if( + begin(m_List), + end(m_List), + [](DeviceListEntry^ e) { return e->Matched == false; }); + + // Determine the number of unmatched entries + auto unmatchedCount = end(m_List) - i; + + while (unmatchedCount > 0) + { + m_List->RemoveAtEnd(); + unmatchedCount -= 1; + } + })); +} + +void DeviceList::SuspendDeviceWatcher(Object^, SuspendingEventArgs^) +{ + if (WatcherStarted) + { + m_WatcherSuspended = true; + StopFx2Watcher(); + } + else + { + m_WatcherSuspended = false; + } +} + +void DeviceList::ResumeDeviceWatcher(Object^, Object^) +{ + if (m_WatcherSuspended) + { + m_WatcherSuspended = false; + StartFx2Watcher(); + } +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Package.appxmanifest b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Package.appxmanifest new file mode 100644 index 00000000..0ec45a07 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Package.appxmanifest @@ -0,0 +1,41 @@ +<?xml version='1.0' encoding='utf-8'?> +<Package + xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" + xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" + xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" + xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4" + IgnorableNamespaces="uap mp uap4" + > + <Identity Name="Microsoft.SDKSamples.CustomCapability.CPP" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="1.0.0.0" /> + <mp:PhoneIdentity PhoneProductId="26388851-6c33-4124-b1e5-96e859da28bf" PhonePublisherId="00000000-0000-0000-0000-000000000000"/> + <Properties> + <DisplayName>Custom Capability C++ Sample</DisplayName> + <PublisherDisplayName>Microsoft Corporation</PublisherDisplayName> + <Logo>Assets\StoreLogo-sdk.png</Logo> + </Properties> + <Dependencies> + <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.15063.0" MaxVersionTested="10.0.15063.0"/> + </Dependencies> + <Resources> + <Resource Language="x-generate"/> + </Resources> + <Applications> + <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="CustomCapability.App"> + <uap:VisualElements + DisplayName="Custom Capability C++ sample" + Square150x150Logo="Assets\squareTile-sdk.png" + Square44x44Logo="Assets\smallTile-sdk.png" + Description="Hsa C++ sample" + BackgroundColor="#00B2F0" + > + <uap:SplashScreen Image="Assets\splash-sdk.png"/> + <uap:DefaultTile> + <uap:ShowNameOnTiles> + <uap:ShowOn Tile="square150x150Logo"/> + </uap:ShowNameOnTiles> + </uap:DefaultTile> + </uap:VisualElements> + </Application> + </Applications> + +</Package> diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp new file mode 100644 index 00000000..870d6306 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp @@ -0,0 +1,177 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +// There is an error in the system header files that incorrectly +// places RpcStringBindingCompose in the app partition. +// Work around it by changing the WINAPI_FAMILY to desktop temporarily. +#pragma push_macro("WINAPI_FAMILY") +#undef WINAPI_FAMILY +#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP +#include "RpcClient.h" +#pragma pop_macro("WINAPI_FAMILY") + +using namespace SDKTemplate; + +__int64 RpcClient::Initialize() +{ + RPC_STATUS status; + RPC_WSTR pszStringBinding = nullptr; + + status = RpcStringBindingCompose( + NULL, + reinterpret_cast<RPC_WSTR>(L"ncalrpc"), + NULL, + reinterpret_cast<RPC_WSTR>(RPC_STATIC_ENDPOINT), + NULL, + &pszStringBinding); + + if (status) + { + goto error_status; + } + + status = RpcBindingFromStringBinding( + pszStringBinding, + &hRpcBinding); + + if (status) + { + goto error_status; + } + + status = RpcStringFree(&pszStringBinding); + + if (status) + { + goto error_status; + } + + RpcTryExcept + { + ::RemoteOpen(hRpcBinding, &phContext); + } + RpcExcept(1) + { + status = RpcExceptionCode(); + } + RpcEndExcept + +error_status: + + return status; +} + +// +// Make RPC call to start metering. This is a blocking call and +// will return only after StopMetering is called. +// +__int64 RpcClient::StartMeteringAndWaitForStop(__int64 samplePeriod) +{ + __int64 ulCode = 0; + CallbackCount = 0; + MeteringData = 0; + + RpcTryExcept + { + ::StartMetering(phContext, samplePeriod, (__int64)this); + } + RpcExcept(1) + { + ulCode = RpcExceptionCode(); + } + RpcEndExcept + + return ulCode; +} + + +// +// Make rpc call SetSampleRate +// +__int64 RpcClient::SetSampleRate(int rate) +{ + __int64 ulCode = 0; + RpcTryExcept + { + ::SetSamplePeriod(phContext, rate); + } + RpcExcept(1) + { + ulCode = RpcExceptionCode(); + } + RpcEndExcept + return ulCode; +} + +// +// Make rpc call StopMetering +// +__int64 RpcClient::StopMetering() +{ + __int64 ulCode = 0; + RpcTryExcept + { + ::StopMetering(phContext); + } + RpcExcept(1) + { + ulCode = RpcExceptionCode(); + } + RpcEndExcept + return ulCode; +} + +RpcClient::~RpcClient() +{ + RPC_STATUS status; + + if (hRpcBinding != NULL) + { + RpcTryExcept + { + ::RemoteClose(&phContext); + } + RpcExcept(1) + { + // Ignoring the result of RemoteClose as nothing can be + // done on the client side with this return code + status = RpcExceptionCode(); + } + RpcEndExcept + + status = RpcBindingFree(&hRpcBinding); + hRpcBinding = NULL; + } +} + +// +// Metering rpc callback +// +void MeteringDataEvent(__int64 data, __int64 context) +{ + RpcClient* client = static_cast<RpcClient*>((PVOID)context); + client->MeteringData = data; + ++client->CallbackCount; +} + +///******************************************************/ +///* MIDL allocate and free */ +///******************************************************/ + +void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) +{ + return(malloc(len)); +} + +void __RPC_USER midl_user_free(void __RPC_FAR * ptr) +{ + free(ptr); +}
\ No newline at end of file diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.h new file mode 100644 index 00000000..0ee5ff78 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.h @@ -0,0 +1,30 @@ +// +// RpcClient.h +// + +#pragma once + +#define RPC_STATIC_ENDPOINT L"HsaSampleRpcEndpoint" + +#include "RpcInterface_h.h" + +namespace SDKTemplate +{ + /// <summary> + /// Client side RPC implementation + /// </summary> + private class RpcClient sealed + { + public: + ~RpcClient(); + __int64 Initialize(); + __int64 StartMeteringAndWaitForStop(__int64 samplePeriod); + __int64 StopMetering(); + __int64 SetSampleRate(int rate); + int CallbackCount; + __int64 MeteringData; + private: + handle_t hRpcBinding; + PCONTEXT_HANDLE_TYPE phContext; + }; +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface.c b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface.c new file mode 100644 index 00000000..0f988533 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface.c @@ -0,0 +1,6 @@ +// RpcInterface_c.c expects _ARM_ to be set when building for ARM. +#ifdef _M_ARM +#define _ARM_ 1 +#endif + +#include "RpcInterface_c.c" diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_c.c b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_c.c new file mode 100644 index 00000000..8b05c1ea --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_c.c @@ -0,0 +1,476 @@ + + +/* this ALWAYS GENERATED file contains the RPC client stubs */ + + + /* File created by MIDL compiler version 8.01.0622 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* Compiler settings for C:\WinHEC 2017 Lab\Toaster Driver\Service\RpcInterface.Idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0622 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#if defined(_M_AMD64) + + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif + +#pragma warning( disable: 4211 ) /* redefine extern to static */ +#pragma warning( disable: 4232 ) /* dllimport identity*/ +#pragma warning( disable: 4024 ) /* array to pointer mapping*/ + +#include <string.h> + +#include "RpcInterface_h.h" + +#define TYPE_FORMAT_STRING_SIZE 23 +#define PROC_FORMAT_STRING_SIZE 245 +#define EXPR_FORMAT_STRING_SIZE 1 +#define TRANSMIT_AS_TABLE_SIZE 0 +#define WIRE_MARSHAL_TABLE_SIZE 0 + +typedef struct _RpcInterface_MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_TYPE_FORMAT_STRING; + +typedef struct _RpcInterface_MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_PROC_FORMAT_STRING; + +typedef struct _RpcInterface_MIDL_EXPR_FORMAT_STRING + { + long Pad; + unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_EXPR_FORMAT_STRING; + + +static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax = +{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; + + +extern const RpcInterface_MIDL_TYPE_FORMAT_STRING RpcInterface__MIDL_TypeFormatString; +extern const RpcInterface_MIDL_PROC_FORMAT_STRING RpcInterface__MIDL_ProcFormatString; +extern const RpcInterface_MIDL_EXPR_FORMAT_STRING RpcInterface__MIDL_ExprFormatString; + +#define GENERIC_BINDING_TABLE_SIZE 0 + + +/* Standard interface: RpcInterface, ver. 1.0, + GUID={0x906B0CE0,0xC70B,0x1067,{0xB3,0x17,0x00,0xDD,0x01,0x06,0x62,0xDA}} */ + + +extern const MIDL_SERVER_INFO RpcInterface_ServerInfo; + + +extern const RPC_DISPATCH_TABLE RpcInterface_v1_0_DispatchTable; + +static const RPC_CLIENT_INTERFACE RpcInterface___RpcClientInterface = + { + sizeof(RPC_CLIENT_INTERFACE), + {{0x906B0CE0,0xC70B,0x1067,{0xB3,0x17,0x00,0xDD,0x01,0x06,0x62,0xDA}},{1,0}}, + {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}, + (RPC_DISPATCH_TABLE*)&RpcInterface_v1_0_DispatchTable, + 0, + 0, + 0, + &RpcInterface_ServerInfo, + 0x04000000 + }; +RPC_IF_HANDLE RpcInterface_v1_0_c_ifspec = (RPC_IF_HANDLE)& RpcInterface___RpcClientInterface; + +extern const MIDL_STUB_DESC RpcInterface_StubDesc; + +static RPC_BINDING_HANDLE RpcInterface__MIDL_AutoBindHandle; + + +void RemoteOpen( + /* [in] */ handle_t hBinding, + /* [out] */ PPCONTEXT_HANDLE_TYPE pphContext) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[0], + hBinding, + pphContext); + +} + + +void RemoteClose( + /* [out][in] */ PPCONTEXT_HANDLE_TYPE pphContext) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[36], + pphContext); + +} + + +void StartMetering( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext, + /* [in] */ __int64 samplePeriod, + /* [optional][in] */ __int64 context) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[74], + phContext, + samplePeriod, + context); + +} + + +void SetSamplePeriod( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext, + /* [in] */ __int64 samplePeriod) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[124], + phContext, + samplePeriod); + +} + + +void StopMetering( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[168], + phContext); + +} + + +#if !defined(__RPC_WIN64__) +#error Invalid build platform for this stub. +#endif + +static const RpcInterface_MIDL_PROC_FORMAT_STRING RpcInterface__MIDL_ProcFormatString = + { + 0, + { + + /* Procedure RemoteOpen */ + + 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 2 */ NdrFcLong( 0x0 ), /* 0 */ +/* 6 */ NdrFcShort( 0x0 ), /* 0 */ +/* 8 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 10 */ 0x32, /* FC_BIND_PRIMITIVE */ + 0x0, /* 0 */ +/* 12 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 14 */ NdrFcShort( 0x0 ), /* 0 */ +/* 16 */ NdrFcShort( 0x38 ), /* 56 */ +/* 18 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 20 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 22 */ NdrFcShort( 0x0 ), /* 0 */ +/* 24 */ NdrFcShort( 0x0 ), /* 0 */ +/* 26 */ NdrFcShort( 0x0 ), /* 0 */ +/* 28 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter pphContext */ + +/* 30 */ NdrFcShort( 0x110 ), /* Flags: out, simple ref, */ +/* 32 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 34 */ NdrFcShort( 0x6 ), /* Type Offset=6 */ + + /* Procedure RemoteClose */ + +/* 36 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 38 */ NdrFcLong( 0x0 ), /* 0 */ +/* 42 */ NdrFcShort( 0x1 ), /* 1 */ +/* 44 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 46 */ 0x30, /* FC_BIND_CONTEXT */ + 0xe0, /* Ctxt flags: via ptr, in, out, */ +/* 48 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 50 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 52 */ NdrFcShort( 0x38 ), /* 56 */ +/* 54 */ NdrFcShort( 0x38 ), /* 56 */ +/* 56 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 58 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ +/* 62 */ NdrFcShort( 0x0 ), /* 0 */ +/* 64 */ NdrFcShort( 0x0 ), /* 0 */ +/* 66 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter pphContext */ + +/* 68 */ NdrFcShort( 0x118 ), /* Flags: in, out, simple ref, */ +/* 70 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 72 */ NdrFcShort( 0xe ), /* Type Offset=14 */ + + /* Procedure StartMetering */ + +/* 74 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 76 */ NdrFcLong( 0x0 ), /* 0 */ +/* 80 */ NdrFcShort( 0x2 ), /* 2 */ +/* 82 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 84 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 86 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 88 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 90 */ NdrFcShort( 0x44 ), /* 68 */ +/* 92 */ NdrFcShort( 0x0 ), /* 0 */ +/* 94 */ 0x40, /* Oi2 Flags: has ext, */ + 0x3, /* 3 */ +/* 96 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 98 */ NdrFcShort( 0x0 ), /* 0 */ +/* 100 */ NdrFcShort( 0x0 ), /* 0 */ +/* 102 */ NdrFcShort( 0x0 ), /* 0 */ +/* 104 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 106 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 108 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 110 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Parameter samplePeriod */ + +/* 112 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 114 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 116 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Parameter context */ + +/* 118 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 120 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 122 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Procedure SetSamplePeriod */ + +/* 124 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 126 */ NdrFcLong( 0x0 ), /* 0 */ +/* 130 */ NdrFcShort( 0x3 ), /* 3 */ +/* 132 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 134 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 136 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 138 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 140 */ NdrFcShort( 0x34 ), /* 52 */ +/* 142 */ NdrFcShort( 0x0 ), /* 0 */ +/* 144 */ 0x40, /* Oi2 Flags: has ext, */ + 0x2, /* 2 */ +/* 146 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 148 */ NdrFcShort( 0x0 ), /* 0 */ +/* 150 */ NdrFcShort( 0x0 ), /* 0 */ +/* 152 */ NdrFcShort( 0x0 ), /* 0 */ +/* 154 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 156 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 158 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 160 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Parameter samplePeriod */ + +/* 162 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 164 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 166 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Procedure StopMetering */ + +/* 168 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 170 */ NdrFcLong( 0x0 ), /* 0 */ +/* 174 */ NdrFcShort( 0x4 ), /* 4 */ +/* 176 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 178 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 180 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 182 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 184 */ NdrFcShort( 0x24 ), /* 36 */ +/* 186 */ NdrFcShort( 0x0 ), /* 0 */ +/* 188 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 190 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 192 */ NdrFcShort( 0x0 ), /* 0 */ +/* 194 */ NdrFcShort( 0x0 ), /* 0 */ +/* 196 */ NdrFcShort( 0x0 ), /* 0 */ +/* 198 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 200 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 202 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 204 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Procedure MeteringDataEvent */ + +/* 206 */ 0x34, /* FC_CALLBACK_HANDLE */ + 0x48, /* Old Flags: */ +/* 208 */ NdrFcLong( 0x0 ), /* 0 */ +/* 212 */ NdrFcShort( 0x0 ), /* 0 */ +/* 214 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 216 */ NdrFcShort( 0x20 ), /* 32 */ +/* 218 */ NdrFcShort( 0x0 ), /* 0 */ +/* 220 */ 0x40, /* Oi2 Flags: has ext, */ + 0x2, /* 2 */ +/* 222 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 224 */ NdrFcShort( 0x0 ), /* 0 */ +/* 226 */ NdrFcShort( 0x0 ), /* 0 */ +/* 228 */ NdrFcShort( 0x0 ), /* 0 */ +/* 230 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter data */ + +/* 232 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 234 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 236 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Parameter context */ + +/* 238 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 240 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 242 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const RpcInterface_MIDL_TYPE_FORMAT_STRING RpcInterface__MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ +/* 2 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */ +/* 6 */ 0x30, /* FC_BIND_CONTEXT */ + 0xa0, /* Ctxt flags: via ptr, out, */ +/* 8 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 10 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 12 */ NdrFcShort( 0x2 ), /* Offset= 2 (14) */ +/* 14 */ 0x30, /* FC_BIND_CONTEXT */ + 0xe1, /* Ctxt flags: via ptr, in, out, can't be null */ +/* 16 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 18 */ 0x30, /* FC_BIND_CONTEXT */ + 0x41, /* Ctxt flags: in, can't be null */ +/* 20 */ 0x0, /* 0 */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const unsigned short RpcInterface_FormatStringOffsetTable[] = + { + 0, + 36, + 74, + 124, + 168, + }; + + +static const unsigned short _callbackRpcInterface_FormatStringOffsetTable[] = + { + 206 + }; + + +static const MIDL_STUB_DESC RpcInterface_StubDesc = + { + (void *)& RpcInterface___RpcClientInterface, + MIDL_user_allocate, + MIDL_user_free, + &RpcInterface__MIDL_AutoBindHandle, + 0, + 0, + 0, + 0, + RpcInterface__MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x50002, /* Ndr library version */ + 0, + 0x801026e, /* MIDL Version 8.1.622 */ + 0, + 0, + 0, /* notify & notify_flag routine table */ + 0x1, /* MIDL flag */ + 0, /* cs routines */ + 0, /* proxy/server info */ + 0 + }; + +static const RPC_DISPATCH_FUNCTION RpcInterface_table[] = + { + NdrServerCall2, + 0 + }; +static const RPC_DISPATCH_TABLE RpcInterface_v1_0_DispatchTable = + { + 1, + (RPC_DISPATCH_FUNCTION*)RpcInterface_table + }; + +static const SERVER_ROUTINE RpcInterface_ServerRoutineTable[] = + { + (SERVER_ROUTINE)MeteringDataEvent + }; + +static const MIDL_SERVER_INFO RpcInterface_ServerInfo = + { + &RpcInterface_StubDesc, + RpcInterface_ServerRoutineTable, + RpcInterface__MIDL_ProcFormatString.Format, + _callbackRpcInterface_FormatStringOffsetTable, + 0, + 0, + 0, + 0}; +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + + +#endif /* defined(_M_AMD64)*/ + diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_h.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_h.h new file mode 100644 index 00000000..a0e2dcac --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_h.h @@ -0,0 +1,112 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0622 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* Compiler settings for C:\WinHEC 2017 Lab\Toaster Driver\Service\RpcInterface.Idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0622 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the <rpcndr.h> version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of <rpcndr.h> +#endif /* __RPCNDR_H_VERSION__ */ + + +#ifndef __RpcInterface_h_h__ +#define __RpcInterface_h_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#if defined(__cplusplus) +#if defined(__MIDL_USE_C_ENUM) +#define MIDL_ENUM enum +#else +#define MIDL_ENUM enum class +#endif +#endif + + +/* Forward Declarations */ + +/* header files for imported files */ +#include "oaidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +#ifndef __RpcInterface_INTERFACE_DEFINED__ +#define __RpcInterface_INTERFACE_DEFINED__ + +/* interface RpcInterface */ +/* [unique][version][uuid] */ + +typedef /* [context_handle] */ void *PCONTEXT_HANDLE_TYPE; + +typedef /* [ref] */ PCONTEXT_HANDLE_TYPE *PPCONTEXT_HANDLE_TYPE; + +void RemoteOpen( + /* [in] */ handle_t hBinding, + /* [out] */ PPCONTEXT_HANDLE_TYPE pphContext); + +void RemoteClose( + /* [out][in] */ PPCONTEXT_HANDLE_TYPE pphContext); + +void StartMetering( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext, + /* [in] */ __int64 samplePeriod, + /* [optional][in] */ __int64 context); + +void SetSamplePeriod( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext, + /* [in] */ __int64 samplePeriod); + +void StopMetering( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext); + +/* [callback] */ void MeteringDataEvent( + /* [in] */ __int64 data, + /* [optional][in] */ __int64 context); + + + +extern RPC_IF_HANDLE RpcInterface_v1_0_c_ifspec; +extern RPC_IF_HANDLE RpcInterface_v1_0_s_ifspec; +#endif /* __RpcInterface_INTERFACE_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +void __RPC_USER PCONTEXT_HANDLE_TYPE_rundown( PCONTEXT_HANDLE_TYPE ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_s.c b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_s.c new file mode 100644 index 00000000..ec58170d --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_s.c @@ -0,0 +1,430 @@ + + +/* this ALWAYS GENERATED file contains the RPC server stubs */ + + + /* File created by MIDL compiler version 8.01.0622 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* Compiler settings for C:\WinHEC 2017 Lab\Toaster Driver\Service\RpcInterface.Idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0622 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#if defined(_M_AMD64) + + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif + +#pragma warning( disable: 4211 ) /* redefine extern to static */ +#pragma warning( disable: 4232 ) /* dllimport identity*/ +#pragma warning( disable: 4024 ) /* array to pointer mapping*/ + +#include <string.h> +#include "RpcInterface_h.h" + +#define TYPE_FORMAT_STRING_SIZE 23 +#define PROC_FORMAT_STRING_SIZE 245 +#define EXPR_FORMAT_STRING_SIZE 1 +#define TRANSMIT_AS_TABLE_SIZE 0 +#define WIRE_MARSHAL_TABLE_SIZE 0 + +typedef struct _RpcInterface_MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_TYPE_FORMAT_STRING; + +typedef struct _RpcInterface_MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_PROC_FORMAT_STRING; + +typedef struct _RpcInterface_MIDL_EXPR_FORMAT_STRING + { + long Pad; + unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_EXPR_FORMAT_STRING; + + +static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax = +{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; + +extern const RpcInterface_MIDL_TYPE_FORMAT_STRING RpcInterface__MIDL_TypeFormatString; +extern const RpcInterface_MIDL_PROC_FORMAT_STRING RpcInterface__MIDL_ProcFormatString; +extern const RpcInterface_MIDL_EXPR_FORMAT_STRING RpcInterface__MIDL_ExprFormatString; + +/* Standard interface: RpcInterface, ver. 1.0, + GUID={0x906B0CE0,0xC70B,0x1067,{0xB3,0x17,0x00,0xDD,0x01,0x06,0x62,0xDA}} */ + + +extern const MIDL_SERVER_INFO RpcInterface_ServerInfo; + +extern const RPC_DISPATCH_TABLE RpcInterface_v1_0_DispatchTable; + +static const RPC_SERVER_INTERFACE RpcInterface___RpcServerInterface = + { + sizeof(RPC_SERVER_INTERFACE), + {{0x906B0CE0,0xC70B,0x1067,{0xB3,0x17,0x00,0xDD,0x01,0x06,0x62,0xDA}},{1,0}}, + {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}, + (RPC_DISPATCH_TABLE*)&RpcInterface_v1_0_DispatchTable, + 0, + 0, + 0, + &RpcInterface_ServerInfo, + 0x04000000 + }; +RPC_IF_HANDLE RpcInterface_v1_0_s_ifspec = (RPC_IF_HANDLE)& RpcInterface___RpcServerInterface; + +extern const MIDL_STUB_DESC RpcInterface_StubDesc; + + extern const MIDL_STUBLESS_PROXY_INFO RpcInterface_ProxyInfo; + +/* [callback] */ void MeteringDataEvent( + /* [in] */ __int64 data, + /* [optional][in] */ __int64 context) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[206], + data, + context); + +} + +extern const NDR_RUNDOWN RundownRoutines[]; + +#if !defined(__RPC_WIN64__) +#error Invalid build platform for this stub. +#endif + +static const RpcInterface_MIDL_PROC_FORMAT_STRING RpcInterface__MIDL_ProcFormatString = + { + 0, + { + + /* Procedure RemoteOpen */ + + 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 2 */ NdrFcLong( 0x0 ), /* 0 */ +/* 6 */ NdrFcShort( 0x0 ), /* 0 */ +/* 8 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 10 */ 0x32, /* FC_BIND_PRIMITIVE */ + 0x0, /* 0 */ +/* 12 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 14 */ NdrFcShort( 0x0 ), /* 0 */ +/* 16 */ NdrFcShort( 0x38 ), /* 56 */ +/* 18 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 20 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 22 */ NdrFcShort( 0x0 ), /* 0 */ +/* 24 */ NdrFcShort( 0x0 ), /* 0 */ +/* 26 */ NdrFcShort( 0x0 ), /* 0 */ +/* 28 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter pphContext */ + +/* 30 */ NdrFcShort( 0x110 ), /* Flags: out, simple ref, */ +/* 32 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 34 */ NdrFcShort( 0x6 ), /* Type Offset=6 */ + + /* Procedure RemoteClose */ + +/* 36 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 38 */ NdrFcLong( 0x0 ), /* 0 */ +/* 42 */ NdrFcShort( 0x1 ), /* 1 */ +/* 44 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 46 */ 0x30, /* FC_BIND_CONTEXT */ + 0xe0, /* Ctxt flags: via ptr, in, out, */ +/* 48 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 50 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 52 */ NdrFcShort( 0x38 ), /* 56 */ +/* 54 */ NdrFcShort( 0x38 ), /* 56 */ +/* 56 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 58 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ +/* 62 */ NdrFcShort( 0x0 ), /* 0 */ +/* 64 */ NdrFcShort( 0x0 ), /* 0 */ +/* 66 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter pphContext */ + +/* 68 */ NdrFcShort( 0x118 ), /* Flags: in, out, simple ref, */ +/* 70 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 72 */ NdrFcShort( 0xe ), /* Type Offset=14 */ + + /* Procedure StartMetering */ + +/* 74 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 76 */ NdrFcLong( 0x0 ), /* 0 */ +/* 80 */ NdrFcShort( 0x2 ), /* 2 */ +/* 82 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 84 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 86 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 88 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 90 */ NdrFcShort( 0x44 ), /* 68 */ +/* 92 */ NdrFcShort( 0x0 ), /* 0 */ +/* 94 */ 0x40, /* Oi2 Flags: has ext, */ + 0x3, /* 3 */ +/* 96 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 98 */ NdrFcShort( 0x0 ), /* 0 */ +/* 100 */ NdrFcShort( 0x0 ), /* 0 */ +/* 102 */ NdrFcShort( 0x0 ), /* 0 */ +/* 104 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 106 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 108 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 110 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Parameter samplePeriod */ + +/* 112 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 114 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 116 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Parameter context */ + +/* 118 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 120 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 122 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Procedure SetSamplePeriod */ + +/* 124 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 126 */ NdrFcLong( 0x0 ), /* 0 */ +/* 130 */ NdrFcShort( 0x3 ), /* 3 */ +/* 132 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 134 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 136 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 138 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 140 */ NdrFcShort( 0x34 ), /* 52 */ +/* 142 */ NdrFcShort( 0x0 ), /* 0 */ +/* 144 */ 0x40, /* Oi2 Flags: has ext, */ + 0x2, /* 2 */ +/* 146 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 148 */ NdrFcShort( 0x0 ), /* 0 */ +/* 150 */ NdrFcShort( 0x0 ), /* 0 */ +/* 152 */ NdrFcShort( 0x0 ), /* 0 */ +/* 154 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 156 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 158 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 160 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Parameter samplePeriod */ + +/* 162 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 164 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 166 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Procedure StopMetering */ + +/* 168 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 170 */ NdrFcLong( 0x0 ), /* 0 */ +/* 174 */ NdrFcShort( 0x4 ), /* 4 */ +/* 176 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 178 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 180 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 182 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 184 */ NdrFcShort( 0x24 ), /* 36 */ +/* 186 */ NdrFcShort( 0x0 ), /* 0 */ +/* 188 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 190 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 192 */ NdrFcShort( 0x0 ), /* 0 */ +/* 194 */ NdrFcShort( 0x0 ), /* 0 */ +/* 196 */ NdrFcShort( 0x0 ), /* 0 */ +/* 198 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 200 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 202 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 204 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Procedure MeteringDataEvent */ + +/* 206 */ 0x34, /* FC_CALLBACK_HANDLE */ + 0x48, /* Old Flags: */ +/* 208 */ NdrFcLong( 0x0 ), /* 0 */ +/* 212 */ NdrFcShort( 0x0 ), /* 0 */ +/* 214 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 216 */ NdrFcShort( 0x20 ), /* 32 */ +/* 218 */ NdrFcShort( 0x0 ), /* 0 */ +/* 220 */ 0x40, /* Oi2 Flags: has ext, */ + 0x2, /* 2 */ +/* 222 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 224 */ NdrFcShort( 0x0 ), /* 0 */ +/* 226 */ NdrFcShort( 0x0 ), /* 0 */ +/* 228 */ NdrFcShort( 0x0 ), /* 0 */ +/* 230 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter data */ + +/* 232 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 234 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 236 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Parameter context */ + +/* 238 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 240 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 242 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const RpcInterface_MIDL_TYPE_FORMAT_STRING RpcInterface__MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ +/* 2 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */ +/* 6 */ 0x30, /* FC_BIND_CONTEXT */ + 0xa0, /* Ctxt flags: via ptr, out, */ +/* 8 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 10 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 12 */ NdrFcShort( 0x2 ), /* Offset= 2 (14) */ +/* 14 */ 0x30, /* FC_BIND_CONTEXT */ + 0xe1, /* Ctxt flags: via ptr, in, out, can't be null */ +/* 16 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 18 */ 0x30, /* FC_BIND_CONTEXT */ + 0x41, /* Ctxt flags: in, can't be null */ +/* 20 */ 0x0, /* 0 */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const NDR_RUNDOWN RundownRoutines[] = + { + PCONTEXT_HANDLE_TYPE_rundown + }; + + +static const unsigned short RpcInterface_FormatStringOffsetTable[] = + { + 0, + 36, + 74, + 124, + 168, + }; + + +static const unsigned short _callbackRpcInterface_FormatStringOffsetTable[] = + { + 206 + }; + + +static const MIDL_STUB_DESC RpcInterface_StubDesc = + { + (void *)& RpcInterface___RpcServerInterface, + MIDL_user_allocate, + MIDL_user_free, + 0, + RundownRoutines, + 0, + 0, + 0, + RpcInterface__MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x50002, /* Ndr library version */ + 0, + 0x801026e, /* MIDL Version 8.1.622 */ + 0, + 0, + 0, /* notify & notify_flag routine table */ + 0x1, /* MIDL flag */ + 0, /* cs routines */ + 0, /* proxy/server info */ + 0 + }; + +static const RPC_DISPATCH_FUNCTION RpcInterface_table[] = + { + NdrServerCall2, + NdrServerCall2, + NdrServerCall2, + NdrServerCall2, + NdrServerCall2, + 0 + }; +static const RPC_DISPATCH_TABLE RpcInterface_v1_0_DispatchTable = + { + 5, + (RPC_DISPATCH_FUNCTION*)RpcInterface_table + }; + +static const SERVER_ROUTINE RpcInterface_ServerRoutineTable[] = + { + (SERVER_ROUTINE)RemoteOpen, + (SERVER_ROUTINE)RemoteClose, + (SERVER_ROUTINE)StartMetering, + (SERVER_ROUTINE)SetSamplePeriod, + (SERVER_ROUTINE)StopMetering, + }; + +static const MIDL_SERVER_INFO RpcInterface_ServerInfo = + { + &RpcInterface_StubDesc, + RpcInterface_ServerRoutineTable, + RpcInterface__MIDL_ProcFormatString.Format, + RpcInterface_FormatStringOffsetTable, + 0, + 0, + 0, + 0}; +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + + +#endif /* defined(_M_AMD64)*/ + diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.cpp new file mode 100644 index 00000000..a808cf83 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.cpp @@ -0,0 +1,21 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#include "pch.h" +#include "MainPage.xaml.h" +#include "SampleConfiguration.h" + +using namespace SDKTemplate; + +Platform::Array<Scenario>^ MainPage::scenariosInner = ref new Platform::Array<Scenario> +{ + { "Connect to an NT Service", "SDKTemplate.MeteringData" }, +}; diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.h new file mode 100644 index 00000000..22581275 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.h @@ -0,0 +1,47 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#pragma once +#include "pch.h" + +namespace SDKTemplate +{ + value struct Scenario; + + partial ref class MainPage + { + internal: + static property Platform::String^ FEATURE_NAME + { + Platform::String^ get() + { + return "Custom Capability C++ sample"; + } + } + + static property Platform::Array<Scenario>^ scenarios + { + Platform::Array<Scenario>^ get() + { + return scenariosInner; + } + } + + private: + static Platform::Array<Scenario>^ scenariosInner; + }; + + public value struct Scenario + { + Platform::String^ Title; + Platform::String^ ClassName; + }; +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml new file mode 100644 index 00000000..0636f74d --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml @@ -0,0 +1,68 @@ +<!-- +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* +--> +<Page + x:Class="SDKTemplate.MeteringData" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d"> + + <ScrollViewer Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Padding="12,10,12,12"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + <StackPanel Margin="0,0,0,10"> + <TextBlock Text="Description:" Style="{StaticResource SampleHeaderTextStyle}"/> + <TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap"> + This scenario demonstrates RPC communication between an app and an NT service. For demonstration purposes, the service reads data from an imaginary device. + </TextBlock> + <StackPanel BorderThickness="2" BorderBrush="{ThemeResource ButtonBorderThemeBrush}" Margin="0,10,0,0" Padding="5"> + <TextBlock TextWrapping="Wrap"> + <Run FontWeight="Bold" Text="Step 1: Choose a period at which the samples will be pushed from the NT service"/> + </TextBlock> + <TextBlock TextWrapping="Wrap" Margin="0,10,5,0"> + Sample Period (ms): <Run Text="{x:Bind SamplePeriodSlider.Value, Mode=OneWay}"/> + </TextBlock> + <Slider x:Name="SamplePeriodSlider" HorizontalAlignment="Left" Width="300" IsEnabled="{x:Bind ViewModel.SliderEnabled, Mode=OneWay}" VerticalAlignment="Top" Minimum="1" Maximum="1000" ValueChanged="slider_ValueChanged" FontSize="20" Value="{x:Bind ViewModel.SliderValue, Mode=OneWay}"/> + </StackPanel> + <StackPanel BorderThickness="2" BorderBrush="{ThemeResource ButtonBorderThemeBrush}" Margin="0,10,0,0" Padding="5"> + <TextBlock TextWrapping="Wrap"> + <Run FontWeight="Bold" Text="Step 2: Click start to receive samples from the NT service"/> + </TextBlock> + <StackPanel Orientation="Horizontal" Margin="0,10,0,0"> + <Button IsEnabled="{x:Bind ViewModel.StartButtonEnabled, Mode=OneWay}" Content="Start" Click="button_Click_StartMetering"/> + <Button IsEnabled="{x:Bind ViewModel.StopButtonEnabled, Mode=OneWay}" Content="Stop" Click="button_Click_StopMetering" Margin="10,0,0,0"/> + </StackPanel> + </StackPanel> + <StackPanel BorderThickness="2" BorderBrush="{ThemeResource ButtonBorderThemeBrush}" Margin="0,10,0,0" Padding="5"> + <TextBlock TextWrapping="Wrap"> + <Run FontWeight="Bold" Text="Step 3: Observe the expected and actual incoming sample rate"/> + </TextBlock> + <TextBlock Margin="0,10,0,0"> + Expected Sample Rate: <Run Text="{x:Bind ViewModel.ExpectedRpcCallbackRate, Mode=OneWay}"/> + </TextBlock> + <TextBlock Margin="0,10,0,0"> + Actual Sample Rate: <Run Text="{x:Bind ViewModel.ActualRpcCallbackRate, Mode=OneWay}"/> + </TextBlock> + </StackPanel> + <TextBlock FontWeight="Bold" Margin="0,10,0,0" Text="Samples:"/> + </StackPanel> + <ScrollViewer Grid.Row="2" HorizontalAlignment="Stretch" Margin="0,10,0,0" VerticalAlignment="Stretch"> + <TextBox Height="400" IsReadOnly="true" HorizontalAlignment="Stretch" Text="{x:Bind ViewModel.SampleMessage, Mode=OneWay}" BorderThickness="0"/> + </ScrollViewer> + </Grid> + </ScrollViewer> +</Page> diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.cpp new file mode 100644 index 00000000..3a9e1f48 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.cpp @@ -0,0 +1,47 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#include "pch.h" +#include "Scenario1_MeteringData.xaml.h" + +using namespace SDKTemplate; + +using namespace Platform; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls::Primitives; + +MeteringData::MeteringData() +{ + InitializeComponent(); + ViewModel = ref new ServiceViewModel(); +} + +void SDKTemplate::MeteringData::button_Click_StartMetering(Object^ sender, RoutedEventArgs^ e) +{ + ViewModel->StartMetering((int)SamplePeriodSlider->Value); +} + +void SDKTemplate::MeteringData::button_Click_StopMetering(Object^ sender, RoutedEventArgs^ e) +{ + ViewModel->StopMetering(); +} + +void SDKTemplate::MeteringData::slider_ValueChanged(Object^ sender, RangeBaseValueChangedEventArgs^ e) +{ + // Ignore slider value changes prior to ViewModel initialization. + if (ViewModel != nullptr) + { + // Update the sample period in response to slider change. + ViewModel->SetSamplePeriod((int)SamplePeriodSlider->Value); + } +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.h new file mode 100644 index 00000000..79faa4f3 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.h @@ -0,0 +1,31 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#pragma once + +#include "Scenario1_MeteringData.g.h" +#include "ServiceViewModel.h" + +namespace SDKTemplate +{ + [Windows::Foundation::Metadata::WebHostHidden] + public ref class MeteringData sealed + { + public: + MeteringData(); + property ServiceViewModel^ ViewModel; + + private: + void button_Click_StartMetering(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void button_Click_StopMetering(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void slider_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e); + }; +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.cpp new file mode 100644 index 00000000..9f9674c4 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.cpp @@ -0,0 +1,282 @@ +#include "pch.h" +#include "ServiceViewModel.h" +#include "MainPage.xaml.h" + +using namespace Concurrency; +using namespace Platform; +using namespace SDKTemplate; +using namespace Windows::System::Threading; +using namespace Windows::UI::Xaml::Data; + +ServiceViewModel::ServiceViewModel() +{ + // Set default rate + samplePeriod = 100; + + // Initialize UI state + startButtonEnabled = true; + stopButtonEnabled = false; + sliderEnabled = true; + sliderValue = samplePeriod; + actualRpcCallbackRate = "0"; + expectedRpcCallbackRate = "0"; + + meteringOn = false; + + // Get the dispatcher for notifying property change + dispatcher = Windows::UI::Core::CoreWindow::GetForCurrentThread()->Dispatcher; + + sampleArray = ref new Platform::Array<__int64>(1000); +} + +// +// if errCode represents an error, then display a message and return true. +// +inline bool ServiceViewModel::NotifyIfAnyError(__int64 errCode) +{ + if (errCode != 0) + { + meteringOn = false; + NotifyStatusMessage("Error occured while communicating with RPC server: " + errCode.ToString(), NotifyType::ErrorMessage); + + // Reset button state + StartButtonEnabled = true; + StopButtonEnabled = false; + return true; + } + return false; +} + +// Bindable properties +#pragma region BindableProperties + +String^ ServiceViewModel::ExpectedRpcCallbackRate::get() { return expectedRpcCallbackRate; } +void ServiceViewModel::ExpectedRpcCallbackRate::set(String^ value) +{ + if (expectedRpcCallbackRate != value) + { + expectedRpcCallbackRate = value; + NotifyPropertyChanged("ExpectedRpcCallbackRate"); + } +} + +String^ ServiceViewModel::ActualRpcCallbackRate::get() { return actualRpcCallbackRate; } +void ServiceViewModel::ActualRpcCallbackRate::set(String^ value) +{ + if (actualRpcCallbackRate != value) + { + actualRpcCallbackRate = value; + NotifyPropertyChanged("ActualRpcCallbackRate"); + } +} + +String^ ServiceViewModel::SampleMessage::get() { return sampleMessage; } +void ServiceViewModel::SampleMessage::set(String^ value) +{ + if (sampleMessage != value) + { + sampleMessage = value; + NotifyPropertyChanged("SampleMessage"); + } +} + +bool ServiceViewModel::StartButtonEnabled::get() { return startButtonEnabled; } +void ServiceViewModel::StartButtonEnabled::set(bool value) +{ + if (startButtonEnabled != value) + { + startButtonEnabled = value; + NotifyPropertyChanged("StartButtonEnabled"); + } +} + +bool ServiceViewModel::StopButtonEnabled::get() { return stopButtonEnabled; } +void ServiceViewModel::StopButtonEnabled::set(bool value) +{ + if (stopButtonEnabled != value) + { + stopButtonEnabled = value; + NotifyPropertyChanged("StopButtonEnabled"); + } +} + +bool ServiceViewModel::SliderEnabled::get() { return sliderEnabled; } +void ServiceViewModel::SliderEnabled::set(bool value) +{ + if (sliderEnabled != value) + { + sliderEnabled = value; + NotifyPropertyChanged("SliderEnabled"); + } +} + +double ServiceViewModel::SliderValue::get() { return sliderValue; } +void ServiceViewModel::SliderValue::set(double value) +{ + if (sliderValue != value) + { + sliderValue = value; + NotifyPropertyChanged("SliderValue"); + } +} +#pragma endregion BindableProperties + +void SDKTemplate::ServiceViewModel::NotifyPropertyChanged(Platform::String^ prop) +{ + if (dispatcher != nullptr) + { + dispatcher->RunAsync( + Windows::UI::Core::CoreDispatcherPriority::Normal, + ref new Windows::UI::Core::DispatchedHandler([this, prop]() + { + PropertyChangedEventArgs^ args = + ref new PropertyChangedEventArgs(prop); + PropertyChanged(this, args); + })); + } + // else log error +} + +// +// Initializes rpcclient and metering +// +void ServiceViewModel::StartMetering(int sampleRate) +{ + create_task([this, sampleRate] + { + SampleMessage = ""; + StartButtonEnabled = false; + StopButtonEnabled = true; + stopMeteringRequested = false; + + rpcclient = std::make_unique<RpcClient>(); + if (NotifyIfAnyError(rpcclient->Initialize())) return; + + meteringOn = true; + sampleRefreshCount = 0; + sampleArray[0] = 0; + + // Set the sample rate on server + this->samplePeriod = sampleRate; + __int64 retCode = rpcclient->SetSampleRate(sampleRate); + + FILETIME initialSystemTime; + GetSystemTimeAsFileTime(&initialSystemTime); + lastUpdateTime.LowPart = initialSystemTime.dwLowDateTime; + lastUpdateTime.HighPart = initialSystemTime.dwHighDateTime; + + if (!NotifyIfAnyError(retCode)) + { + // Set up worker for UI update. + Windows::Foundation::TimeSpan span{ 100 * 10000 }; // 100ms refresh rate + + auto timerHandler = ref new TimerElapsedHandler([this](ThreadPoolTimer^) + { + __int64 meteringData = rpcclient->MeteringData; + + // If there is no new data, return + if (sampleArray[0] == meteringData) + { + return; + } + + // Arithmetic subtraction of time + // https://msdn.microsoft.com/en-us/library/ms724950%28VS.85%29.aspx?f=255&MSPPError=-2147217396 + FILETIME currentSystemTime; + ULARGE_INTEGER currentTimeUi; + GetSystemTimeAsFileTime(¤tSystemTime); + currentTimeUi.LowPart = currentSystemTime.dwLowDateTime; + currentTimeUi.HighPart = currentSystemTime.dwHighDateTime; + + // Calculate number of samples received since last callback + __int64 now = rpcclient->CallbackCount; + __int64 diff = now - rpcDataCountOld; + rpcDataCountOld = now; + + // Calculate incoming sample rate + double rate = (double)diff*1E7 / (currentTimeUi.QuadPart - lastUpdateTime.QuadPart); + ExpectedRpcCallbackRate = (1E3 / this->samplePeriod).ToString() + " /sec"; + lastUpdateTime = currentTimeUi; + + ActualRpcCallbackRate = rate.ToString() + " /sec"; + + // Construct the sample data string + String^ sampleMessage = meteringData + "\n"; + unsigned int length = sampleArray->Length; + if (sampleRefreshCount < length) + { + ++sampleRefreshCount; + length = sampleRefreshCount; + } + + // Insert the new data point at the top of the array. + // Old data falls off the end of the array. + for (unsigned int i = 1; i < length; ++i) + { + sampleArray[i] = sampleArray[i - 1]; + sampleMessage += sampleArray[i] + "\n"; + } + sampleArray[0] = meteringData; + + SampleMessage = sampleMessage; + }); + + ThreadPoolTimer^ periodicTimer = ThreadPoolTimer::CreatePeriodicTimer(timerHandler, span); + NotifyStatusMessage("Metering start command sent successfully", NotifyType::StatusMessage); + retCode = this->rpcclient->StartMeteringAndWaitForStop(sampleRate); + meteringOn = false; + periodicTimer->Cancel(); + if (!NotifyIfAnyError(retCode) && !stopMeteringRequested) + { + NotifyStatusMessage("Rpc server connection closed without stop metering being requested", + NotifyType::ErrorMessage); + StartButtonEnabled = true; + StopButtonEnabled = false; + } + } + }); +} + +// +// Stop metering +// +void ServiceViewModel::StopMetering() +{ + create_task([this] + { + StopButtonEnabled = false; + SliderEnabled = false; + stopMeteringRequested = true; + + __int64 retCode = this->rpcclient->StopMetering(); + if (!NotifyIfAnyError(retCode)) + { + NotifyStatusMessage("Metering stop command sent successfully", + NotifyType::StatusMessage); + } + + SliderEnabled = true; + StartButtonEnabled = true; + }); +} + +// +// Set sample period +// +void ServiceViewModel::SetSamplePeriod(int samplePeriod) +{ + create_task([this, samplePeriod] + { + this->samplePeriod = samplePeriod; + if (meteringOn) + { + _int64 retCode = rpcclient->SetSampleRate(samplePeriod); + if (!NotifyIfAnyError(retCode)) + { + NotifyStatusMessage( + "Sample period set to: " + samplePeriod, + NotifyType::StatusMessage); + } + } + }); +}
\ No newline at end of file diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h new file mode 100644 index 00000000..c2fcad0c --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h @@ -0,0 +1,77 @@ +#pragma once + +#include "RpcClient.h" +#include <memory> + +namespace SDKTemplate +{ + [Windows::UI::Xaml::Data::Bindable] + public ref class ServiceViewModel sealed : Windows::UI::Xaml::Data::INotifyPropertyChanged + { + public: + ServiceViewModel(); + void StartMetering(int sampleRate); + void SetSamplePeriod(int rate); + void StopMetering(); + property Platform::String^ ExpectedRpcCallbackRate + { + Platform::String^ get(); + void set(Platform::String^ value); + } + property Platform::String^ ActualRpcCallbackRate + { + Platform::String^ get(); + void set(Platform::String^ value); + } + property Platform::String^ SampleMessage + { + Platform::String^ get(); + void set(Platform::String^ value); + } + property bool StartButtonEnabled + { + bool get(); + void set(bool value); + } + property bool StopButtonEnabled + { + bool get(); + void set(bool value); + } + property bool SliderEnabled + { + bool get(); + void set(bool value); + } + property double SliderValue + { + double get(); + void set(double value); + } + virtual event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ PropertyChanged; + + private: + volatile bool meteringOn; + Windows::UI::Core::ICoreDispatcher^ dispatcher; + int samplePeriod; + ULARGE_INTEGER lastUpdateTime; + __int64 rpcDataCountOld = 0; + unsigned int sampleRefreshCount = 0; + std::unique_ptr<RpcClient> rpcclient; + bool stopMeteringRequested; + bool NotifyIfAnyError(__int64 errCode); + + // Variables backing UI bindings + Platform::String^ sampleMessage; + Platform::String^ expectedRpcCallbackRate; + Platform::String^ actualRpcCallbackRate; + bool startButtonEnabled; + bool stopButtonEnabled; + bool sliderEnabled; + double sliderValue; + + void NotifyPropertyChanged(Platform::String^ prop); + + Platform::Array<__int64>^ sampleArray; + }; +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.cpp new file mode 100644 index 00000000..b300c4c0 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.cpp @@ -0,0 +1,60 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +// +// pch.cpp +// Include the standard header and generate the precompiled header. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +#include <robuffer.h> +#include <wrl\client.h> + +using namespace Microsoft::WRL; +using namespace Windows::Storage::Streams; + +byte* GetArrayFromBuffer(Windows::Storage::Streams::IBuffer^ buffer) +{ + ComPtr<IInspectable> base = reinterpret_cast<IInspectable*>(buffer); + ComPtr<IBufferByteAccess> access; + + auto hr = base.As(&access); + + if (FAILED(hr)) + { + throw Platform::Exception::CreateException(hr); + } + + byte* data; + + hr = access->Buffer(&data); + + if (FAILED(hr)) + { + throw Platform::Exception::CreateException(hr); + } + + // The returned buffer is valid as long as the IBuffer passed in + // remains valid. + return data; +} + +void NotifyStatusMessage(Platform::String^ message, SDKTemplate::NotifyType messageType) +{ + SDKTemplate::MainPage::Current->Dispatcher->RunAsync( + Windows::UI::Core::CoreDispatcherPriority::Normal, + ref new Windows::UI::Core::DispatchedHandler( + [message, messageType]() { + SDKTemplate::MainPage::Current->NotifyUser(message, messageType); + })); +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.h new file mode 100644 index 00000000..3cec6ca5 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.h @@ -0,0 +1,27 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +// +// pch.h +// Header for standard system include files. +// + +#pragma once + +#include <collection.h> +#include <ppltasks.h> + +#include "App.xaml.h" +#include "MainPage.xaml.h" + +byte* GetArrayFromBuffer(Windows::Storage::Streams::IBuffer^ buffer); + +void NotifyStatusMessage(Platform::String^ message, SDKTemplate::NotifyType messageType); |
