1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 function BatteryInfo() {
6 this.level = $('<p></p>').addClass('center');
7 this.charging = $('<p></p>').addClass('center');
8 $('#battery_data').append(this.level, this.charging);
10 this.draw_graph = function draw_graph(BATDATA) {
11 $('#battery_container div span').css('width', BATDATA.level * 100 + '%');
12 if (BATDATA.isCharging) {
13 $('#battery_container div').addClass('shine');
15 $('#battery_container div').removeClass('shine');
19 this.getInfo = function getInfo(BATTERY) {
20 tizen.systeminfo.getPropertyValue(
23 BATTERY.draw_graph(battery);
24 BATTERY.charging.text(battery.isCharging ? 'Charging' : 'No Charging');
25 BATTERY.level.text(battery.level * 100 + '%');
28 tizen.systeminfo.addPropertyValueChangeListener(
31 BATTERY.draw_graph(battery);
32 BATTERY.charging.text(battery.isCharging ? 'Charging' : 'No Charging');
33 BATTERY.level.text(battery.level * 100 + '%');
38 function BuildInfo() {
39 this.model = $('<p></p>').addClass('center');
40 this.manufacturer = $('<p></p>').addClass('center');
41 this.build_version = $('<p></p>').addClass('center');
42 $('#build').append(this.model, this.manufacturer, this.build_version);
44 this.getInfo = function getInfo(BUILD) {
45 tizen.systeminfo.getPropertyValue(
48 BUILD.model.text('MODEL: ' + build.model);
49 BUILD.manufacturer.text('MANUFACTURE: ' + build.manufacturer);
50 BUILD.build_version.text('BUILDVERSION: ' + build.buildVersion);
53 tizen.systeminfo.addPropertyValueChangeListener(
56 BUILD.model.text('MODEL: ' + build.model);
57 BUILD.manufacturer.text('MANUFACTURE: ' + build.manufacturer);
58 BUILD.build_version.text('BUILDVERSION: ' + build.buildVersion);
63 function CellularNetworkInfo() {
64 this.status = $('<p></p>').text('CELLULAR is OFF');
65 this.apn_imei = $('<p></p>');
66 this.ip_address = $('<p></p>');
67 this.ipv6_address = $('<p></p>');
68 this.short_info = $('<p></p>');
69 this.bool_info = $('<p></p>');
70 $('#cellular_network_info').append(this.status, this.apn_imei,
71 this.ip_address, this.ipv6_address,
72 this.short_info, this.bool_info);
74 this.change_cellular = function change_cellular(cellular) {
75 if (cellular.status == 'ON') {
76 this.status.text('CELLULAR: ' + cellular.status);
77 this.apn_imei.text('APN: ' + cellular.apn + ' ' +
78 'IMEI: ' + cellular.imei);
79 this.ip_address.text('IP ADDRESS: ' + cellular.ipAddress);
80 this.ipv6_address.text('IPV6 ADDRESS: ' + cellular.ipv6Address);
81 this.short_info.text('MCC: ' + cellular.mcc + ' ' +
82 'MNC: ' + cellular.mnc + ' ' +
83 'CELLID: ' + cellular.cellId + ' ' +
84 'LAC: ' + cellular.lac);
85 this.bool_info.text(cellular.isRoaming ? 'Roaming' : 'NoRoaming' +
86 cellular.isFlightMode ? 'Flight' : 'NoFlight');
88 this.status.text('CELLULAR IS OFF!');
92 this.getInfo = function getInfo(CELLULAR) {
93 tizen.systeminfo.getPropertyValue(
96 CELLULAR.change_cellular(cellular);
99 tizen.systeminfo.addPropertyValueChangeListener(
102 CELLULAR.change_cellular(cellular);
109 this.cpu_container = document.getElementById('cpu_container');
111 this.cpu_data_size = 200;
112 this.cpu_graph = null;
120 colors: ['#f00', '#fdd'],
130 tickFormatter: function(n) {return n + '%';},
139 ticks: [[0, 'PAST'], [200, 'FUTURE']],
145 colors: [[0, '#fff'], [1, '#bbb']],
151 this.cpu_animate = function cpu_animate(CPU, length) {
152 if (CPU.cpu_data.length <= CPU.cpu_data_size) {
153 CPU.cpu_data.push(CPU.cpu_data[length - 1]);
155 CPU.cpu_data.push(CPU.cpu_data[length - 1]);
156 CPU.cpu_data.shift();
159 CPU.graph_lines.data = [];
160 for (var i = 0; i < CPU.cpu_data.length; ++i) {
161 CPU.graph_lines.data.push([i, CPU.cpu_data[i]]);
164 while (CPU.cpu_data[length - 1] > CPU.graph_yaxis.max) {
165 CPU.graph_yaxis.max += 50;
168 CPU.cpu_graph = Flotr.draw(CPU.cpu_container,
170 title: CPU.cpu_data[length - 1] + '%',
171 yaxis: CPU.graph_yaxis,
172 xaxis: CPU.graph_xaxis,
173 grid: CPU.graph_grid,
174 legend: {position: 'nw'}
178 setTimeout(function() {
179 CPU.cpu_animate(CPU, CPU.cpu_data.length);
183 this.getInfo = function getInfo(CPU) {
184 tizen.systeminfo.getPropertyValue(
187 CPU.cpu_data.push((cpu.load * 100).toFixed(1));
190 CPU.cpu_animate(CPU, CPU.cpu_data.length);
191 tizen.systeminfo.addPropertyValueChangeListener(
194 if (CPU.cpu_data.length < CPU.cpu_data_size) {
195 CPU.cpu_data.push((cpu.load * 100).toFixed(1));
197 CPU.cpu_data.shift();
198 CPU.cpu_data.push((cpu.load * 100).toFixed(1));
204 function DeviceOrientationInfo() {
205 this.status = $('<p></p>');
206 this.auto_rotation = $('<p></p>');
207 $('#deviceorientation').append(this.status, this.auto_rotation);
209 this.change_status = function change_status(status) {
211 case 'PORTRAIT_PRIMARY':
212 $('#ball').css('-webkit-animation', 'jump-pp 1s infinite');
213 $('#ball').css('animation', 'jump-pp 1.5s infinite');
214 $('#ball').removeClass();
215 $('#ball').addClass('ball-top');
217 case 'PORTRAIT_SECONDARY':
218 $('#ball').css('-webkit-animation', 'jump-ps 1s infinite');
219 $('#ball').css('animation', 'jump-ps 1.5s infinite');
220 $('#ball').removeClass();
221 $('#ball').addClass('ball-bottom');
223 case 'LANDSCAPE_PRIMARY':
224 $('#ball').css('-webkit-animation', 'jump-lp 1s infinite');
225 $('#ball').css('animation', 'jump-lp 1.5s infinite');
226 $('#ball').removeClass();
227 $('#ball').addClass('ball-left');
229 case 'LANDSCAPE_SECONDARY':
230 $('#ball').css('-webkit-animation', 'jump-ls 1s infinite');
231 $('#ball').css('animation', 'jump-ls 1.5s infinite');
232 $('#ball').removeClass();
233 $('#ball').addClass('ball-right');
236 $('#ball').css('-webkit-animation', 'jump-no 1s infinite');
237 $('#ball').css('animation', 'jump-no 1.5s infinite');
238 $('#ball').removeClass();
242 this.getInfo = function getInfo(DEVICEORIENTATION) {
243 tizen.systeminfo.getPropertyValue(
244 'DEVICE_ORIENTATION',
245 function(deviceorientation) {
246 DEVICEORIENTATION.change_status(deviceorientation.status);
247 DEVICEORIENTATION.status.text('STATUS: ' + deviceorientation.status);
248 DEVICEORIENTATION.auto_rotation.text(deviceorientation.isAutoRotation ?
249 'AUTOROTATION' : 'NO AUTOROTATION');
252 tizen.systeminfo.addPropertyValueChangeListener(
253 'DEVICE_ORIENTATION',
254 function(deviceorientation) {
255 DEVICEORIENTATION.change_status(deviceorientation.status);
256 DEVICEORIENTATION.status.text('STATUS: ' + deviceorientation.status);
257 DEVICEORIENTATION.auto_rotation.text(deviceorientation.isAutoRotation ?
258 'AUTOROTATION' : 'NO AUTOROTATION');
263 function DisplayInfo() {
264 this.dots_perinch_width = $('<p></p>').addClass('center');
265 this.dots_perinch_height = $('<p></p>').addClass('center');
266 this.screen = $('<p></p>').addClass('center');
267 this.physical = $('<p></p>').addClass('center');
268 this.brightness = $('<p></p>').addClass('center');
269 $('#display_status').append(this.dots_perinch_width, this.dots_perinch_height,
270 this.screen, this.physical, this.brightness);
272 this.change_display = function change_display(display) {
273 this.dots_perinch_width.text('DOS PER INCH WIDTH: ' +
274 display.dotsPerInchWidth.toFixed(2));
275 this.dots_perinch_height.text('DOS PER INCH HEIGTH: ' +
276 display.dotsPerInchHeight.toFixed(2));
277 this.screen.text('SCREEN: WIDTH(' + display.resolutionWidth +
278 ') HEIGHT(' + display.resolutionHeight + ')');
279 this.physical.text('PHYSICAL: WIDTH(' + display.physicalWidth +
280 ') HEIGHT(' + display.physicalHeight + ')');
281 this.brightness.text('BRIGHTNESS: ' + display.brightness);
282 var physicalTotal = display.physicalWidth + display.physicalHeight;
283 var screenTotal = display.resolutionWidth + display.resolutionHeight;
284 $('#display_physical').width(500 * display.physicalWidth /
285 physicalTotal + 'px');
286 $('#display_physical').height(500 * display.physicalHeight /
287 physicalTotal + 'px');
288 $('#display_screen').width(380 * display.resolutionWidth /
290 $('#display_screen').height(380 * display.resolutionHeight /
292 $('#display_screen').css('opacity', display.brightness);
295 this.getInfo = function getInfo(DISPLAY) {
296 tizen.systeminfo.getPropertyValue(
299 DISPLAY.change_display(display);
302 tizen.systeminfo.addPropertyValueChangeListener(
305 DISPLAY.change_display(display);
310 function LocaleInfo() {
311 this.language = $('<p></p>').addClass('center');
312 this.country = $('<p></p>').addClass('center');
313 $('#locale').append(this.language, this.country);
315 this.getInfo = function getInfo(LOCALE) {
316 tizen.systeminfo.getPropertyValue(
319 LOCALE.language.text('LANGUAGE: ' + locale.language);
320 LOCALE.country.text('COUNTRY: ' + locale.country);
323 tizen.systeminfo.addPropertyValueChangeListener(
326 LOCALE.language.text('LANGUAGE: ' + locale.language);
327 LOCALE.country.text('COUNTRY: ' + locale.country);
332 function NetworkInfo() {
333 this.network_type = $('#network_type');
335 this.getInfo = function getInfo(NETWORK) {
336 tizen.systeminfo.getPropertyValue(
339 NETWORK.network_type.text('TYPE: ' + network.type);
342 tizen.systeminfo.addPropertyValueChangeListener(
345 NETWORK.network_type.text('TYPE: ' + network.type);
350 function PeripheralInfo() {
351 this.video_output = $('<p></p>');
352 $('#peripheral').append(this.video_output);
354 this.getInfo = function getInfo(PERIPHERAL) {
355 tizen.systeminfo.getPropertyValue(
357 function(peripheral) {
358 PERIPHERAL.video_output.text(peripheral.isVideoOutputOn ?
359 'VIDEOOUTPUT: ON' : 'VIDEOOUTPUT: OFF');
362 tizen.systeminfo.addPropertyValueChangeListener(
364 function(peripheral) {
365 PERIPHERAL.video_output.text(peripheral.isVideoOutputOn ?
366 'VIDEOOUTPUT: ON' : 'VIDEOOUTPUT: OFF');
372 this.state = $('<p></p>');
373 this.operator_name = $('<p></p>');
374 this.msisdn_iccid = $('<p></p>');
375 this.short_info = $('<p></p>');
376 this.msin_spn = $('<p></p>');
377 $('#sim_container').append(this.state, this.operator_name, this.msisdn_iccid,
378 this.short_info, this.msin_spn);
380 this.change_sim = function change_sim(sim) {
381 this.state.text('STATE: ' + sim.state);
382 this.operator_name.text('OPERATOR NAME: ' + sim.operatorName);
383 this.msisdn_iccid.text('MSISDN: ' + sim.msisdn + ' ' +
384 'ICCID: ' + sim.iccid);
385 this.short_info.text('MCC: ' + sim.mcc + ' ' +
387 this.msin_spn.text('MSIN: ' + sim.msin + ' ' +
391 this.getInfo = function getInfo(SIM) {
392 tizen.systeminfo.getPropertyValue(
398 tizen.systeminfo.addPropertyValueChangeListener(
406 function StorageInfo() {
407 this.draw_graph = function draw_graph(UNITS) {
408 $('#storage_container').empty();
409 for (var i = 0; i < UNITS.length; ++i) {
410 var unit = $('<div></div>').attr('id', 'unit' + i);
412 unit.height(85 / UNITS.length + '%');
413 unit.css('margin', '0 auto');
414 unit.css('padding', '10px');
415 $('#storage_container').css('position', 'relative');
416 $('#storage_container').append(unit);
417 var data1 = [0, UNITS[i].capacity - UNITS[i].availableCapacity];
418 var data2 = [0, UNITS[i].availableCapacity];
419 var containner = document.getElementById('unit' + i);
420 Flotr.draw(containner, [
421 {data: [data1], label: 'used'},
422 {data: [data2], label: 'available'}
425 title: 'TYPE:' + UNITS[i].type,
427 verticalLines: false,
428 horizontalLines: false,
431 xaxis: {showLabels: false},
432 yaxis: {showLabels: false},
437 mouse: {track: true},
440 backgroundColor: '#D2E8FF'
446 this.getInfo = function getInfo(STORAGE) {
447 tizen.systeminfo.getPropertyValue(
450 STORAGE.draw_graph(storage.units);
453 tizen.systeminfo.addPropertyValueChangeListener(
456 STORAGE.draw_graph(storage.units);
461 function WifiNetworkInfo() {
462 this.status = $('<p></p>').text('WIFI IS OFF!');
463 this.ssid = $('<p></p>');
464 this.ip_address = $('<p></p>');
465 this.ipv6_address = $('<p></p>');
466 this.signal_strength = $('<p></p>');
467 $('#wifi_network_info').append(this.status, this.ssid, this.ip_address,
468 this.ipv6_address, this.signal_strength);
470 this.change_wifi = function change_wifi(wifi) {
471 if (wifi.status == 'ON') {
472 this.status.text('WIFI: ' + wifi.status);
473 this.ssid.text('WIFI SSID: ' + wifi.ssid);
474 this.ip_address.text('WIFI IP ADDRESS: ' + wifi.ipAddress);
475 this.ipv6_address.text('WIFI IPV6 ADDRESS: ' + wifi.ipv6Address);
476 this.signal_strength.text('WIFI SIGNAL STRENGTH: ' +
477 wifi.signalStrength);
479 this.status.text('WIFI IS OFF!');
483 this.getInfo = function getInfo(WIFI) {
484 tizen.systeminfo.getPropertyValue(
487 WIFI.change_wifi(wifi);
490 tizen.systeminfo.addPropertyValueChangeListener(
493 WIFI.change_wifi(wifi);