2 LuCI - Network model - NCM protocol extension
4 Copyright 2015 Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
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
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
20 local netmod = luci.model.network
22 local proto = netmod:register_protocol("ncm")
23 local interface = luci.model.network.interface
25 function proto.get_i18n(self)
26 return luci.i18n.translate("NCM")
29 function proto.opkg_package(self)
33 function proto.is_installed(self)
34 return nixio.fs.access("/lib/netifd/proto/ncm.sh")
37 function proto.is_floating(self)
41 function proto.is_virtual(self)
45 function proto.get_interface(self)
46 local _ifname=netmod.protocol.ifname(self)
50 return interface(_ifname, self)
53 function proto.get_interfaces(self)
57 function proto.contains_interface(self, ifc)
58 return (netmod:ifnameof(ifc) == self:ifname())
61 netmod:register_pattern_virtual("^ncm%-%w")
63 netmod:register_error_code("CONFIGURE_FAILED", luci.i18n.translate("Configuration failed"))
64 netmod:register_error_code("DISCONNECT_FAILED", luci.i18n.translate("Disconnection attempt failed"))
65 netmod:register_error_code("FINALIZE_FAILED", luci.i18n.translate("Finalizing failed"))
66 netmod:register_error_code("GETINFO_FAILED", luci.i18n.translate("Modem information query failed"))
67 netmod:register_error_code("INITIALIZE_FAILED", luci.i18n.translate("Initialization failure"))
68 netmod:register_error_code("SETMODE_FAILED", luci.i18n.translate("Setting operation mode failed"))
69 netmod:register_error_code("UNSUPPORTED_MODEM", luci.i18n.translate("Unsupported modem"))