ServiceActionListBuilder.cs 5.6 KB

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