×
Namespaces

Variants
Actions
(Difference between revisions)

Blinking flashing increasing brightness of backlight in WRT

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update)
Line 1: Line 1:
__NOTOC__
 
__NOEDITSECTION__
 
  
{{KBCS}}
+
{{ArticleMetaData <!-- v1.2 -->
{{ArticleMetaData
+
|sourcecode= [[Media:Blinking flashing increasing brightness of backlight in WRT.zip]]  
|id=CS001248;
+
|platform=S60 3rd Edition, FP2, S60 5th Edition
+
|devices=Nokia E90 Communicator (v.210.34.75 and later), Nokia 5800 XpressMusic
+
|category=Web Runtime (WRT)
+
|subcategory=Hardware
+
|creationdate=November 24, 2008
+
|keywords=x-systeminfo-widget, SystemInfo.lightblink(), SystemInfo.lighton()
+
 
+
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
+
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
+
|devices= Nokia E90 Communicator (v.210.34.75 and later), Nokia 5800 XpressMusic
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
+
|platform= S60 3rd Edition, FP2, S60 5th Edition
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices. -->)
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|author=[[User:Dekuykin]]
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= x-systeminfo-widget, SystemInfo.lightblink(), SystemInfo.lighton()
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20081210
 +
|author= [[User:Dekuykin]]
 +
<!-- The following are not in current metadata -->
 +
|subcategory= Hardware
 +
|id= CS001248;
 
}}
 
}}
  
Line 122: Line 127:
 
==Supplementary material==
 
==Supplementary material==
  
For a complete example that makes use of the SystemInfo Service API to control the backlight, see [[Media:Blinking_flashing_increasing_brightness_of_backlight_in_WRT.zip|Blinking_flashing_increasing_brightness_of_backlight_in_WRT.zip]]
+
For a complete example that makes use of the SystemInfo Service API to control the backlight, see [[Media:Blinking flashing increasing brightness of backlight in WRT.zip|Blinking flashing increasing brightness of backlight in WRT.zip]]
  
[[Category:Symbian Web Runtime]][[Category:Code Examples]][[Category:Hardware]][[Category:S60 3rd Edition FP1]][[Category:S60 3rd Edition FP2]][[Category:S60 5th Edition]][[Category:Code Snippet]]
+
[[Category:Symbian Web Runtime]][[Category:Code Examples]][[Category:Hardware]][[Category:S60 3rd Edition FP1]][[Category:S60 3rd Edition FP2]][[Category:S60 5th Edition (initial release)]][[Category:Code Snippet]]

Revision as of 09:21, 10 May 2012

Article Metadata
Code ExampleTested with
Devices(s): Nokia E90 Communicator (v.210.34.75 and later), Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition, FP2, S60 5th Edition
S60 5th Edition
S60 3rd Edition FP2
S60 3rd Edition FP1
Article
Keywords: x-systeminfo-widget, SystemInfo.lightblink(), SystemInfo.lighton()
Created: dekuykin (10 Dec 2008)
Last edited: hamishwillee (10 May 2012)

Contents

Overview

This code snippet demonstrates how to control the backlight of a device by using the SystemInfo Service API of the Web Runtime version 1.0.

The API is supported from S60 3rd Edition, Feature Pack 2 onwards. It is also supported in select S60 3rd Edition, Feature Pack 1 devices or their newest firmware versions (for example, Nokia E90 Communicator, from v.210.34.75 onwards).

Source

Embed the SystemInfo widget into the document:

<body>
<embed type="application/x-systeminfo-widget" hidden="yes" />
</body>

Add three buttons to control the backlight:

<input type="button" onclick="lightOn();" value="Light on" />
<input type="button" onclick="blink();" value="Blink" />
<input type="button" onclick="lightOff();" value="Light off" />

The JavaScript code:

var sysInfo = null;
 
window.onload = init;
 
var SMOOTH = true;
 
function init() {
// Obtain the SystemInfo object
try {
sysInfo = document.embeds[0];
} catch (ex) {
alert("SystemInfo object cannot be found.");
return;
}
}
 
// Switches the display light on
function lightOn() {
if (sysInfo == undefined) {
alert("SystemInfo object is undefined.");
return;
}
 
// Reset the backlight state to default
resetLight();
 
sysInfo.lighton(sysInfo.lighttargetsystem, sysInfo.lightinfiniteduration,
sysInfo.lightmaxintensity, SMOOTH);
}
 
// Starts blinking the display
function blink() {
if (sysInfo == undefined) {
alert("SystemInfo object is undefined.");
return;
}
 
// Reset the backlight state to default
resetLight();
 
sysInfo.lightblink(sysInfo.lighttargetsystem,
sysInfo.lightinfiniteduration, sysInfo.lightdefaultcycletime,
sysInfo.lightdefaultcycletime, sysInfo.lightmaxintensity);
}
 
// Switches the display light off
function lightOff() {
if (sysInfo == undefined) {
alert("SystemInfo object is undefined.");
return;
}
 
sysInfo.lightoff(sysInfo.lighttargetsystem, sysInfo.lightinfiniteduration,
SMOOTH);
}
 
// Sets the backlight of the display to default value
function resetLight() {
if (sysInfo == undefined) {
alert("SystemInfo object is undefined.");
return;
}
 
sysInfo.lighton(sysInfo.lighttargetsystem, sysInfo.lightinfiniteduration,
sysInfo.lightdefaultintensity, SMOOTH);
}

Postconditions

Different possibilities to control the backlight are demonstrated.

Supplementary material

For a complete example that makes use of the SystemInfo Service API to control the backlight, see Blinking flashing increasing brightness of backlight in WRT.zip

170 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×