2 LuCI - Lua Configuration Interface
4 Copyright 2012 Jo-Philipp Wich <xm@subsignal.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
14 module("luci.tools.proto", package.seeall)
16 function opt_macaddr(s, ifc, ...)
17 local v = luci.cbi.Value
18 local o = s:taboption("advanced", v, "macaddr", ...)
20 o.placeholder = ifc and ifc:mac()
21 o.datatype = "macaddr"
23 function o.cfgvalue(self, section)
24 local w = ifc and ifc:get_wifinet()
26 return w:get("macaddr")
28 return v.cfgvalue(self, section)
32 function o.write(self, section, value)
33 local w = ifc and ifc:get_wifinet()
35 w:set("macaddr", value)
37 v.write(self, section, value)
39 v.remove(self, section)
43 function o.remove(self, section)
44 self:write(section, nil)