Class: RUPNP::CP::RemoteDevice
- Defined in:
- lib/rupnp/cp/remote_device.rb
Overview
A device is a UPnP service provider.
Constant Summary
Constants inherited from Base
Constants included from LogMixin
Instance Attribute Summary collapse
-
#cache_control ⇒ String
readonly
Contains
max-agedirective used to specify advertisement validity. -
#control_point ⇒ ControlPoint
readonly
Get control point which controls this device.
-
#date ⇒ String
readonly
Date when response was generated.
-
#devices ⇒ Array<Device>
readonly
List of embedded devices.
-
#expiration ⇒ Time
readonly
Expiration time for the advertisement.
- #ext ⇒ String readonly
-
#friendly_name ⇒ String
readonly
Short description for end users.
-
#icons ⇒ Array<OpenStruct>
readonly
Array of icons to depict device in control point UI.
-
#location ⇒ String
readonly
URL to the UPnP description of the root device.
-
#manufacturer ⇒ String
readonly
Manufacturer’s name.
-
#manufacturer_url ⇒ String
readonly
Web site for manufacturer.
-
#model_description ⇒ String
readonly
Long decription for end user.
-
#model_name ⇒ String
readonly
Model name.
-
#model_number ⇒ String
readonly
Model number.
-
#model_url ⇒ String
readonly
Web site for model.
-
#presentation_url ⇒ String
readonly
URL to presentation for device.
-
#serial_umber ⇒ String
readonly
Serial number.
-
#server ⇒ String
readonly
Get SERVER string.
-
#services ⇒ Array<Service>
readonly
List of device’s services.
-
#st ⇒ String
readonly
Get search target.
-
#type ⇒ String
readonly
Device type.
-
#udn ⇒ String
readonly
Unique Device Name.
-
#upc ⇒ String
readonly
Universal Product Code.
-
#upnp_version ⇒ String
readonly
UPnP version used by the device.
-
#url_base ⇒ String
readonly
URL base for device access.
-
#usn ⇒ String
readonly
Get Unique Service Name.
-
#xmlns ⇒ String
readonly
XML namespace for device description.
Instance Method Summary collapse
-
#fetch ⇒ void
Get device from its description.
-
#initialize(control_point, notification) ⇒ RemoteDevice
constructor
A new instance of RemoteDevice.
Methods inherited from Base
Methods included from LogMixin
Methods included from Tools
#build_url, #snake_case, #urn_are_equivalent?, #usn2udn
Constructor Details
#initialize(control_point, notification) ⇒ RemoteDevice
Returns a new instance of RemoteDevice.
96 97 98 99 100 101 102 103 104 |
# File 'lib/rupnp/cp/remote_device.rb', line 96 def initialize(control_point, notification) super() @control_point = control_point @notification = notification @icons = [] @services = [] @devices = [] end |
Instance Attribute Details
#cache_control ⇒ String (readonly)
Contains max-age directive used to specify advertisement validity
33 34 35 |
# File 'lib/rupnp/cp/remote_device.rb', line 33 def cache_control @cache_control end |
#control_point ⇒ ControlPoint (readonly)
Get control point which controls this device
12 13 14 |
# File 'lib/rupnp/cp/remote_device.rb', line 12 def control_point @control_point end |
#date ⇒ String (readonly)
Date when response was generated
30 31 32 |
# File 'lib/rupnp/cp/remote_device.rb', line 30 def date @date end |
#devices ⇒ Array<Device> (readonly)
List of embedded devices
91 92 93 |
# File 'lib/rupnp/cp/remote_device.rb', line 91 def devices @devices end |
#expiration ⇒ Time (readonly)
Expiration time for the advertisement
36 37 38 |
# File 'lib/rupnp/cp/remote_device.rb', line 36 def expiration @expiration end |
#ext ⇒ String (readonly)
27 28 29 |
# File 'lib/rupnp/cp/remote_device.rb', line 27 def ext @ext end |
#friendly_name ⇒ String (readonly)
Short description for end users
52 53 54 |
# File 'lib/rupnp/cp/remote_device.rb', line 52 def friendly_name @friendly_name end |
#icons ⇒ Array<OpenStruct> (readonly)
Array of icons to depict device in control point UI
85 86 87 |
# File 'lib/rupnp/cp/remote_device.rb', line 85 def icons @icons end |
#location ⇒ String (readonly)
URL to the UPnP description of the root device
25 26 27 |
# File 'lib/rupnp/cp/remote_device.rb', line 25 def location @location end |
#manufacturer ⇒ String (readonly)
Manufacturer’s name
55 56 57 |
# File 'lib/rupnp/cp/remote_device.rb', line 55 def manufacturer @manufacturer end |
#manufacturer_url ⇒ String (readonly)
Web site for manufacturer
58 59 60 |
# File 'lib/rupnp/cp/remote_device.rb', line 58 def manufacturer_url @manufacturer_url end |
#model_description ⇒ String (readonly)
Long decription for end user
61 62 63 |
# File 'lib/rupnp/cp/remote_device.rb', line 61 def model_description @model_description end |
#model_name ⇒ String (readonly)
Model name
64 65 66 |
# File 'lib/rupnp/cp/remote_device.rb', line 64 def model_name @model_name end |
#model_number ⇒ String (readonly)
Model number
67 68 69 |
# File 'lib/rupnp/cp/remote_device.rb', line 67 def model_number @model_number end |
#model_url ⇒ String (readonly)
Web site for model
70 71 72 |
# File 'lib/rupnp/cp/remote_device.rb', line 70 def model_url @model_url end |
#presentation_url ⇒ String (readonly)
URL to presentation for device
82 83 84 |
# File 'lib/rupnp/cp/remote_device.rb', line 82 def presentation_url @presentation_url end |
#serial_umber ⇒ String (readonly)
Serial number
73 74 75 |
# File 'lib/rupnp/cp/remote_device.rb', line 73 def serial_umber @serial_umber end |
#server ⇒ String (readonly)
Get SERVER string
22 23 24 |
# File 'lib/rupnp/cp/remote_device.rb', line 22 def server @server end |
#services ⇒ Array<Service> (readonly)
List of device’s services
88 89 90 |
# File 'lib/rupnp/cp/remote_device.rb', line 88 def services @services end |
#st ⇒ String (readonly)
Get search target.
16 17 18 |
# File 'lib/rupnp/cp/remote_device.rb', line 16 def st @st end |
#type ⇒ String (readonly)
Device type
49 50 51 |
# File 'lib/rupnp/cp/remote_device.rb', line 49 def type @type end |
#udn ⇒ String (readonly)
Unique Device Name
76 77 78 |
# File 'lib/rupnp/cp/remote_device.rb', line 76 def udn @udn end |
#upc ⇒ String (readonly)
Universal Product Code
79 80 81 |
# File 'lib/rupnp/cp/remote_device.rb', line 79 def upc @upc end |
#upnp_version ⇒ String (readonly)
UPnP version used by the device
40 41 42 |
# File 'lib/rupnp/cp/remote_device.rb', line 40 def upnp_version @upnp_version end |
#url_base ⇒ String (readonly)
URL base for device access
46 47 48 |
# File 'lib/rupnp/cp/remote_device.rb', line 46 def url_base @url_base end |
#usn ⇒ String (readonly)
Get Unique Service Name
19 20 21 |
# File 'lib/rupnp/cp/remote_device.rb', line 19 def usn @usn end |
#xmlns ⇒ String (readonly)
XML namespace for device description
43 44 45 |
# File 'lib/rupnp/cp/remote_device.rb', line 43 def xmlns @xmlns end |
Instance Method Details
#fetch ⇒ void
This method returns an undefined value.
Get device from its description
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/rupnp/cp/remote_device.rb', line 108 def fetch description_getter = EM::DefaultDeferrable.new description_getter.errback do msg = "Failed getting description" log :error, "Fetching device: #{msg}" fail self, msg end extract_from_ssdp_notification description_getter description_getter.callback do |description| @description = description unless description fail self, 'Blank description returned' next end if bad_description? fail self, "Bad description returned: #@description" next end extract_url_base extract_device_info extract_icons @services_extracted = @devices_extracted = false extract_services extract_devices tick_loop = EM.tick_loop do :stop if @services_extracted and @devices_extracted end tick_loop.on_stop { succeed self } end end |