aboutsummaryrefslogtreecommitdiff
path: root/Emby.Dlna/ConnectionManager
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2023-11-09 14:45:16 -0500
committerPatrick Barron <barronpm@gmail.com>2023-11-15 20:53:44 -0500
commitf1aba6b95230474d47c580071370c7dbd00eba13 (patch)
tree4fdc0131e7ae17c724e5bcda8d1e8878475a6461 /Emby.Dlna/ConnectionManager
parent01fd42cf9555d85469c07ce3d0c0e5842359eb2b (diff)
Remove Emby.Dlna
Diffstat (limited to 'Emby.Dlna/ConnectionManager')
-rw-r--r--Emby.Dlna/ConnectionManager/ConnectionManagerService.cs53
-rw-r--r--Emby.Dlna/ConnectionManager/ConnectionManagerXmlBuilder.cs119
-rw-r--r--Emby.Dlna/ConnectionManager/ControlHandler.cs55
-rw-r--r--Emby.Dlna/ConnectionManager/ServiceActionListBuilder.cs234
4 files changed, 0 insertions, 461 deletions
diff --git a/Emby.Dlna/ConnectionManager/ConnectionManagerService.cs b/Emby.Dlna/ConnectionManager/ConnectionManagerService.cs
deleted file mode 100644
index 916044a0cc..0000000000
--- a/Emby.Dlna/ConnectionManager/ConnectionManagerService.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#pragma warning disable CS1591
-
-using System.Net.Http;
-using System.Threading.Tasks;
-using Emby.Dlna.Service;
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.Dlna;
-using Microsoft.Extensions.Logging;
-
-namespace Emby.Dlna.ConnectionManager
-{
- /// <summary>
- /// Defines the <see cref="ConnectionManagerService" />.
- /// </summary>
- public class ConnectionManagerService : BaseService, IConnectionManager
- {
- private readonly IDlnaManager _dlna;
- private readonly IServerConfigurationManager _config;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ConnectionManagerService"/> class.
- /// </summary>
- /// <param name="dlna">The <see cref="IDlnaManager"/> for use with the <see cref="ConnectionManagerService"/> instance.</param>
- /// <param name="config">The <see cref="IServerConfigurationManager"/> for use with the <see cref="ConnectionManagerService"/> instance.</param>
- /// <param name="logger">The <see cref="ILogger{ConnectionManagerService}"/> for use with the <see cref="ConnectionManagerService"/> instance..</param>
- /// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/> for use with the <see cref="ConnectionManagerService"/> instance..</param>
- public ConnectionManagerService(
- IDlnaManager dlna,
- IServerConfigurationManager config,
- ILogger<ConnectionManagerService> logger,
- IHttpClientFactory httpClientFactory)
- : base(logger, httpClientFactory)
- {
- _dlna = dlna;
- _config = config;
- }
-
- /// <inheritdoc />
- public string GetServiceXml()
- {
- return ConnectionManagerXmlBuilder.GetXml();
- }
-
- /// <inheritdoc />
- public Task<ControlResponse> ProcessControlRequestAsync(ControlRequest request)
- {
- var profile = _dlna.GetProfile(request.Headers) ??
- _dlna.GetDefaultProfile();
-
- return new ControlHandler(_config, Logger, profile).ProcessControlRequestAsync(request);
- }
- }
-}
diff --git a/Emby.Dlna/ConnectionManager/ConnectionManagerXmlBuilder.cs b/Emby.Dlna/ConnectionManager/ConnectionManagerXmlBuilder.cs
deleted file mode 100644
index db1190ae7c..0000000000
--- a/Emby.Dlna/ConnectionManager/ConnectionManagerXmlBuilder.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-#pragma warning disable CS1591
-
-using System.Collections.Generic;
-using Emby.Dlna.Common;
-using Emby.Dlna.Service;
-
-namespace Emby.Dlna.ConnectionManager
-{
- /// <summary>
- /// Defines the <see cref="ConnectionManagerXmlBuilder" />.
- /// </summary>
- public static class ConnectionManagerXmlBuilder
- {
- /// <summary>
- /// Gets the ConnectionManager:1 service template.
- /// See http://upnp.org/specs/av/UPnP-av-ConnectionManager-v1-Service.pdf.
- /// </summary>
- /// <returns>An XML description of this service.</returns>
- public static string GetXml()
- {
- return new ServiceXmlBuilder().GetXml(ServiceActionListBuilder.GetActions(), GetStateVariables());
- }
-
- /// <summary>
- /// Get the list of state variables for this invocation.
- /// </summary>
- /// <returns>The <see cref="IEnumerable{StateVariable}"/>.</returns>
- private static IEnumerable<StateVariable> GetStateVariables()
- {
- return new StateVariable[]
- {
- new StateVariable
- {
- Name = "SourceProtocolInfo",
- DataType = "string",
- SendsEvents = true
- },
-
- new StateVariable
- {
- Name = "SinkProtocolInfo",
- DataType = "string",
- SendsEvents = true
- },
-
- new StateVariable
- {
- Name = "CurrentConnectionIDs",
- DataType = "string",
- SendsEvents = true
- },
-
- new StateVariable
- {
- Name = "A_ARG_TYPE_ConnectionStatus",
- DataType = "string",
- SendsEvents = false,
-
- AllowedValues = new[]
- {
- "OK",
- "ContentFormatMismatch",
- "InsufficientBandwidth",
- "UnreliableChannel",
- "Unknown"
- }
- },
-
- new StateVariable
- {
- Name = "A_ARG_TYPE_ConnectionManager",
- DataType = "string",
- SendsEvents = false
- },
-
- new StateVariable
- {
- Name = "A_ARG_TYPE_Direction",
- DataType = "string",
- SendsEvents = false,
-
- AllowedValues = new[]
- {
- "Output",
- "Input"
- }
- },
-
- new StateVariable
- {
- Name = "A_ARG_TYPE_ProtocolInfo",
- DataType = "string",
- SendsEvents = false
- },
-
- new StateVariable
- {
- Name = "A_ARG_TYPE_ConnectionID",
- DataType = "ui4",
- SendsEvents = false
- },
-
- new StateVariable
- {
- Name = "A_ARG_TYPE_AVTransportID",
- DataType = "ui4",
- SendsEvents = false
- },
-
- new StateVariable
- {
- Name = "A_ARG_TYPE_RcsID",
- DataType = "ui4",
- SendsEvents = false
- }
- };
- }
- }
-}
diff --git a/Emby.Dlna/ConnectionManager/ControlHandler.cs b/Emby.Dlna/ConnectionManager/ControlHandler.cs
deleted file mode 100644
index 1a1790ee6a..0000000000
--- a/Emby.Dlna/ConnectionManager/ControlHandler.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-#pragma warning disable CS1591
-
-using System;
-using System.Collections.Generic;
-using System.Xml;
-using Emby.Dlna.Service;
-using MediaBrowser.Common.Extensions;
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Model.Dlna;
-using Microsoft.Extensions.Logging;
-
-namespace Emby.Dlna.ConnectionManager
-{
- /// <summary>
- /// Defines the <see cref="ControlHandler" />.
- /// </summary>
- public class ControlHandler : BaseControlHandler
- {
- private readonly DeviceProfile _profile;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ControlHandler"/> class.
- /// </summary>
- /// <param name="config">The <see cref="IServerConfigurationManager"/> for use with the <see cref="ControlHandler"/> instance.</param>
- /// <param name="logger">The <see cref="ILogger"/> for use with the <see cref="ControlHandler"/> instance.</param>
- /// <param name="profile">The <see cref="DeviceProfile"/> for use with the <see cref="ControlHandler"/> instance.</param>
- public ControlHandler(IServerConfigurationManager config, ILogger logger, DeviceProfile profile)
- : base(config, logger)
- {
- _profile = profile;
- }
-
- /// <inheritdoc />
- protected override void WriteResult(string methodName, IReadOnlyDictionary<string, string> methodParams, XmlWriter xmlWriter)
- {
- if (string.Equals(methodName, "GetProtocolInfo", StringComparison.OrdinalIgnoreCase))
- {
- HandleGetProtocolInfo(xmlWriter);
- return;
- }
-
- throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
- }
-
- /// <summary>
- /// Builds the response to the GetProtocolInfo request.
- /// </summary>
- /// <param name="xmlWriter">The <see cref="XmlWriter"/>.</param>
- private void HandleGetProtocolInfo(XmlWriter xmlWriter)
- {
- xmlWriter.WriteElementString("Source", _profile.ProtocolInfo);
- xmlWriter.WriteElementString("Sink", string.Empty);
- }
- }
-}
diff --git a/Emby.Dlna/ConnectionManager/ServiceActionListBuilder.cs b/Emby.Dlna/ConnectionManager/ServiceActionListBuilder.cs
deleted file mode 100644
index 542c7bfb4b..0000000000
--- a/Emby.Dlna/ConnectionManager/ServiceActionListBuilder.cs
+++ /dev/null
@@ -1,234 +0,0 @@
-#pragma warning disable CS1591
-
-using System.Collections.Generic;
-using Emby.Dlna.Common;
-
-namespace Emby.Dlna.ConnectionManager
-{
- /// <summary>
- /// Defines the <see cref="ServiceActionListBuilder" />.
- /// </summary>
- public static class ServiceActionListBuilder
- {
- /// <summary>
- /// Returns an enumerable of the ConnectionManagar:1 DLNA actions.
- /// </summary>
- /// <returns>An <see cref="IEnumerable{ServiceAction}"/>.</returns>
- public static IEnumerable<ServiceAction> GetActions()
- {
- var list = new List<ServiceAction>
- {
- GetCurrentConnectionInfo(),
- GetProtocolInfo(),
- GetCurrentConnectionIDs(),
- ConnectionComplete(),
- PrepareForConnection()
- };
-
- return list;
- }
-
- /// <summary>
- /// Returns the action details for "PrepareForConnection".
- /// </summary>
- /// <returns>The <see cref="ServiceAction"/>.</returns>
- private static ServiceAction PrepareForConnection()
- {
- var action = new ServiceAction
- {
- Name = "PrepareForConnection"
- };
-
- action.ArgumentList.Add(new Argument
- {
- Name = "RemoteProtocolInfo",
- Direction = "in",
- RelatedStateVariable = "A_ARG_TYPE_ProtocolInfo"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "PeerConnectionManager",
- Direction = "in",
- RelatedStateVariable = "A_ARG_TYPE_ConnectionManager"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "PeerConnectionID",
- Direction = "in",
- RelatedStateVariable = "A_ARG_TYPE_ConnectionID"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "Direction",
- Direction = "in",
- RelatedStateVariable = "A_ARG_TYPE_Direction"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "ConnectionID",
- Direction = "out",
- RelatedStateVariable = "A_ARG_TYPE_ConnectionID"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "AVTransportID",
- Direction = "out",
- RelatedStateVariable = "A_ARG_TYPE_AVTransportID"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "RcsID",
- Direction = "out",
- RelatedStateVariable = "A_ARG_TYPE_RcsID"
- });
-
- return action;
- }
-
- /// <summary>
- /// Returns the action details for "GetCurrentConnectionInfo".
- /// </summary>
- /// <returns>The <see cref="ServiceAction"/>.</returns>
- private static ServiceAction GetCurrentConnectionInfo()
- {
- var action = new ServiceAction
- {
- Name = "GetCurrentConnectionInfo"
- };
-
- action.ArgumentList.Add(new Argument
- {
- Name = "ConnectionID",
- Direction = "in",
- RelatedStateVariable = "A_ARG_TYPE_ConnectionID"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "RcsID",
- Direction = "out",
- RelatedStateVariable = "A_ARG_TYPE_RcsID"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "AVTransportID",
- Direction = "out",
- RelatedStateVariable = "A_ARG_TYPE_AVTransportID"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "ProtocolInfo",
- Direction = "out",
- RelatedStateVariable = "A_ARG_TYPE_ProtocolInfo"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "PeerConnectionManager",
- Direction = "out",
- RelatedStateVariable = "A_ARG_TYPE_ConnectionManager"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "PeerConnectionID",
- Direction = "out",
- RelatedStateVariable = "A_ARG_TYPE_ConnectionID"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "Direction",
- Direction = "out",
- RelatedStateVariable = "A_ARG_TYPE_Direction"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "Status",
- Direction = "out",
- RelatedStateVariable = "A_ARG_TYPE_ConnectionStatus"
- });
-
- return action;
- }
-
- /// <summary>
- /// Returns the action details for "GetProtocolInfo".
- /// </summary>
- /// <returns>The <see cref="ServiceAction"/>.</returns>
- private static ServiceAction GetProtocolInfo()
- {
- var action = new ServiceAction
- {
- Name = "GetProtocolInfo"
- };
-
- action.ArgumentList.Add(new Argument
- {
- Name = "Source",
- Direction = "out",
- RelatedStateVariable = "SourceProtocolInfo"
- });
-
- action.ArgumentList.Add(new Argument
- {
- Name = "Sink",
- Direction = "out",
- RelatedStateVariable = "SinkProtocolInfo"
- });
-
- return action;
- }
-
- /// <summary>
- /// Returns the action details for "GetCurrentConnectionIDs".
- /// </summary>
- /// <returns>The <see cref="ServiceAction"/>.</returns>
- private static ServiceAction GetCurrentConnectionIDs()
- {
- var action = new ServiceAction
- {
- Name = "GetCurrentConnectionIDs"
- };
-
- action.ArgumentList.Add(new Argument
- {
- Name = "ConnectionIDs",
- Direction = "out",
- RelatedStateVariable = "CurrentConnectionIDs"
- });
-
- return action;
- }
-
- /// <summary>
- /// Returns the action details for "ConnectionComplete".
- /// </summary>
- /// <returns>The <see cref="ServiceAction"/>.</returns>
- private static ServiceAction ConnectionComplete()
- {
- var action = new ServiceAction
- {
- Name = "ConnectionComplete"
- };
-
- action.ArgumentList.Add(new Argument
- {
- Name = "ConnectionID",
- Direction = "in",
- RelatedStateVariable = "A_ARG_TYPE_ConnectionID"
- });
-
- return action;
- }
- }
-}