OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.gcdPrivate</code> API to discover GCD APIs and register | 5 // Use the <code>chrome.gcdPrivate</code> API to discover GCD APIs and register |
6 // them. | 6 // them. |
7 namespace gcdPrivate { | 7 namespace gcdPrivate { |
8 | 8 |
9 enum SetupType { mdns, wifi, cloud }; | 9 enum SetupType { mdns, wifi, cloud }; |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 callback CommandCallback = void(object command); | 79 callback CommandCallback = void(object command); |
80 | 80 |
81 // |commands| : Array of commands described at | 81 // |commands| : Array of commands described at |
82 // https://developers.google.com/cloud-devices/v1/reference/commands | 82 // https://developers.google.com/cloud-devices/v1/reference/commands |
83 // TODO(vitalybuka): consider to describe object in IDL. | 83 // TODO(vitalybuka): consider to describe object in IDL. |
84 callback CommandListCallback = void(object[] commands); | 84 callback CommandListCallback = void(object[] commands); |
85 | 85 |
86 // Generic callback for session calls, with status only. | 86 // Generic callback for session calls, with status only. |
87 callback SessionCallback = void(Status status); | 87 callback SessionCallback = void(Status status); |
88 | 88 |
| 89 // Called when the device info is available or on error. |
| 90 // |status| : The status of operation (success or type of error). |
| 91 // |deviceInfo| : Content of /privet/info response. |
| 92 // https://developers.google.com/cloud-devices/v1/reference/local-api/info |
| 93 callback GetDeviceInfoCallback = void(Status status, |
| 94 object deviceInfo); |
| 95 |
89 // Called when device starts to establish a secure session. | 96 // Called when device starts to establish a secure session. |
90 // If |status| is |success| app should call |startPairing|. | 97 // If |status| is |success| app should call |startPairing|. |
91 // |sessionId| : The session ID (identifies the session for future calls). | 98 // |sessionId| : The session ID (identifies the session for future calls). |
92 // |status| : The status of operation (success or type of error). | 99 // |status| : The status of operation (success or type of error). |
93 // |pairingTypes| is the list of supported pairing types. | 100 // |pairingTypes| is the list of supported pairing types. |
94 callback CreateSessionCallback = void(long sessionId, | 101 callback CreateSessionCallback = void(long sessionId, |
95 Status status, | 102 Status status, |
96 PairingType[] pairingTypes); | 103 PairingType[] pairingTypes); |
97 | 104 |
98 // Called when the response to the message sent is available or on error. | 105 // Called when the response to the message sent is available or on error. |
(...skipping 23 matching lines...) Expand all Loading... |
122 // Cache the WiFi password in the browser process for use during | 129 // Cache the WiFi password in the browser process for use during |
123 // provisioning. This is done to allow the gathering of the wifi password to | 130 // provisioning. This is done to allow the gathering of the wifi password to |
124 // not be done while connected to the device's network. Callback is called | 131 // not be done while connected to the device's network. Callback is called |
125 // with true if wifi password was cached and false if it was unavailable. | 132 // with true if wifi password was cached and false if it was unavailable. |
126 // |ssid| : The network to prefetch password for. | 133 // |ssid| : The network to prefetch password for. |
127 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); | 134 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); |
128 | 135 |
129 // Get the list of SSIDs with prefetched callbacks. | 136 // Get the list of SSIDs with prefetched callbacks. |
130 static void getPrefetchedWifiNameList(SSIDListCallback callback); | 137 static void getPrefetchedWifiNameList(SSIDListCallback callback); |
131 | 138 |
| 139 // Returns local device information. |
| 140 // |serviceName| : The mDns service name of the device. |
| 141 static void getDeviceInfo(DOMString serviceName, |
| 142 GetDeviceInfoCallback callback); |
| 143 |
132 // Create new pairing. | 144 // Create new pairing. |
133 // |serviceName| : The mDns service name of the device. | 145 // |serviceName| : The mDns service name of the device. |
134 static void createSession(DOMString serviceName, | 146 static void createSession(DOMString serviceName, |
135 CreateSessionCallback callback); | 147 CreateSessionCallback callback); |
136 | 148 |
137 // Start pairing with selected method. Should be called after | 149 // Start pairing with selected method. Should be called after |
138 // |establishSession|. | 150 // |establishSession|. |
139 // |sessionId| : The ID of the session created with |establishSession|. | 151 // |sessionId| : The ID of the session created with |establishSession|. |
140 // |pairingType| : The value selected from the list provided in | 152 // |pairingType| : The value selected from the list provided in |
141 // callback of |establishSession|. | 153 // callback of |establishSession|. |
142 static void startPairing(long sessionId, | 154 static void startPairing(long sessionId, |
143 PairingType pairingType, | 155 PairingType pairingType, |
144 SessionCallback callback); | 156 SessionCallback callback); |
145 | 157 |
146 // Confirm pairing code. Should be called after |startPairing|. | 158 // Confirm pairing code. Should be called after |startPairing|. |
147 // |sessionId| : The ID of the session created with |establishSession|. | 159 // |sessionId| : The ID of the session created with |establishSession|. |
148 // |code| : The string generated by pairing process and availible to the | 160 // |code| : The string generated by pairing process and available to the |
149 // user. | 161 // user. |
150 static void confirmCode(long sessionId, | 162 static void confirmCode(long sessionId, |
151 DOMString code, | 163 DOMString code, |
152 SessionCallback callback); | 164 SessionCallback callback); |
153 | 165 |
154 // Send an encrypted message to the device. | 166 // Send an encrypted message to the device. |
155 // If the message is a setup message with a wifi SSID specified but no | 167 // If the message is a setup message with a wifi SSID specified but no |
156 // password, the password cached by |prefetchWifiPassword| will be used and | 168 // password, the password cached by |prefetchWifiPassword| will be used and |
157 // the call will fail if it's not available. For open networks use an empty | 169 // the call will fail if it's not available. For open networks use an empty |
158 // string as the password. | 170 // string as the password. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // Subscribe to this event to start listening new or updated devices. New | 226 // Subscribe to this event to start listening new or updated devices. New |
215 // listeners will get called with all known devices on the network, and | 227 // listeners will get called with all known devices on the network, and |
216 // status updates for devices available through the cloud. | 228 // status updates for devices available through the cloud. |
217 static void onDeviceStateChanged(GCDDevice device); | 229 static void onDeviceStateChanged(GCDDevice device); |
218 | 230 |
219 // Notifies that device has disappeared. | 231 // Notifies that device has disappeared. |
220 // |deviceId| : The device has disappeared. | 232 // |deviceId| : The device has disappeared. |
221 static void onDeviceRemoved(DOMString deviceId); | 233 static void onDeviceRemoved(DOMString deviceId); |
222 }; | 234 }; |
223 }; | 235 }; |
OLD | NEW |