ServiceActionListBuilder.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. #pragma warning disable CS1591
  2. using System.Collections.Generic;
  3. using Emby.Dlna.Common;
  4. namespace Emby.Dlna.ConnectionManager
  5. {
  6. /// <summary>
  7. /// Defines the <see cref="ServiceActionListBuilder" />.
  8. /// </summary>
  9. public static class ServiceActionListBuilder
  10. {
  11. /// <summary>
  12. /// Returns an enumerable of the ConnectionManagar:1 DLNA actions.
  13. /// </summary>
  14. /// <returns>An <see cref="IEnumerable{ServiceAction}"/>.</returns>
  15. public static IEnumerable<ServiceAction> GetActions()
  16. {
  17. var list = new List<ServiceAction>
  18. {
  19. GetCurrentConnectionInfo(),
  20. GetProtocolInfo(),
  21. GetCurrentConnectionIDs(),
  22. ConnectionComplete(),
  23. PrepareForConnection()
  24. };
  25. return list;
  26. }
  27. /// <summary>
  28. /// Returns the action details for "PrepareForConnection".
  29. /// </summary>
  30. /// <returns>The <see cref="ServiceAction"/>.</returns>
  31. private static ServiceAction PrepareForConnection()
  32. {
  33. var action = new ServiceAction
  34. {
  35. Name = "PrepareForConnection"
  36. };
  37. action.ArgumentList.Add(new Argument
  38. {
  39. Name = "RemoteProtocolInfo",
  40. Direction = "in",
  41. RelatedStateVariable = "A_ARG_TYPE_ProtocolInfo"
  42. });
  43. action.ArgumentList.Add(new Argument
  44. {
  45. Name = "PeerConnectionManager",
  46. Direction = "in",
  47. RelatedStateVariable = "A_ARG_TYPE_ConnectionManager"
  48. });
  49. action.ArgumentList.Add(new Argument
  50. {
  51. Name = "PeerConnectionID",
  52. Direction = "in",
  53. RelatedStateVariable = "A_ARG_TYPE_ConnectionID"
  54. });
  55. action.ArgumentList.Add(new Argument
  56. {
  57. Name = "Direction",
  58. Direction = "in",
  59. RelatedStateVariable = "A_ARG_TYPE_Direction"
  60. });
  61. action.ArgumentList.Add(new Argument
  62. {
  63. Name = "ConnectionID",
  64. Direction = "out",
  65. RelatedStateVariable = "A_ARG_TYPE_ConnectionID"
  66. });
  67. action.ArgumentList.Add(new Argument
  68. {
  69. Name = "AVTransportID",
  70. Direction = "out",
  71. RelatedStateVariable = "A_ARG_TYPE_AVTransportID"
  72. });
  73. action.ArgumentList.Add(new Argument
  74. {
  75. Name = "RcsID",
  76. Direction = "out",
  77. RelatedStateVariable = "A_ARG_TYPE_RcsID"
  78. });
  79. return action;
  80. }
  81. /// <summary>
  82. /// Returns the action details for "GetCurrentConnectionInfo".
  83. /// </summary>
  84. /// <returns>The <see cref="ServiceAction"/>.</returns>
  85. private static ServiceAction GetCurrentConnectionInfo()
  86. {
  87. var action = new ServiceAction
  88. {
  89. Name = "GetCurrentConnectionInfo"
  90. };
  91. action.ArgumentList.Add(new Argument
  92. {
  93. Name = "ConnectionID",
  94. Direction = "in",
  95. RelatedStateVariable = "A_ARG_TYPE_ConnectionID"
  96. });
  97. action.ArgumentList.Add(new Argument
  98. {
  99. Name = "RcsID",
  100. Direction = "out",
  101. RelatedStateVariable = "A_ARG_TYPE_RcsID"
  102. });
  103. action.ArgumentList.Add(new Argument
  104. {
  105. Name = "AVTransportID",
  106. Direction = "out",
  107. RelatedStateVariable = "A_ARG_TYPE_AVTransportID"
  108. });
  109. action.ArgumentList.Add(new Argument
  110. {
  111. Name = "ProtocolInfo",
  112. Direction = "out",
  113. RelatedStateVariable = "A_ARG_TYPE_ProtocolInfo"
  114. });
  115. action.ArgumentList.Add(new Argument
  116. {
  117. Name = "PeerConnectionManager",
  118. Direction = "out",
  119. RelatedStateVariable = "A_ARG_TYPE_ConnectionManager"
  120. });
  121. action.ArgumentList.Add(new Argument
  122. {
  123. Name = "PeerConnectionID",
  124. Direction = "out",
  125. RelatedStateVariable = "A_ARG_TYPE_ConnectionID"
  126. });
  127. action.ArgumentList.Add(new Argument
  128. {
  129. Name = "Direction",
  130. Direction = "out",
  131. RelatedStateVariable = "A_ARG_TYPE_Direction"
  132. });
  133. action.ArgumentList.Add(new Argument
  134. {
  135. Name = "Status",
  136. Direction = "out",
  137. RelatedStateVariable = "A_ARG_TYPE_ConnectionStatus"
  138. });
  139. return action;
  140. }
  141. /// <summary>
  142. /// Returns the action details for "GetProtocolInfo".
  143. /// </summary>
  144. /// <returns>The <see cref="ServiceAction"/>.</returns>
  145. private static ServiceAction GetProtocolInfo()
  146. {
  147. var action = new ServiceAction
  148. {
  149. Name = "GetProtocolInfo"
  150. };
  151. action.ArgumentList.Add(new Argument
  152. {
  153. Name = "Source",
  154. Direction = "out",
  155. RelatedStateVariable = "SourceProtocolInfo"
  156. });
  157. action.ArgumentList.Add(new Argument
  158. {
  159. Name = "Sink",
  160. Direction = "out",
  161. RelatedStateVariable = "SinkProtocolInfo"
  162. });
  163. return action;
  164. }
  165. /// <summary>
  166. /// Returns the action details for "GetCurrentConnectionIDs".
  167. /// </summary>
  168. /// <returns>The <see cref="ServiceAction"/>.</returns>
  169. private static ServiceAction GetCurrentConnectionIDs()
  170. {
  171. var action = new ServiceAction
  172. {
  173. Name = "GetCurrentConnectionIDs"
  174. };
  175. action.ArgumentList.Add(new Argument
  176. {
  177. Name = "ConnectionIDs",
  178. Direction = "out",
  179. RelatedStateVariable = "CurrentConnectionIDs"
  180. });
  181. return action;
  182. }
  183. /// <summary>
  184. /// Returns the action details for "ConnectionComplete".
  185. /// </summary>
  186. /// <returns>The <see cref="ServiceAction"/>.</returns>
  187. private static ServiceAction ConnectionComplete()
  188. {
  189. var action = new ServiceAction
  190. {
  191. Name = "ConnectionComplete"
  192. };
  193. action.ArgumentList.Add(new Argument
  194. {
  195. Name = "ConnectionID",
  196. Direction = "in",
  197. RelatedStateVariable = "A_ARG_TYPE_ConnectionID"
  198. });
  199. return action;
  200. }
  201. }
  202. }