×
Namespaces

Variants
Actions
(Difference between revisions)

Setting Vibration in WRT

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot change of template (Template:CodeSnippet) - now using Template:ArticleMetaData)
hamishwillee (Talk | contribs)
m (Hamishwillee - Fix categories. Add Abstract)
 
Line 1: Line 1:
__NOTOC__
+
[[Category:Symbian Web Runtime]][[Category:Code Examples]][[Category:S60 5th Edition]][[Category:Base/System]][[Category:UI]]
__NOEDITSECTION__
+
{{Abstract|This code snippet demonstrates how to set Vibration in a device by using the SystemInfo Service API of the Web Runtime (WRT) 1.1. }}
 
{{ArticleMetaData
 
{{ArticleMetaData
|id=
 
 
|platform=S60 5th Edition
 
|platform=S60 5th Edition
 
|devices=Nokia 5800 XpressMusic
 
|devices=Nokia 5800 XpressMusic
 
|category=Web Runtime (WRT)
 
|category=Web Runtime (WRT)
 
|subcategory=System information
 
|subcategory=System information
|creationdate=December 25, 2008
+
|creationdate=20081225
 
|keywords=device.getServiceObject(), Service.SysInfo, Service.SysInfo.SetInfo()
 
|keywords=device.getServiceObject(), Service.SysInfo, Service.SysInfo.SetInfo()
 
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|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]]) -->
Line 15: Line 13:
 
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices. -->)
+
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices. -->
 
|author=[[User:Kiran10182]]
 
|author=[[User:Kiran10182]]
 
}}
 
}}
  
==Overview==
+
{{Note|The SystemInfo Service API for WRT 1.1 is only available from S60 5th Edition onwards. }}
 
+
This code snippet demonstrates how to set Vibration in a device by using the SystemInfo Service API of the Web Runtime (WRT) 1.1.
+
 
+
'''Note''': The SystemInfo Service API for WRT 1.1 is only available from S60 5th Edition onwards.  
+
  
 
==Source file: index.html ==
 
==Source file: index.html ==
Line 86: Line 80:
  
 
==Supplementary material==
 
==Supplementary material==
 
 
[[Category:Symbian Web Runtime]][[Category:Code Examples]][[Category:How To]][[Category:S60 5th Edition]]
 

Latest revision as of 08:33, 10 October 2012

This code snippet demonstrates how to set Vibration in a device by using the SystemInfo Service API of the Web Runtime (WRT) 1.1.

Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 5th Edition
S60 5th Edition
Article
Keywords: device.getServiceObject(), Service.SysInfo, Service.SysInfo.SetInfo()
Created: kiran10182 (25 Dec 2008)
Last edited: hamishwillee (10 Oct 2012)

Note.pngNote: The SystemInfo Service API for WRT 1.1 is only available from S60 5th Edition onwards.

Contents

[edit] Source file: index.html

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="basic.js"></script>
<script type="text/javascript" src="WRTKit/WRTKit.js"></script>
<style type="text/css">
@import url("basic.css");
</style>
</head>
<body onload="init()">
</body>
</html>

[edit] Source file: basic.js

var systemServiceObj = null;
 
// Called from the onload event handler to initialize the widget.
function init()
{
try
{
systemServiceObj = device.getServiceObject("Service.SysInfo", "ISysInfo");
}
catch (ex)
{
alert("System Service object cannot be found.");
return;
}
setVibraActive();
}
 
// General Information
function setVibraActive()
{
var on = {Status:1};
 
var setParameters = {Entity:"General", Key:"VibraActive", SystemData:on};
try {
var result = systemServiceObj.ISysInfo.SetInfo(setParameters);
}
catch (ex)
{
alert(ex);
return;
}
alert("Vibrator is set to on");
}

[edit] Postconditions

  • Sets Vibration on in the device.

[edit] Supplementary material

This page was last modified on 10 October 2012, at 08:33.
50 page views in the last 30 days.