]>
Commit | Line | Data |
---|---|---|
c5e3d520 MT |
1 | #!/usr/bin/perl |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2008 Michael Tremer & Christian Schmidt # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
22 | use strict; | |
23 | ||
24 | # enable only the following on debugging purpose | |
25 | use warnings; | |
26 | use CGI::Carp 'fatalsToBrowser'; | |
27 | ||
28 | require '/var/ipfire/general-functions.pl'; | |
29 | require "${General::swroot}/lang.pl"; | |
30 | require "${General::swroot}/header.pl"; | |
31 | require "${General::swroot}/modem-lib.pl"; | |
32 | ||
33 | my $modem; | |
34 | my %ethsettings = {}; | |
35 | my %pppsettings = {}; | |
36 | ||
37 | &General::readhash("${General::swroot}/ethernet/settings", \%ethsettings); | |
38 | ||
39 | if ($ethsettings{"RED_TYPE"} eq "PPPOE") { | |
40 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
41 | ||
42 | # Establish the connection to the modem. | |
43 | my $port = $pppsettings{'MONPORT'}; | |
44 | if ($port) { | |
45 | $port = "/dev/$port"; | |
46 | $modem = Modem->new($port, $pppsettings{"DTERATE"}); | |
47 | } | |
48 | } | |
49 | ||
50 | &Header::showhttpheaders(); | |
51 | &Header::openpage($Lang::tr{'modem information'}, 1, ''); | |
52 | &Header::openbigbox('100%', 'left'); | |
53 | ||
54 | if ($modem) { | |
55 | &Header::openbox("100%", "center", $Lang::tr{'modem hardware details'}); | |
56 | ||
57 | print <<END; | |
58 | <table width="100%"> | |
59 | <tbody> | |
60 | END | |
61 | ||
62 | my $vendor = $modem->get_vendor(); | |
63 | if ($vendor) { | |
64 | print <<END; | |
65 | <tr> | |
66 | <td width="33%">$Lang::tr{'vendor'}</td> | |
67 | <td>$vendor</td> | |
68 | </tr> | |
69 | END | |
70 | } | |
71 | ||
72 | my $model = $modem->get_model(); | |
73 | if ($model) { | |
74 | print <<END; | |
75 | <tr> | |
76 | <td width="33%">$Lang::tr{'model'}</td> | |
77 | <td>$model</td> | |
78 | </tr> | |
79 | END | |
80 | } | |
81 | ||
82 | my $software_version = $modem->get_software_version(); | |
83 | if ($software_version) { | |
84 | print <<END; | |
85 | <tr> | |
86 | <td width="33%">$Lang::tr{'software version'}</td> | |
87 | <td>$software_version</td> | |
88 | </tr> | |
89 | END | |
90 | } | |
91 | ||
92 | my $imei = $modem->get_imei(); | |
93 | if ($imei) { | |
94 | print <<END; | |
95 | <tr> | |
96 | <td width="33%">$Lang::tr{'imei'}</td> | |
97 | <td>$imei</td> | |
98 | </tr> | |
99 | END | |
100 | } | |
101 | ||
102 | my @caps = $modem->get_capabilities(); | |
103 | if (@caps) { | |
104 | my $caps_string = join(", ", @caps); | |
105 | ||
106 | print <<END; | |
107 | <tr> | |
108 | <td width="33%">$Lang::tr{'capabilities'}</td> | |
109 | <td>$caps_string</td> | |
110 | </tr> | |
111 | END | |
112 | } | |
113 | ||
114 | print <<END; | |
115 | </tbody> | |
116 | </table> | |
117 | END | |
118 | &Header::closebox(); | |
119 | ||
120 | ||
121 | &Header::openbox("100%", "center", $Lang::tr{'modem sim information'}); | |
122 | print <<END; | |
123 | <table width="100%"> | |
124 | <tbody> | |
125 | END | |
126 | ||
127 | my $imsi = $modem->get_sim_imsi(); | |
128 | if ($imsi) { | |
129 | print <<END; | |
130 | <tr> | |
131 | <td width="33%">$Lang::tr{'imsi'}</td> | |
132 | <td>$imsi</td> | |
133 | </tr> | |
134 | END | |
135 | } | |
136 | ||
137 | print <<END; | |
138 | </tbody> | |
139 | </table> | |
140 | END | |
141 | &Header::closebox(); | |
142 | ||
143 | &Header::openbox("100%", "center", $Lang::tr{'modem network information'}); | |
144 | print <<END; | |
145 | <table width="100%"> | |
146 | <tbody> | |
147 | END | |
148 | ||
149 | my $network_registration = $modem->get_network_registration(); | |
150 | if ($network_registration) { | |
151 | print <<END; | |
152 | <tr> | |
153 | <td width="33%">$Lang::tr{'modem network registration'}</td> | |
154 | <td>$network_registration</td> | |
155 | </tr> | |
156 | END | |
157 | } | |
158 | ||
159 | my $network_operator = $modem->get_network_operator(); | |
160 | if ($network_operator) { | |
161 | print <<END; | |
162 | <tr> | |
163 | <td width="33%">$Lang::tr{'modem network operator'}</td> | |
164 | <td>$network_operator</td> | |
165 | </tr> | |
166 | END | |
167 | } | |
168 | ||
169 | my $network_mode = $modem->get_network_mode(); | |
170 | if ($network_mode) { | |
171 | print <<END; | |
172 | <tr> | |
173 | <td width="33%">$Lang::tr{'modem network mode'}</td> | |
174 | <td>$network_mode</td> | |
175 | </tr> | |
176 | END | |
177 | } | |
178 | ||
179 | my $signal_quality = $modem->get_signal_quality(); | |
180 | if ($signal_quality) { | |
181 | print <<END; | |
182 | <tr> | |
183 | <td width="33%">$Lang::tr{'modem network signal quality'}</td> | |
184 | <td>$signal_quality dBm</td> | |
185 | </tr> | |
186 | END | |
187 | } | |
188 | ||
189 | my $bit_error_rate = $modem->get_bit_error_rate(); | |
190 | if ($bit_error_rate) { | |
191 | print <<END; | |
192 | <tr> | |
193 | <td width="33%">$Lang::tr{'modem network bit error rate'}</td> | |
194 | <td>$bit_error_rate</td> | |
195 | </tr> | |
196 | END | |
197 | } | |
198 | print <<END; | |
199 | </tbody> | |
200 | </table> | |
201 | END | |
202 | ||
203 | &Header::closebox(); | |
204 | } else { | |
205 | &Header::openbox("100%", "center", $Lang::tr{'modem no connection'}); | |
206 | print "<p>$Lang::tr{'modem no connection message'}</p>"; | |
207 | &Header::closebox(); | |
208 | } | |
209 | ||
210 | &Header::closebigbox(); | |
211 | &Header::closepage(); |