1 -- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
2 -- Licensed to the public under the Apache License 2.0.
4 local netmod = luci.model.network
5 local interface = luci.model.network.interface
6 local proto = netmod:register_protocol("qmi")
8 function proto.get_i18n(self)
9 return luci.i18n.translate("QMI Cellular")
12 function proto.ifname(self)
13 local base = netmod._M.protocol
14 local ifname = base.ifname(self) -- call base class "protocol.ifname(self)"
16 -- Note: ifname might be nil if the adapter could not be determined through ubus (default name to qmi-wan in this case)
18 ifname = "qmi-" .. self.sid
23 function proto.get_interface(self)
24 return interface(self:ifname(), self)
27 function proto.opkg_package(self)
31 function proto.is_installed(self)
32 return nixio.fs.access("/lib/netifd/proto/qmi.sh")
35 function proto.is_floating(self)
39 function proto.is_virtual(self)
43 function proto.get_interfaces(self)
47 function proto.contains_interface(self, ifc)
48 return (netmod:ifnameof(ifc) == self:ifname())
51 netmod:register_pattern_virtual("^qmi%-%w")