[Information] Make a common class for integrating key-value functions 74/145474/15
authorKichan Kwon <k_c.kwon@samsung.com>
Tue, 22 Aug 2017 10:42:54 +0000 (19:42 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 13 Sep 2017 07:51:01 +0000 (16:51 +0900)
- You can get the runtime feature with using string key
  - http://tizen.org/runtimefeature/FEATURE_NAME
- Information class just checks whether this key is
  runtime feature or not and pass to the appropriate class
- For convenience, key and type check functions are
  embedded in the get function
  - Before run get function, these are automatically run

Change-Id: I0f1f6137afbb1f0409d16b433376b2d3de46b2c5
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/Tizen.System.Information/Common/Information.cs [new file with mode: 0755]
src/Tizen.System.Information/Interop/Interop.RuntimeInfo.cs
src/Tizen.System.Information/RuntimeInfo/Enumerations.cs
src/Tizen.System.Information/RuntimeInfo/RuntimeFeatureStatusChangedEventArgs.cs [moved from src/Tizen.System.Information/RuntimeInfo/RuntimeKeyStatusChangedEventArgs.cs with 69% similarity]
src/Tizen.System.Information/RuntimeInfo/RuntimeInfo.cs [moved from src/Tizen.System.Information/RuntimeInfo/RuntimeInformation.cs with 64% similarity]
src/Tizen.System.Information/RuntimeInfo/RuntimeInfoEventHandler.cs
src/Tizen.System.Information/RuntimeInfo/TvProductHelper.cs
src/Tizen.System.Information/SystemInfo/SystemInfo.cs
src/Tizen.System.Information/Usage/SystemCpuUsage.cs
src/Tizen.System.Information/Usage/SystemMemoryUsage.cs

diff --git a/src/Tizen.System.Information/Common/Information.cs b/src/Tizen.System.Information/Common/Information.cs
new file mode 100755 (executable)
index 0000000..5ec9dc0
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the License);
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an AS IS BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+
+namespace Tizen.System
+{
+    /// <summary>
+    /// The Information class provides functions to obtain various system information.
+    /// </summary>
+    public static class Information
+    {
+        internal const string HttpPrefix = "http://";
+        internal const string RuntimeInfoStringKeyPrefix = "tizen.org/runtimefeature/";
+
+        internal const string RuntimeInfoStringKeyBluetooth = "bluetooth";
+        internal const string RuntimeInfoStringKeyTetheringWiFi = "tethering.wifi";
+        internal const string RuntimeInfoStringKeyTetheringBluetooth = "tethering.bluetooth";
+        internal const string RuntimeInfoStringKeyTetheringUsb = "tethering.usb";
+        internal const string RuntimeInfoStringKeyPacketData = "packetdata";
+        internal const string RuntimeInfoStringKeyDataRoaming = "dataroaming";
+        internal const string RuntimeInfoStringKeyVibration = "vibration";
+        internal const string RuntimeInfoStringKeyAudioJackConnected = "audiojack.connected";
+        internal const string RuntimeInfoStringKeyBatteryCharging = "battery.charging";
+        internal const string RuntimeInfoStringKeyTvOut = "tvout";
+        internal const string RuntimeInfoStringKeyCharger = "charger";
+        internal const string RuntimeInfoStringKeyAutoRotation = "autorotation";
+        internal const string RuntimeInfoStringKeyGps = "gps";
+        internal const string RuntimeInfoStringKeyAudioJackType = "audiojack.type";
+
+
+        private static readonly Dictionary<string, RuntimeInfoKey> StringEnumMapping = new Dictionary<string, RuntimeInfoKey>
+        {
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyBluetooth] = RuntimeInfoKey.Bluetooth,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyTetheringWiFi] = RuntimeInfoKey.WifiHotspot,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyTetheringBluetooth] = RuntimeInfoKey.BluetoothTethering,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyTetheringUsb] = RuntimeInfoKey.UsbTethering,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyPacketData] = RuntimeInfoKey.PacketData,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyDataRoaming] = RuntimeInfoKey.DataRoaming,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyVibration] = RuntimeInfoKey.Vibration,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyAudioJackConnected] = RuntimeInfoKey.AudioJack,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyBatteryCharging] = RuntimeInfoKey.BatteryIsCharging,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyTvOut] = RuntimeInfoKey.TvOut,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyCharger] = RuntimeInfoKey.Charger,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyAutoRotation] = RuntimeInfoKey.AutoRotation,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyGps] = RuntimeInfoKey.Gps,
+            [RuntimeInfoStringKeyPrefix + RuntimeInfoStringKeyAudioJackType] = RuntimeInfoKey.AudioJackConnector
+        };
+
+        internal static readonly Dictionary<RuntimeInfoKey, string> EnumStringMapping = new Dictionary<RuntimeInfoKey, string>
+        {
+            [RuntimeInfoKey.Bluetooth] = RuntimeInfoStringKeyBluetooth,
+            [RuntimeInfoKey.WifiHotspot] = RuntimeInfoStringKeyTetheringWiFi,
+            [RuntimeInfoKey.BluetoothTethering] = RuntimeInfoStringKeyTetheringBluetooth,
+            [RuntimeInfoKey.UsbTethering] = RuntimeInfoStringKeyTetheringUsb,
+            [RuntimeInfoKey.PacketData] = RuntimeInfoStringKeyPacketData,
+            [RuntimeInfoKey.DataRoaming] = RuntimeInfoStringKeyDataRoaming,
+            [RuntimeInfoKey.Vibration] = RuntimeInfoStringKeyVibration,
+            [RuntimeInfoKey.AudioJack] = RuntimeInfoStringKeyAudioJackConnected,
+            [RuntimeInfoKey.BatteryIsCharging] = RuntimeInfoStringKeyBatteryCharging,
+            [RuntimeInfoKey.TvOut] = RuntimeInfoStringKeyTvOut,
+            [RuntimeInfoKey.Charger] = RuntimeInfoStringKeyCharger,
+            [RuntimeInfoKey.AutoRotation] = RuntimeInfoStringKeyAutoRotation,
+            [RuntimeInfoKey.Gps] = RuntimeInfoStringKeyGps,
+            [RuntimeInfoKey.AudioJackConnector] = RuntimeInfoStringKeyAudioJackType
+        };
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        private static bool ConvertStringToRuntimeInfoKey(string key, out RuntimeInfoKey feature)
+        {
+            string filteredKey = key.StartsWith(HttpPrefix) ? key.Substring(HttpPrefix.Length) : key;
+            feature = default(RuntimeInfoKey);
+
+            return StringEnumMapping.TryGetValue(filteredKey, out feature);
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        private static bool TryGetRuntimeInfoValue<T>(RuntimeInfoKey key, out T value)
+        {
+            value = default(T);
+
+            if (!RuntimeInfo.Is<T>(key))
+            {
+                Log.Error(InformationErrorFactory.LogTag, "Invalid return type");
+                return false;
+            }
+
+            return RuntimeInfo.TryGetValue<T>(key, out value);
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        private static bool TryGetSystemInfoValue<T>(string key, out T value)
+        {
+            value = default(T);
+
+            if (!SystemInfo.IsValidKey(key))
+            {
+                Log.Error(InformationErrorFactory.LogTag, "Invalid key");
+                return false;
+            }
+
+            if (!SystemInfo.Is<T>(key))
+            {
+                Log.Error(InformationErrorFactory.LogTag, "Invalid return type");
+                return false;
+            }
+
+            return SystemInfo.TryGetValue<T>(key, out value);
+        }
+
+        /// <summary>
+        /// Gets the value of the feature.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        /// <typeparam name="T">The type of <paramref name="value"/>.</typeparam>
+        /// <param name="key">The name of the feature.</param>
+        /// <param name="value">The value of the given feature.</param>
+        /// <returns>Returns true on success, otherwise false.</returns>
+        public static bool TryGetValue<T>(string key, out T value)
+        {
+            RuntimeInfoKey runtimeFeature;
+
+            if (ConvertStringToRuntimeInfoKey(key, out runtimeFeature))
+            {
+                return TryGetRuntimeInfoValue<T>(runtimeFeature, out value);
+            }
+            else
+            {
+                return TryGetSystemInfoValue<T>(key, out value);
+            }
+        }
+
+        /// <summary>
+        /// Registers a change event callback for given runtime feature key.
+        /// </summary>
+        /// <remarks>
+        /// This function is only for runtime feature.
+        /// </remarks>
+        /// <since_tizen> 4 </since_tizen>
+        /// <param name="key">The name of runtime feature which wants to register callback.</param>
+        /// <param name="callback">The callback function to subscribe.</param>
+        /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
+        /// <exception cref="NotSupportedException">Thrown when the feature related <paramref name="key"/> is not supported.</exception>
+        public static void SetCallback(string key, EventHandler<RuntimeFeatureStatusChangedEventArgs> callback)
+        {
+            RuntimeInfoKey runtimeFeature;
+
+            if (!ConvertStringToRuntimeInfoKey(key, out runtimeFeature))
+            {
+                Log.Error(InformationErrorFactory.LogTag, "Invalid key");
+                InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+            }
+
+            RuntimeInfo.SetCallback(runtimeFeature, callback);
+        }
+
+        /// <summary>
+        /// Unregisters a change event callback for given runtime feature key.
+        /// </summary>
+        /// <remarks>
+        /// This function is only for runtime feature.
+        /// </remarks>
+        /// <since_tizen> 4 </since_tizen>
+        /// <param name="key">The name of runtime feature which wants to unregister callback.</param>
+        /// <param name="callback">The callback function to unsubscribe.</param>
+        /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
+        /// <exception cref="NotSupportedException">Thrown when the feature related <paramref name="key"/> is not supported.</exception>
+        public static void UnsetCallback(string key, EventHandler<RuntimeFeatureStatusChangedEventArgs> callback)
+        {
+            RuntimeInfoKey runtimeFeature;
+
+            if (!ConvertStringToRuntimeInfoKey(key, out runtimeFeature))
+            {
+                Log.Error(InformationErrorFactory.LogTag, "Invalid key");
+                InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
+            }
+
+            RuntimeInfo.UnsetCallback(runtimeFeature, callback);
+        }
+    }
+}
index 8c177a1..d34d53a 100755 (executable)
@@ -22,7 +22,7 @@ internal static partial class Interop
 {
     internal static partial class RuntimeInfo
     {
-        public delegate void RuntimeInformationChangedCallback(RuntimeInformationKey key, IntPtr userData);
+        public delegate void RuntimeInformationChangedCallback(RuntimeInfoKey key, IntPtr userData);
 
         [StructLayout(LayoutKind.Sequential)]
         public struct MemoryInfo
@@ -63,16 +63,16 @@ internal static partial class Interop
         }
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_int")]
-        public static extern InformationError GetValue(RuntimeInformationKey key, out int status);
+        public static extern InformationError GetValue(RuntimeInfoKey key, out int status);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_bool")]
-        public static extern InformationError GetValue(RuntimeInformationKey key, out bool status);
+        public static extern InformationError GetValue(RuntimeInfoKey key, out bool status);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_double")]
-        public static extern InformationError GetValue(RuntimeInformationKey key, out double status);
+        public static extern InformationError GetValue(RuntimeInfoKey key, out double status);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_string")]
-        public static extern InformationError GetValue(RuntimeInformationKey key, out string status);
+        public static extern InformationError GetValue(RuntimeInfoKey key, out string status);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_system_memory_info")]
         public static extern InformationError GetSystemMemoryInfo(out MemoryInfo memoryInfo);
@@ -96,9 +96,9 @@ internal static partial class Interop
         public static extern InformationError GetProcessorMaxFrequency(int coreId, out int cpuFreq);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_set_changed_cb")]
-        public static extern InformationError SetRuntimeInfoChangedCallback(RuntimeInformationKey runtimeInfoKey, RuntimeInformationChangedCallback cb, IntPtr userData);
+        public static extern InformationError SetRuntimeInfoChangedCallback(RuntimeInfoKey runtimeInfoKey, RuntimeInformationChangedCallback cb, IntPtr userData);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_unset_changed_cb")]
-        public static extern InformationError UnsetRuntimeInfoChangedCallback(RuntimeInformationKey runtimeInfoKey);
+        public static extern InformationError UnsetRuntimeInfoChangedCallback(RuntimeInfoKey runtimeInfoKey);
     }
 }
index 8b2fcf0..da3b370 100755 (executable)
 * limitations under the License.
 */
 
-using System;
+using System.ComponentModel;
 
 namespace Tizen.System
 {
+    [EditorBrowsable(EditorBrowsableState.Never)]
     /// <summary>
     /// Enumeration for the runtime information key.
     /// </summary>
-    public enum RuntimeInformationKey
+    internal enum RuntimeInfoKey
     {
         /// <summary>
         /// Indicates whether Bluetooth is enabled.
 */
 
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace Tizen.System
 {
     /// <summary>
-    /// RuntimeInfoChangedEventArgs is an extended EventArgs class. This class contains event arguments for runtime event listeners.
+    /// RuntimeFeatureStatusChangedEventArgs is an extended EventArgs class. This class contains event arguments for runtime event listeners.
     /// </summary>
-    public class RuntimeKeyStatusChangedEventArgs : EventArgs
+    public class RuntimeFeatureStatusChangedEventArgs : EventArgs
     {
         /// <summary>
         /// The key indicating the runtime system preference which was changed.
+        /// It includes the prefix "http://" though you don't use for registering callback.
         /// </summary>
-        public RuntimeInformationKey Key { get; internal set; }
+        public String Key { get; internal set; }
     }
 }
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd All Rights Reserved
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.ComponentModel;
-using System.Runtime.InteropServices;
 
 namespace Tizen.System
 {
-    /// <summary>
-    /// The RuntimeInformation provides functions to obtain the runtime information of various system preferences.
-    /// </summary>
-    public static class RuntimeInformation
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    internal static class RuntimeInfo
     {
-        private static RuntimeInfoEventHandler BluetoothEnabled = new RuntimeInfoEventHandler(RuntimeInformationKey.Bluetooth);
-        private static RuntimeInfoEventHandler WifiHotspotEnabled = new RuntimeInfoEventHandler(RuntimeInformationKey.WifiHotspot);
-        private static RuntimeInfoEventHandler BluetoothTetheringEnabled = new RuntimeInfoEventHandler(RuntimeInformationKey.BluetoothTethering);
-        private static RuntimeInfoEventHandler UsbTetheringEnabled = new RuntimeInfoEventHandler(RuntimeInformationKey.UsbTethering);
-        private static RuntimeInfoEventHandler PacketDataEnabled = new RuntimeInfoEventHandler(RuntimeInformationKey.PacketData);
-        private static RuntimeInfoEventHandler DataRoamingEnabled = new RuntimeInfoEventHandler(RuntimeInformationKey.DataRoaming);
-        private static RuntimeInfoEventHandler VibrationEnabled = new RuntimeInfoEventHandler(RuntimeInformationKey.Vibration);
-        private static RuntimeInfoEventHandler AudioJackConnected = new RuntimeInfoEventHandler(RuntimeInformationKey.AudioJack);
-        private static RuntimeInfoEventHandler GpsStatusChanged = new RuntimeInfoEventHandler(RuntimeInformationKey.Gps);
-        private static RuntimeInfoEventHandler BatteryIsCharging = new RuntimeInfoEventHandler(RuntimeInformationKey.BatteryIsCharging);
-        private static RuntimeInfoEventHandler TvOutConnected = new RuntimeInfoEventHandler(RuntimeInformationKey.TvOut);
-        private static RuntimeInfoEventHandler AudioJackConnectorChanged = new RuntimeInfoEventHandler(RuntimeInformationKey.AudioJackConnector);
-        private static RuntimeInfoEventHandler ChargerConnected = new RuntimeInfoEventHandler(RuntimeInformationKey.Charger);
-        private static RuntimeInfoEventHandler AutoRotationEnabled = new RuntimeInfoEventHandler(RuntimeInformationKey.AutoRotation);
-
-        internal static readonly Dictionary<RuntimeInformationKey, Type> s_keyDataTypeMapping = new Dictionary<RuntimeInformationKey, Type>
+        private static RuntimeInfoEventHandler BluetoothEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.Bluetooth);
+        private static RuntimeInfoEventHandler WifiHotspotEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.WifiHotspot);
+        private static RuntimeInfoEventHandler BluetoothTetheringEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.BluetoothTethering);
+        private static RuntimeInfoEventHandler UsbTetheringEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.UsbTethering);
+        private static RuntimeInfoEventHandler PacketDataEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.PacketData);
+        private static RuntimeInfoEventHandler DataRoamingEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.DataRoaming);
+        private static RuntimeInfoEventHandler VibrationEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.Vibration);
+        private static RuntimeInfoEventHandler AudioJackConnected = new RuntimeInfoEventHandler(RuntimeInfoKey.AudioJack);
+        private static RuntimeInfoEventHandler GpsStatusChanged = new RuntimeInfoEventHandler(RuntimeInfoKey.Gps);
+        private static RuntimeInfoEventHandler BatteryIsCharging = new RuntimeInfoEventHandler(RuntimeInfoKey.BatteryIsCharging);
+        private static RuntimeInfoEventHandler TvOutConnected = new RuntimeInfoEventHandler(RuntimeInfoKey.TvOut);
+        private static RuntimeInfoEventHandler AudioJackConnectorChanged = new RuntimeInfoEventHandler(RuntimeInfoKey.AudioJackConnector);
+        private static RuntimeInfoEventHandler ChargerConnected = new RuntimeInfoEventHandler(RuntimeInfoKey.Charger);
+        private static RuntimeInfoEventHandler AutoRotationEnabled = new RuntimeInfoEventHandler(RuntimeInfoKey.AutoRotation);
+
+        internal static readonly Dictionary<RuntimeInfoKey, Type> s_keyDataTypeMapping = new Dictionary<RuntimeInfoKey, Type>
         {
-            [RuntimeInformationKey.Bluetooth] = typeof(bool),
-            [RuntimeInformationKey.WifiHotspot] = typeof(bool),
-            [RuntimeInformationKey.BluetoothTethering] = typeof(bool),
-            [RuntimeInformationKey.UsbTethering] = typeof(bool),
-            [RuntimeInformationKey.PacketData] = typeof(bool),
-            [RuntimeInformationKey.DataRoaming] = typeof(bool),
-            [RuntimeInformationKey.Vibration] = typeof(bool),
-            [RuntimeInformationKey.AudioJack] = typeof(bool),
-            [RuntimeInformationKey.BatteryIsCharging] = typeof(bool),
-            [RuntimeInformationKey.TvOut] = typeof(bool),
-            [RuntimeInformationKey.Charger] = typeof(bool),
-            [RuntimeInformationKey.AutoRotation] = typeof(bool),
-            [RuntimeInformationKey.Gps] = typeof(int),
-            [RuntimeInformationKey.AudioJackConnector] = typeof(int)
+            [RuntimeInfoKey.Bluetooth] = typeof(bool),
+            [RuntimeInfoKey.WifiHotspot] = typeof(bool),
+            [RuntimeInfoKey.BluetoothTethering] = typeof(bool),
+            [RuntimeInfoKey.UsbTethering] = typeof(bool),
+            [RuntimeInfoKey.PacketData] = typeof(bool),
+            [RuntimeInfoKey.DataRoaming] = typeof(bool),
+            [RuntimeInfoKey.Vibration] = typeof(bool),
+            [RuntimeInfoKey.AudioJack] = typeof(bool),
+            [RuntimeInfoKey.BatteryIsCharging] = typeof(bool),
+            [RuntimeInfoKey.TvOut] = typeof(bool),
+            [RuntimeInfoKey.Charger] = typeof(bool),
+            [RuntimeInfoKey.AutoRotation] = typeof(bool),
+            [RuntimeInfoKey.Gps] = typeof(int),
+            [RuntimeInfoKey.AudioJackConnector] = typeof(int)
         };
 
         /// <summary>
         /// Validates the data type of the status represented by the runtime key.
         /// Note that this is a generic method.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <typeparam name="T">The generic type to validate.</typeparam>
         /// <param name="key">The runtime information key for which the status type is validated.</param>
         /// <returns>True if the data type matches.</returns>
         /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
-        public static bool Is<T>(RuntimeInformationKey key)
+        internal static bool Is<T>(RuntimeInfoKey key)
         {
             if (!s_keyDataTypeMapping.ContainsKey(key))
             {
@@ -87,12 +80,11 @@ namespace Tizen.System
         /// Gets the status of runtime key.
         /// Note that this is a generic method.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
         /// <typeparam name="T">The generic type to return.</typeparam>
         /// <param name="key">The runtime information key for which the current should be read.</param>
         /// <param name="value">The value of the given feature.</param>
         /// <returns>Returns true on success, otherwise false.</returns>
-        public static bool TryGetValue<T>(RuntimeInformationKey key, out T value)
+        internal static bool TryGetValue<T>(RuntimeInfoKey key, out T value)
         {
             Type type;
             value = default(T);
@@ -131,51 +123,50 @@ namespace Tizen.System
             return true;
         }
 
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        private static void FindEventHandler(RuntimeInformationKey key, ref RuntimeInfoEventHandler handler)
+        private static void FindEventHandler(RuntimeInfoKey key, ref RuntimeInfoEventHandler handler)
         {
             switch (key)
             {
-                case RuntimeInformationKey.Bluetooth:
+                case RuntimeInfoKey.Bluetooth:
                     handler = BluetoothEnabled;
                     break;
-                case RuntimeInformationKey.WifiHotspot:
+                case RuntimeInfoKey.WifiHotspot:
                     handler = WifiHotspotEnabled;
                     break;
-                case RuntimeInformationKey.BluetoothTethering:
+                case RuntimeInfoKey.BluetoothTethering:
                     handler = BluetoothTetheringEnabled;
                     break;
-                case RuntimeInformationKey.UsbTethering:
+                case RuntimeInfoKey.UsbTethering:
                     handler = UsbTetheringEnabled;
                     break;
-                case RuntimeInformationKey.PacketData:
+                case RuntimeInfoKey.PacketData:
                     handler = PacketDataEnabled;
                     break;
-                case RuntimeInformationKey.DataRoaming:
+                case RuntimeInfoKey.DataRoaming:
                     handler = DataRoamingEnabled;
                     break;
-                case RuntimeInformationKey.Vibration:
+                case RuntimeInfoKey.Vibration:
                     handler = VibrationEnabled;
                     break;
-                case RuntimeInformationKey.AudioJack:
+                case RuntimeInfoKey.AudioJack:
                     handler = AudioJackConnected;
                     break;
-                case RuntimeInformationKey.Gps:
+                case RuntimeInfoKey.Gps:
                     handler = GpsStatusChanged;
                     break;
-                case RuntimeInformationKey.BatteryIsCharging:
+                case RuntimeInfoKey.BatteryIsCharging:
                     handler = BatteryIsCharging;
                     break;
-                case RuntimeInformationKey.TvOut:
+                case RuntimeInfoKey.TvOut:
                     handler = TvOutConnected;
                     break;
-                case RuntimeInformationKey.AudioJackConnector:
+                case RuntimeInfoKey.AudioJackConnector:
                     handler = AudioJackConnectorChanged;
                     break;
-                case RuntimeInformationKey.Charger:
+                case RuntimeInfoKey.Charger:
                     handler = ChargerConnected;
                     break;
-                case RuntimeInformationKey.AutoRotation:
+                case RuntimeInfoKey.AutoRotation:
                     handler = AutoRotationEnabled;
                     break;
                 default:
@@ -187,12 +178,11 @@ namespace Tizen.System
         /// <summary>
         /// Registers a change event callback for given key.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
         /// <param name="key">The runtime information key which wants to register callback.</param>
         /// <param name="callback">The callback function to subscribe.</param>
         /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
         /// <exception cref="NotSupportedException">Thrown when the feature related <paramref name="key"/> is not supported.</exception>
-        public static void SetCallback(RuntimeInformationKey key, EventHandler<RuntimeKeyStatusChangedEventArgs> callback)
+        internal static void SetCallback(RuntimeInfoKey key, EventHandler<RuntimeFeatureStatusChangedEventArgs> callback)
         {
             RuntimeInfoEventHandler handler = null;
 
@@ -209,11 +199,10 @@ namespace Tizen.System
         /// <summary>
         /// Unregisters a change event callback for given key.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
         /// <param name="key">The runtime information key which wants to unregister callback.</param>
         /// <param name="callback">The callback function to unsubscribe.</param>
         /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
-        public static void UnsetCallback(RuntimeInformationKey key, EventHandler<RuntimeKeyStatusChangedEventArgs> callback)
+        internal static void UnsetCallback(RuntimeInfoKey key, EventHandler<RuntimeFeatureStatusChangedEventArgs> callback)
         {
             RuntimeInfoEventHandler handler = null;
 
index 445ceca..733e0f1 100755 (executable)
@@ -22,16 +22,16 @@ namespace Tizen.System
     [EditorBrowsable(EditorBrowsableState.Never)]
     internal class RuntimeInfoEventHandler
     {
-        private RuntimeInformationKey Key;
-        private event EventHandler<RuntimeKeyStatusChangedEventArgs> Handler;
+        private RuntimeInfoKey Key;
+        private event EventHandler<RuntimeFeatureStatusChangedEventArgs> Handler;
 
-        internal RuntimeInfoEventHandler(RuntimeInformationKey key)
+        internal RuntimeInfoEventHandler(RuntimeInfoKey key)
         {
             Key = key;
             Handler = null;
         }
 
-        internal event EventHandler<RuntimeKeyStatusChangedEventArgs> EventHandler
+        internal event EventHandler<RuntimeFeatureStatusChangedEventArgs> EventHandler
         {
             add
             {
@@ -61,11 +61,11 @@ namespace Tizen.System
             }
         }
 
-        private void RuntimeInformationChangedCallback(RuntimeInformationKey key, IntPtr userData)
+        private void RuntimeInformationChangedCallback(RuntimeInfoKey key, IntPtr userData)
         {
-            RuntimeKeyStatusChangedEventArgs eventArgs = new RuntimeKeyStatusChangedEventArgs()
+            RuntimeFeatureStatusChangedEventArgs eventArgs = new RuntimeFeatureStatusChangedEventArgs()
             {
-                Key = key
+                Key = Information.HttpPrefix + Information.RuntimeInfoStringKeyPrefix + (Information.EnumStringMapping.ContainsKey(key) ? Information.EnumStringMapping[key] : "Invalid")
             };
 
             Handler?.Invoke(null, eventArgs);
index 73b45f9..df9e3a2 100755 (executable)
@@ -25,26 +25,26 @@ namespace Tizen.System
     {
         private static int is_TV_product = -1;
 
-        private static readonly Dictionary<RuntimeInformationKey, int> s_keyTVkeyMapping = new Dictionary<RuntimeInformationKey, int>
+        private static readonly Dictionary<RuntimeInfoKey, int> s_keyTVkeyMapping = new Dictionary<RuntimeInfoKey, int>
         {
-            [RuntimeInformationKey.Bluetooth] = 5,
-            [RuntimeInformationKey.WifiHotspot] = 6,
-            [RuntimeInformationKey.BluetoothTethering] = 7,
-            [RuntimeInformationKey.UsbTethering] = 8,
-            [RuntimeInformationKey.PacketData] = 13,
-            [RuntimeInformationKey.DataRoaming] = 14,
-            [RuntimeInformationKey.Vibration] = 16,
-            [RuntimeInformationKey.AudioJack] = 20,
-            [RuntimeInformationKey.BatteryIsCharging] = 22,
-            [RuntimeInformationKey.TvOut] = 18,
-            [RuntimeInformationKey.Charger] = 26,
-            [RuntimeInformationKey.AutoRotation] = 28,
-            [RuntimeInformationKey.Gps] = 21,
-            [RuntimeInformationKey.AudioJackConnector] = 20
+            [RuntimeInfoKey.Bluetooth] = 5,
+            [RuntimeInfoKey.WifiHotspot] = 6,
+            [RuntimeInfoKey.BluetoothTethering] = 7,
+            [RuntimeInfoKey.UsbTethering] = 8,
+            [RuntimeInfoKey.PacketData] = 13,
+            [RuntimeInfoKey.DataRoaming] = 14,
+            [RuntimeInfoKey.Vibration] = 16,
+            [RuntimeInfoKey.AudioJack] = 20,
+            [RuntimeInfoKey.BatteryIsCharging] = 22,
+            [RuntimeInfoKey.TvOut] = 18,
+            [RuntimeInfoKey.Charger] = 26,
+            [RuntimeInfoKey.AutoRotation] = 28,
+            [RuntimeInfoKey.Gps] = 21,
+            [RuntimeInfoKey.AudioJackConnector] = 20
         };
 
         /// This function is for a TV product. It will be removed.
-        internal static RuntimeInformationKey ConvertKeyIfTvProduct(RuntimeInformationKey key)
+        internal static RuntimeInfoKey ConvertKeyIfTvProduct(RuntimeInfoKey key)
         {
             bool is_key_existed = false;
             string profile;
@@ -73,7 +73,7 @@ namespace Tizen.System
                 {
                     InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
                 }
-                return (RuntimeInformationKey)key_TV;
+                return (RuntimeInfoKey)key_TV;
             }
         }
     }
index 5f410e7..ba7afd5 100755 (executable)
@@ -19,9 +19,7 @@ using System.ComponentModel;
 
 namespace Tizen.System
 {
-    /// <summary>
-    /// System Information class. This class has methods which can be used to obtain device information.
-    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
     public static class SystemInfo
     {
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -47,11 +45,10 @@ namespace Tizen.System
         /// <summary>
         /// Checks if the type of value for the given feature is T.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <typeparam name="T">Type of value for the feature key.</typeparam>
         /// <param name="key">The name of the feature.</param>
         /// <returns>True if type of value for the given feature is T, otherwise false.</returns>
-        public static bool Is<T>(string key)
+        internal static bool Is<T>(string key)
         {
             Interop.SystemInfo.SystemInfoValueType valueType;
             Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
@@ -77,10 +74,9 @@ namespace Tizen.System
         /// <summary>
         /// Checks if the given key is a valid feature.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <param name="key">The name of the feature.</param>
         /// <returns>True if the key is valid, otherwise false.</returns>
-        public static bool IsValidKey(string key)
+        internal static bool IsValidKey(string key)
         {
             Interop.SystemInfo.SystemInfoValueType valueType;
             return GetValueType(key, out valueType) != Interop.SystemInfo.SystemInfoType.None;
@@ -89,12 +85,11 @@ namespace Tizen.System
         /// <summary>
         /// Gets the value of the feature.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <typeparam name="T">Type of key value.</typeparam>
         /// <param name="key">The name of the feature.</param>
         /// <param name="value">The value of the given feature.</param>
         /// <returns>Returns true on success, otherwise false.</returns>
-        public static bool TryGetValue<T>(string key, out T value)
+        internal static bool TryGetValue<T>(string key, out T value)
         {
             bool res = false;
             if (typeof(T) == typeof(bool))
@@ -131,7 +126,6 @@ namespace Tizen.System
         /// <summary>
         /// Gets the bool value of the feature.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <param name="key">The name of the feature.</param>
         /// <param name="value">The value of the given feature.</param>
         /// <returns>Returns true on success, otherwise false.</returns>
@@ -165,7 +159,6 @@ namespace Tizen.System
         /// <summary>
         /// Gets the int value of the feature.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <param name="key">The name of the feature.</param>
         /// <param name="value">The value of the given feature.</param>
         /// <returns>Returns true on success, otherwise false.</returns>
@@ -200,11 +193,10 @@ namespace Tizen.System
         /// <summary>
         /// Gets the double value of the feature.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <param name="key">The name of the feature.</param>
         /// <param name="value">The value of the given feature.</param>
         /// <returns>Returns true on success, otherwise false.</returns>
-        public static bool TryGetValue(string key, out double value)
+        internal static bool TryGetValue(string key, out double value)
         {
             Interop.SystemInfo.SystemInfoValueType valueType;
             Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
@@ -235,7 +227,6 @@ namespace Tizen.System
         /// <summary>
         /// Gets the string value of the feature.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <param name="key">The name of the feature.</param>
         /// <param name="value">The value of the given feature.</param>
         /// <returns>Returns true on success, otherwise false.</returns>
index 5573e0e..d72b462 100755 (executable)
@@ -24,9 +24,9 @@ namespace Tizen.System
     /// </summary>
     public class SystemCpuUsage
     {
-        internal Interop.RuntimeInfo.CpuUsage Usage;
-        internal int[] CurrentFrequencies;
-        internal int[] MaxFrequencies;
+        private Interop.RuntimeInfo.CpuUsage Usage;
+        private int[] CurrentFrequencies;
+        private int[] MaxFrequencies;
 
         /// <summary>
         /// The constructor of SystemCpuUsage class.
index f7508ae..41ec78f 100755 (executable)
@@ -23,7 +23,7 @@ namespace Tizen.System
     /// </summary>
     public class SystemMemoryUsage
     {
-        internal Interop.RuntimeInfo.MemoryInfo Info;
+        private Interop.RuntimeInfo.MemoryInfo Info;
 
         /// <summary>
         /// The constructor of MemoryInformation class.