diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 413b7e71..87b9c5cf 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -71,10 +71,13 @@ "BuildConsoleApp", "BuildCppSamples", "BuildCSharpSamples", + "BuildInDevelopmentServicePlugins", + "BuildInDevelopmentServicePluginsInstaller", "BuildServiceAndPlugins", "BuildServiceAndPluginsInstaller", "BuildSettingsApp", "BuildUserToolsSharedComponents", + "CreateVersionIncludes", "Prerequisites" ] } @@ -92,10 +95,13 @@ "BuildConsoleApp", "BuildCppSamples", "BuildCSharpSamples", + "BuildInDevelopmentServicePlugins", + "BuildInDevelopmentServicePluginsInstaller", "BuildServiceAndPlugins", "BuildServiceAndPluginsInstaller", "BuildSettingsApp", "BuildUserToolsSharedComponents", + "CreateVersionIncludes", "Prerequisites" ] } diff --git a/build/nuke_build/Build.cs b/build/nuke_build/Build.cs index 003b080a..ef736dcf 100644 --- a/build/nuke_build/Build.cs +++ b/build/nuke_build/Build.cs @@ -34,22 +34,27 @@ class Build : NukeBuild //readonly GitVersion MasterBuildVersion; - string SetupVersionName => "Developer Preview 7"; - string NuGetVersionName => "preview.7"; + string VersionName => "Developer Preview 8"; + string NuGetVersionName => "preview.8"; // we set these here, especially the time, so it's the same for all platforms in the single build - string SetupBuildMajorMinor = "1.0.1"; - string SetupBuildDateNumber = DateTime.Now.ToString("yy") + DateTime.Now.DayOfYear.ToString("000"); // YYddd where ddd is the day number for the year - string SetupBuildTimeNumber = UInt32.Parse(DateTime.Now.ToString("HHmm")).ToString(); // HHmm + const string BuildVersionMajor = "1"; + const string BuildVersionMinor = "0"; + const string BuildVersionRevision = "1"; + const string BuildMajorMinorRevision = $"{BuildVersionMajor}.{BuildVersionMinor}.{BuildVersionRevision}"; - string NugetVersionString => SetupBuildMajorMinor + "-" + NuGetVersionName + "." + SetupBuildDateNumber + "." + SetupBuildTimeNumber ; + string BuildDateNumber = DateTime.Now.ToString("yy") + DateTime.Now.DayOfYear.ToString("000"); // YYddd where ddd is the day number for the year + string BuildTimeNumber = UInt32.Parse(DateTime.Now.ToString("HHmm")).ToString(); // HHmm + + + string NugetVersionString => BuildMajorMinorRevision + "-" + NuGetVersionName + "." + BuildDateNumber + "." + BuildTimeNumber ; string NugetPackageId => "Microsoft.Windows.Devices.Midi2"; string NugetFullPackageIdWithVersion => NugetPackageId + "." + NugetVersionString; - string SetupBundleFullVersionString => SetupBuildMajorMinor + "-" + NuGetVersionName + "." + SetupBuildDateNumber + "." + SetupBuildTimeNumber; + string SetupBundleFullVersionString => BuildMajorMinorRevision + "-" + NuGetVersionName + "." + BuildDateNumber + "." + BuildTimeNumber; AbsolutePath _thisReleaseFolder; @@ -89,6 +94,8 @@ class Build : NukeBuild AbsolutePath InBoxComponentsSetupSolutionFolder => SourceRootFolder / "oob-setup"; + AbsolutePath InDevelopmentServiceComponentsSetupSolutionFolder => SourceRootFolder / "oob-setup-in-dev"; + AbsolutePath ApiReferenceFolder => SourceRootFolder / "shared" / "api-ref"; @@ -109,6 +116,8 @@ class Build : NukeBuild AbsolutePath SetupBundleInfoIncludeFile => StagingRootFolder / "version" / "BundleInfo.wxi"; + AbsolutePath CommonVersionHeaderFile => StagingRootFolder / "version" / "WindowsMidiServicesVersion.h"; + AbsolutePath CommonVersionCSharpFile => StagingRootFolder / "version" / "WindowsMidiServicesVersion.cs"; AbsolutePath SamplesRootFolder => NukeBuild.RootDirectory / "samples"; AbsolutePath SamplesCppWinRTSolutionFolder => SamplesRootFolder / "cpp-winrt"; @@ -117,7 +126,8 @@ class Build : NukeBuild string[] SdkPlatforms => new string[] { "x64", "Arm64EC" }; - string[] ServiceAndApiPlatforms => new string[] { "x64", "Arm64EC" }; + string[] ServiceAndApiPlatforms => new string[] { "x64", "Arm64" }; + string[] ServiceAndApiPlatformsAll => new string[] { "x64", "Arm64", "Arm64EC" }; string[] ToolsPlatforms => new string[] { "x64", "Arm64" }; string[] NativeSamplesPlatforms => new string[] { "x64", "Arm64EC", "Arm64" }; string[] ManagedSamplesPlatforms => new string[] { "x64", "Arm64" }; @@ -138,16 +148,81 @@ class Build : NukeBuild Environment.SetEnvironmentVariable("MIDI_REPO_ROOT", NukeBuild.RootDirectory); } - _thisReleaseFolder = $"{ReleaseRootFolder / SetupVersionName} ({DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss")})"; + _thisReleaseFolder = $"{ReleaseRootFolder / VersionName} ({DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss")})"; }); + Target CreateVersionIncludes => _ => _ + .DependsOn(Prerequisites) + .Executes(() => + { + string buildSource = "GitHub Preview"; + string versionName = VersionName; + string versionString = SetupBundleFullVersionString; + + string buildVersionMajor = BuildVersionMajor; + string buildVersionMinor = BuildVersionMinor; + string buildVersionRevision = BuildVersionRevision; + + string buildVersionDateNumber = BuildDateNumber; + string buildVersionTimeNumber = BuildTimeNumber; + + // create .h file for SDK and related tools + + using (StreamWriter writer = System.IO.File.CreateText(CommonVersionHeaderFile)) + { + writer.WriteLine("// this file has been auto-generated by the Windows MIDI Services build process"); + writer.WriteLine(); + writer.WriteLine("#ifndef WINDOWS_MIDI_SERVICES_VERSION_INCLUDE"); + writer.WriteLine("#define WINDOWS_MIDI_SERVICES_VERSION_INCLUDE"); + writer.WriteLine(); + writer.WriteLine($"#define WINDOWS_MIDI_SERVICES_BUILD_SOURCE L\"{buildSource}\""); + writer.WriteLine($"#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_NAME L\"{versionName}\""); + writer.WriteLine($"#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_FULL L\"{versionString}\""); + writer.WriteLine($"#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_MAJOR L\"{buildVersionMajor}\""); + writer.WriteLine($"#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_MINOR L\"{buildVersionMinor}\""); + writer.WriteLine($"#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_REVISION L\"{buildVersionRevision}\""); + writer.WriteLine($"#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_DATE_NUMBER L\"{buildVersionDateNumber}\""); + writer.WriteLine($"#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_TIME_NUMBER L\"{buildVersionTimeNumber}\""); + writer.WriteLine(); + writer.WriteLine("#endif"); + writer.WriteLine(); + } + + // create .cs file for console and settings app + + using (StreamWriter writer = System.IO.File.CreateText(CommonVersionCSharpFile)) + { + writer.WriteLine("// this file has been auto-generated by the Windows MIDI Services build process"); + writer.WriteLine(); + + writer.WriteLine("namespace Microsoft.Midi.Common"); + writer.WriteLine("{"); + writer.WriteLine("\tpublic static class MidiBuildInformation"); + writer.WriteLine("\t{"); + writer.WriteLine($"\t\tpublic const string Source = \"{buildSource}\";"); + writer.WriteLine($"\t\tpublic const string Name = \"{versionName}\";"); + writer.WriteLine($"\t\tpublic const string BuildFullVersion = \"{versionString}\";"); + writer.WriteLine($"\t\tpublic const string VersionMajor = \"{buildVersionMajor}\";"); + writer.WriteLine($"\t\tpublic const string VersionMinor = \"{buildVersionMinor}\";"); + writer.WriteLine($"\t\tpublic const string VersionRevision = \"{buildVersionRevision}\";"); + writer.WriteLine($"\t\tpublic const string VersionDateNumber = \"{buildVersionDateNumber}\";"); + writer.WriteLine($"\t\tpublic const string VersionTimeNumber = \"{buildVersionTimeNumber}\";"); + writer.WriteLine("\t}"); + writer.WriteLine("}"); + writer.WriteLine(); + } + + + }); + Target BuildServiceAndPlugins => _ => _ + .DependsOn(CreateVersionIncludes) .DependsOn(Prerequisites) .Executes(() => { - foreach (var platform in ServiceAndApiPlatforms) + foreach (var platform in ServiceAndApiPlatformsAll) { string solutionDir = ApiSolutionFolder.ToString() + @"\"; @@ -176,10 +251,14 @@ class Build : NukeBuild // copy binaries to staging folder var stagingFiles = new List(); + // This abstraction gets compiled to Arm64X and x64. The Arm64X output is in the Arm64EC folder + // var midiSrvAbstractionPlatform = (platform == "Arm64EC" || platform == "Arm64") ? "Arm64EC" : "x64"; stagingFiles.Add(ApiSolutionFolder / "vsfiles" / platform / Configuration.Release / $"Midi2.MidiSrvAbstraction.dll"); - // only in-proc files, like the MidiSrvAbstraction, are Arm64EC - var servicePlatform = platform == "Arm64EC" ? "Arm64" : "x64"; + + // only in-proc files, like the MidiSrvAbstraction, are Arm64EC. For all the others + // any reference to Arm64EC is just Arm64. We don't use any of the Arm64X output + var servicePlatform = (platform == "Arm64EC" || platform == "Arm64") ? "Arm64" : "x64"; stagingFiles.Add(ApiSolutionFolder / "vsfiles" / servicePlatform / Configuration.Release / $"Midisrv.exe"); @@ -213,18 +292,20 @@ class Build : NukeBuild var intermediateFolder = ApiSolutionFolder / "vsfiles" / "intermediate"; - foreach (var platform in ServiceAndApiPlatforms) + foreach (var platform in ServiceAndApiPlatformsAll) { var referenceFiles = new List(); // for the destination platform, we use x64 files here since they're not // binaries anyway - string sourcePlatform = (platform == "Arm64EC" ? "x64" : platform); + //string sourcePlatform = (platform == "Arm64EC" ? "x64" : platform); + string sourcePlatform = platform; referenceFiles.Add(intermediateFolder / "idl" / sourcePlatform / Configuration.Release / "WindowsMidiServices.h"); referenceFiles.Add(intermediateFolder / "idl" / sourcePlatform / Configuration.Release / "WindowsMidiServices_i.c"); referenceFiles.Add(intermediateFolder / "idl" / sourcePlatform / Configuration.Release / "WindowsMidiServices_i.c"); + // this is the only one that needs Arm64X referenceFiles.Add(intermediateFolder / "Midi2.MidiSrvAbstraction" / sourcePlatform / Configuration.Release / "Midi2MidiSrvAbstraction.h"); // copy the files over to the reference location @@ -237,9 +318,63 @@ class Build : NukeBuild }); + Target BuildInDevelopmentServicePlugins => _ => _ + .DependsOn(CreateVersionIncludes) + .DependsOn(Prerequisites) + .DependsOn(BuildServiceAndPlugins) + .Executes(() => + { + foreach (var platform in ServiceAndApiPlatforms) + { + string solutionDir = ApiSolutionFolder.ToString() + @"\"; + + var msbuildProperties = new Dictionary(); + msbuildProperties.Add("Platform", platform); + msbuildProperties.Add("SolutionDir", solutionDir); // to include trailing slash + msbuildProperties.Add("NoWarn", "MIDL2111"); // IDL identifier length warning + + Console.Out.WriteLine($"----------------------------------------------------------------------"); + Console.Out.WriteLine($"SolutionDir: {solutionDir}"); + Console.Out.WriteLine($"Platform: {platform}"); + + + MSBuildTasks.MSBuild(_ => _ + .SetTargetPath(ApiSolutionFolder / "Midi2-InDevelopment.sln") + .SetMaxCpuCount(14) + /*.SetOutDir(outputFolder) */ + /*.SetProcessWorkingDirectory(ApiSolutionFolder)*/ + /*.SetTargets("Build") */ + .SetProperties(msbuildProperties) + .SetConfiguration(Configuration.Release) + .SetVerbosity(MSBuildVerbosity.Minimal) + .EnableNodeReuse() + ); + + // copy binaries to staging folder + var stagingFiles = new List(); + + // only in-proc files, like the MidiSrvAbstraction, are Arm64EC + //var servicePlatform = (platform == "Arm64EC" || platform == "Arm64") ? "Arm64" : "x64"; + var servicePlatform = platform; + + stagingFiles.Add(ApiSolutionFolder / "vsfiles" / servicePlatform / Configuration.Release / $"Midi2.NetworkMidiTransport.dll"); + // stagingFiles.Add(ApiSolutionFolder / "vsfiles" / servicePlatform / Configuration.Release / $"Midi2.VirtualPatchBayAbstraction.dll"); + + foreach (var file in stagingFiles) + { + FileSystemTasks.CopyFileToDirectory(file, ApiStagingFolder / servicePlatform, FileExistsPolicy.Overwrite, true); + } + } + + }); + + + Target BuildAndPackAllAppSDKs => _ => _ .DependsOn(Prerequisites) + .DependsOn(CreateVersionIncludes) .DependsOn(BuildServiceAndPlugins) + .DependsOn(BuildInDevelopmentServicePlugins) .Executes(() => { //// for cswinrt @@ -329,9 +464,10 @@ class Build : NukeBuild { string sourcePlatform; + // the solution compiles these apps to x64 when target is EC. if (targetPlatform.ToLower() == "arm64ec") { - sourcePlatform = "Arm64"; + sourcePlatform = "x64"; } else { @@ -347,7 +483,6 @@ class Build : NukeBuild // sample manifest FileSystemTasks.CopyFileToDirectory(AppSdkSolutionFolder / "ExampleMidiApp.exe.manifest", AppSdkStagingFolder / targetPlatform, FileExistsPolicy.Overwrite, true); - } }); @@ -356,6 +491,7 @@ class Build : NukeBuild Target BuildAppSdkRuntimeAndToolsInstaller => _ => _ .DependsOn(Prerequisites) + .DependsOn(CreateVersionIncludes) .DependsOn(BuildConsoleApp) //.DependsOn(BuildSettingsApp) .DependsOn(BuildAndPackAllAppSDKs) @@ -409,7 +545,7 @@ void UpdateSetupBundleInfoIncludeFile(string platform) using (StreamWriter writer = System.IO.File.CreateText(SetupBundleInfoIncludeFile)) { writer.WriteLine(""); - writer.WriteLine($" "); + writer.WriteLine($" "); writer.WriteLine($" "); writer.WriteLine(""); } @@ -453,10 +589,50 @@ void UpdateSetupBundleInfoIncludeFile(string platform) // do this copy if a new setup file was created. Maybe do a before/after date/time check? FileSystemTasks.CopyFile( InBoxComponentsSetupSolutionFolder / "main-bundle" / "bin" / platform / Configuration.Release / "WindowsMidiServicesInBoxComponentsSetup.exe", - ThisReleaseFolder / $"Windows MIDI Services (In-Box Service) - {SetupBundleFullVersionString}-{platform.ToLower()}.exe"); + ThisReleaseFolder / $"Windows MIDI Services (In-Box Service) {SetupBundleFullVersionString}-{platform.ToLower()}.exe"); } }); + Target BuildInDevelopmentServicePluginsInstaller => _ => _ + .DependsOn(Prerequisites) + .DependsOn(BuildInDevelopmentServicePlugins) + .Executes(() => + { + // we build for Arm64 and x64. No EC required here + foreach (var platform in InstallerPlatforms) + { + UpdateSetupBundleInfoIncludeFile(platform); + + //string fullSetupVersionString = $"{SetupVersionName} {SetupBuildMajorMinor}.{SetupBuildDateNumber}.{SetupBuildTimeNumber}"; + + string solutionDir = InDevelopmentServiceComponentsSetupSolutionFolder.ToString() + @"\"; + + var msbuildProperties = new Dictionary(); + msbuildProperties.Add("Platform", platform); + msbuildProperties.Add("SolutionDir", solutionDir); // to include trailing slash + + Console.Out.WriteLine($"----------------------------------------------------------------------"); + Console.Out.WriteLine($"SolutionDir: {solutionDir}"); + Console.Out.WriteLine($"Platform: {platform}"); + + var output = MSBuildTasks.MSBuild(_ => _ + .SetTargetPath(InDevelopmentServiceComponentsSetupSolutionFolder / "midi-services-in-box-in-dev-setup.sln") + .SetMaxCpuCount(14) + /*.SetOutDir(outputFolder) */ + /*.SetProcessWorkingDirectory(ApiSolutionFolder)*/ + /*.SetTargets("Build") */ + .SetProperties(msbuildProperties) + .SetConfiguration(Configuration.Release) + .EnableNodeReuse() + ); + + FileSystemTasks.CopyFile( + InDevelopmentServiceComponentsSetupSolutionFolder / "main-bundle" / "bin" / platform / Configuration.Release / "WindowsMidiServicesInDevelopmentServiceComponentsSetup.exe", + ThisReleaseFolder / $"Windows MIDI Services (Preview Service Plugins) {SetupBundleFullVersionString}-{platform.ToLower()}.exe"); + } + }); + + Target BuildUserToolsSharedComponents => _ => _ .DependsOn(Prerequisites) @@ -1254,8 +1430,11 @@ void UpdatePackagesConfigForCPPProject(string configFilePath) Target BuildAndPublishAll => _ => _ .DependsOn(Prerequisites) + .DependsOn(CreateVersionIncludes) .DependsOn(BuildServiceAndPlugins) .DependsOn(BuildServiceAndPluginsInstaller) + .DependsOn(BuildInDevelopmentServicePlugins) + .DependsOn(BuildInDevelopmentServicePluginsInstaller) .DependsOn(BuildAndPackAllAppSDKs) .DependsOn(BuildConsoleApp) .DependsOn(BuildSettingsApp) diff --git a/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.Initialization.dll b/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.Initialization.dll index f02c79a1..025a9ba8 100644 Binary files a/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.Initialization.dll and b/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.Initialization.dll differ diff --git a/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.Initialization.winmd b/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.Initialization.winmd index 30a8a6f3..fc0956fe 100644 Binary files a/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.Initialization.winmd and b/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.Initialization.winmd differ diff --git a/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.dll b/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.dll index 8472ea0d..d0b1abec 100644 Binary files a/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.dll and b/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.dll differ diff --git a/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.winmd b/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.winmd index cdb6536d..f13c7528 100644 Binary files a/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.winmd and b/build/staging/app-sdk/Arm64EC/Microsoft.Windows.Devices.Midi2.winmd differ diff --git a/build/staging/app-sdk/Arm64EC/mididiag.exe b/build/staging/app-sdk/Arm64EC/mididiag.exe index f22f4756..50585e67 100644 Binary files a/build/staging/app-sdk/Arm64EC/mididiag.exe and b/build/staging/app-sdk/Arm64EC/mididiag.exe differ diff --git a/build/staging/version/BundleInfo.wxi b/build/staging/version/BundleInfo.wxi index 44ac7489..2c0357e2 100644 --- a/build/staging/version/BundleInfo.wxi +++ b/build/staging/version/BundleInfo.wxi @@ -1,4 +1,4 @@ - - + + diff --git a/samples/cpp-winrt/basics/client-basics-cpp.vcxproj b/samples/cpp-winrt/basics/client-basics-cpp.vcxproj index fd7106bc..17708f58 100644 --- a/samples/cpp-winrt/basics/client-basics-cpp.vcxproj +++ b/samples/cpp-winrt/basics/client-basics-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.1-preview.7.24305.1438 + Microsoft.Windows.Devices.Midi2.1.0.1-preview.8.24308.2011 true true false diff --git a/samples/cpp-winrt/basics/packages.config b/samples/cpp-winrt/basics/packages.config index 19d454f1..438885e7 100644 --- a/samples/cpp-winrt/basics/packages.config +++ b/samples/cpp-winrt/basics/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj b/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj index a8d88ccc..5ea3aa1d 100644 --- a/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj +++ b/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.1-preview.7.24305.1438 + Microsoft.Windows.Devices.Midi2.1.0.1-preview.8.24308.2011 true true true diff --git a/samples/cpp-winrt/loopback-endpoints/packages.config b/samples/cpp-winrt/loopback-endpoints/packages.config index 19d454f1..438885e7 100644 --- a/samples/cpp-winrt/loopback-endpoints/packages.config +++ b/samples/cpp-winrt/loopback-endpoints/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/send-speed/packages.config b/samples/cpp-winrt/send-speed/packages.config index 19d454f1..438885e7 100644 --- a/samples/cpp-winrt/send-speed/packages.config +++ b/samples/cpp-winrt/send-speed/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj b/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj index b5ca52c0..f48fa048 100644 --- a/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj +++ b/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.1-preview.7.24305.1438 + Microsoft.Windows.Devices.Midi2.1.0.1-preview.8.24308.2011 true true true diff --git a/samples/cpp-winrt/static-enum-endpoints/packages.config b/samples/cpp-winrt/static-enum-endpoints/packages.config index 19d454f1..438885e7 100644 --- a/samples/cpp-winrt/static-enum-endpoints/packages.config +++ b/samples/cpp-winrt/static-enum-endpoints/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj b/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj index 0370de48..c94e85c3 100644 --- a/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj +++ b/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.1-preview.7.24305.1438 + Microsoft.Windows.Devices.Midi2.1.0.1-preview.8.24308.2011 true true true diff --git a/samples/cpp-winrt/virtual-device-app-winui/packages.config b/samples/cpp-winrt/virtual-device-app-winui/packages.config index 3ccabd08..a46f5c8c 100644 --- a/samples/cpp-winrt/virtual-device-app-winui/packages.config +++ b/samples/cpp-winrt/virtual-device-app-winui/packages.config @@ -1,7 +1,7 @@  - + diff --git a/samples/cpp-winrt/virtual-device-app-winui/virtual-device-app-winui.vcxproj b/samples/cpp-winrt/virtual-device-app-winui/virtual-device-app-winui.vcxproj index 79357225..0ef26aab 100644 --- a/samples/cpp-winrt/virtual-device-app-winui/virtual-device-app-winui.vcxproj +++ b/samples/cpp-winrt/virtual-device-app-winui/virtual-device-app-winui.vcxproj @@ -4,7 +4,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.1-preview.7.24305.1438 + Microsoft.Windows.Devices.Midi2.1.0.1-preview.8.24308.2011 true true true diff --git a/samples/cpp-winrt/watch-endpoints/packages.config b/samples/cpp-winrt/watch-endpoints/packages.config index 19d454f1..438885e7 100644 --- a/samples/cpp-winrt/watch-endpoints/packages.config +++ b/samples/cpp-winrt/watch-endpoints/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj b/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj index 2f535e30..63da9424 100644 --- a/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj +++ b/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj @@ -2,7 +2,7 @@ - Microsoft.Windows.Devices.Midi2.1.0.1-preview.7.24305.1438 + Microsoft.Windows.Devices.Midi2.1.0.1-preview.8.24308.2011 true true true diff --git a/src/api/Abstraction/UdpNetworkMidi2/Midi2.NetworkMidiConfigurationManager.cpp b/src/api/Abstraction/UdpNetworkMidi2/Midi2.NetworkMidiConfigurationManager.cpp index def21e97..1ff44aa0 100644 --- a/src/api/Abstraction/UdpNetworkMidi2/Midi2.NetworkMidiConfigurationManager.cpp +++ b/src/api/Abstraction/UdpNetworkMidi2/Midi2.NetworkMidiConfigurationManager.cpp @@ -40,50 +40,50 @@ CMidi2NetworkMidiConfigurationManager::Initialize( -MidiNetworkUdpHostAuthentication MidiNetworkUdpHostAuthenticationFromJsonString(_In_ winrt::hstring const& jsonString) +MidiNetworkHostAuthentication MidiNetworkHostAuthenticationFromJsonString(_In_ winrt::hstring const& jsonString) { auto value = internal::ToLowerTrimmedHStringCopy(jsonString); if (value == MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_HOST_AUTHENTICATION_VALUE_NONE) { - return MidiNetworkUdpHostAuthentication::NoAuthentication; + return MidiNetworkHostAuthentication::NoAuthentication; } else if (value == MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_HOST_AUTHENTICATION_VALUE_PASSWORD) { - return MidiNetworkUdpHostAuthentication::PasswordAuthentication; + return MidiNetworkHostAuthentication::PasswordAuthentication; } else if (value == MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_HOST_AUTHENTICATION_VALUE_USER) { - return MidiNetworkUdpHostAuthentication::UserAuthentication; + return MidiNetworkHostAuthentication::UserAuthentication; } else { // default is any - return MidiNetworkUdpHostAuthentication::NoAuthentication; + return MidiNetworkHostAuthentication::NoAuthentication; } } -MidiNetworkUdpHostConnectionPolicy MidiNetworkUdpHostConnectionPolicyFromJsonString(_In_ winrt::hstring const& jsonString) +MidiNetworkHostConnectionPolicy MidiNetworkHostConnectionPolicyFromJsonString(_In_ winrt::hstring const& jsonString) { auto value = internal::ToLowerTrimmedHStringCopy(jsonString); if (value == MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_CONNECTION_POLICY_ALLOW_IPV4_VALUE_ANY) { - return MidiNetworkUdpHostConnectionPolicy::AllowAllConnections; + return MidiNetworkHostConnectionPolicy::PolicyAllowAllConnections; } else if (value == MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_CONNECTION_POLICY_ALLOW_IPV4_VALUE_LIST) { - return MidiNetworkUdpHostConnectionPolicy::AllowFromIpList; + return MidiNetworkHostConnectionPolicy::PolicyAllowFromIpList; } else if (value == MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_CONNECTION_POLICY_ALLOW_IPV4_VALUE_RANGE) { - return MidiNetworkUdpHostConnectionPolicy::AllowFromIpRange; + return MidiNetworkHostConnectionPolicy::PolicyAllowFromIpRange; } else { // default is any - return MidiNetworkUdpHostConnectionPolicy::AllowAllConnections; + return MidiNetworkHostConnectionPolicy::PolicyAllowAllConnections; } } @@ -92,7 +92,7 @@ MidiNetworkUdpHostConnectionPolicy MidiNetworkUdpHostConnectionPolicyFromJsonStr _Use_decl_annotations_ HRESULT CMidi2NetworkMidiConfigurationManager::ValidateHostDefinition( - MidiNetworkUdpHostDefinition& definition, + MidiNetworkHostDefinition& definition, winrt::hstring& errorMessage) { errorMessage = L""; @@ -120,7 +120,7 @@ CMidi2NetworkMidiConfigurationManager::ValidateHostDefinition( return E_INVALIDARG; } - if (definition.ConnectionPolicy == MidiNetworkUdpHostConnectionPolicy::AllowFromIpRange) + if (definition.ConnectionPolicy == MidiNetworkHostConnectionPolicy::PolicyAllowFromIpRange) { // validate that there are exactly two entries @@ -130,7 +130,7 @@ CMidi2NetworkMidiConfigurationManager::ValidateHostDefinition( return E_INVALIDARG; } } - else if (definition.ConnectionPolicy == MidiNetworkUdpHostConnectionPolicy::AllowFromIpList) + else if (definition.ConnectionPolicy == MidiNetworkHostConnectionPolicy::PolicyAllowFromIpList) { // validate that there is at least one entry @@ -194,6 +194,7 @@ CMidi2NetworkMidiConfigurationManager::UpdateConfiguration( // "networkPort" : "auto", // "umpOnly" : true, // "enabled" : true, + // "advertise" : true, // "connectionRulesIpv4" : // { // "allow" : "list", @@ -278,7 +279,7 @@ CMidi2NetworkMidiConfigurationManager::UpdateConfiguration( // are we defining a host? if (auto hostEntry = jsonEntry.GetNamedObject(MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_HOST_KEY, nullptr); hostEntry != nullptr) { - MidiNetworkUdpHostDefinition definition; + MidiNetworkHostDefinition definition; winrt::hstring validationErrorMessage{}; // currently, UDP is the only allowed protocol @@ -296,11 +297,11 @@ CMidi2NetworkMidiConfigurationManager::UpdateConfiguration( definition.UmpEndpointName = internal::TrimmedHStringCopy(hostEntry.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, L"")); definition.ProductInstanceId = internal::TrimmedHStringCopy(hostEntry.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_PRODUCT_INSTANCE_ID_PROPERTY, L"")); - definition.Authentication = MidiNetworkUdpHostAuthenticationFromJsonString(hostEntry.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_HOST_AUTHENTICATION_KEY, L"")); - definition.ConnectionPolicy = MidiNetworkUdpHostConnectionPolicyFromJsonString(hostEntry.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_CONNECTION_POLICY_KEY, L"")); + definition.Authentication = MidiNetworkHostAuthenticationFromJsonString(hostEntry.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_HOST_AUTHENTICATION_KEY, L"")); + definition.ConnectionPolicy = MidiNetworkHostConnectionPolicyFromJsonString(hostEntry.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_CONNECTION_POLICY_KEY, L"")); // read the list of ip info - if (definition.ConnectionPolicy != MidiNetworkUdpHostConnectionPolicy::AllowAllConnections) + if (definition.ConnectionPolicy != MidiNetworkHostConnectionPolicy::PolicyAllowAllConnections) { auto addressArray = hostEntry.GetNamedArray(MIDI_CONFIG_JSON_ENDPOINT_NETWORK_MIDI_CONNECTION_POLICY_IPV4_ADDRESSES_KEY); @@ -315,14 +316,14 @@ CMidi2NetworkMidiConfigurationManager::UpdateConfiguration( } // read authentication information - if (definition.Authentication != MidiNetworkUdpHostAuthentication::NoAuthentication) + if (definition.Authentication != MidiNetworkHostAuthentication::NoAuthentication) { - if (definition.Authentication == MidiNetworkUdpHostAuthentication::PasswordAuthentication) + if (definition.Authentication == MidiNetworkHostAuthentication::PasswordAuthentication) { // TODO: Read the password vault key } - else if (definition.Authentication == MidiNetworkUdpHostAuthentication::UserAuthentication) + else if (definition.Authentication == MidiNetworkHostAuthentication::UserAuthentication) { // TODO: Read username/password vault key } @@ -355,7 +356,7 @@ CMidi2NetworkMidiConfigurationManager::UpdateConfiguration( definition.ServiceInstanceName = serviceInstanceNamePrefix; - // TODO: See if the serviceInstanceName is already in use. If so, add a disambiguation number + // TODO: See if the serviceInstanceName is already in use. If so, add a disambiguation number. Keep trying until unused one is found @@ -371,7 +372,13 @@ CMidi2NetworkMidiConfigurationManager::UpdateConfiguration( RETURN_HR_IF_NULL(E_POINTER, host); RETURN_IF_FAILED(host->Initialize(definition)); - host->Start(); + // TODO: add to our collection of hosts + + + TransportState::Current().AddHost(host); + + // start the network host + RETURN_IF_FAILED(host->Start()); } else { @@ -386,24 +393,6 @@ CMidi2NetworkMidiConfigurationManager::UpdateConfiguration( // TODO: Add to the client reconnect table } - - - // internal::JsonStringifyObjectToOutParam(responseObject, &Response); - - // // create the device-side endpoint. This is a critical step - // RETURN_IF_FAILED(AbstractionState::Current().GetEndpointManager()->CreateDeviceSideEndpoint(deviceEntry)); - - // // mark success - // responseObject.SetNamedValue( - // MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, - // jsonTrue); - - // // TODO: This should have the association Id or something in it for the client to make sense of it - // auto singleResponse = internal::JsonCreateSingleWStringPropertyObject( - // MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_CREATED_ID_PROPERTY_KEY, - // deviceEntry.CreatedDeviceEndpointId); - - // createdDevicesResponseArray.Append(singleResponse); } } diff --git a/src/api/Abstraction/UdpNetworkMidi2/Midi2.NetworkMidiConfigurationManager.h b/src/api/Abstraction/UdpNetworkMidi2/Midi2.NetworkMidiConfigurationManager.h index f760e3fe..912c5760 100644 --- a/src/api/Abstraction/UdpNetworkMidi2/Midi2.NetworkMidiConfigurationManager.h +++ b/src/api/Abstraction/UdpNetworkMidi2/Midi2.NetworkMidiConfigurationManager.h @@ -20,7 +20,7 @@ class CMidi2NetworkMidiConfigurationManager : STDMETHOD(UpdateConfiguration(_In_ LPCWSTR configurationJsonSection, _Out_ LPWSTR* Response)); STDMETHOD(Shutdown)(); - STDMETHOD(ValidateHostDefinition(_In_ MidiNetworkUdpHostDefinition& definition, _Out_ winrt::hstring& errorMessage)); + STDMETHOD(ValidateHostDefinition(_In_ MidiNetworkHostDefinition& definition, _Out_ winrt::hstring& errorMessage)); // STDMETHOD(ValidateClientDefinition(_In_ MidiNetworkUdpClientDefinition& definition)); private: diff --git a/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHost.cpp b/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHost.cpp index 58838b37..a3a33db7 100644 --- a/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHost.cpp +++ b/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHost.cpp @@ -13,7 +13,7 @@ _Use_decl_annotations_ HRESULT MidiNetworkHost::Initialize( - MidiNetworkUdpHostDefinition& hostDefinition + MidiNetworkHostDefinition& hostDefinition ) { TraceLoggingWrite( @@ -26,19 +26,27 @@ MidiNetworkHost::Initialize( ); RETURN_HR_IF(E_INVALIDARG, hostDefinition.HostName.empty()); - RETURN_HR_IF(E_INVALIDARG, hostDefinition.ProductInstanceId.empty()); RETURN_HR_IF(E_INVALIDARG, hostDefinition.ServiceInstanceName.empty()); - RETURN_HR_IF(E_INVALIDARG, hostDefinition.UmpEndpointName.empty()); + RETURN_HR_IF(E_INVALIDARG, hostDefinition.UmpEndpointName.empty()); RETURN_HR_IF(E_INVALIDARG, hostDefinition.UmpEndpointName.size() > MAX_UMP_ENDPOINT_NAME_LENGTH); + + RETURN_HR_IF(E_INVALIDARG, hostDefinition.ProductInstanceId.empty()); RETURN_HR_IF(E_INVALIDARG, hostDefinition.ProductInstanceId.size() > MAX_UMP_PRODUCT_INSTANCE_ID_LENGTH); + if (!hostDefinition.UseAutomaticPortAllocation) + { + RETURN_HR_IF(E_INVALIDARG, hostDefinition.Port.empty()); + } + m_hostDefinition = hostDefinition; - m_advertiser = std::make_shared(); + // TODO: If we are to automatically pick a port, then do so here. - RETURN_HR_IF_NULL(E_POINTER, m_advertiser); + + m_advertiser = std::make_shared(); + RETURN_HR_IF_NULL(E_POINTER, m_advertiser); RETURN_IF_FAILED(m_advertiser->Initialize()); return S_OK; @@ -48,7 +56,6 @@ HRESULT MidiNetworkHost::Start() { winrt::Windows::Foundation::TimeSpan timeout = std::chrono::seconds(5); - auto status = m_socket.BindServiceNameAsync(winrt::to_hstring(m_hostDefinition.Port)).wait_for(timeout); if (status != winrt::Windows::Foundation::AsyncStatus::Completed) @@ -60,7 +67,7 @@ MidiNetworkHost::Start() TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), TraceLoggingWideString(L"Timed out trying to bind service to socket.", MIDI_TRACE_EVENT_MESSAGE_FIELD), - TraceLoggingUInt16(m_hostDefinition.Port, "port") + TraceLoggingWideString(m_hostDefinition.Port.c_str(), "port") ); RETURN_IF_FAILED(E_FAIL); @@ -68,23 +75,31 @@ MidiNetworkHost::Start() HostName hostName(m_hostDefinition.HostName); - RETURN_IF_FAILED(m_advertiser->Advertise( - m_hostDefinition.ServiceInstanceName, - hostName, - m_socket, - m_hostDefinition.Port, - m_hostDefinition.UmpEndpointName, - m_hostDefinition.ProductInstanceId - )); + // this should have error checking + auto portNumber = static_cast(std::stoi(winrt::to_string(m_hostDefinition.Port))); - // TODO: start listening on a new thread. - //ProcessIncomingPackets(); - - + // open the port + // TODO: This can specify encryption level, which we may want to add to params + m_socket.BindServiceNameAsync(m_hostDefinition.Port).get(); + // advertise + if (m_hostDefinition.Advertise) + { + RETURN_IF_FAILED(m_advertiser->Advertise( + m_hostDefinition.ServiceInstanceName, + hostName, + m_socket, + portNumber, + m_hostDefinition.UmpEndpointName, + m_hostDefinition.ProductInstanceId + )); + } + // TODO: spin up new thread and start listening + //ProcessIncomingPackets(); + return S_OK; @@ -295,7 +310,11 @@ MidiNetworkHost::EstablishNewSession() ); - // need to add a new session to the session list + // TODO: Add a new session to the session list + + // TODO: Let the endpoint manager know to enumerate this new endpoint + + // TODO: We'll need to make sure we can instantiate this before getting the SWD ID back, so protocol negotiation works return S_OK; @@ -314,16 +333,15 @@ MidiNetworkHost::Shutdown() TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD) ); - - // TODO: when done, stop advertising, send "bye" to all sessions, and then unbind the socket - - - if (m_advertiser) { m_advertiser->Shutdown(); } + // TODO: send "bye" to all sessions, and then unbind the socket + + // TODO: Stop packet processing thread + return S_OK; } \ No newline at end of file diff --git a/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHost.h b/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHost.h index 86430490..e65685f5 100644 --- a/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHost.h +++ b/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHost.h @@ -14,50 +14,61 @@ using namespace winrt::Windows::Networking::ServiceDiscovery::Dnssd; #include -enum MidiNetworkUdpHostConnectionPolicy +enum MidiNetworkHostConnectionPolicy { - AllowAllConnections = 0, - AllowFromIpList, - AllowFromIpRange, + PolicyAllowAllConnections = 0, + PolicyAllowFromIpList, + PolicyAllowFromIpRange, }; -enum MidiNetworkUdpHostAuthentication +enum MidiNetworkHostAuthentication { NoAuthentication = 0, PasswordAuthentication, UserAuthentication, }; -struct MidiNetworkUdpHostDefinition +enum MidiNetworkHostProtocol +{ + ProtocolDefault = 0, + ProtocolUdp, +}; + +struct MidiNetworkHostDefinition { winrt::hstring EntryIdentifier; // internal - uint16_t Port; + bool UseAutomaticPortAllocation{ true }; + winrt::hstring Port; winrt::hstring UmpEndpointName; winrt::hstring ProductInstanceId; bool UmpOnly{ true }; bool Enabled{ true }; + bool Advertise{ true }; // connection rules - MidiNetworkUdpHostConnectionPolicy ConnectionPolicy{ MidiNetworkUdpHostConnectionPolicy::AllowAllConnections }; + MidiNetworkHostConnectionPolicy ConnectionPolicy{ MidiNetworkHostConnectionPolicy::PolicyAllowAllConnections }; // network adapter (the id is a guid) + // protocol + MidiNetworkHostProtocol NetworkProtocol{ MidiNetworkHostProtocol::ProtocolDefault }; + // ip information std::vector IpAddresses{}; // authentication - MidiNetworkUdpHostAuthentication Authentication{ MidiNetworkUdpHostAuthentication::NoAuthentication }; + MidiNetworkHostAuthentication Authentication{ MidiNetworkHostAuthentication::NoAuthentication }; // auth lookup key // generated properties winrt::hstring ServiceInstanceName; // instance name for the PTR record - winrt::hstring HostName; // must include the .local domain + winrt::hstring HostName; // must include the .local domain }; @@ -66,7 +77,7 @@ struct MidiNetworkUdpHostDefinition class MidiNetworkHost { public: - HRESULT Initialize(_In_ MidiNetworkUdpHostDefinition& hostDefinition); + HRESULT Initialize(_In_ MidiNetworkHostDefinition& hostDefinition); HRESULT Start(); @@ -88,7 +99,7 @@ class MidiNetworkHost _In_ DatagramSocket const& sender, _In_ DatagramSocketMessageReceivedEventArgs const& args); - MidiNetworkUdpHostDefinition m_hostDefinition{}; + MidiNetworkHostDefinition m_hostDefinition{}; std::shared_ptr m_advertiser; diff --git a/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHostSession.cpp b/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHostSession.cpp index 94e5b4ed..81238fd3 100644 --- a/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHostSession.cpp +++ b/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHostSession.cpp @@ -8,8 +8,9 @@ #include "pch.h" -HRESULT -MidiNetworkHostSession::Initialize() +_Use_decl_annotations_ +HRESULT +MidiNetworkHostSession::Initialize(IMidiCallback* callback) { TraceLoggingWrite( MidiNetworkMidiTransportTelemetryProvider::Provider(), @@ -20,7 +21,9 @@ MidiNetworkHostSession::Initialize() TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD) ); + RETURN_HR_IF_NULL(E_INVALIDARG, callback); + m_callback = callback; return S_OK; } @@ -35,15 +38,27 @@ MidiNetworkHostSession::ReceiveMidiMessagesFromNetwork(uint16_t const sequenceNu // receive a block of message data from the network, parse them, and begin sending // them to the BiDi callback, one message at a time + // timestamps are generated here + return S_OK; } -HRESULT -MidiNetworkHostSession::SendMidiMessageToNetwork() +_Use_decl_annotations_ +HRESULT +MidiNetworkHostSession::SendMidiMessage( + PVOID message, + UINT size, + LONGLONG timestamp +) { + UNREFERENCED_PARAMETER(message); + UNREFERENCED_PARAMETER(size); + UNREFERENCED_PARAMETER(timestamp); + + // we simply enqueue messages so the host can send them diff --git a/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHostSession.h b/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHostSession.h index c2837bbf..9bf1b93e 100644 --- a/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHostSession.h +++ b/src/api/Abstraction/UdpNetworkMidi2/MidiNetworkHostSession.h @@ -19,19 +19,30 @@ // + + +// TODO: Should the session just be 1:1 with IMidiBiDi / ICallback and then simply implemented in there? + + class MidiNetworkHostSession { public: - HRESULT Initialize(/* TODO: Linked IMidiCallback and IMidiBiDi */); + HRESULT Initialize(_In_ IMidiCallback* callback /* TODO: Linked IMidiCallback and IMidiBiDi */); HRESULT ReceiveMidiMessagesFromNetwork(_In_ uint16_t const sequenceNumber, _In_ std::vector const& words); - HRESULT SendMidiMessageToNetwork(); + HRESULT SendMidiMessage( + _In_ PVOID message, + _In_ UINT size, + _In_ LONGLONG timestamp + ); HRESULT Shutdown(); private: + wil::com_ptr m_callback; + // client information // crypto nonce for this session for this client diff --git a/src/api/Abstraction/UdpNetworkMidi2/TransportState.cpp b/src/api/Abstraction/UdpNetworkMidi2/TransportState.cpp index 027fac3c..36281833 100644 --- a/src/api/Abstraction/UdpNetworkMidi2/TransportState.cpp +++ b/src/api/Abstraction/UdpNetworkMidi2/TransportState.cpp @@ -43,11 +43,11 @@ TransportState::ConstructConfigurationManager() _Use_decl_annotations_ HRESULT -TransportState::AddHost(MidiNetworkHost* host) +TransportState::AddHost(std::shared_ptr host) { RETURN_HR_IF_NULL(E_INVALIDARG, host); - + m_hosts.push_back(host); return S_OK; } diff --git a/src/api/Abstraction/UdpNetworkMidi2/TransportState.h b/src/api/Abstraction/UdpNetworkMidi2/TransportState.h index de814496..c06bb48e 100644 --- a/src/api/Abstraction/UdpNetworkMidi2/TransportState.h +++ b/src/api/Abstraction/UdpNetworkMidi2/TransportState.h @@ -51,7 +51,7 @@ class TransportState HRESULT ConstructEndpointManager(); HRESULT ConstructConfigurationManager(); - HRESULT AddHost(_In_ MidiNetworkHost* host); + HRESULT AddHost(_In_ std::shared_ptr); private: @@ -63,6 +63,6 @@ class TransportState wil::com_ptr m_configurationManager; // key is the host identifier - std::map> m_hosts; + std::vector> m_hosts{}; }; \ No newline at end of file diff --git a/src/api/Midi2-InDevelopment.sln b/src/api/Midi2-InDevelopment.sln index c95b6e10..0a67ea7e 100644 --- a/src/api/Midi2-InDevelopment.sln +++ b/src/api/Midi2-InDevelopment.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 17.12.35209.166 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.NetworkMidiTransport", "Abstraction\UdpNetworkMidi2\Midi2.NetworkMidiTransport.vcxproj", "{7E618284-6AA0-4FCE-9E4A-D895A5EE8E3C}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.VirtualPatchBayTransport", "Abstraction\VirtualPatchbay\Midi2.VirtualPatchBayTransport.vcxproj", "{7427BC7A-4247-42B0-AC9B-7DA10418AA9D}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -29,18 +27,6 @@ Global {7E618284-6AA0-4FCE-9E4A-D895A5EE8E3C}.Release|ARM64EC.Build.0 = Release|ARM64EC {7E618284-6AA0-4FCE-9E4A-D895A5EE8E3C}.Release|x64.ActiveCfg = Release|x64 {7E618284-6AA0-4FCE-9E4A-D895A5EE8E3C}.Release|x64.Build.0 = Release|x64 - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Debug|ARM64.Build.0 = Debug|ARM64 - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Debug|ARM64EC.ActiveCfg = Debug|ARM64EC - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Debug|ARM64EC.Build.0 = Debug|ARM64EC - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Debug|x64.ActiveCfg = Debug|x64 - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Debug|x64.Build.0 = Debug|x64 - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Release|ARM64.ActiveCfg = Release|ARM64 - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Release|ARM64.Build.0 = Release|ARM64 - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Release|ARM64EC.ActiveCfg = Release|ARM64EC - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Release|ARM64EC.Build.0 = Release|ARM64EC - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Release|x64.ActiveCfg = Release|x64 - {7427BC7A-4247-42B0-AC9B-7DA10418AA9D}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/app-sdk/mididiag/main.cpp b/src/app-sdk/mididiag/main.cpp index 2a79669f..25317f7d 100644 --- a/src/app-sdk/mididiag/main.cpp +++ b/src/app-sdk/mididiag/main.cpp @@ -787,6 +787,9 @@ int __cdecl main() OutputHeader(MIDIDIAG_PRODUCT_NAME); OutputHeader(L"This application Copyright (c) 2024- Microsoft Corporation"); OutputHeader(L"Information, license, and source available at https://aka.ms/midi"); + OutputStringField(MIDIDIAG_HEADER_FIELD_LABEL_VERSION_BUILD_SOURCE, std::wstring{ WINDOWS_MIDI_SERVICES_BUILD_SOURCE }); + OutputStringField(MIDIDIAG_HEADER_FIELD_LABEL_VERSION_NAME, std::wstring{ WINDOWS_MIDI_SERVICES_BUILD_VERSION_NAME }); + OutputStringField(MIDIDIAG_HEADER_FIELD_LABEL_VERSION_FULL, std::wstring{ WINDOWS_MIDI_SERVICES_BUILD_VERSION_FULL }); OutputSectionHeader(MIDIDIAG_SECTION_LABEL_HEADER); diff --git a/src/app-sdk/mididiag/mididiag.vcxproj b/src/app-sdk/mididiag/mididiag.vcxproj index 4bc1d93a..48bc81e8 100644 --- a/src/app-sdk/mididiag/mididiag.vcxproj +++ b/src/app-sdk/mididiag/mididiag.vcxproj @@ -120,9 +120,9 @@ stdcpp20 stdcpp20 stdcpp20 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc; - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc; - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc; + %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(SolutionDir)..\..\build\staging\version\ + %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(SolutionDir)..\..\build\staging\version\ + %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(SolutionDir)..\..\build\staging\version\ Console @@ -150,9 +150,9 @@ stdcpp20 stdcpp20 stdcpp20 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc; - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc; - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc; + %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(SolutionDir)..\..\build\staging\version\ + %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(SolutionDir)..\..\build\staging\version\ + %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(SolutionDir)..\..\build\staging\version\ Console diff --git a/src/app-sdk/mididiag/mididiag.vcxproj.filters b/src/app-sdk/mididiag/mididiag.vcxproj.filters index 3e6f2442..ba5cbcc9 100644 --- a/src/app-sdk/mididiag/mididiag.vcxproj.filters +++ b/src/app-sdk/mididiag/mididiag.vcxproj.filters @@ -36,4 +36,7 @@ + + + \ No newline at end of file diff --git a/src/app-sdk/mididiag/mididiag_field_defs.h b/src/app-sdk/mididiag/mididiag_field_defs.h index be9f2e8c..0dcea613 100644 --- a/src/app-sdk/mididiag/mididiag_field_defs.h +++ b/src/app-sdk/mididiag/mididiag_field_defs.h @@ -15,6 +15,10 @@ #define MIDIDIAG_MAX_FIELD_LABEL_WIDTH 25 +#define MIDIDIAG_HEADER_FIELD_LABEL_VERSION_BUILD_SOURCE L"ver_build_source" +#define MIDIDIAG_HEADER_FIELD_LABEL_VERSION_NAME L"ver_build_name" +#define MIDIDIAG_HEADER_FIELD_LABEL_VERSION_FULL L"ver_build_full" + #define MIDIDIAG_FIELD_SEPARATOR L" : " #define MIDIDIAG_SECTION_HEADER_SEPARATOR_CHAR '=' #define MIDIDIAG_ITEM_SEPARATOR_CHAR '-' diff --git a/src/app-sdk/mididiag/pch.h b/src/app-sdk/mididiag/pch.h index 855bd952..638cfb6e 100644 --- a/src/app-sdk/mididiag/pch.h +++ b/src/app-sdk/mididiag/pch.h @@ -58,6 +58,7 @@ namespace svc = winrt::Microsoft::Windows::Devices::Midi2::ServiceConfig; #include #include +#include #include "wstring_util.h" #include "MidiDefs.h" diff --git a/src/app-sdk/midiusbinfo/main.cpp b/src/app-sdk/midiusbinfo/main.cpp index e1d36389..8683ddc1 100644 --- a/src/app-sdk/midiusbinfo/main.cpp +++ b/src/app-sdk/midiusbinfo/main.cpp @@ -38,6 +38,15 @@ int __cdecl main() std::cout << dye::aqua(" that you stop the midisrv service before running this tool.") << std::endl; std::cout << dye::grey("===================================================================") << std::endl; + std::wcout + << WINDOWS_MIDI_SERVICES_BUILD_VERSION_NAME + << L" (" + << WINDOWS_MIDI_SERVICES_BUILD_SOURCE + << L")" + << std::endl; + + std::wcout << WINDOWS_MIDI_SERVICES_BUILD_VERSION_FULL << std::endl; + // enumerate all in-scope devices winrt::hstring deviceSelector( L"System.Devices.InterfaceClassGuid:=\"{6994AD04-93EF-11D0-A3CC-00A0C9223196}\" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True"); diff --git a/src/app-sdk/midiusbinfo/midiusbinfo.vcxproj b/src/app-sdk/midiusbinfo/midiusbinfo.vcxproj index aa6119cc..f103af43 100644 --- a/src/app-sdk/midiusbinfo/midiusbinfo.vcxproj +++ b/src/app-sdk/midiusbinfo/midiusbinfo.vcxproj @@ -126,9 +126,9 @@ stdcpp20 stdcpp20 stdcpp20 - %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc - %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc - %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc + %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc;$(SolutionDir)..\..\build\staging\version\ + %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc;$(SolutionDir)..\..\build\staging\version\ + %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc;$(SolutionDir)..\..\build\staging\version\ Console @@ -156,9 +156,9 @@ stdcpp20 stdcpp20 stdcpp20 - %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc - %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc - %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc + %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc;$(SolutionDir)..\..\build\staging\version\ + %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc;$(SolutionDir)..\..\build\staging\version\ + %(AdditionalIncludeDirectories);..\..\api\VSFiles\intermediate\idl\$(Platform)\$(Configuration);..\..\api\inc;$(SolutionDir)..\..\build\staging\version\ Console diff --git a/src/app-sdk/midiusbinfo/pch.h b/src/app-sdk/midiusbinfo/pch.h index 2889949f..fc53ba44 100644 --- a/src/app-sdk/midiusbinfo/pch.h +++ b/src/app-sdk/midiusbinfo/pch.h @@ -67,6 +67,8 @@ namespace collections = winrt::Windows::Foundation::Collections; #include "wstring_util.h" +#include + #include "WindowsMidiServices.h" #include "WindowsMidiServices_i.c" diff --git a/src/app-sdk/sdk-runtime-installer/main-bundle/Bundle.wxs b/src/app-sdk/sdk-runtime-installer/main-bundle/Bundle.wxs index b817d554..d6c7d333 100644 --- a/src/app-sdk/sdk-runtime-installer/main-bundle/Bundle.wxs +++ b/src/app-sdk/sdk-runtime-installer/main-bundle/Bundle.wxs @@ -111,7 +111,7 @@ SourceFile="WindowsMIDIServicesConsoleStandAloneSetup.msi"> - + diff --git a/src/app-sdk/winrt-initialization/Microsoft.Windows.Devices.Midi2.Initialization.vcxproj b/src/app-sdk/winrt-initialization/Microsoft.Windows.Devices.Midi2.Initialization.vcxproj index 2e7461d6..cfc635ec 100644 --- a/src/app-sdk/winrt-initialization/Microsoft.Windows.Devices.Midi2.Initialization.vcxproj +++ b/src/app-sdk/winrt-initialization/Microsoft.Windows.Devices.Midi2.Initialization.vcxproj @@ -206,9 +206,9 @@ true true true - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;%(AdditionalIncludeDirectories) - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;%(AdditionalIncludeDirectories) - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;%(AdditionalIncludeDirectories) stdcpp20 stdcpp20 @@ -255,9 +255,9 @@ NDEBUG;%(PreprocessorDefinitions);WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;%(AdditionalIncludeDirectories) - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;%(AdditionalIncludeDirectories) - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;%(AdditionalIncludeDirectories) true true true diff --git a/src/app-sdk/winrt-initialization/pch.h b/src/app-sdk/winrt-initialization/pch.h index f1abdda9..390e38d1 100644 --- a/src/app-sdk/winrt-initialization/pch.h +++ b/src/app-sdk/winrt-initialization/pch.h @@ -57,6 +57,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2 {}; namespace internal = ::WindowsMidiServicesInternal; namespace midi2 = ::winrt::Microsoft::Windows::Devices::Midi2; +#include #include #include diff --git a/src/app-sdk/winrt/Microsoft.Windows.Devices.Midi2.vcxproj b/src/app-sdk/winrt/Microsoft.Windows.Devices.Midi2.vcxproj index 1cc0ac7c..440a9530 100644 --- a/src/app-sdk/winrt/Microsoft.Windows.Devices.Midi2.vcxproj +++ b/src/app-sdk/winrt/Microsoft.Windows.Devices.Midi2.vcxproj @@ -173,9 +173,9 @@ true true true - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) stdcpp20 stdcpp20 @@ -219,9 +219,9 @@ NDEBUG;%(PreprocessorDefinitions);WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) - $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) + $(SolutionDir)..\api\inc;$(SolutionDir)..\api\vsfiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)..\api\vsfiles\intermediate\Midi2.MidiSrvAbstraction\$(Platform)\$(Configuration);$(SolutionDir)sdk-shared;$(SolutionDir)..\..\build\staging\version\;$(ProjectDir)libmidi2\include;%(AdditionalIncludeDirectories) true true true @@ -262,6 +262,21 @@ + + MidiNetworkClientEndpointCreationConfig.idl + + + MidiNetworkClientEndpointRemovalConfig.idl + + + MidiNetworkEndpointManager.idl + + + MidiNetworkHostEndpointCreationConfig.idl + + + MidiNetworkHostEndpointRemovalConfig.idl + @@ -353,7 +368,9 @@ MidiStreamConfigRequestReceivedEventArgs.idl - + + MidiUniqueId.idl + MidiVirtualDevice.idl @@ -414,6 +431,22 @@ + + MidiNetworkClientEndpointCreationConfig.idl + + + MidiNetworkClientEndpointRemovalConfig.idl + + + MidiNetworkEndpointManager.idl + + + MidiNetworkHostEndpointCreationConfig.idl + + + MidiNetworkHostEndpointRemovalConfig.idl + + NotUsing NotUsing @@ -595,7 +628,9 @@ MidiStreamConfigRequestReceivedEventArgs.idl - + + MidiUniqueId.idl + MidiVirtualDevice.idl @@ -687,6 +722,17 @@ + + + + + + + + + + + diff --git a/src/app-sdk/winrt/Microsoft.Windows.Devices.Midi2.vcxproj.filters b/src/app-sdk/winrt/Microsoft.Windows.Devices.Midi2.vcxproj.filters index ed8df60b..43624588 100644 --- a/src/app-sdk/winrt/Microsoft.Windows.Devices.Midi2.vcxproj.filters +++ b/src/app-sdk/winrt/Microsoft.Windows.Devices.Midi2.vcxproj.filters @@ -46,6 +46,21 @@ SDK\CapabilityInquiry + + SDK\Endpoints\Network\Host + + + SDK\Endpoints\Network\Host + + + SDK\Endpoints\Network\Client + + + SDK\Endpoints\Network\Client + + + SDK\Endpoints\Network + @@ -92,6 +107,21 @@ SDK\CapabilityInquiry + + SDK\Endpoints\Network\Host + + + SDK\Endpoints\Network\Host + + + SDK\Endpoints\Network\Client + + + SDK\Endpoints\Network\Client + + + SDK\Endpoints\Network + @@ -373,6 +403,39 @@ SDK\Utilities\Messages + + SDK\Endpoints\Network + + + SDK\Endpoints\Network\Client + + + SDK\Endpoints\Network\Client + + + SDK\Endpoints\Network\Client + + + SDK\Endpoints\Network\Client + + + SDK\Endpoints\Network\Host + + + SDK\Endpoints\Network\Host + + + SDK\Endpoints\Network\Host + + + SDK\Endpoints\Network\Host + + + SDK\Endpoints\Network + + + SDK\Endpoints\Network + @@ -461,5 +524,14 @@ {440006ae-c234-49ce-aae1-65bd4354b22d} + + {285ad19a-e3d4-4572-842e-d316ceb1f42c} + + + {8375564e-aa3f-4bd5-bded-2e89f5b4a708} + + + {0224a83d-4dbc-4f65-9e50-e0ba99c5ba6a} + \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkAuthenticationTypeEnum.idl b/src/app-sdk/winrt/MidiNetworkAuthenticationTypeEnum.idl new file mode 100644 index 00000000..b2839b89 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkAuthenticationTypeEnum.idl @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [experimental] + enum MidiNetworkAuthenticationType + { + NoAuthentication = 0, + PasswordAuthentication, + UserAuthentication, + }; +} \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkClientEndpointCreationConfig.cpp b/src/app-sdk/winrt/MidiNetworkClientEndpointCreationConfig.cpp new file mode 100644 index 00000000..714cdf8c --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkClientEndpointCreationConfig.cpp @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +#include "pch.h" +#include "MidiNetworkClientEndpointCreationConfig.h" +#include "Endpoints.Network.MidiNetworkClientEndpointCreationConfig.g.cpp" + +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::implementation +{ + winrt::guid MidiNetworkClientEndpointCreationConfig::TransportId() + { + throw hresult_not_implemented(); + } + hstring MidiNetworkClientEndpointCreationConfig::GetConfigJson() + { + throw hresult_not_implemented(); + } +} diff --git a/src/app-sdk/winrt/MidiNetworkClientEndpointCreationConfig.h b/src/app-sdk/winrt/MidiNetworkClientEndpointCreationConfig.h new file mode 100644 index 00000000..107f821c --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkClientEndpointCreationConfig.h @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +#pragma once +#include "Endpoints.Network.MidiNetworkClientEndpointCreationConfig.g.h" + +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::implementation +{ + struct MidiNetworkClientEndpointCreationConfig : MidiNetworkClientEndpointCreationConfigT + { + MidiNetworkClientEndpointCreationConfig() = default; + + winrt::guid TransportId(); + hstring GetConfigJson(); + }; +} +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::factory_implementation +{ + struct MidiNetworkClientEndpointCreationConfig : MidiNetworkClientEndpointCreationConfigT + { + }; +} diff --git a/src/app-sdk/winrt/MidiNetworkClientEndpointCreationConfig.idl b/src/app-sdk/winrt/MidiNetworkClientEndpointCreationConfig.idl new file mode 100644 index 00000000..b7efa191 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkClientEndpointCreationConfig.idl @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + + +import "IMidiServiceTransportPluginConfig.idl"; + + + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [default_interface] + [experimental] + runtimeclass MidiNetworkClientEndpointCreationConfig : Microsoft.Windows.Devices.Midi2.ServiceConfig.IMidiServiceTransportPluginConfig + { + MidiNetworkClientEndpointCreationConfig(); + + + } +} \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkClientEndpointCreationResult.idl b/src/app-sdk/winrt/MidiNetworkClientEndpointCreationResult.idl new file mode 100644 index 00000000..9c586c37 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkClientEndpointCreationResult.idl @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [experimental] + struct MidiNetworkClientEndpointCreationResult + { + Boolean foo; + + }; +} \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalConfig.cpp b/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalConfig.cpp new file mode 100644 index 00000000..18e0ab52 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalConfig.cpp @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +#include "pch.h" +#include "MidiNetworkClientEndpointRemovalConfig.h" +#include "Endpoints.Network.MidiNetworkClientEndpointRemovalConfig.g.cpp" + +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::implementation +{ + winrt::guid MidiNetworkClientEndpointRemovalConfig::TransportId() + { + throw hresult_not_implemented(); + } + hstring MidiNetworkClientEndpointRemovalConfig::GetConfigJson() + { + throw hresult_not_implemented(); + } +} diff --git a/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalConfig.h b/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalConfig.h new file mode 100644 index 00000000..cde7b5ca --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalConfig.h @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +#pragma once +#include "Endpoints.Network.MidiNetworkClientEndpointRemovalConfig.g.h" + +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::implementation +{ + struct MidiNetworkClientEndpointRemovalConfig : MidiNetworkClientEndpointRemovalConfigT + { + MidiNetworkClientEndpointRemovalConfig() = default; + + winrt::guid TransportId(); + hstring GetConfigJson(); + }; +} +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::factory_implementation +{ + struct MidiNetworkClientEndpointRemovalConfig : MidiNetworkClientEndpointRemovalConfigT + { + }; +} diff --git a/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalConfig.idl b/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalConfig.idl new file mode 100644 index 00000000..b3b0f4a6 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalConfig.idl @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + + +import "IMidiServiceTransportPluginConfig.idl"; + + + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [default_interface] + [experimental] + runtimeclass MidiNetworkClientEndpointRemovalConfig : Microsoft.Windows.Devices.Midi2.ServiceConfig.IMidiServiceTransportPluginConfig + { + MidiNetworkClientEndpointRemovalConfig(); + + + } +} \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalResult.idl b/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalResult.idl new file mode 100644 index 00000000..99ded3a8 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkClientEndpointRemovalResult.idl @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [experimental] + struct MidiNetworkClientEndpointRemovalResult + { + Boolean foo; + + }; +} \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkEndpointManager.cpp b/src/app-sdk/winrt/MidiNetworkEndpointManager.cpp new file mode 100644 index 00000000..d646a0e7 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkEndpointManager.cpp @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +#include "pch.h" +#include "MidiNetworkEndpointManager.h" +#include "Endpoints.Network.MidiNetworkEndpointManager.g.cpp" + +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::implementation +{ + bool MidiNetworkEndpointManager::IsTransportAvailable() + { + throw hresult_not_implemented(); + } + winrt::guid MidiNetworkEndpointManager::AbstractionId() + { + throw hresult_not_implemented(); + } + + _Use_decl_annotations_ + network::MidiNetworkHostEndpointCreationResult MidiNetworkEndpointManager::CreateNetworkHost( + network::MidiNetworkHostEndpointCreationConfig const& creationConfig) + { + UNREFERENCED_PARAMETER(creationConfig); + throw hresult_not_implemented(); + } + + _Use_decl_annotations_ + network::MidiNetworkHostEndpointRemovalResult MidiNetworkEndpointManager::RemoveNetworkHost( + network::MidiNetworkHostEndpointRemovalConfig const& removalConfig) + { + UNREFERENCED_PARAMETER(removalConfig); + throw hresult_not_implemented(); + } + + _Use_decl_annotations_ + network::MidiNetworkClientEndpointCreationResult MidiNetworkEndpointManager::CreateNetworkClient( + network::MidiNetworkClientEndpointCreationConfig const& creationConfig) + { + UNREFERENCED_PARAMETER(creationConfig); + throw hresult_not_implemented(); + } + + _Use_decl_annotations_ + network::MidiNetworkClientEndpointRemovalResult MidiNetworkEndpointManager::RemoveNetworkClient( + network::MidiNetworkClientEndpointRemovalConfig const& removalConfig) + { + UNREFERENCED_PARAMETER(removalConfig); + throw hresult_not_implemented(); + } +} diff --git a/src/app-sdk/winrt/MidiNetworkEndpointManager.h b/src/app-sdk/winrt/MidiNetworkEndpointManager.h new file mode 100644 index 00000000..5fb8c4dd --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkEndpointManager.h @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + + +#pragma once +#include "Endpoints.Network.MidiNetworkEndpointManager.g.h" + +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::implementation +{ + struct MidiNetworkEndpointManager : MidiNetworkEndpointManagerT + { + MidiNetworkEndpointManager() = default; + + static bool IsTransportAvailable(); + static winrt::guid AbstractionId(); + static winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::MidiNetworkHostEndpointCreationResult CreateNetworkHost(winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::MidiNetworkHostEndpointCreationConfig const& creationConfig); + static winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::MidiNetworkHostEndpointRemovalResult RemoveNetworkHost(winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::MidiNetworkHostEndpointRemovalConfig const& removalConfig); + static winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::MidiNetworkClientEndpointCreationResult CreateNetworkClient(winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::MidiNetworkClientEndpointCreationConfig const& creationConfig); + static winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::MidiNetworkClientEndpointRemovalResult RemoveNetworkClient(winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::MidiNetworkClientEndpointRemovalConfig const& removalConfig); + }; +} +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::factory_implementation +{ + struct MidiNetworkEndpointManager : MidiNetworkEndpointManagerT + { + }; +} diff --git a/src/app-sdk/winrt/MidiNetworkEndpointManager.idl b/src/app-sdk/winrt/MidiNetworkEndpointManager.idl new file mode 100644 index 00000000..81dcaf09 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkEndpointManager.idl @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +import "MidiNetworkHostEndpointCreationResult.idl"; +import "MidiNetworkHostEndpointCreationConfig.idl"; + +import "MidiNetworkHostEndpointRemovalResult.idl"; +import "MidiNetworkHostEndpointRemovalConfig.idl"; + +import "MidiNetworkClientEndpointCreationResult.idl"; +import "MidiNetworkClientEndpointCreationConfig.idl"; + +import "MidiNetworkClientEndpointRemovalResult.idl"; +import "MidiNetworkClientEndpointRemovalConfig.idl"; + + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [default_interface] + [experimental] + static runtimeclass MidiNetworkEndpointManager + { + static Boolean IsTransportAvailable{ get; }; + static Guid AbstractionId{ get; }; + + static MidiNetworkHostEndpointCreationResult CreateNetworkHost( + MidiNetworkHostEndpointCreationConfig creationConfig); + + static MidiNetworkHostEndpointRemovalResult RemoveNetworkHost( + MidiNetworkHostEndpointRemovalConfig removalConfig); + + + static MidiNetworkClientEndpointCreationResult CreateNetworkClient( + MidiNetworkClientEndpointCreationConfig creationConfig); + + static MidiNetworkClientEndpointRemovalResult RemoveNetworkClient( + MidiNetworkClientEndpointRemovalConfig removalConfig); + + + } +} \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkHostConnectionPolicyEnum.idl b/src/app-sdk/winrt/MidiNetworkHostConnectionPolicyEnum.idl new file mode 100644 index 00000000..d107f92e --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkHostConnectionPolicyEnum.idl @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [experimental] + enum MidiNetworkHostConnectionPolicy + { + AllowAllConnections = 0, + AllowFromIpList, + AllowFromIpRange, + }; +} \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkHostEndpointCreationConfig.cpp b/src/app-sdk/winrt/MidiNetworkHostEndpointCreationConfig.cpp new file mode 100644 index 00000000..6628291e --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkHostEndpointCreationConfig.cpp @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +#include "pch.h" +#include "MidiNetworkHostEndpointCreationConfig.h" +#include "Endpoints.Network.MidiNetworkHostEndpointCreationConfig.g.cpp" + +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::implementation +{ + + winrt::hstring MidiNetworkHostEndpointCreationConfig::GetConfigJson() + { + throw hresult_not_implemented(); + } +} diff --git a/src/app-sdk/winrt/MidiNetworkHostEndpointCreationConfig.h b/src/app-sdk/winrt/MidiNetworkHostEndpointCreationConfig.h new file mode 100644 index 00000000..6287ebe7 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkHostEndpointCreationConfig.h @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +#pragma once +#include "Endpoints.Network.MidiNetworkHostEndpointCreationConfig.g.h" + +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::implementation +{ + struct MidiNetworkHostEndpointCreationConfig : MidiNetworkHostEndpointCreationConfigT + { + MidiNetworkHostEndpointCreationConfig() = default; + + winrt::guid Identifier() { return m_identifier; } + void Identifier(_In_ winrt::guid const& value) { m_identifier = value; } + + winrt::hstring Name() { return m_name; } + void Name(_In_ winrt::hstring const& value) { m_name = internal::TrimmedHStringCopy(value); } + + winrt::hstring HostInstanceName() { return m_hostInstanceName; } + void HostInstanceName(_In_ winrt::hstring const& value) { m_hostInstanceName = internal::TrimmedHStringCopy(value); } + + winrt::hstring ProductInstanceId() { return m_productInstanceId; } + void ProductInstanceId(_In_ winrt::hstring const& value) { m_productInstanceId = internal::TrimmedHStringCopy(value); } + + bool UmpOnly() { return m_umpOnly; } + void UmpOnly(_In_ bool const value) { m_umpOnly = value; } + + bool UseAutomaticPortAllocation() { return m_useAutomaticPortAllocation; } + void UseAutomaticPortAllocation(_In_ bool const value) { m_useAutomaticPortAllocation = value; } + + winrt::hstring ManuallyAssignedPort() { return m_manuallyAssignedPort; } + void ManuallyAssignedPort(_In_ winrt::hstring const& value) { m_manuallyAssignedPort = internal::TrimmedHStringCopy(value); } + + bool Advertise() { return m_advertise; } + void Advertise(_In_ bool const value) { m_advertise = value; } + + collections::IVector AllowedClientConnectionList() { return m_allowedClientConnectionList; } + + network::MidiNetworkAuthenticationType AuthenticationType() { return m_authenticationType; } + void AuthenticationType(_In_ network::MidiNetworkAuthenticationType const& value) { m_authenticationType = value; } + + winrt::guid TransportId() { return m_transportId; } + winrt::hstring GetConfigJson(); + + private: + winrt::guid m_identifier{}; + winrt::hstring m_name; + winrt::hstring m_hostInstanceName; + winrt::hstring m_productInstanceId; + bool m_umpOnly{ true }; + bool m_useAutomaticPortAllocation{ true }; + winrt::hstring m_manuallyAssignedPort{}; + bool m_advertise{ true }; + + network::MidiNetworkAuthenticationType m_authenticationType{ network::MidiNetworkAuthenticationType::NoAuthentication }; + + winrt::guid m_transportId{}; + + collections::IVector m_allowedClientConnectionList{ + winrt::multi_threaded_vector() }; + + }; +} +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::factory_implementation +{ + struct MidiNetworkHostEndpointCreationConfig : MidiNetworkHostEndpointCreationConfigT + { + }; +} diff --git a/src/app-sdk/winrt/MidiNetworkHostEndpointCreationConfig.idl b/src/app-sdk/winrt/MidiNetworkHostEndpointCreationConfig.idl new file mode 100644 index 00000000..f00152c2 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkHostEndpointCreationConfig.idl @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + + +import "IMidiServiceTransportPluginConfig.idl"; +import "MidiNetworkAuthenticationTypeEnum.idl"; + + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [default_interface] + [experimental] + runtimeclass MidiNetworkHostEndpointCreationConfig : Microsoft.Windows.Devices.Midi2.ServiceConfig.IMidiServiceTransportPluginConfig + { + MidiNetworkHostEndpointCreationConfig(); + + Guid Identifier; + + String Name; + String HostInstanceName; + String ProductInstanceId; + + Boolean UmpOnly; + + Boolean UseAutomaticPortAllocation; + String ManuallyAssignedPort; + + Boolean Advertise; + + // todo: network adapter/interface + + // todo: connection rules + IVector AllowedClientConnectionList{ get; }; + + + + MidiNetworkAuthenticationType AuthenticationType; + + // todo: password key etc. + + + } +} \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkHostEndpointCreationResult.idl b/src/app-sdk/winrt/MidiNetworkHostEndpointCreationResult.idl new file mode 100644 index 00000000..2f1d87d3 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkHostEndpointCreationResult.idl @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [experimental] + struct MidiNetworkHostEndpointCreationResult + { + Boolean foo; + + }; +} \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalConfig.cpp b/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalConfig.cpp new file mode 100644 index 00000000..fc0f1df4 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalConfig.cpp @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +#include "pch.h" +#include "MidiNetworkHostEndpointRemovalConfig.h" +#include "Endpoints.Network.MidiNetworkHostEndpointRemovalConfig.g.cpp" + +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::implementation +{ + winrt::guid MidiNetworkHostEndpointRemovalConfig::TransportId() + { + throw hresult_not_implemented(); + } + hstring MidiNetworkHostEndpointRemovalConfig::GetConfigJson() + { + throw hresult_not_implemented(); + } +} diff --git a/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalConfig.h b/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalConfig.h new file mode 100644 index 00000000..7a97e68b --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalConfig.h @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + +#pragma once +#include "Endpoints.Network.MidiNetworkHostEndpointRemovalConfig.g.h" + +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::implementation +{ + struct MidiNetworkHostEndpointRemovalConfig : MidiNetworkHostEndpointRemovalConfigT + { + MidiNetworkHostEndpointRemovalConfig() = default; + + winrt::guid TransportId(); + hstring GetConfigJson(); + }; +} +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network::factory_implementation +{ + struct MidiNetworkHostEndpointRemovalConfig : MidiNetworkHostEndpointRemovalConfigT + { + }; +} diff --git a/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalConfig.idl b/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalConfig.idl new file mode 100644 index 00000000..94b84755 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalConfig.idl @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + + +import "IMidiServiceTransportPluginConfig.idl"; + + + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [default_interface] + [experimental] + runtimeclass MidiNetworkHostEndpointRemovalConfig : Microsoft.Windows.Devices.Midi2.ServiceConfig.IMidiServiceTransportPluginConfig + { + MidiNetworkHostEndpointRemovalConfig(); + + + } +} \ No newline at end of file diff --git a/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalResult.idl b/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalResult.idl new file mode 100644 index 00000000..5b4ee663 --- /dev/null +++ b/src/app-sdk/winrt/MidiNetworkHostEndpointRemovalResult.idl @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App SDK and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + + +namespace Microsoft.Windows.Devices.Midi2.Endpoints.Network +{ + [experimental] + struct MidiNetworkHostEndpointRemovalResult + { + Boolean foo; + + }; +} \ No newline at end of file diff --git a/src/app-sdk/winrt/pch.h b/src/app-sdk/winrt/pch.h index 5432600e..d2602cc7 100644 --- a/src/app-sdk/winrt/pch.h +++ b/src/app-sdk/winrt/pch.h @@ -116,6 +116,8 @@ namespace msgs = ::winrt::Microsoft::Windows::Devices::Midi2::Messages; namespace winrt::Microsoft::Windows::Devices::Midi2::CapabilityInquiry {}; namespace ci = ::winrt::Microsoft::Windows::Devices::Midi2::CapabilityInquiry; +namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network {}; +namespace network = ::winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Network; #define SAFE_COTASKMEMFREE(p) \ @@ -124,6 +126,7 @@ namespace ci = ::winrt::Microsoft::Windows::Devices::Midi2::CapabilityInquiry; (p) = NULL; \ } +#include #include "resource.h" @@ -179,6 +182,15 @@ namespace ci = ::winrt::Microsoft::Windows::Devices::Midi2::CapabilityInquiry; #include "MidiVirtualDeviceCreationConfig.h" #include "MidiVirtualDeviceManager.h" +#include "MidiNetworkHostEndpointCreationConfig.h" +#include "MidiNetworkHostEndpointRemovalConfig.h" +#include "MidiNetworkClientEndpointCreationConfig.h" +#include "MidiNetworkClientEndpointRemovalConfig.h" +#include "MidiNetworkEndpointManager.h" + + + + #include "MidiDiagnostics.h" #include "MidiServicePingResponseSummary.h" diff --git a/src/oob-setup-in-dev/api-package/WindowsMidiServices.wxs b/src/oob-setup-in-dev/api-package/WindowsMidiServices.wxs index 1625a47f..ec2a662c 100644 --- a/src/oob-setup-in-dev/api-package/WindowsMidiServices.wxs +++ b/src/oob-setup-in-dev/api-package/WindowsMidiServices.wxs @@ -6,7 +6,7 @@ Name="Windows MIDI Services In-Development $(var.Platform)" Manufacturer="Microsoft Corporation" Version="1.0.0.0" - UpgradeCode="43890557-4bb2-49b7-9173-d778d0db36fd" + UpgradeCode="2d53aa96-4021-41fe-b5ef-6df7e345a0b9" Scope="perMachine" Compressed="true" @@ -32,9 +32,9 @@ + Guid="3727cc9a-c427-4237-a733-5c6b10b33a9d" > - + @@ -44,7 +44,7 @@ - + + diff --git a/src/oob-setup-in-dev/main-bundle/main-bundle.wixproj b/src/oob-setup-in-dev/main-bundle/main-bundle.wixproj index 6c08c833..251f5b0f 100644 --- a/src/oob-setup-in-dev/main-bundle/main-bundle.wixproj +++ b/src/oob-setup-in-dev/main-bundle/main-bundle.wixproj @@ -1,7 +1,7 @@  Bundle - WindowsMidiServicesInBoxComponentsSetup + WindowsMidiServicesInDevelopmentServiceComponentsSetup $([System.DateTime]::Now.ToString("yyyyMMddhhmm")) BuildDate=$(BuildDate) diff --git a/src/user-tools/midi-console/Midi/AnsiMarkupFormatter.cs b/src/user-tools/midi-console/Midi/AnsiMarkupFormatter.cs index 43b6926f..3376a740 100644 --- a/src/user-tools/midi-console/Midi/AnsiMarkupFormatter.cs +++ b/src/user-tools/midi-console/Midi/AnsiMarkupFormatter.cs @@ -81,6 +81,11 @@ public static string FormatAppTitle(string title) return "[deepskyblue1]" + EscapeString(title) + "[/]"; } + public static string FormatAppVersionInformation(string versionInformation) + { + return "[grey35]" + EscapeString(versionInformation) + "[/]"; + } + public static string FormatAppDescription(string description) { return "[deepskyblue2]" + EscapeString(description) + "[/]"; diff --git a/src/user-tools/midi-console/Midi/Commands/Enumerate/EnumActiveSessionsCommand.cs b/src/user-tools/midi-console/Midi/Commands/Enumerate/EnumActiveSessionsCommand.cs index 5ae8bc86..ca98c330 100644 --- a/src/user-tools/midi-console/Midi/Commands/Enumerate/EnumActiveSessionsCommand.cs +++ b/src/user-tools/midi-console/Midi/Commands/Enumerate/EnumActiveSessionsCommand.cs @@ -15,6 +15,10 @@ internal class EnumActiveSessionsCommand : Command 0) { foreach (var session in sessionList) { + // if session has no open connections, and we haven't specified to include all, then skip + if (!settings.All && session.Connections.Count == 0) + { + continue; + } + table.AddRow( $"{AnsiMarkupFormatter.FormatProcessName(session.ProcessName)} [[{AnsiMarkupFormatter.FormatProcessId(session.ProcessId)}]]", $"Session {AnsiMarkupFormatter.FormatSessionName(session.SessionName)} open since {AnsiMarkupFormatter.FormatLongDateTime(session.StartTime)}" @@ -54,6 +65,8 @@ public override int Execute(CommandContext context, Settings settings) if (session.Connections.Count > 0) { + reportedSessionCount++; + //table.AddEmptyRow(); string connectionCountMessage = string.Empty; @@ -106,16 +119,24 @@ public override int Execute(CommandContext context, Settings settings) table.AddRow("", $"{connectionInfoString} {AnsiMarkupFormatter.FormatFullEndpointInterfaceId(connection.EndpointDeviceId)}"); table.AddEmptyRow(); - } + } else { - table.AddRow("", "No open endpoint connections."); + table.AddRow("", "No open endpoint connections"); } table.AddEmptyRow(); } + + if (reportedSessionCount == 0) + { + table.AddRow("", "No active sessions with open connections (use --all to see all sessions)"); + } + + + } else { diff --git a/src/user-tools/midi-console/Midi/Midi.csproj b/src/user-tools/midi-console/Midi/Midi.csproj index 837926a2..3dfa68ad 100644 --- a/src/user-tools/midi-console/Midi/Midi.csproj +++ b/src/user-tools/midi-console/Midi/Midi.csproj @@ -37,9 +37,13 @@ + + + + - + diff --git a/src/user-tools/midi-console/Midi/Program.cs b/src/user-tools/midi-console/Midi/Program.cs index 5e373d97..60beb67a 100644 --- a/src/user-tools/midi-console/Midi/Program.cs +++ b/src/user-tools/midi-console/Midi/Program.cs @@ -223,6 +223,8 @@ // app title AnsiConsole.WriteLine(); AnsiConsole.MarkupLine(AnsiMarkupFormatter.FormatAppTitle(Strings.AppTitle)); +AnsiConsole.MarkupLine(AnsiMarkupFormatter.FormatAppVersionInformation($"{Microsoft.Midi.Common.MidiBuildInformation.Name} ({Microsoft.Midi.Common.MidiBuildInformation.Source})")); +AnsiConsole.MarkupLine(AnsiMarkupFormatter.FormatAppVersionInformation(Microsoft.Midi.Common.MidiBuildInformation.BuildFullVersion)); AnsiConsole.WriteLine(); if (args.Length == 0) diff --git a/src/user-tools/midi-console/Midi/Resources/Strings.Designer.cs b/src/user-tools/midi-console/Midi/Resources/Strings.Designer.cs index 685d7243..e81b00f2 100644 --- a/src/user-tools/midi-console/Midi/Resources/Strings.Designer.cs +++ b/src/user-tools/midi-console/Midi/Resources/Strings.Designer.cs @@ -79,7 +79,7 @@ internal static string AppShortName { } /// - /// Looks up a localized string similar to Microsoft Windows MIDI Services Console (Preview). + /// Looks up a localized string similar to Microsoft Windows MIDI Services Console. /// internal static string AppTitle { get { diff --git a/src/user-tools/midi-console/Midi/Resources/Strings.resx b/src/user-tools/midi-console/Midi/Resources/Strings.resx index 3b35a5a8..5e6bbbca 100644 --- a/src/user-tools/midi-console/Midi/Resources/Strings.resx +++ b/src/user-tools/midi-console/Midi/Resources/Strings.resx @@ -124,7 +124,7 @@ MIDI Console (Preview) - Microsoft Windows MIDI Services Console (Preview) + Microsoft Windows MIDI Services Console Generate a report, typically for a support request, or for use when filing a bug