Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
UPnPService.cs
1using System;
2using System.Threading.Tasks;
3using System.Xml;
4
6{
10 public class UPnPService
11 {
12 private readonly UPnPClient client;
13 private readonly XmlElement xml;
14 private readonly string serviceType;
15 private readonly string serviceId;
16 private readonly string scpdURL;
17 private readonly string controlURL;
18 private readonly string eventSubURL;
19 private readonly Uri scpdURI;
20 private readonly Uri controlURI;
21 private readonly Uri eventSubURI;
22
30 public UPnPService(UPnPClient Client, string ServiceType, string ServiceId, string ScpdUrl)
31 {
32 this.client = Client;
33 this.xml = null;
34 this.serviceType = ServiceType;
35 this.serviceId = ServiceId;
36 this.scpdURL = ScpdUrl;
37 this.scpdURI = new Uri(ScpdUrl);
38 this.controlURL = null;
39 this.controlURI = null;
40 this.eventSubURL = null;
41 this.eventSubURI = null;
42 }
43
50 public UPnPService(XmlElement Xml, Uri BaseUri, UPnPClient Client)
51 {
52 this.client = Client;
53 this.xml = Xml;
54
55 foreach (XmlNode N in Xml.ChildNodes)
56 {
57 switch (N.LocalName)
58 {
59 case "serviceType":
60 this.serviceType = N.InnerText;
61 break;
62
63 case "serviceId":
64 this.serviceId = N.InnerText;
65 break;
66
67 case "SCPDURL":
68 this.scpdURL = N.InnerText;
69 this.scpdURI = new Uri(BaseUri, this.scpdURL);
70 break;
71
72 case "controlURL":
73 this.controlURL = N.InnerText;
74 this.controlURI = new Uri(BaseUri, this.controlURL);
75 break;
76
77 case "eventSubURL":
78 this.eventSubURL = N.InnerText;
79 this.eventSubURI = new Uri(BaseUri, this.eventSubURL);
80 break;
81 }
82 }
83 }
84
88 public XmlElement Xml => this.xml;
89
93 public string ServiceType => this.serviceType;
94
98 public string ServiceId => this.serviceId;
99
103 public string SCPDURL => this.scpdURL;
104
108 public string ControlURL => this.controlURL;
109
113 public string EventSubURL => this.eventSubURL;
114
118 public Uri SCPDURI => this.scpdURI;
119
123 public Uri ControlURI => this.controlURI;
124
128 public Uri EventSubURI => this.eventSubURI;
129
131 public override string ToString()
132 {
133 return this.serviceType;
134 }
135
144 {
145 return this.client.GetService(this);
146 }
147
157 {
158 return this.client.GetService(this, Timeout);
159 }
160
165 public Task<ServiceDescriptionDocument> GetServiceAsync()
166 {
167 return this.client.GetServiceAsync(this);
168 }
169
175 public Task<ServiceDescriptionDocument> GetServiceAsync(int Timeout)
176 {
177 return this.client.GetServiceAsync(this, Timeout);
178 }
179 }
180}
Contains the information provided in a Service Description Document, downloaded from a service in the...
Implements support for the UPnP protocol, as described in: http://upnp.org/specs/arch/UPnP-arch-Devic...
Definition: UPnPClient.cs:21
Contains information about a service.
Definition: UPnPService.cs:11
ServiceDescriptionDocument GetService()
Gets the service description document from a service in the network. This method is the synchronous v...
Definition: UPnPService.cs:143
string ServiceType
Service Type
Definition: UPnPService.cs:93
string ControlURL
URL for control
Definition: UPnPService.cs:108
XmlElement Xml
Underlying XML definition.
Definition: UPnPService.cs:88
UPnPService(XmlElement Xml, Uri BaseUri, UPnPClient Client)
Contains information about a service.
Definition: UPnPService.cs:50
string EventSubURL
URL for eventing
Definition: UPnPService.cs:113
Uri SCPDURI
URI to service description
Definition: UPnPService.cs:118
Uri EventSubURI
URI for eventing
Definition: UPnPService.cs:128
string SCPDURL
URL to service description
Definition: UPnPService.cs:103
ServiceDescriptionDocument GetService(int Timeout)
Gets the service description document from a service in the network. This method is the synchronous v...
Definition: UPnPService.cs:156
UPnPService(UPnPClient Client, string ServiceType, string ServiceId, string ScpdUrl)
Contains information about a service.
Definition: UPnPService.cs:30
Task< ServiceDescriptionDocument > GetServiceAsync()
Starts the retrieval of a Service Description Document.
Definition: UPnPService.cs:165
Task< ServiceDescriptionDocument > GetServiceAsync(int Timeout)
Starts the retrieval of a Service Description Document.
Definition: UPnPService.cs:175