7 'require tools.widgets as widgets';
12 uci.load('basicstation')
16 render: function(data) {
19 /* General Settings */
20 m = new form.Map('basicstation', _('General Settings'));
22 /* Station Identity */
23 s = m.section(form.NamedSection, 'station', 'station',
24 _('Station Identity'));
26 o = s.option(widgets.DeviceSelect, 'idGenIf',
27 _('Interface for station ID generation'),
28 _('Station ID is derived from the MAC address of the chosen interface'));
29 o.filter = function(section_id, value) {
30 var dev = this.devices.filter(function(dev) { return dev.getName() == value })[0];
31 return (dev && dev.getMAC() != null && dev.getMAC() != '00:00:00:00:00:00');
38 o.write = function(sid, value) {
39 var path = "/sys/class/net/" + value + "/address";
40 uci.set('basicstation', sid, 'idGenIf', value);
41 uci.set('basicstation', sid, 'routerid', path);
44 o = s.option(form.Value, 'stationid', _('Station ID'),
45 _('Click save and apply to generate station ID'));
49 s = m.section(form.NamedSection, 'auth', 'auth',
52 o = s.option(form.ListValue, 'cred', _('Credentials'),
53 _('Credentials for LNS (TC) or CUPS (CUPS)'));
54 o.value('tc', _('TC'));
55 o.value('cups', _('CUPS'));
58 o = s.option(form.ListValue, 'mode', _('Authentication mode'),
59 _('Authentication mode for server connection'));
60 o.value('no', _('No Authentication'));
61 o.value('server', _('TLS Server Authentication'));
62 o.value('serverAndClient', _('TLS Server and Client Authentication'));
63 o.value('serverAndClientToken', _('TLS Server Authentication and Client Token'));
66 o = s.option(form.Value, 'addr', _('Server address'));
69 o.placeholder = 'eu1.cloud.thethings.network';
71 o = s.option(form.Value, 'port', _('Port'));
74 o.datatype = 'uinteger';
75 o.placeholder = '8887';
77 o = s.option(form.Value, 'token', _('Authorization token'));
80 o.depends({ mode: 'serverAndClientToken' });
82 o = s.option(form.Value, 'key', _('Private station key'));
85 o.depends({ mode: 'serverAndClient' });
87 o = s.option(form.FileUpload, 'crt', _('Private station certificate'));
90 o.depends({ mode: "serverAndClient" });
92 o = s.option(form.FileUpload, 'trust', _('CA certificate'));
95 o.depends({ mode: "no", "!reverse": true });
97 /* Radio Configuration */
98 s = m.section(form.NamedSection, 'sx130x', 'sx130x',
99 _('Radio Configuration'));
101 o = s.option(form.ListValue, 'comif', _('Communication interface'),
102 _('Currently only USB devices are supported'));
103 o.value('usb', 'USB');
106 o = s.option(form.Value, 'devpath', _('Device path'),
107 _('Device path of the LoRaWAN concentrator card'));
110 o.placeholder = '/dev/ttyACM0';
112 o = s.option(form.Flag, 'pps', _('PPS'),
113 _('PPS (pulse per second) provided by GPS device or other source'));
116 o = s.option(form.Flag, 'public', _('Public network'),
117 _('Public or private LoRaWAN network'));
120 o = s.option(form.ListValue, 'clksrc', _('Clock source'),
121 _('Radio to provide clock to Basicstation'));
122 o.value('0', 'Radio 0');
123 o.value('1', 'Radio 1');
126 var options = uci.sections('basicstation', 'rfconf');
128 o = s.option(form.ListValue, 'radio0', _('Radio 0'),
129 _('RF configuration for Radio 0'));
130 for (var i = 0; i < options.length; i++) {
131 var value = options[i]['.name'];
134 o.default = 'rfconf0';
136 o = s.option(form.ListValue, 'radio1', _('Radio 1'),
137 _('RF configuration for Radio 1'));
138 for (var i = 0; i < options.length; i++) {
139 var value = options[i]['.name'];
142 o.default = 'rfconf1';
145 s = m.section(form.NamedSection, 'station','station',
148 o = s.option(form.ListValue, 'logLevel', _('Level'),
149 _('Level to which messages are to be logged'));
150 o.value('XDEBUG', 'xdebug');
151 o.value('DEBUG', 'debug');
152 o.value('VERBOSE', 'verbose');
153 o.value('INFO', 'info');
154 o.value('NOTICE', 'notice');
155 o.value('WARNING', 'warning');
156 o.value('ERROR', 'error');
157 o.value('CRITICAL', 'critical');
160 o = s.option(form.Value, 'logSize', _('Size'),
161 _('Maximum size of log file in MB'));
167 o.datatype = 'range(1,10)';
169 o = s.option(form.Value, 'logRotate', _('Rotate'),
170 _('Number of old log files to be kept'));
176 o.datatype = 'range(1, 10)';