easy_upnp 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -0
- data/lib/easy_upnp/upnp_device.rb +1 -1
- data/lib/easy_upnp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6b753752916257d2f95d32a468f79b71c99b6ad
|
4
|
+
data.tar.gz: 31fcf01b8d619b31d001771fe337334b8bed124f
|
5
5
|
!binary "U0hBNTEy":
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 385b3a0aa8a1bbc401947f4f7cb491b0f94a28cbb7652519b011ba8a564890bb6b2de125cb4679034905bcdd68ba4cad5b18eaeff2df99d52f4cd1ed3ca6bdbd
|
7
|
+
data.tar.gz: 1362a9139d300698126102ec55d27064236211d4e398357a6d0b41d437c9bb33aeded088c71784c36668d67b47811cf5abfa75f6599d6710b3ab97b2901a6e08
|
data/README.md
CHANGED
@@ -14,3 +14,42 @@ You can also add it to your Gemfile:
|
|
14
14
|
```
|
15
15
|
gem 'easy_upnp'
|
16
16
|
```
|
17
|
+
|
18
|
+
## Example usage
|
19
|
+
|
20
|
+
#### Find devices with SSDP
|
21
|
+
|
22
|
+
[Simple Service Discovery Protocol](http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf) (SSDP) is a simple UDP protocol used to discover services on a network. It's the entry point to create control points in easy_upnp.
|
23
|
+
|
24
|
+
The `search` method takes one argument -- the "search target". This controls a header sent in the SSDP packet which affects the devices that respond to the search query. You can use `'ssdp:all'` to specify that all devices should respond.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'easy_upnp/ssdp_searcher'
|
28
|
+
|
29
|
+
searcher = EasyUpnp::SsdpSearcher.new
|
30
|
+
devices = searcher.search 'ssdp:all'
|
31
|
+
```
|
32
|
+
|
33
|
+
This will return a list of `EasyUpnp::UpnpDevice` objects. You'll use these to interact with devices on your network.
|
34
|
+
|
35
|
+
#### Interacting with a specific device
|
36
|
+
|
37
|
+
Once you have a `EasyUpnp::UpnpDevice`, you can start interacting with the services it advertizes. To get a list of all services a device supports:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
device = devices.first
|
41
|
+
device.all_services
|
42
|
+
# => ["urn:schemas-upnp-org:service:ContentDirectory:1", "urn:schemas-upnp-org:service:ConnectionManager:1", "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1"]
|
43
|
+
```
|
44
|
+
|
45
|
+
You can then create a service client and make calls to the service:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
service = service = device.service 'urn:schemas-upnp-org:service:ContentDirectory:1'
|
49
|
+
|
50
|
+
service.service_methods
|
51
|
+
# => ["GetSearchCapabilities", "GetSortCapabilities", "GetSystemUpdateID", "Browse", "Search"]
|
52
|
+
|
53
|
+
service.GetSystemUpdateID
|
54
|
+
# => {:Id=>"207"}
|
55
|
+
```
|
data/lib/easy_upnp/version.rb
CHANGED