Fixed libwebsocket_context race condition.
[profile/ivi/settings-daemon.git] / doc / settings-protocol.js
1 // --------------------------------------------------------------
2 //                           Overview
3 // --------------------------------------------------------------
4 // General form of a request
5 var request =
6     {
7         "type": request_type
8         "transactionid": request_transaction_id
9         "name": request_name
10         "value": request_args
11     }
12
13 // Response for successful operation
14 var response =
15     {
16         "type": request_type
17         "transactionid": request_transaction_id
18         "result": "succeeded"
19         ...
20         <setting specific results>
21         ...
22     }
23
24 // Response for failed operation
25 var response =
26     {
27         "type": request_type,
28         "transactionid": request_transaction_id,
29         "result": "failed"
30         "reason": "<some error message>"
31     }
32
33 // General form of an event
34 var event =
35     {
36         "type": "event"
37         "value": <setting specific value>
38     }
39
40 // --------------------------------------------------------------
41 //                           Bluetooth
42 // --------------------------------------------------------------
43 // Check if bluetooth subsystem is enabled/powered.
44 var request =
45     {
46         "type": "bluetooth",
47         "transactionid": "<some UUID>",
48         "name": "is_enabled",
49         "value": null
50     }
51
52 // Enable bluetooth subsystem
53 var request =
54     {
55         "type": "bluetooth",
56         "transactionid": "<some UUID>",
57         "name": "enable",
58         "value": true
59     }
60
61 // Disable bluetooth subsystem
62 var request =
63     {
64         "type": "bluetooth",
65         "transactionid": "<some UUID>",
66         "name": "enable",
67         "value": false
68     }
69
70 // Successful is_enabled
71 var response =
72     {
73         "type": "bluetooth",
74         "transactionid": "<some UUID>",
75         "result": true or false
76     }
77
78 // Successful enable/disable
79 var response =
80     {
81         "type": "bluetooth",
82         "transactionid": "<some UUID>",
83         "result": "succeeded"
84     }
85
86 // --------------------------------------------------------------
87 //                           WiFi
88 // --------------------------------------------------------------
89 // Check if WiFi subsystem is enabled/powered.
90 var request =
91     {
92         "type": "wifi",
93         "transactionid": "<some UUID>",
94         "name": "is_enabled",
95         "value": null
96     }
97
98 // Enable WiFi subsystem
99 var request =
100     {
101         "type": "wifi",
102         "transactionid": "<some UUID>",
103         "name": "enable",
104         "value": true
105     }
106
107 // Disable WiFi subsystem
108 var request =
109     {
110         "type": "wifi",
111         "transactionid": "<some UUID>",
112         "name": "enable",
113         "value": false
114     }
115
116 // Scan WiFi subsystem
117 var request =
118     {
119         "type": "wifi",
120         "transactionid": "<some UUID>",
121         "name": "scan",
122         "value": null
123     }
124
125 // Connect to WiFi access point
126 var request =
127     {
128         "type": "wifi",
129         "transactionid": "<some UUID>",
130         "name": "connect",
131         "value": "<Connman service object path>"
132     }
133
134 // Disconnect from WiFi access point
135 var request =
136     {
137         "type": "wifi",
138         "transactionid": "<some UUID>",
139         "name": "disconnect",
140         "value": "<Connman service object path>"
141     }
142
143 // Successful is_enabled
144 var response =
145     {
146         "type": "wifi",
147         "transactionid": "<some UUID>",
148         "result": true or false
149     }
150
151 // Successful enable/disable/connect/disconnect
152 var response =
153     {
154         "type": "wifi",
155         "transactionid": "<some UUID>",
156         "result": "succeeded"
157     }
158
159 // Successful scan
160 var response =
161     {
162         "type": "wifi",
163         "transactionid": "3b5c9ebe-23fa-6b58-3f50-1203d7641441",
164         "result": "succeeded",
165         "value": [
166             [
167                 [
168                     "/net/connman/service/ethernet_0010f32f5a70_cable",
169                     {
170                         "AutoConnect": true,
171                         "Domains": [
172                             "ftrdhcpuser.net"
173                         ],
174                         "Domains.Configuration": [],
175                         "Ethernet": {
176                             "Address": "10:20:F3:2F:5E:23",
177                             "Interface": "eno1",
178                             "MTU": 1500,
179                             "Method": "auto"
180                         },
181                         "Favorite": true,
182                         "IPv4": {
183                             "Address": "192.168.1.20",
184                             "Gateway": "192.168.1.1",
185                             "Method": "dhcp",
186                             "Netmask": "255.255.255.0"
187                         },
188                         "IPv4.Configuration": {
189                             "Method": "dhcp"
190                         },
191                         "IPv6": {},
192                         "IPv6.Configuration": {
193                             "Method": "auto",
194                             "Privacy": "disabled"
195                         },
196                         "Immutable": false,
197                         "Name": "Wired",
198                         "Nameservers": [
199                             "192.168.1.1",
200                             "184.11.12.13"
201                         ],
202                         "Nameservers.Configuration": [],
203                         "Provider": {},
204                         "Proxy": {
205                             "Method": "direct"
206                         },
207                         "Proxy.Configuration": {},
208                         "Security": [],
209                         "State": "online",
210                         "Timeservers": [
211                             "192.168.1.1",
212                             "pool.ntp.org"
213                         ],
214                         "Timeservers.Configuration": [],
215                         "Type": "ethernet"
216                     }
217                 ],
218                 [
219                     "/net/connman/service/wifi_c8f733acdf96_3558364737_managed_psk",
220                     {
221                         "AutoConnect": false,
222                         "BSSID": "42:18:23:98:93:f9",
223                         "Domains": [],
224                         "Domains.Configuration": [],
225                         "EncryptionMode": "aes",
226                         "Ethernet": {
227                             "Address": "D8:A7:47:AC:66:10",
228                             "Interface": "wlp1s0",
229                             "MTU": 1500,
230                             "Method": "auto"
231                         },
232                         "Favorite": false,
233                         "Frequency": 2412,
234                         "IPv4": {},
235                         "IPv4.Configuration": {
236                             "Method": "dhcp"
237                         },
238                         "IPv6": {},
239                         "IPv6.Configuration": {
240                             "Method": "auto",
241                             "Privacy": "disabled"
242                         },
243                         "Immutable": false,
244                         "MaxRate": 54000000,
245                         "Name": "TIZENIVI",
246                         "Nameservers": [],
247                         "Nameservers.Configuration": [],
248                         "Provider": {},
249                         "Proxy": {},
250                         "Proxy.Configuration": {},
251                         "Security": [
252                             "psk",
253                             "wps"
254                         ],
255                         "State": "idle",
256                         "Strength": 78,
257                         "Timeservers": [],
258                         "Timeservers.Configuration": [],
259                         "Type": "wifi"
260                     }
261                 ]
262             ]
263         ]
264     }
265
266 // WiFi "PropertyChanged" event format
267 var event =
268     {
269         "type":"event",
270         "value":{
271             "object_path":"/net/connman/technology/wifi",
272             "interface_name":"net.connman.Technology",
273             "signal_name":"PropertyChanged",
274             "parameters":[
275                 "Powered",
276                 true
277             ]
278         }
279     }
280
281 // --------------------------------------------------------------
282 //                           Clock
283 // --------------------------------------------------------------
284 // Set time
285 var request =
286     {
287         "type": "clock",
288         "transactionid": "<some UUID>",
289         "name": "time",
290         "value": <time in seconds from Epoch>
291     }
292
293 // Set timezone
294 var request =
295     {
296         "type": "clock",
297         "transactionid": "<some UUID>",
298         "name": "timezone",
299         "value": "<timezone typically found in tzdata>"
300     }
301
302 // Set time/timezone updates
303 // NOTE: The "time" request will fail with a permission denied error
304 //       if the value is set to "auto".
305 var request =
306     {
307         "type": "clock",
308         "transactionid": "<some UUID>",
309         "name": "time_updates" or "timezone_updates"
310         "value": "manual" or "auto"
311     }
312
313 // Check if time/timezone updates are set to automatic
314 var request =
315     {
316         "type": "clock",
317         "transactionid": "<some UUID>",
318         "name": "is_time_updates_auto" or "is_timezone_updates_auto"
319         "value": null
320     }
321
322 // Successful time/time_updates/timezone/timezone_updates
323 var response =
324     {
325         "type": "clock",
326         "transactionid": "<some UUID>",
327         "result": "succeeded"
328     }
329
330 // Successful is_{time,timezone}_update_auto
331 var response =
332     {
333         "type": "clock",
334         "transactionid": "<some UUID>",
335         "result": "succeeded"
336         "value": true or false
337     }
338
339
340 // --------------------------------------------------------------
341 //                          Global Events
342 // --------------------------------------------------------------
343
344 // "ServicesChanged" event from Connman Manager object
345 var event =
346     {
347         "type": "event",
348         "value": {
349             "interface_name": "net.connman.Manager",
350             "object_path": "/",
351             "signal_name": "ServicesChanged",
352             "parameters": [
353                 [
354                     // Changed services
355                     [
356                         "/net/connman/service/ethernet_002564e81cc7_cable",
357                         {}
358                     ],
359                     [
360                         "/net/connman/service/wifi_50465dae486e_4775657374_managed_none",
361                         {
362                             "AutoConnect": false,
363                             "Domains": [],
364                             "Domains.Configuration": [],
365                             "Ethernet": {
366                                 "Address": "00:21:5D:4E:48:7D",
367                                 "Interface": "wlan0",
368                                 "MTU": 1500,
369                                 "Method": "auto"
370                             },
371                             "Favorite": false,
372                             "IPv4": {},
373                             "IPv4.Configuration": {
374                                 "Method": "dhcp"
375                             },
376                             "IPv6": {},
377                             "IPv6.Configuration": {
378                                 "Method": "auto",
379                                 "Privacy": "prefered"
380                             },
381                             "Immutable": false,
382                             "Name": "Guest",
383                             "Nameservers": [],
384                             "Nameservers.Configuration": [],
385                             "Provider": {},
386                             "Proxy": {},
387                             "Proxy.Configuration": {},
388                             "Security": [
389                                 "none"
390                             ],
391                             "State": "idle",
392                             "Strength": 62,
393                             "Timeservers": [],
394                             "Timeservers.Configuration": [],
395                             "Type": "wifi"
396                         }
397                     ],
398                 ],
399                 [
400                     // Removed services
401                     "/net/connman/service/wifi_50465dae486e_54534e4f6666696365574c414e_managed_ieee8021x",
402                     "/net/connman/service/wifi_50465dae486e_4c6162776c616e_managed_ieee8021x"
403                 ]
404             ]
405         }
406     }