2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
15 m = Map("wireless", translate("wifi"), translate("a_w_devices1"))
17 s = m:section(TypedSection, "wifi-device", translate("devices"))
19 en = s:option(Flag, "disabled", translate("enable"))
23 mode = s:option(ListValue, "mode", translate("mode"))
24 mode:value("", "standard")
25 mode:value("11b", "802.11b")
26 mode:value("11g", "802.11g")
27 mode:value("11a", "802.11a")
28 mode:value("11bg", "802.11b+g")
31 s:option(Value, "channel", translate("a_w_channel"))
35 s = m:section(TypedSection, "wifi-iface", translate("m_n_local"))
38 s:option(Value, "ssid", translate("a_w_netid")).maxlength = 32
41 luci.model.uci.foreach("wireless", "wifi-device",
43 table.insert(devs, section[".name"])
47 device = s:option(DummyValue, "device", translate("device"))
49 s.defaults.device = devs[1]
52 mode = s:option(ListValue, "mode", translate("mode"))
53 mode:value("ap", "Access Point")
54 mode:value("adhoc", "Ad-Hoc")
55 mode:value("sta", "Client")
57 function mode.write(self, section, value)
58 if value == "sta" then
59 luci.model.uci.set("network", "wan", "type", "bridge")
60 luci.model.uci.set("wireless", section, "network", "wan")
62 luci.model.uci.delete("network", "wan", "type")
63 luci.model.uci.set("wireless", section, "network", "lan")
65 luci.model.uci.save("network")
66 return ListValue.write(self, section, value)
69 encr = s:option(ListValue, "encryption", translate("encryption"))
70 encr:value("none", "keine")
71 encr:value("wep", "WEP")
72 encr:value("psk", "WPA-PSK")
73 encr:value("wpa", "WPA-Radius")
74 encr:value("psk2", "WPA2-PSK")
75 encr:value("wpa2", "WPA2-Radius")
77 key = s:option(Value, "key", translate("key"))
78 key:depends("encryption", "wep")
79 key:depends("encryption", "psk")
80 key:depends("encryption", "wpa")
81 key:depends("encryption", "psk2")
82 key:depends("encryption", "wpa2")
85 server = s:option(Value, "server", translate("a_w_radiussrv"))
86 server:depends("encryption", "wpa")
87 server:depends("encryption", "wpa2")
90 port = s:option(Value, "port", translate("a_w_radiusport"))
91 port:depends("encryption", "wpa")
92 port:depends("encryption", "wpa2")
95 iso = s:option(Flag, "isolate", translate("a_w_apisolation"), translate("a_w_apisolation1"))
97 iso:depends("mode", "ap")
99 hide = s:option(Flag, "hidden", translate("a_w_hideessid"))
101 hide:depends("mode", "ap")