6 var callFileList
= rpc
.declare({
10 expect
: { entries
: [] },
11 filter: function(list
, params
) {
13 for (var i
= 0; i
< list
.length
; i
++)
14 if (list
[i
].name
.match(/^cdc-wdm/))
15 rv
.push(params
.path
+ list
[i
].name
);
20 network
.registerPatternVirtual(/^qmi-.+$/);
21 network
.registerErrorCode('CALL_FAILED', _('Call failed'));
22 network
.registerErrorCode('NO_CID', _('Unable to obtain client ID'));
23 network
.registerErrorCode('PLMN_FAILED', _('Setting PLMN failed'));
25 return network
.registerProtocol('qmi', {
27 return _('QMI Cellular');
30 getIfname: function() {
31 return this._ubus('l3_device') || 'qmi-%s'.format(this.sid
);
34 getOpkgPackage: function() {
38 isFloating: function() {
42 isVirtual: function() {
46 getDevices: function() {
50 containsDevice: function(ifname
) {
51 return (network
.getIfnameOf(ifname
) == this.getIfname());
54 renderFormOptions: function(s
) {
55 var dev
= this.getL3Device() || this.getDevice(), o
;
57 o
= s
.taboption('general', form
.Value
, 'device', _('Modem device'));
59 o
.load = function(section_id
) {
60 return callFileList('/dev/').then(L
.bind(function(devices
) {
61 for (var i
= 0; i
< devices
.length
; i
++)
62 this.value(devices
[i
]);
63 return form
.Value
.prototype.load
.apply(this, [section_id
]);
67 s
.taboption('general', form
.Value
, 'apn', _('APN'));
68 s
.taboption('general', form
.Value
, 'pincode', _('PIN'));
70 o
= s
.taboption('general', form
.ListValue
, 'auth', _('Authentication Type'));
71 o
.value('both', 'PAP/CHAP');
72 o
.value('pap', 'PAP');
73 o
.value('chap', 'CHAP');
74 o
.value('none', 'NONE');
77 o
= s
.taboption('general', form
.Value
, 'username', _('PAP/CHAP username'));
78 o
.depends('auth', 'pap');
79 o
.depends('auth', 'chap');
80 o
.depends('auth', 'both');
82 o
= s
.taboption('general', form
.Value
, 'password', _('PAP/CHAP password'));
83 o
.depends('auth', 'pap');
84 o
.depends('auth', 'chap');
85 o
.depends('auth', 'both');
88 if (L
.hasSystemFeature('ipv6')) {
89 o
= s
.taboption('advanced', form
.Flag
, 'ppp_ipv6', _('Enable IPv6 negotiation'));
91 o
.default = o
.disabled
;
94 o
= s
.taboption('advanced', form
.Value
, 'delay', _('Modem init timeout'), _('Maximum amount of seconds to wait for the modem to become ready'));
96 o
.datatype
= 'min(1)';
98 o
= s
.taboption('advanced', form
.Value
, 'mtu', _('Override MTU'));
99 o
.placeholder
= dev
? (dev
.getMTU() || '1500') : '1500';
100 o
.datatype
= 'max(9200)';
102 o
= s
.taboption('general', form
.ListValue
, 'pdptype', _('PDP Type'));
103 o
.value('ipv4v6', 'IPv4/IPv6');
104 o
.value('ipv4', 'IPv4');
105 o
.value('ipv6', 'IPv6');
106 o
.default = 'ipv4v6';
108 o
= s
.taboption('advanced', form
.Flag
, 'defaultroute',
109 _('Use default gateway'),
110 _('If unchecked, no default route is configured'));
111 o
.default = o
.enabled
;
113 o
= s
.taboption('advanced', form
.Value
, 'metric',
114 _('Use gateway metric'));
116 o
.datatype
= 'uinteger';
117 o
.depends('defaultroute', '1');
119 o
= s
.taboption('advanced', form
.Flag
, 'peerdns',
120 _('Use DNS servers advertised by peer'),
121 _('If unchecked, the advertised DNS server addresses are ignored'));
122 o
.default = o
.enabled
;