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.Collections.Generic;
3using System.Threading.Tasks;
4using System.Xml;
5
7{
11 public class UPnPService
12 {
13 private readonly UPnPClient client;
14 private readonly XmlElement xml;
15 private readonly string serviceType;
16 private readonly string serviceId;
17 private readonly string scpdURL;
18 private readonly string controlURL;
19 private readonly string eventSubURL;
20 private readonly Uri scpdURI;
21 private readonly Uri controlURI;
22 private readonly Uri eventSubURI;
23
31 public UPnPService(UPnPClient Client, string ServiceType, string ServiceId, string ScpdUrl)
32 {
33 this.client = Client;
34 this.xml = null;
35 this.serviceType = ServiceType;
36 this.serviceId = ServiceId;
37 this.scpdURL = ScpdUrl;
38 this.scpdURI = new Uri(ScpdUrl);
39 this.controlURL = null;
40 this.controlURI = null;
41 this.eventSubURL = null;
42 this.eventSubURI = null;
43 }
44
51 public UPnPService(XmlElement Xml, Uri BaseUri, UPnPClient Client)
52 {
53 this.client = Client;
54 this.xml = Xml;
55
56 foreach (XmlNode N in Xml.ChildNodes)
57 {
58 switch (N.LocalName)
59 {
60 case "serviceType":
61 this.serviceType = N.InnerText;
62 break;
63
64 case "serviceId":
65 this.serviceId = N.InnerText;
66 break;
67
68 case "SCPDURL":
69 this.scpdURL = N.InnerText;
70 this.scpdURI = new Uri(BaseUri, this.scpdURL);
71 break;
72
73 case "controlURL":
74 this.controlURL = N.InnerText;
75 this.controlURI = new Uri(BaseUri, this.controlURL);
76 break;
77
78 case "eventSubURL":
79 this.eventSubURL = N.InnerText;
80 this.eventSubURI = new Uri(BaseUri, this.eventSubURL);
81 break;
82 }
83 }
84 }
85
89 public XmlElement Xml => this.xml;
90
94 public string ServiceType => this.serviceType;
95
99 public string ServiceId => this.serviceId;
100
104 public string SCPDURL => this.scpdURL;
105
109 public string ControlURL => this.controlURL;
110
114 public string EventSubURL => this.eventSubURL;
115
119 public Uri SCPDURI => this.scpdURI;
120
124 public Uri ControlURI => this.controlURI;
125
129 public Uri EventSubURI => this.eventSubURI;
130
132 public override string ToString()
133 {
134 return this.serviceType;
135 }
136
145 {
146 return this.client.GetService(this);
147 }
148
158 {
159 return this.client.GetService(this, Timeout);
160 }
161
166 public Task<ServiceDescriptionDocument> GetServiceAsync()
167 {
168 return this.client.GetServiceAsync(this);
169 }
170
176 public Task<ServiceDescriptionDocument> GetServiceAsync(int Timeout)
177 {
178 return this.client.GetServiceAsync(this, Timeout);
179 }
180 }
181}
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:12
ServiceDescriptionDocument GetService()
Gets the service description document from a service in the network. This method is the synchronous v...
Definition: UPnPService.cs:144
string ServiceType
Service Type
Definition: UPnPService.cs:94
string ControlURL
URL for control
Definition: UPnPService.cs:109
XmlElement Xml
Underlying XML definition.
Definition: UPnPService.cs:89
UPnPService(XmlElement Xml, Uri BaseUri, UPnPClient Client)
Contains information about a service.
Definition: UPnPService.cs:51
string EventSubURL
URL for eventing
Definition: UPnPService.cs:114
Uri SCPDURI
URI to service description
Definition: UPnPService.cs:119
Uri EventSubURI
URI for eventing
Definition: UPnPService.cs:129
string SCPDURL
URL to service description
Definition: UPnPService.cs:104
ServiceDescriptionDocument GetService(int Timeout)
Gets the service description document from a service in the network. This method is the synchronous v...
Definition: UPnPService.cs:157
UPnPService(UPnPClient Client, string ServiceType, string ServiceId, string ScpdUrl)
Contains information about a service.
Definition: UPnPService.cs:31
Task< ServiceDescriptionDocument > GetServiceAsync()
Starts the retrieval of a Service Description Document.
Definition: UPnPService.cs:166
Task< ServiceDescriptionDocument > GetServiceAsync(int Timeout)
Starts the retrieval of a Service Description Document.
Definition: UPnPService.cs:176