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 local uci = require "luci.model.uci".cursor()
17 local net = require "luci.model.network"
19 function opt_macaddr(s, ifc, ...)
20 local v = luci.cbi.Value
21 local o = s:taboption("advanced", v, "macaddr", ...)
23 o.placeholder = ifc and ifc:mac()
24 o.datatype = "macaddr"
26 function o.cfgvalue(self, section)
27 local w = ifc and ifc:get_wifinet()
29 return w:get("macaddr")
31 return v.cfgvalue(self, section)
35 function o.write(self, section, value)
36 local w = ifc and ifc:get_wifinet()
38 w:set("macaddr", value)
40 v.write(self, section, value)
42 v.remove(self, section)
46 function o.remove(self, section)
47 self:write(self, section, nil)