[TCSACR-87][Information] Modify guide in accordance with refactored API 14/150414/3
authorKichan Kwon <k_c.kwon@samsung.com>
Fri, 15 Sep 2017 11:03:03 +0000 (20:03 +0900)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Mon, 18 Sep 2017 05:59:46 +0000 (08:59 +0300)
PS2: Reviewed

Change-Id: Icfffd7e325384ed6973d4ffb6eb197dad67b3641
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
org.tizen.guides/html/dotnet/information.htm

index 64d89a7..9a0d069 100644 (file)
        <script type="text/javascript" src="../scripts/core.js" charset="utf-8"></script>
        <script type="text/javascript" src="../scripts/search.js" charset="utf-8"></script>
 
-<title>System and Runtime Information</title>
+<title>System Information</title>
 
 </head>
 
-<!-- Start guide -->
-
 <body onload="prettyPrint()" style="overflow: auto;">
 
 <div id="toc-navigation">
                <p class="toc-title">Content</p>
                        <ul class="toc">
                                <li><a href="#prerequisites">Prerequisites</a></li>
-                               <li><a href="#scenario_1">Retrieving Static Information</a></li>
-                               <li><a href="#scenario_2">Checking the Current System Status</a></li>
-                               <li><a href="#scenario_3">Monitoring Runtime Changes</a></li>
+                               <li><a href="#information">Retrieving System Information</a></li>
+                               <li><a href="#usage">Retrieving Resource Usage Details</a></li>
+                               <li><a href="#callback">Monitoring Runtime Changes</a></li>
+                               <li><a href="#runtimefeaturekey">Feature Keys</a></li>
                        </ul>
-               <p></p>
 
                <p class="toc-title">Related Info</p>
                <ul class="toc">
-                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemInfo.html">Tizen.System.SystemInfo Class</a></li>
-                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1RuntimeInformation.html">Tizen.System.RuntimeInformation Class</a></li>
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Information.html">Tizen.System.Information Class</a></li>
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1ProcessCpuUsage.html">Tizen.System.ProcessCpuUsage Class</a></li>
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1ProcessMemoryUsage.html">Tizen.System.ProcessMemoryUsage Class</a></li>
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemCpuUsage.html">Tizen.System.SystemCpuUsage Class</a></li>
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemMemoryUsage.html">Tizen.System.SystemMemoryUsage Class</a></li>
                </ul>
        </div></div>
 </div>
 
 <div id="container"><div id="contents"><div class="content">
 
-<h1>System and Runtime Information</h1>
+<h1>System Information</h1>
 
 <p>You can access various information about your device system and its runtime status.</p>
 
-<p>The main features of the <code>Tizen.System.SystemInfo</code> and <code>Tizen.System.RuntimeInformation</code> classes include:</p>
+<p>The main system information features include:</p>
 <ul>
-       <li>Retrieving static information
-               <p>You can <a href="#scenario_1">access general system information</a>, such as platform features or device capabilities, using the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemInfo.html">Tizen.System.SystemInfo</a> class.</p></li>
-       <li>Checking the current system status
-               <p>You can <a href="#scenario_2">retrieve information about various statuses</a> that can change at runtime, using the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1RuntimeInformation.html">Tizen.System.RuntimeInformation</a> class.</p></li>
+       <li>Retrieving system information
+       <p>You can <a href="#information">access system information</a>, such as platform features or device capabilities, using the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Information.html">Tizen.System.Information</a> class.</p>
+       </li>
+       <li>Retrieving resource usage details
+       <p>You can <a href="#usage">retrieve the resource usage details</a> of the device or a particular process by using the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1ProcessCpuUsage.html">Tizen.System.ProcessCpuUsage</a>, <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1ProcessMemoryUsage.html">Tizen.System.ProcessMemoryUsage</a>, <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemCpuUsage.html">Tizen.System.SystemCpuUsage</a>, and <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemMemoryUsage.html">Tizen.System.SystemMemoryUsage</a> classes.</p>
+       </li>
        <li>Monitoring runtime changes
-               <p>You can register a callback with the <code>Tizen.System.RuntimeInformation</code> class to <a href="#scenario_3">receive notifications</a> when a specific feature changes at runtime.</p></li>
+       <p>You can register a callback with the <code>Tizen.System.Information</code> class to <a href="#callback">receive notifications</a> when a specific feature changes at runtime.</p>
+       </li>
 </ul>
+<p>System information features are classified as either static features, which are device features whose value does not change, or runtime features, whose value can change according to, for example, what peripherals are currently connected to the device. The features are identified using <a href="#runtimefeaturekey">feature keys</a>.</p>
 
 <h2 id="prerequisites">Prerequisites</h2>
-<p>To access per-process resource information (to use the <code>GetProcessCpuUsage()</code> and <code>GetProcessMemoryInformation()</code> methods of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1RuntimeInformation.html">Tizen.System.RuntimeInformation</a> class), the application has to request permission by adding the following privileges to the <code>tizen-manifest.xml</code> file:</p>
+<p>To use the system information features in your application:</p>
+<ol>
+       <li>To access per-process resource information (to use the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1ProcessCpuUsage.html">Tizen.System.ProcessCpuUsage</a> and <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1ProcessMemoryUsage.html">Tizen.System.ProcessMemoryUsage</a> classes), the application has to request permission by adding the following privilege to the <code>tizen-manifest.xml</code> file:
 <pre class="prettyprint">
 &lt;privileges&gt;
    &lt;privilege&gt;http://tizen.org/privilege/systemmonitor&lt;/privilege&gt;
 &lt;/privileges&gt;
 </pre>
+       </li>
+       <li>To use the methods and properties of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Information.html">Tizen.System.Information</a>, <code>Tizen.System.ProcessCpuUsage</code>, <code>Tizen.System.ProcessMemoryUsage</code>, <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemCpuUsage.html">Tizen.System.SystemCpuUsage</a>, and <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemMemoryUsage.html">Tizen.System.SystemMemoryUsage</a> classes, include the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1System.html">Tizen.System</a> namespace in your application:
+<pre class="prettyprint">
+using Tizen.System;
+</pre>
+       </li>
+</ol>
 
-<h2 id="scenario_1" name="scenario_1">Retrieving Static Information</h2>
-<p>You can access static system information by using the <code>TryGetValue()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemInfo.html">Tizen.System.SystemInfo</a> class. To define the feature you want to access, use a <a href="https://developer.tizen.org/development/guides/native-application/device-settings-and-systems/system-information#feature">system information key</a> as a parameter.</p>
+<h2 id="information">Retrieving System Information</h2>
 
-<p>To access the device name and check whether the device has a battery:</p>
+<p>To retrieve system information, use the <code>TryGetValue()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Information.html">Tizen.System.Information</a> class:</p>
 
 <ul>
-<li>Retrieve the device name:
+<li>To retrieve a static feature:
 <pre class="prettyprint">
-public static string get_device_name()
+/// Check whether the device has a battery
+public static bool is_battery_powered_device()
 {
-    const string DEVICE_NAME_KEY = "http://tizen.org/system/model_name";
-    string ret;
-
-    if (SystemInfo.Is&lt;string&gt;(DEVICE_NAME_KEY) == false || SystemInfo.IsValidKey(DEVICE_NAME_KEY) == false)
-    {
-        /// Error handling
-    }
+    bool ret;
 
-    if (SystemInfo.TryGetValue&lt;string&gt;(DEVICE_NAME_KEY, out ret) == false)
+    if (Tizen.System.Information.TryGetValue&lt;bool&gt;("http://tizen.org/feature/battery", out ret) == false)
     {
         /// Error handling
     }
@@ -96,19 +104,14 @@ public static string get_device_name()
 </pre>
 </li>
 
-<li>Check whether the device has a battery:
+<li>To retrieve the current value of a runtime feature:
 <pre class="prettyprint">
-public static bool is_battery_powered_device()
+/// Check whether the battery is charging
+public static bool is_charging()
 {
-    const string BATTERY_FEATURE_KEY = "http://tizen.org/feature/battery";
     bool ret;
 
-    if (SystemInfo.Is&lt;bool&gt;(BATTERY_FEATURE_KEY) == false || SystemInfo.IsValidKey(BATTERY_FEATURE_KEY) == false)
-    {
-        /// Error handling
-    }
-
-    if (SystemInfo.TryGetValue&lt;bool&gt;(BATTERY_FEATURE_KEY, out ret) == false)
+    if (Tizen.System.Information.TryGetValue&lt;bool&gt;("http://tizen.org/runtimefeature/battery.charging", out ret) == false)
     {
         /// Error handling
     }
@@ -119,87 +122,155 @@ public static bool is_battery_powered_device()
 </li>
 </ul>
 
+<h2 id="usage">Retrieving Resource Usage Details</h2>
+<p>To get resource usage details, use the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1ProcessCpuUsage.html">Tizen.System.ProcessCpuUsage</a>, <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1ProcessMemoryUsage.html">Tizen.System.ProcessMemoryUsage</a>, <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemCpuUsage.html">Tizen.System.SystemCpuUsage</a>, and <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1SystemMemoryUsage.html">Tizen.System.SystemMemoryUsage</a> classes. Since these classes collect information during their construction, you can simply make a new instance to access the resource usage details.</p>
 
-<h2 id="scenario_2" name="scenario_2">Checking the Current System Status</h2>
-<p>To check the current system status using the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1RuntimeInformation.html">Tizen.System.RuntimeInformation</a> class:</p>
 <ul>
-<li>You can use the <code>GetStatus()</code> method of the <code>Tizen.System.RuntimeInformation</code> class. To define the feature you want to check, use the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1System.html#aea067ac0fc8151767f11c25d45b422ac">Tizen.System.RuntimeInformationKey</a> enumeration as a parameter.
-<p>To check whether the battery is charging:</p>
+<li>To retrieve system memory usage details:
 <pre class="prettyprint">
-public static bool is_charging()
+public static int get_total_memory_size(void)
 {
-    bool ret = false;
+    Tizen.System.SystemMemoryUsage usage = new Tizen.System.SystemMemoryUsage();
 
-    try
-    {
-        if (RuntimeInformation.Is&lt;bool&gt;(RuntimeInformationKey.BatteryIsCharging) == false)
-        {
-            /// Error handling
-        }
-
-        ret = RuntimeInformation.GetStatus&lt;bool&gt;(RuntimeInformationKey.BatteryIsCharging);
-    }
-    catch (Exception e)
-    {
-        /// Error handling
-    }
-
-    return ret;
+    return usage.Total;
 }
 </pre>
 </li>
 
-<li>You can also use a stand-alone method of the <code>Tizen.System.RuntimeInformation</code> class, such as <code>GetCpuUsage()</code>.
-<p>To check the percentage of time used to run kernel processes:</p>
+<li>To retrieve CPU usage details of a process:
 <pre class="prettyprint">
-public static double get_system_mode_ratio()
+public static void print_family_cpu_usage(Familyinfo family)
 {
-    double ret = -1;
+    IList&lt;int&gt; processList;
+    Tizen.System.ProcessCpuUsage usage;
 
-    try
-    {
-        CpuUsage usage = RuntimeInformation.GetCpuUsage();
-        ret = usage.System;
-    }
-    catch (Exception e)
-    {
-        /// Error handling
-    }
+    processList = new List&lt;int&gt;();
+    processList.Add(family.me.pid);
+    processList.Add(family.father.pid);
 
-    return ret;
+    usage = new Tizen.System.ProcessCpuUsage(processList);
+
+    Tizen.Log.Info("MY_HOUSE", "My CPU UTime = " + usage.GetUTime(family.me.pid));
+    Tizen.Log.Info("MY_HOUSE", "Father's CPU STime = " + usage.GetSTime(family.father.pid));
 }
 </pre>
 </li>
 </ul>
 
+<h2 id="callback">Monitoring Runtime Changes</h2>
+<p>You can monitor the changes in the runtime feature key values by registering event handlers for the corresponding events.</p>
 
-<h2 id="scenario_3" name="scenario_3">Monitoring Runtime Changes</h2>
-<p>You can monitor various runtime events by registering a callback for them.</p>
-<p>To monitor when an audio jack is attached to the device, to allow you to turn down the volume to safe levels:</p>
+<p>For example, to monitor whether an audio jack is connected, and to turn the device volume to safe levels when it is:</p>
 
 <pre class="prettyprint">
-public static void TurnDownTheVolumeCallback(object sender, RuntimeKeyStatusChangedEventArgs args)
+private const string RuntimeFeatureAudiojackConnected = "http://tizen.org/runtimefeature/audiojack.connected";
+
+/// Event handler for the audio jack connection event
+public static void TurnDownTheVolumeCallback(object sender, RuntimeFeatureStatusChangedEventArgs args)
 {
-    if (MySpeaker.GetVolume() > 10)
+    if (MySpeaker.GetVolume() &gt; 10)
     {
         MySpeaker.SetVolume(10);
     }
 }
 
-/// To begin monitoring, register the callback for the AudioJackConnectorChanged event
+/// To begin monitoring, register the event handler for the audiojack.connected event
 public static void init()
 {
-    RuntimeInformation.AudioJackConnectorChanged += TurnDownTheVolumeCallback;
+    Tizen.System.Information.SetCallback(RuntimeFeatureAudiojackConnected, TurnDownTheVolumeCallback);
 }
 
-/// When monitoring is no longer needed, deregister the callback
+/// When monitoring is no longer needed, deregister the event handler
 public static void deinit()
 {
-    RuntimeInformation.AudioJackConnectorChanged -= TurnDownTheVolumeCallback;
+    Tizen.System.Information.UnsetCallback(RuntimeFeatureAudiojackConnected, TurnDownTheVolumeCallback);
 }
 </pre>
-<p>For a list of events that you can monitor, see the<a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1RuntimeInformation.html#properties">Tizen.System.RuntimeInformation class properties</a>.</p>
 
+<h2 id="runtimefeaturekey">Feature Keys</h2>
+
+<p>The static feature keys are identical to the ones used in Tizen native applications. For more information, see the native <a href="../native/device/system_n.htm#feature">System Information</a> guide.</p>
+<p>The runtime feature keys have the <code>runtimefeature</code> prefix. The available runtime feature keys are listed in the following table.</p>
+<p align="center" class="Table"><strong>Table: Runtime feature keys</strong></p>
+<table border="1">
+<tbody>
+<tr>
+<th>Key</th>
+<th>Type</th>
+<th>Description</th>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/audiojack.connected</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether an audio jack is connected.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/audiojack.type</code></td>
+<td><code>int</code></td>
+<td>Indicates the audio jack connector type. For available values, see the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1System.html#a16a32d6f691a6b0476d920b9315e330f">Tizen.System.AudioJackConnectionType</a> enumeration.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/autorotation</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether auto-rotation is enabled.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/battery.charging</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether the battery is currently charging.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/bluetooth</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether Bluetooth is enabled.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/charger</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether a charger is connected.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/dataroaming</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether data roaming is enabled.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/gps</code></td>
+<td><code>int</code></td>
+<td>Indicates the current GPS status. For available values, see the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1System.html#acf0295afa5e628185c6c1dc23b4e4d02">Tizen.System.GpsStatus</a> enumeration.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/packetdata</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether packet data is enabled through the 3G network.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/tethering.bluetooth</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether Bluetooth tethering is enabled.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/tethering.usb</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether USB tethering is enabled.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/tethering.wifi</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether a Wi-Fi hotspot is enabled.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/tvout</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether the TV out is connected.</td>
+</tr>
+<tr>
+<td><code>http://tizen.org/runtimefeature/vibration</code></td>
+<td><code>bool</code></td>
+<td>Indicates whether vibration is enabled.</td>
+</tr>
+</tbody>
+</table>
 
 <script type="text/javascript" src="../scripts/jquery.zclip.min.js"></script>
 <script type="text/javascript" src="../scripts/showhide.js"></script>