OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Use the <code>chrome.dial</code> API to discover devices that support DIAL. | 5 // Use the <code>chrome.dial</code> API to discover devices that support DIAL. |
6 // Protocol specification: http://www.dial-multiscreen.org/ | 6 // Protocol specification: http://www.dial-multiscreen.org/ |
7 namespace dial { | 7 namespace dial { |
8 | 8 |
9 // Represents a unique device that responded to a DIAL discovery request. | 9 // Represents a unique device that responded to a DIAL discovery request. |
10 dictionary DialDevice { | 10 dictionary DialDevice { |
11 | 11 |
12 // A label identifying the device within this instance of the browser. | 12 // A label identifying the device within this instance of the browser. |
13 // Not guaranteed to persist beyond browser instances. | 13 // Not guaranteed to persist beyond browser instances. |
14 DOMString deviceLabel; | 14 DOMString deviceLabel; |
15 | 15 |
16 // A URL pointing to the device description resource for the device. | 16 // A URL pointing to the device description resource for the device. |
17 DOMString deviceDescriptionUrl; | 17 DOMString deviceDescriptionUrl; |
18 | 18 |
19 // The uPnP configuration ID reported by the device. Corresponds to the | 19 // The uPnP configuration ID reported by the device. Corresponds to the |
20 // CONFIGID.UPNP.ORG header in the M-SEARCH response. | 20 // CONFIGID.UPNP.ORG header in the M-SEARCH response. |
21 long? configId; | 21 long? configId; |
22 }; | 22 }; |
23 | 23 |
24 // Represents a MDNS/DNS-SD service. | |
25 dictionary MDnsService { | |
26 // The service name of an mDNS advertised service, | |
27 // <instance_name>.<service_type>. | |
28 // Set when discoveryType is mdns, unset otherwise. | |
scheib
2013/08/20 23:33:50
discoveryType is not defined elsewhere in this idl
justinlin
2013/08/28 16:53:10
service type no longer needed.
| |
29 DOMString serviceName; | |
30 | |
31 // The host:port pair of an mDNS advertised service. | |
32 // Set when discoveryType is mdns, unset otherwise. | |
33 DOMString serviceHostPort; | |
34 | |
35 // The IP address of an mDNS advertised service. | |
36 // Set when discoveryType is mdns, unset otherwise. | |
37 DOMString ipAddress; | |
38 | |
39 // Metadata for an mDNS advertised service. | |
40 // Set when discoveryType is mdns, unset otherwise. | |
41 DOMString[] serviceData; | |
42 }; | |
43 | |
24 enum DialErrorCode { | 44 enum DialErrorCode { |
25 no_listeners, | 45 no_listeners, |
26 no_valid_network_interfaces, | 46 no_valid_network_interfaces, |
27 network_disconnected, | 47 network_disconnected, |
28 cellular_network, | 48 cellular_network, |
29 socket_error, | 49 socket_error, |
30 unknown | 50 unknown |
31 }; | 51 }; |
32 | 52 |
33 dictionary DialError { | 53 dictionary DialError { |
34 DialErrorCode code; | 54 DialErrorCode code; |
35 }; | 55 }; |
36 | 56 |
37 callback BooleanCallback = void (boolean result); | 57 callback BooleanCallback = void (boolean result); |
38 | 58 |
39 interface Functions { | 59 interface Functions { |
40 | |
41 // Requests that DIAL discovery happen immediately. The request may not be | 60 // Requests that DIAL discovery happen immediately. The request may not be |
42 // honored as discovery may already be happening in the background. The | 61 // honored as discovery may already be happening in the background. The |
43 // callback is invoked with |true| if discovery was initiated or |false| | 62 // callback is invoked with |true| if discovery was initiated or |false| |
44 // otherwise. | 63 // otherwise. |
45 static void discoverNow(BooleanCallback callback); | 64 static void discoverNow(BooleanCallback callback); |
65 | |
66 // Registers interest in an mDNS/DNS-SD service type. | |
67 static void registerNetworkService(DOMString serviceType); | |
scheib
2013/08/20 23:33:50
Perhaps registerInterestInNetworkService?
scheib
2013/08/20 23:33:50
Reverence what a serviceType string could be.
justinlin
2013/08/28 16:53:10
Removed this method, we use a manifest field now.
justinlin
2013/08/28 16:53:10
serviceType no longer needed.
| |
46 }; | 68 }; |
47 | 69 |
48 interface Events { | 70 interface Events { |
49 | 71 |
50 // Event fired to inform clients of the current, complete set of responsive | 72 // Event fired to inform clients of the current, complete set of responsive |
51 // devices. Clients should only need to store the list from the most recent | 73 // devices. Clients should only need to store the list from the most recent |
52 // event. May be fired in response to multiple circumstances: | 74 // event. May be fired in response to multiple circumstances: |
53 // | 75 // |
54 // (1) The DIAL service refreshed its device list through periodic polling. | 76 // (1) The DIAL service refreshed its device list through periodic polling. |
55 // (2) A client invoked discoverNow(). | 77 // (2) A client invoked discoverNow(). |
56 // (3) An event happened that should invalidate the device list | 78 // (3) An event happened that should invalidate the device list |
57 // (e.g., a network interface went offline), in which case it is fired | 79 // (e.g., a network interface went offline), in which case it is fired |
58 // with an empty array. | 80 // with an empty array. |
59 static void onDeviceList(DialDevice[] result); | 81 static void onDeviceList(DialDevice[] result); |
60 | 82 |
61 // Event fired to inform clients on errors during device discovery. | 83 // Event fired to inform clients on errors during device discovery. |
62 static void onError(DialError error); | 84 static void onError(DialError error); |
85 | |
86 // Invoked with the current set of services. | |
87 static void onServiceList(MDnsService[] result); | |
63 }; | 88 }; |
64 }; | 89 }; |
OLD | NEW |