2 listDeviceNames
: L
.rpc
.declare({
5 expect
: { 'devices': [ ] },
6 filter: function(data
) {
12 getDeviceStatus
: L
.rpc
.declare({
17 filter: function(data
, params
) {
18 if (!$.isEmptyObject(data
))
20 data
['device'] = params
['device'];
27 getAssocList
: L
.rpc
.declare({
31 expect
: { results
: [ ] },
32 filter: function(data
, params
) {
33 for (var i
= 0; i
< data
.length
; i
++)
34 data
[i
]['device'] = params
['device'];
36 data
.sort(function(a
, b
) {
37 if (a
.bssid
< b
.bssid
)
39 else if (a
.bssid
> b
.bssid
)
49 getWirelessStatus: function() {
50 return this.listDeviceNames().then(function(names
) {
53 for (var i
= 0; i
< names
.length
; i
++)
54 L
.wireless
.getDeviceStatus(names
[i
]);
57 }).then(function(networks
) {
61 'country', 'channel', 'frequency', 'frequency_offset',
62 'txpower', 'txpower_offset', 'hwmodes', 'hardware', 'phy'
66 'ssid', 'bssid', 'mode', 'quality', 'quality_max',
67 'signal', 'noise', 'bitrate', 'encryption'
70 for (var i
= 0; i
< networks
.length
; i
++)
72 var phy
= rv
[networks
[i
].phy
] || (
73 rv
[networks
[i
].phy
] = { networks
: [ ] }
77 device
: networks
[i
].device
80 for (var j
= 0; j
< phy_attrs
.length
; j
++)
81 phy
[phy_attrs
[j
]] = networks
[i
][phy_attrs
[j
]];
83 for (var j
= 0; j
< net_attrs
.length
; j
++)
84 net
[net_attrs
[j
]] = networks
[i
][net_attrs
[j
]];
86 phy
.networks
.push(net
);
93 getAssocLists: function()
95 return this.listDeviceNames().then(function(names
) {
98 for (var i
= 0; i
< names
.length
; i
++)
99 L
.wireless
.getAssocList(names
[i
]);
101 return L
.rpc
.flush();
102 }).then(function(assoclists
) {
105 for (var i
= 0; i
< assoclists
.length
; i
++)
106 for (var j
= 0; j
< assoclists
[i
].length
; j
++)
107 rv
.push(assoclists
[i
][j
]);
113 formatEncryption: function(enc
)
115 var format_list = function(l
, s
)
118 for (var i
= 0; i
< l
.length
; i
++)
119 rv
.push(l
[i
].toUpperCase());
120 return rv
.join(s
? s
: ', ');
123 if (!enc
|| !enc
.enabled
)
128 if (enc
.wep
.length
== 2)
129 return L
.tr('WEP Open/Shared') + ' (%s)'.format(format_list(enc
.ciphers
, ', '));
130 else if (enc
.wep
[0] == 'shared')
131 return L
.tr('WEP Shared Auth') + ' (%s)'.format(format_list(enc
.ciphers
, ', '));
133 return L
.tr('WEP Open System') + ' (%s)'.format(format_list(enc
.ciphers
, ', '));
137 if (enc
.wpa
.length
== 2)
138 return L
.tr('mixed WPA/WPA2') + ' %s (%s)'.format(
139 format_list(enc
.authentication
, '/'),
140 format_list(enc
.ciphers
, ', ')
142 else if (enc
.wpa
[0] == 2)
143 return 'WPA2 %s (%s)'.format(
144 format_list(enc
.authentication
, '/'),
145 format_list(enc
.ciphers
, ', ')
148 return 'WPA %s (%s)'.format(
149 format_list(enc
.authentication
, '/'),
150 format_list(enc
.ciphers
, ', ')
154 return L
.tr('Unknown');