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"))
18 s = m:section(TypedSection, "wifi-device", translate("devices"))
20 en = s:option(Flag, "disabled", translate("enable"))
24 mode = s:option(ListValue, "mode", translate("mode"))
25 mode:value("", "standard")
26 mode:value("11b", "802.11b")
27 mode:value("11g", "802.11g")
28 mode:value("11a", "802.11a")
29 mode:value("11bg", "802.11b+g")
32 s:option(Value, "channel", translate("a_w_channel"))
36 s = m:section(TypedSection, "wifi-iface", translate("m_n_local"))
39 s:option(Value, "ssid", translate("a_w_netid")).maxlength = 32
42 luci.model.uci.foreach("wireless", "wifi-device",
44 table.insert(devs, section[".name"])
48 device = s:option(DummyValue, "device", translate("device"))
50 s.defaults.device = devs[1]
53 mode = s:option(ListValue, "mode", translate("mode"))
54 mode:value("ap", translate("m_w_ap"))
55 mode:value("adhoc", translate("m_w_adhoc"))
56 mode:value("sta", translate("m_w_client"))
58 function mode.write(self, section, value)
59 if value == "sta" then
60 -- ToDo: Move this away
61 if not luci.model.uci.get("network", "wan") then
62 luci.model.uci.set("network", "wan", "proto", "none")
63 luci.model.uci.set("network", "wan", "ifname", " ")
66 local oldif = luci.model.uci.get("network", "wan", "ifname")
67 if oldif and oldif ~= " " then
68 luci.model.uci.set("network", "wan", "_ifname", oldif)
70 luci.model.uci.set("network", "wan", "ifname", " ")
72 self.map:set(section, "network", "wan")
74 if luci.model.uci.get("network", "wan", "_ifname") then
75 luci.model.uci.set("network", "wan", "ifname", luci.model.uci.get("network", "wan", "_ifname"))
77 self.map:set(section, "network", "lan")
80 return ListValue.write(self, section, value)
83 encr = s:option(ListValue, "encryption", translate("encryption"))
84 encr:value("none", "keine")
85 encr:value("wep", "WEP")
86 encr:value("psk", "WPA-PSK")
87 encr:value("wpa", "WPA-Radius")
88 encr:value("psk2", "WPA2-PSK")
89 encr:value("wpa2", "WPA2-Radius")
91 key = s:option(Value, "key", translate("key"))
92 key:depends("encryption", "wep")
93 key:depends("encryption", "psk")
94 key:depends("encryption", "wpa")
95 key:depends("encryption", "psk2")
96 key:depends("encryption", "wpa2")
99 server = s:option(Value, "server", translate("a_w_radiussrv"))
100 server:depends("encryption", "wpa")
101 server:depends("encryption", "wpa2")
102 server.rmempty = true
104 port = s:option(Value, "port", translate("a_w_radiusport"))
105 port:depends("encryption", "wpa")
106 port:depends("encryption", "wpa2")
109 iso = s:option(Flag, "isolate", translate("a_w_apisolation"), translate("a_w_apisolation1"))
111 iso:depends("mode", "ap")
113 hide = s:option(Flag, "hidden", translate("a_w_hideessid"))
115 hide:depends("mode", "ap")