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(/^ttyUSB/) || list
[i
].name
.match(/^cdc-wdm/))
15 rv
.push(params
.path
+ list
[i
].name
);
20 network
.registerPatternVirtual(/^ncm-.+$/);
21 network
.registerErrorCode('CONFIGURE_FAILED', _('Configuration failed'));
22 network
.registerErrorCode('DISCONNECT_FAILED', _('Disconnection attempt failed'));
23 network
.registerErrorCode('FINALIZE_FAILED', _('Finalizing failed'));
24 network
.registerErrorCode('GETINFO_FAILED', _('Modem information query failed'));
25 network
.registerErrorCode('INITIALIZE_FAILED', _('Initialization failure'));
26 network
.registerErrorCode('SETMODE_FAILED', _('Setting operation mode failed'));
27 network
.registerErrorCode('UNSUPPORTED_MODEM', _('Unsupported modem'));
29 return network
.registerProtocol('ncm', {
34 getIfname: function() {
35 return this._ubus('l3_device') || 'wan';
38 getOpkgPackage: function() {
42 isFloating: function() {
46 isVirtual: function() {
50 getDevices: function() {
54 containsDevice: function(ifname
) {
55 return (network
.getIfnameOf(ifname
) == this.getIfname());
58 renderFormOptions: function(s
) {
61 o
= s
.taboption('general', form
.Value
, 'device', _('Modem device'));
63 o
.load = function(section_id
) {
64 return callFileList('/dev/').then(L
.bind(function(devices
) {
65 for (var i
= 0; i
< devices
.length
; i
++)
66 this.value(devices
[i
]);
67 return form
.Value
.prototype.load
.apply(this, [section_id
]);
71 o
= s
.taboption('general', form
.Value
, 'service', _('Service Type'));
72 o
.value('', _('Modem default'));
73 o
.value('preferlte', _('Prefer LTE'));
74 o
.value('preferumts', _('Prefer UMTS'));
75 o
.value('lte', 'LTE');
76 o
.value('umts', 'UMTS/GPRS');
77 o
.value('gsm', _('GPRS only'));
78 o
.value('auto', _('auto'));
80 o
= s
.taboption('general', form
.ListValue
, 'pdptype', _('IP Protocol'));
82 o
.value('IP', _('IPv4'));
83 o
.value('IPV4V6', _('IPv4+IPv6'));
84 o
.value('IPV6', _('IPv6'));
86 s
.taboption('general', form
.Value
, 'apn', _('APN'));
87 s
.taboption('general', form
.Value
, 'pincode', _('PIN'));
88 s
.taboption('general', form
.Value
, 'username', _('PAP/CHAP username'));
90 o
= s
.taboption('general', form
.Value
, 'password', _('PAP/CHAP password'));
93 o
= s
.taboption('general', form
.Value
, 'dialnumber', _('Dial number'));
94 o
.placeholder
= '*99***1#';
96 if (L
.hasSystemFeature('ipv6')) {
97 o
= s
.taboption('advanced', form
.ListValue
, 'ipv6', _('Obtain IPv6-Address'));
98 o
.value('auto', _('Automatic'));
99 o
.value('0', _('Disabled'));
100 o
.value('1', _('Manual'));
104 o
= s
.taboption('advanced', form
.Value
, 'delay', _('Modem init timeout'), _('Maximum amount of seconds to wait for the modem to become ready'));
105 o
.placeholder
= '10';
106 o
.datatype
= 'min(1)';