org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-E0ED671A-BBDA-4C07-828F-BD35782D9B36.html
changeset 229 716254ccbcc0
equal deleted inserted replaced
228:913c9751c067 229:716254ccbcc0
       
     1 
       
     2 <!DOCTYPE html
       
     3   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
     4 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="copyright" content="(C) Copyright 2009"/><meta name="DC.rights.owner" content="(C) Copyright 2009"/><meta name="DC.Type" content="mobileconcept"/><meta name="DC.Title" content="Accessing and modifying system information"/><meta name="DC.Relation" scheme="URI" content="GUID-E9A578AA-58C5-4902-B418-4CE44EA40D5D"/><meta name="DC.Relation" scheme="URI" content="GUID-6FBE64B7-0949-4AAE-B835-52B276540A59"/><meta name="DC.Relation" scheme="URI" content="GUID-1EFD7043-E9B8-4B4E-9EA6-A20B3EECC14A"/><meta name="DC.Relation" scheme="URI" content="GUID-46EABDC1-37CB-412A-ACAD-1A1A9466BB68"/><meta name="DC.Format" content="XHTML"/><meta name="DC.Identifier" content="GUID-E0ED671A-BBDA-4C07-828F-BD35782D9B36"/><title>Accessing
       
     5 and modifying system information </title><script type="text/javascript">
       
     6       function initPage() {}
       
     7     </script><link href="../PRODUCT_PLUGIN/book.css" rel="stylesheet" type="text/css"/><link href="css/s60/style.css" rel="stylesheet" type="text/css" media="all"/></head><body onload="initPage();"><div class="body"><div class="contentLeft prTxt"><h1 class="pageHeading" id="GUID-E0ED671A-BBDA-4C07-828F-BD35782D9B36">Accessing
       
     8 and modifying system information</h1><div>
       
     9 <p>The <a href="GUID-AEB26A58-1DE2-46CB-81EC-6DB3A477B7A3.html#GUID-AEB26A58-1DE2-46CB-81EC-6DB3A477B7A3">SystemInfo
       
    10 Service API<span> of WRT 1.1</span></a> allows <span>widgets</span> to
       
    11 access and modify system information on a device. System information is represented
       
    12 as a set of system attributes. You can use the SystemInfo Service to create <span>widgets</span> that:</p>
       
    13 <ul>
       
    14 <li><p>Read and modify system attribute values</p></li>
       
    15 <li><p>Notify the user when system attribute values change</p>
       
    16 </li>
       
    17 </ul>
       
    18 <p>The system attributes are grouped into the following categories:</p>
       
    19 <ul>
       
    20 <li><p>Battery</p></li>
       
    21 <li><p>Connectivity</p></li>
       
    22 <li><p>Device</p></li>
       
    23 <li><p>Display</p></li>
       
    24 <li><p>Features</p></li>
       
    25 <li><p>General</p></li>
       
    26 <li><p>Memory</p></li>
       
    27 <li><p>Network</p></li>
       
    28 </ul>
       
    29 <p>Only a few system attributes are modifiable and support change notifications.
       
    30 For more information about system attributes, see section <a href="GUID-B796D072-4E51-4BC7-9259-84530DB3539D.html#GUID-B796D072-4E51-4BC7-9259-84530DB3539D">System attributes</a></p>
       
    31 <div><h3>Accessing the API and supported methods</h3>
       
    32 <p>To create a <a href="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html#GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080">service
       
    33 object</a> for the SystemInfo Service API, use <code>Service.SysInfo</code> to
       
    34 identify the service provider and <code>ISysInfo</code> to identify
       
    35 the supported interface:</p>
       
    36 
       
    37 <pre class="codeblock" id="GUID-9F7EE91E-7245-44A9-BFAE-BF043CA4E67D-GENIDd0e9114">var so = device.getServiceObject("Service.SysInfo", "ISysInfo");</pre>
       
    38 <p>The <code>ISysInfo</code> interface provides the following methods:</p>
       
    39 <ul>
       
    40 <li><p><a href="GUID-279A3698-D09B-44BF-8340-739E19F94727.html#GUID-279A3698-D09B-44BF-8340-739E19F94727"><code>GetInfo()</code></a></p>
       
    41 
       
    42 <p>Use the <code>GetInfo()</code> method to retrieve information
       
    43 about a system attribute.</p>
       
    44 
       
    45 </li>
       
    46 <li><p><a href="GUID-4347A7F1-1560-4B28-B4A8-DC570864F505.html#GUID-4347A7F1-1560-4B28-B4A8-DC570864F505"><code>SetInfo()</code></a></p>
       
    47 
       
    48 <p>Use the <code>SetInfo()</code> method to modify the value of
       
    49 a system attribute.</p>
       
    50 
       
    51 </li>
       
    52 <li><p><a href="GUID-7978FAFD-5BAC-45FD-9C44-5CF7BC484A1E.html#GUID-7978FAFD-5BAC-45FD-9C44-5CF7BC484A1E"><code>GetNotification()</code></a></p>
       
    53 
       
    54 <p>Use the <code>GetNotification()</code> method to receive a notification
       
    55 when the value of a system attribute is changed.</p>
       
    56 
       
    57 </li>
       
    58 <li><p><a href="GUID-BF044B8D-C16A-47DC-84F3-9103D9DCE09B.html#GUID-BF044B8D-C16A-47DC-84F3-9103D9DCE09B"><code>Cancel()</code></a></p>
       
    59 
       
    60 <p>Use the <code>Cancel()</code> method to cancel an ongoing asynchronous
       
    61 call. This method is valid for any asynchronous call made through the SystemInfo
       
    62 Service API.</p>
       
    63 
       
    64 </li>
       
    65 </ul>
       
    66 </div>
       
    67 <div><h3>Using the service in a widget</h3>
       
    68 <p>To access and modify system information using the SystemInfo Service
       
    69 API:</p>
       
    70 <ol>
       
    71 <li id="GUID-E8ECDB2F-00C4-488F-A253-87FABDA66CA6-GENIDd0e9200"><a name="GUID-E8ECDB2F-00C4-488F-A253-87FABDA66CA6-GENIDd0e9200"><!----></a><p>Create a service
       
    72 object for the API using <a href="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html#GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080"><code>device.getServiceObject()</code></a>.</p>
       
    73 </li>
       
    74 <li id="GUID-0625B45D-A5C9-4ADA-BC21-07963F957A7C-GENIDd0e9209"><a name="GUID-0625B45D-A5C9-4ADA-BC21-07963F957A7C-GENIDd0e9209"><!----></a><p>Define the
       
    75 tasks you want to perform and choose the correct methods for them.</p>
       
    76 </li>
       
    77 <li id="GUID-DBD9997B-CD51-45F9-9ED0-38A98AF08A12-GENIDd0e9214"><a name="GUID-DBD9997B-CD51-45F9-9ED0-38A98AF08A12-GENIDd0e9214"><!----></a><p>Optionally,
       
    78 define how you want the results filtered.</p></li>
       
    79 <li id="GUID-AAB5C193-F848-4B0A-AF03-6BA7425BD10B-GENIDd0e9218"><a name="GUID-AAB5C193-F848-4B0A-AF03-6BA7425BD10B-GENIDd0e9218"><!----></a><p>Define methods
       
    80 to process the results.</p></li>
       
    81 <li id="GUID-F0C3D20F-6F77-4C88-AF35-39DA70DE701B-GENIDd0e9222"><a name="GUID-F0C3D20F-6F77-4C88-AF35-39DA70DE701B-GENIDd0e9222"><!----></a><p>Retrieve the
       
    82 results using the methods from step 2. Use asynchronous methods together with <a href="GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608.html#GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608"><code>callback()</code></a>.</p>
       
    83 </li>
       
    84 <li id="GUID-0ABE0CB0-D76C-444B-AE53-0D435B3C6E74-GENIDd0e9231"><a name="GUID-0ABE0CB0-D76C-444B-AE53-0D435B3C6E74-GENIDd0e9231"><!----></a><p>Process the
       
    85 results using the methods defined in step 4.</p></li>
       
    86 </ol>
       
    87 <p>For the complete source of a sample widget that demonstrates how to
       
    88 use this service, see <a href="GUID-7C9CCFF3-A6E0-4593-8315-1A0EAAFD05AF.html#GUID-7C9CCFF3-A6E0-4593-8315-1A0EAAFD05AF">the
       
    89 full example</a>.</p>
       
    90 </div>
       
    91 </div></div></div><div class="footer"><hr/><div class="copy">© Nokia 2009.</div></div></body></html>