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 11 matching lines...) Expand all Loading... | |
22 // Device type (camera, printer, etc) | 22 // Device type (camera, printer, etc) |
23 DOMString deviceType; | 23 DOMString deviceType; |
24 | 24 |
25 // Device human readable name | 25 // Device human readable name |
26 DOMString deviceName; | 26 DOMString deviceName; |
27 | 27 |
28 // Device human readable description | 28 // Device human readable description |
29 DOMString deviceDescription; | 29 DOMString deviceDescription; |
30 }; | 30 }; |
31 | 31 |
32 // Represents wifi network credentials. | |
33 dictionary WiFiCredentials { | |
34 DOMString ssid; | |
35 DOMString password; | |
36 }; | |
37 | |
38 callback CloudDeviceListCallback = void(GCDDevice[] devices); | 32 callback CloudDeviceListCallback = void(GCDDevice[] devices); |
33 callback CommandDefinitionsCallback = void(object commandDefinitions); | |
Noam Samuel
2014/07/08 18:26:32
Is the object schema in this case a CDD? I think
Vitaly Buka (NO REVIEWS)
2014/07/08 18:49:06
Done.
| |
34 callback CommandCallback = void(object command); | |
35 callback CommandListCallback = void(object[] commands); | |
39 | 36 |
40 interface Functions { | 37 interface Functions { |
38 // Returns the list of cloud devices visible locally or available in the | |
39 // cloud for user account. | |
41 static void getCloudDeviceList(CloudDeviceListCallback callback); | 40 static void getCloudDeviceList(CloudDeviceListCallback callback); |
42 | 41 |
42 // Queries network for local devices. Triggers an onCloudDeviceStateChanged | |
43 // event per device. Call this function *only* after registering for | |
44 // onCloudDeviceStateChanged events, or it will do nothing. | |
45 static void queryForNewLocalDevices(); | |
46 | |
43 // Starts device setup process. Returns id of setup process. Id should be | 47 // Starts device setup process. Returns id of setup process. Id should be |
44 // used as |setupId| in all subsequent setup related calls, and for | 48 // used as |setupId| in all subsequent setup related calls, and for |
45 // filtering setup events. | 49 // filtering setup events. |
46 static long startSetup(GCDDevice device); | 50 static long startSetup(GCDDevice device); |
47 | 51 |
48 // Sets WiFi network list as reply to |onGetWifiNetworks| event. | 52 // Sets WiFi network as reply to |onGetWifiNetworks| event. |
49 // |setupId| : The value returned by |startSetup|. | 53 // |setupId| : The value returned by |startSetup|. |
50 // |networks| : The list of network device should be registered on. | 54 // |network| : The wifi network for device setup. |
51 static void setWiFiNetworks(long setupId, DOMString[] networks); | 55 static void setWiFiNetwork(long setupId, DOMString network); |
52 | 56 |
53 // Sets WiFi network credentials as reply to |onGetWifiCredentials| | 57 // Sets WiFi network password as reply to |onGetWifiCredentials| event. |
54 // event. | |
55 // |setupId| : The value returned by |startSetup|. | 58 // |setupId| : The value returned by |startSetup|. |
56 // |credentials| : The list of ssid with passwoors. The list is not required | 59 // |password| : The passwords for network selected with |setWiFiNetwork|. |
57 // to match |networks| provided with |setWiFiNetworks| or | 60 static void setWiFiPassword(long setupId, DOMString password); |
58 // |onGetWifiCredentials|. | |
59 static void setWiFiCredentials(long setupId, WiFiCredentials[] credentials); | |
60 | 61 |
61 // Confirms that security code known to application match to the code known | 62 // Confirms that security code known to application match to the code known |
62 // to device. | 63 // to device. |
63 // |setupId| : The value returned by |startSetup|. | 64 // |setupId| : The value returned by |startSetup|. |
64 static void confirmCode(long setupId); | 65 static void confirmCode(long setupId); |
65 | 66 |
66 // Stops registration process. | 67 // Stops registration process. |
67 // This call triggers |onSetupError| event. App should wait this even before | 68 // This call triggers |onSetupError| event. App should wait this even before |
68 // starting new registration. | 69 // starting new registration. |
69 // |setupId| : The value returned by |startSetup|. | 70 // |setupId| : The value returned by |startSetup|. |
70 static void stopSetup(long setupId); | 71 static void stopSetup(long setupId); |
72 | |
73 // Returns command definitions. | |
74 // |device| : The device to get command definitions for. | |
75 // |callback| : The result callback. | |
76 static void getCommandDefinitions(GCDDevice device, | |
77 CommandDefinitionsCallback callback); | |
78 | |
79 // Creates and sends a new command. | |
80 // |device| : The device to send the command to. | |
81 // |expireInMs| : The number of milliseconds since now before the command | |
82 // expires. Expired command should not be executed by device. Acceptable | |
83 // values are 10000 to 2592000000, inclusive. All values outside that range | |
84 // will be replaced by 2592000000. | |
85 // |callback| : The result callback. | |
86 static void insertCommand(GCDDevice device, | |
Noam Samuel
2014/07/08 18:26:32
Does this transparently switch between local and c
Vitaly Buka (NO REVIEWS)
2014/07/08 18:49:05
yes
On 2014/07/08 18:26:32, Noam Samuel wrote:
| |
87 long expireInMs, | |
88 object command, | |
Noam Samuel
2014/07/08 18:26:32
Is the schema for the command the GCD command sche
Vitaly Buka (NO REVIEWS)
2014/07/08 18:49:06
Done.
| |
89 CommandCallback callback); | |
90 | |
91 // Returns a particular command. | |
92 // |commandId| : Unique command ID. | |
93 // |callback| : The result callback. | |
94 static void getCommand(DOMString commandId, | |
Noam Samuel
2014/07/08 18:26:32
Does this transparently handle local and cloud? If
Vitaly Buka (NO REVIEWS)
2014/07/08 18:49:06
implementation should take care about this.
On 20
| |
95 CommandCallback callback); | |
96 | |
97 // Cancels a command. | |
98 // |commandId| : Unique command ID. | |
99 // |callback| : The result callback. | |
100 static void cancelCommand(DOMString commandId, | |
101 CommandCallback callback); | |
102 | |
103 // Lists all commands in order of creation. | |
104 // |device| : The device to get the commands for. | |
105 // |byUser| : List all the commands issued by the user. Special value 'me' | |
106 // can be used to list by the current user. | |
107 // |state| : Command state. | |
108 // |callback| : The result callback. | |
109 static void getCommandsList(GCDDevice device, | |
Noam Samuel
2014/07/08 18:26:32
Is this function cloud-only?
Vitaly Buka (NO REVIEWS)
2014/07/08 18:49:06
No. It going to be local queue for local devices.
| |
110 DOMString byUser, | |
111 DOMString state, | |
112 CommandListCallback callback); | |
71 }; | 113 }; |
72 | 114 |
73 interface Events { | 115 interface Events { |
74 // Subscribe to this event to start listening to cloud devices. New | 116 // Subscribe to this event to start listening to cloud devices. New |
75 // listeners will get called with all known devices on the network. | 117 // listeners will get called with all known devices on the network, and |
118 // devices available using cloud. | |
Noam Samuel
2014/07/08 18:26:32
Does this mean we want to start a cloud request wh
Vitaly Buka (NO REVIEWS)
2014/07/08 18:49:05
Maybe we would need subscribeForDeviceChanges(GCDe
Noam Samuel
2014/07/08 19:04:30
Maybe "and status updates for devices available th
| |
76 static void onCloudDeviceStateChanged(boolean available, GCDDevice device); | 119 static void onCloudDeviceStateChanged(boolean available, GCDDevice device); |
77 | 120 |
78 // Notifies app that setup is waiting for network list. App should reply | 121 // Notifies app that setup is waiting for a wifi network. App should reply |
79 // with |setWiFiNetworks|. | 122 // with |setWiFiNetwork|. |
80 // |setupId| : The value returned by |startSetup|. | 123 // |setupId| : The value returned by |startSetup|. |
81 static void onGetWifiNetworks(long setupId); | 124 static void onGetWifiNetwork(long setupId); |
82 | 125 |
83 // Notifies app that setup is waiting for credentions for |networks| list. | 126 // Notifies app that setup is waiting for password for the network provided |
84 // App should reply with |setWiFiCredentials|. | 127 // with |setWiFiNetwork|. Even will be called if setup flow would unable to |
128 // get password from the system. | |
129 // App should reply with |setWiFiPassword|. | |
85 // |setupId| : The value returned by |startSetup|. | 130 // |setupId| : The value returned by |startSetup|. |
86 // |networks| : A subset of the list provided in |setWiFiNetworks| for which | 131 static void onGetWifiPassword(long setupId); |
87 // setup flow is unable to find credentials | |
88 static void onGetWifiCredentials(long setupId, DOMString[] networks); | |
89 | 132 |
90 // Notifies app that setup is waiting for confirmation that code is the same | 133 // Notifies app that setup is waiting for confirmation that code is the same |
91 // as code known to device. App should reply with |confirmCode|, or | 134 // as code known to device. App should reply with |confirmCode|, or |
92 // |stopSetup| if code does not match. | 135 // |stopSetup| if code does not match. |
93 // |confirmationCode| : The code to confirm. | 136 // |confirmationCode| : The code to confirm. |
94 // |setupId| : The value returned by |startSetup|. | 137 // |setupId| : The value returned by |startSetup|. |
95 static void onConfirmCode(long setupId, DOMString confirmationCode); | 138 static void onConfirmCode(long setupId, DOMString confirmationCode); |
96 | 139 |
97 // Notifies app that setup is completed successfully. | 140 // Notifies app that setup is completed successfully. |
98 // |setupId| : The value returned by |startSetup|. | 141 // |setupId| : The value returned by |startSetup|. |
99 static void onSetupSuccess(long setupId); | 142 static void onSetupSuccess(long setupId); |
100 | 143 |
101 // Notifies app that setup is failed or stoped. | 144 // Notifies app that setup is failed or stopped. |
102 // |setupId| : The value returned by |startSetup|. | 145 // |setupId| : The value returned by |startSetup|. |
103 static void onSetupError(long setupId); | 146 static void onSetupError(long setupId); |
104 }; | 147 }; |
105 }; | 148 }; |
OLD | NEW |