gluon-web-cellular: add package

This adds a new package which allows configuration of Gluons cellular
WWAN capabilities using the configuration mode. This way, a user can
enter APN information as well as the SIM PIN and enable / disable the
functionality.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer 2022-09-05 22:24:13 +02:00
parent 55096d55f0
commit c22956ca55
4 changed files with 110 additions and 0 deletions

View File

@ -0,0 +1,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-cellular
include ../gluon.mk
define Package/gluon-web-cellular
DEPENDS:=+gluon-web-admin
TITLE:=UI for activating cellular WAN
endef
$(eval $(call BuildPackageGluon,gluon-web-cellular))

View File

@ -0,0 +1,37 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "APN"
msgstr ""
msgid "Cellular"
msgstr ""
msgid "Enabled"
msgstr ""
msgid "IPv4"
msgstr ""
msgid "IPv4/IPv6"
msgstr ""
msgid "IPv6"
msgstr ""
msgid "Password"
msgstr ""
msgid "SIM PIN"
msgstr ""
msgid "Type"
msgstr ""
msgid "Username"
msgstr ""
msgid ""
"You can enable uplink via cellular service. If you decide so, the VPN "
"connection is established using the integrated WWAN modem."
msgstr ""

View File

@ -0,0 +1,7 @@
local platform = require 'gluon.platform'
package 'gluon-web-cellular'
if platform.is_cellular_device() then
entry({"admin", "cellular"}, model("admin/cellular"), _("Cellular"), 30)
end

View File

@ -0,0 +1,54 @@
local uci = require("simple-uci").cursor()
local f = Form(translate("Cellular"))
local s = f:section(Section, nil, translate(
'You can enable uplink via cellular service. If you decide so, the VPN connection is established '
.. 'using the integrated WWAN modem.'
))
local enabled = s:option(Flag, "enabled", translate("Enabled"))
enabled.default = uci:get('gluon', 'cellular') and uci:get_bool('gluon', 'cellular', 'enabled')
local pin = s:option(Value, "pin", translate("SIM PIN"))
pin:depends(enabled, true)
pin.default = uci:get('gluon', 'cellular', 'pin')
local apn = s:option(Value, "apn", translate("APN"))
apn:depends(enabled, true)
apn.default = uci:get('gluon', 'cellular', 'apn')
local pdptype = s:option(ListValue, "type", translate("Type"))
pdptype:depends(enabled, true)
pdptype:value("IP", translate("IPv4"))
pdptype:value("IPV6", translate("IPv6"))
pdptype:value("IPV4V6", translate("IPv4/IPv6"))
pdptype.default = uci:get('gluon', 'cellular', 'pdptype') or "IP"
local username = s:option(Value, "username", translate("Username"))
username:depends(enabled, true)
username.default = uci:get('gluon', 'cellular', 'username')
local password = s:option(Value, "password", translate("Password"))
password:depends(enabled, true)
password.default = uci:get('gluon', 'cellular', 'password')
function f:write()
local cellular_enabled = false
if enabled.data then
cellular_enabled = true
end
uci:section('gluon', 'cellular', 'cellular', {
enabled = cellular_enabled,
apn = apn.data,
pdptype = pdptype.data,
pin = pin.data,
username = username.data,
password = password.data,
})
uci:commit('gluon')
end
return f