Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 11:22, 6 May 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Checking availability of Bluetooth feature in WRT

From Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 5th Edition
S60 5th Edition
Platform Security
Capabilities: )
Article
Keywords: device.getServiceObject(), Service.SysInfo, Service.SysInfo.GetInfo()
Created: kiran10182 (25 Dec 2008)
Last edited: hamishwillee (06 May 2013)

Contents

Overview

This code snippet checks whether Bluetooth feature is available 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

<?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>

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;
}
isBluetoothAvailable();
}
 
// Feature Information
function isBluetoothAvailable()
{
// Initialize the criteria for the service object and obtain the
// information
var criteria = new Object();
criteria.Entity = "Features";
criteria.Key = "BlueTooth";
try {
var result = systemServiceObj.ISysInfo.GetInfo(criteria);
}
catch (ex)
{
alert(ex);
return;
}
 
if(result.ReturnValue.Status)
alert("Bluetooth is available");
else
alert("Bluetooth is not available");
}

Postconditions

  • Displays whether Bluetooth feature is available or not in the device.

Supplementary material

This page was last modified on 6 May 2013, at 11:22.
38 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.

×