UPnP 设备描述文件和服务描述文件

对于一个设备来说,无论是客户端还是服务端,接入网络后,UPnP经历下列过程:
* 获取自己的IP地址,无论是通过dhcp或者手动设置。
* 组播M-SEARCH/*-NOTIFY。
*获取Loacation指定的设备描述文件, 服务描述文件。
*从描述的service/actions/events中选择自己感兴趣的。
 
# 设备描述文件模板
 


1
0

base URL for all relative URLs

urn:schemas-upnp-org:device:deviceType:v
short user-friendly title
manufacturer name
URL to manufacturer site
long user-friendly title
model name
model number
URL to model site
manufacturer's serial number
uuid:UUID
Universal Product Code

 
 image/format
 horizontal pixels
 vertical pixels
 color depth
 URL to icon
 
 XML to declare other icons, if any, go here


 
 urn:schemas-upnp-org:service:serviceType:v
 urn:upnp-org:serviceId:serviceID
 URL to service description
 URL for control
 URL for eventing
 
 Declarations for other services defined by a UPnP Forum working 
 committee (if any) go here
 Declarations for other services added by UPnP vendor (if any) go here


 Description of embedded devices defined by a UPnP Forum working 
 committee (if any) go here
 Description of embedded devices added by UPnP vendor (if any) go here

URL for presentation


 
 
UDN -- Unique Device Name
SCPDURL -- Service Control Protocol Document, URL for service description of SOAP methods and state variables.
controlURL -- used for sending SOAP requests.
eventSubURL -- when a state variable is changed, the new state is sent to all programs/devices that have subscribed to the event.
 
# 例子
DeviceDescription.xml

 
     
         1
         0
     
     
         urn:schemas-upnp-org:device:BinaryLight:1
         UPnP Binary Light
         MyCompany
         www.mywebsite.org
         New brilliant BinaryLight
         SuperWhiteLight 4000
         1
         uuid:138d3934-4202-45d7-bf35-8b50b0208139
         
             
                 urn:schemas-upnp-org:service:SwitchPower:1
                 urn:upnp-org:serviceId:SwitchPower:1
                 switchpower_scpd.xml
                 /control
                 /eventing
             
         
     
 
 
--> switchpower_scpd.xml:

 
     
         1
         0
     
     
         
             SetTarget
             
                 
                     newTargetValue
                     Target
                     in
                 
             
          
          
              GetTarget
              
                  
                      RetTargetValue
                      Target
                      out
                  
              
          
          
              GetStatus
              
                  
                      ResultStatus
                      Status
                      out
                  
              
          
      
      
          
              Target
              boolean
              0
          
          
              Status
              boolean
              0
          
      
 

相当于
public interface SwitchPower{
boolean Target = 0;
boolean Status = 0;
void SetTarget(boolean newTargetValue);
boolean GetTarget(void);
boolean GetStatus(void);
}
 

你可能感兴趣的:(网络,网络)