[Information] Integrate error type and log tag 23/145423/8
authorKichan Kwon <k_c.kwon@samsung.com>
Tue, 22 Aug 2017 08:33:14 +0000 (17:33 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 13 Sep 2017 07:47:54 +0000 (16:47 +0900)
- Cornerstone for integrating the get function of
  runtime-info and system-info
- It is not problem because both CAPI packages are using
  same Tizen error

Change-Id: I41035a8a8b10b24fc51f7a4a917ebc655c216ad1
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/Tizen.System.Information/Common/InformationErrorFactory.cs [new file with mode: 0755]
src/Tizen.System.Information/Interop/Interop.RuntimeInfo.cs
src/Tizen.System.Information/Interop/Interop.SystemInfo.cs [changed mode: 0644->0755]
src/Tizen.System.Information/RuntimeInfo/RuntimeInfoErrorFactory.cs [deleted file]
src/Tizen.System.Information/RuntimeInfo/RuntimeInformation.cs
src/Tizen.System.Information/SystemInfo/SystemInfo.cs
src/Tizen.System.Information/Usage/ProcessCpuUsage.cs
src/Tizen.System.Information/Usage/ProcessMemoryUsage.cs
src/Tizen.System.Information/Usage/SystemCpuUsage.cs
src/Tizen.System.Information/Usage/SystemMemoryUsage.cs

diff --git a/src/Tizen.System.Information/Common/InformationErrorFactory.cs b/src/Tizen.System.Information/Common/InformationErrorFactory.cs
new file mode 100755 (executable)
index 0000000..906961d
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2016 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.IO;
+using System.ComponentModel;
+using Tizen.Internals.Errors;
+
+namespace Tizen.System
+{
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    internal enum InformationError
+    {
+        None = ErrorCode.None,
+        InvalidParameter = ErrorCode.InvalidParameter,
+        OutOfMemory = ErrorCode.OutOfMemory,
+        Io = ErrorCode.IoError,
+        RemoteIo = ErrorCode.RemoteIo,
+        PermissionDenied = ErrorCode.PermissionDenied,
+        NotSupported = ErrorCode.NotSupported,
+        NoData = ErrorCode.NoData
+    }
+
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    internal static class InformationErrorFactory
+    {
+        internal const string LogTag = "Tizen.System.Information";
+
+        internal static void ThrowException(InformationError err)
+        {
+            InformationError error = (InformationError)err;
+            if (error == InformationError.InvalidParameter)
+            {
+                throw new ArgumentException("Invalid parameter");
+            }
+            else if (error == InformationError.OutOfMemory)
+            {
+                throw new OutOfMemoryException("Out of memory");
+            }
+            else if (error == InformationError.Io)
+            {
+                throw new IOException("I/O Error");
+            }
+            else if (error == InformationError.RemoteIo)
+            {
+                throw new IOException("Remote I/O Error");
+            }
+            else if (error == InformationError.PermissionDenied)
+            {
+                throw new UnauthorizedAccessException("Permission denied");
+            }
+            else if (error == InformationError.NotSupported)
+            {
+                throw new NotSupportedException("Not supported");
+            }
+            else if (error == InformationError.NoData)
+            {
+                throw new NotSupportedException("No data");
+            }
+        }
+    }
+}
index 705df5aa374841b8588f8c2e477c40a16b2cef07..8c177a1da8ea1954167f797d0bf820ef7b189feb 100755 (executable)
@@ -63,42 +63,42 @@ internal static partial class Interop
         }
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_int")]
-        public static extern int GetValue(RuntimeInformationKey key, out int status);
+        public static extern InformationError GetValue(RuntimeInformationKey key, out int status);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_bool")]
-        public static extern int GetValue(RuntimeInformationKey key, out bool status);
+        public static extern InformationError GetValue(RuntimeInformationKey key, out bool status);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_double")]
-        public static extern int GetValue(RuntimeInformationKey key, out double status);
+        public static extern InformationError GetValue(RuntimeInformationKey key, out double status);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_value_string")]
-        public static extern int GetValue(RuntimeInformationKey key, out string status);
+        public static extern InformationError GetValue(RuntimeInformationKey key, out string status);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_system_memory_info")]
-        public static extern int GetSystemMemoryInfo(out MemoryInfo memoryInfo);
+        public static extern InformationError GetSystemMemoryInfo(out MemoryInfo memoryInfo);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_process_memory_info")]
-        public static extern int GetProcessMemoryInfo(int[] pid, int size, ref IntPtr array);
+        public static extern InformationError GetProcessMemoryInfo(int[] pid, int size, ref IntPtr array);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_cpu_usage")]
-        public static extern int GetCpuUsage(out CpuUsage cpuUsage);
+        public static extern InformationError GetCpuUsage(out CpuUsage cpuUsage);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_process_cpu_usage")]
-        public static extern int GetProcessCpuUsage(int[] pid, int size, ref IntPtr array);
+        public static extern InformationError GetProcessCpuUsage(int[] pid, int size, ref IntPtr array);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_processor_count")]
-        public static extern int GetProcessorCount(out int processorCount);
+        public static extern InformationError GetProcessorCount(out int processorCount);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_processor_current_frequency")]
-        public static extern int GetProcessorCurrentFrequency(int coreId, out int cpuFreq);
+        public static extern InformationError GetProcessorCurrentFrequency(int coreId, out int cpuFreq);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_processor_max_frequency")]
-        public static extern int GetProcessorMaxFrequency(int coreId, out int cpuFreq);
+        public static extern InformationError GetProcessorMaxFrequency(int coreId, out int cpuFreq);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_set_changed_cb")]
-        public static extern int SetRuntimeInfoChangedCallback(RuntimeInformationKey runtimeInfoKey, RuntimeInformationChangedCallback cb, IntPtr userData);
+        public static extern InformationError SetRuntimeInfoChangedCallback(RuntimeInformationKey runtimeInfoKey, RuntimeInformationChangedCallback cb, IntPtr userData);
 
         [DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_unset_changed_cb")]
-        public static extern int UnsetRuntimeInfoChangedCallback(RuntimeInformationKey runtimeInfoKey);
+        public static extern InformationError UnsetRuntimeInfoChangedCallback(RuntimeInformationKey runtimeInfoKey);
     }
 }
old mode 100644 (file)
new mode 100755 (executable)
index de7282e..2e820be
 * limitations under the License.
 */
 
-using System;
+using Tizen.System;
 using System.Runtime.InteropServices;
 
 internal static partial class Interop
 {
     internal static partial class SystemInfo
     {
-        internal enum ErrorCode
-        {
-            None = Tizen.Internals.Errors.ErrorCode.None,
-            InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
-            OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
-            IoError = Tizen.Internals.Errors.ErrorCode.IoError,
-            PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
-            NotSupported = Tizen.Internals.Errors.ErrorCode.NoSuchDevice,
-        }
-
         internal enum SystemInfoValueType
         {
             Bool = 0,
@@ -47,33 +37,33 @@ internal static partial class Interop
         }
 
         [DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_platform_type")]
-        internal static extern ErrorCode SystemInfoGetPlatformType(string key, out SystemInfoValueType type);
+        internal static extern InformationError SystemInfoGetPlatformType(string key, out SystemInfoValueType type);
 
         [DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_custom_type")]
-        internal static extern ErrorCode SystemInfoGetCustomType(string key, out SystemInfoValueType type);
+        internal static extern InformationError SystemInfoGetCustomType(string key, out SystemInfoValueType type);
 
         [DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_platform_bool")]
-        internal static extern ErrorCode SystemInfoGetPlatformBool(string key, out bool value);
+        internal static extern InformationError SystemInfoGetPlatformBool(string key, out bool value);
 
         [DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_platform_int")]
-        internal static extern ErrorCode SystemInfoGetPlatformInt(string key, out int value);
+        internal static extern InformationError SystemInfoGetPlatformInt(string key, out int value);
 
         [DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_platform_double")]
-        internal static extern ErrorCode SystemInfoGetPlatformDouble(string key, out double value);
+        internal static extern InformationError SystemInfoGetPlatformDouble(string key, out double value);
 
         [DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_platform_string")]
-        internal static extern ErrorCode SystemInfoGetPlatformString(string key, out string value);
+        internal static extern InformationError SystemInfoGetPlatformString(string key, out string value);
 
         [DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_custom_bool")]
-        internal static extern ErrorCode SystemInfoGetCustomBool(string key, out bool value);
+        internal static extern InformationError SystemInfoGetCustomBool(string key, out bool value);
 
         [DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_custom_int")]
-        internal static extern ErrorCode SystemInfoGetCustomInt(string key, out int value);
+        internal static extern InformationError SystemInfoGetCustomInt(string key, out int value);
 
         [DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_custom_double")]
-        internal static extern ErrorCode SystemInfoGetCustomDouble(string key, out double value);
+        internal static extern InformationError SystemInfoGetCustomDouble(string key, out double value);
 
         [DllImport(Libraries.SystemInfo, EntryPoint = "system_info_get_custom_string")]
-        internal static extern ErrorCode SystemInfoGetCustomString(string key, out string value);
+        internal static extern InformationError SystemInfoGetCustomString(string key, out string value);
     }
 }
diff --git a/src/Tizen.System.Information/RuntimeInfo/RuntimeInfoErrorFactory.cs b/src/Tizen.System.Information/RuntimeInfo/RuntimeInfoErrorFactory.cs
deleted file mode 100644 (file)
index e9fee57..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-* Copyright (c) 2016 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.IO;
-using System.ComponentModel;
-using Tizen.Internals.Errors;
-
-namespace Tizen.System
-{
-    [EditorBrowsable(EditorBrowsableState.Never)]
-    internal enum RuntimeInfoError
-    {
-        None = ErrorCode.None,
-        InvalidParameter = ErrorCode.InvalidParameter,
-        OutOfMemory = ErrorCode.OutOfMemory,
-        Io = ErrorCode.IoError,
-        RemoteIo = ErrorCode.RemoteIo,
-        PermissionDenied = ErrorCode.PermissionDenied,
-        NotSupported = ErrorCode.NotSupported,
-        NoData = ErrorCode.NoData
-    }
-
-    [EditorBrowsable(EditorBrowsableState.Never)]
-    internal static class RuntimeInfoErrorFactory
-    {
-        internal const string LogTag = "Tizen.System.RuntimeInformation";
-
-        internal static void ThrowException(int err)
-        {
-            RuntimeInfoError error = (RuntimeInfoError)err;
-            if (error == RuntimeInfoError.InvalidParameter)
-            {
-                throw new ArgumentException("Invalid parameter");
-            }
-            else if (error == RuntimeInfoError.OutOfMemory)
-            {
-                throw new OutOfMemoryException("Out of memory");
-            }
-            else if (error == RuntimeInfoError.Io)
-            {
-                throw new IOException("I/O Error");
-            }
-            else if (error == RuntimeInfoError.RemoteIo)
-            {
-                throw new IOException("Remote I/O Error");
-            }
-            else if (error == RuntimeInfoError.PermissionDenied)
-            {
-                throw new UnauthorizedAccessException("Permission denied");
-            }
-            else if (error == RuntimeInfoError.NotSupported)
-            {
-                throw new NotSupportedException("Not supported");
-            }
-            else if (error == RuntimeInfoError.NoData)
-            {
-                throw new NotSupportedException("No data");
-            }
-        }
-    }
-}
index 0910768a1fe660b79519a6b5338a0a79d904f4ff..70428b59c9f5780cc2c7b9e08409643df117b225 100755 (executable)
@@ -195,7 +195,7 @@ namespace Tizen.System
             {
                 if (!s_keyTVkeyMapping.TryGetValue(key, out key_TV))
                 {
-                    RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+                    InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
                 }
                 return (RuntimeInformationKey)key_TV;
             }
@@ -207,17 +207,17 @@ namespace Tizen.System
             Type value;
             if (!s_keyDataTypeMapping.TryGetValue(key, out value))
             {
-                RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+                InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             }
 
             if (s_keyDataTypeMapping[key] == typeof(int))
             {
                 int status;
-                int ret = Interop.RuntimeInfo.GetValue(ConvertKeyIfTvProduct(key), out status);
-                if (ret != (int)RuntimeInfoError.None)
+                InformationError ret = Interop.RuntimeInfo.GetValue(ConvertKeyIfTvProduct(key), out status);
+                if (ret != InformationError.None)
                 {
-                    Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString());
-                    RuntimeInfoErrorFactory.ThrowException(ret);
+                    Log.Error(InformationErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString());
+                    InformationErrorFactory.ThrowException(ret);
                 }
 
                 return status;
@@ -225,11 +225,11 @@ namespace Tizen.System
             else
             {
                 bool status;
-                int ret = Interop.RuntimeInfo.GetValue(ConvertKeyIfTvProduct(key), out status);
-                if (ret != (int)RuntimeInfoError.None)
+                InformationError ret = Interop.RuntimeInfo.GetValue(ConvertKeyIfTvProduct(key), out status);
+                if (ret != InformationError.None)
                 {
-                    Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString());
-                    RuntimeInfoErrorFactory.ThrowException(ret);
+                    Log.Error(InformationErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString());
+                    InformationErrorFactory.ThrowException(ret);
                 }
 
                 return status;
@@ -249,7 +249,7 @@ namespace Tizen.System
         {
             if (!s_keyDataTypeMapping.ContainsKey(key))
             {
-                Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid data type");
+                Log.Error(InformationErrorFactory.LogTag, "Invalid data type");
                 throw new ArgumentException("Invalid parameter");
             }
 
@@ -281,11 +281,11 @@ namespace Tizen.System
             {
                 if (s_bluetoothEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Bluetooth), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Bluetooth), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_bluetoothEnabled += value;
@@ -295,11 +295,11 @@ namespace Tizen.System
                 s_bluetoothEnabled -= value;
                 if (s_bluetoothEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Bluetooth));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Bluetooth));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -313,11 +313,11 @@ namespace Tizen.System
             {
                 if (s_wifiHotspotEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.WifiHotspot), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.WifiHotspot), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_wifiHotspotEnabled += value;
@@ -327,11 +327,11 @@ namespace Tizen.System
                 s_wifiHotspotEnabled -= value;
                 if (s_wifiHotspotEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.WifiHotspot));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.WifiHotspot));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -345,11 +345,11 @@ namespace Tizen.System
             {
                 if (s_bluetoothTetheringEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BluetoothTethering), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BluetoothTethering), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_bluetoothTetheringEnabled += value;
@@ -359,11 +359,11 @@ namespace Tizen.System
                 s_bluetoothTetheringEnabled -= value;
                 if (s_bluetoothTetheringEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BluetoothTethering));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BluetoothTethering));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -377,11 +377,11 @@ namespace Tizen.System
             {
                 if (s_usbTetheringEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.UsbTethering), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.UsbTethering), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_usbTetheringEnabled += value;
@@ -391,11 +391,11 @@ namespace Tizen.System
                 s_usbTetheringEnabled -= value;
                 if (s_usbTetheringEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.UsbTethering));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.UsbTethering));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -409,11 +409,11 @@ namespace Tizen.System
             {
                 if (s_packetDataEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.PacketData), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.PacketData), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_packetDataEnabled += value;
@@ -423,11 +423,11 @@ namespace Tizen.System
                 s_packetDataEnabled -= value;
                 if (s_packetDataEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.PacketData));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.PacketData));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -441,11 +441,11 @@ namespace Tizen.System
             {
                 if (s_dataRoamingEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.DataRoaming), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.DataRoaming), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_dataRoamingEnabled += value;
@@ -455,11 +455,11 @@ namespace Tizen.System
                 s_dataRoamingEnabled -= value;
                 if (s_dataRoamingEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.DataRoaming));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.DataRoaming));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -473,11 +473,11 @@ namespace Tizen.System
             {
                 if (s_vibrationEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Vibration), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Vibration), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_vibrationEnabled += value;
@@ -487,11 +487,11 @@ namespace Tizen.System
                 s_vibrationEnabled -= value;
                 if (s_vibrationEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Vibration));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Vibration));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -505,11 +505,11 @@ namespace Tizen.System
             {
                 if (s_audioJackConnected == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJack), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJack), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_audioJackConnected += value;
@@ -519,11 +519,11 @@ namespace Tizen.System
                 s_audioJackConnected -= value;
                 if (s_audioJackConnected == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJack));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJack));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -537,11 +537,11 @@ namespace Tizen.System
             {
                 if (s_gpsStatusChanged == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Gps), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Gps), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_gpsStatusChanged += value;
@@ -551,11 +551,11 @@ namespace Tizen.System
                 s_gpsStatusChanged -= value;
                 if (s_gpsStatusChanged == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Gps));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Gps));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -569,11 +569,11 @@ namespace Tizen.System
             {
                 if (s_batteryIsCharging == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BatteryIsCharging), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BatteryIsCharging), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_batteryIsCharging += value;
@@ -583,11 +583,11 @@ namespace Tizen.System
                 s_batteryIsCharging -= value;
                 if (s_batteryIsCharging == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BatteryIsCharging));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BatteryIsCharging));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -601,11 +601,11 @@ namespace Tizen.System
             {
                 if (s_tvOutConnected == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.TvOut), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.TvOut), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_tvOutConnected += value;
@@ -615,11 +615,11 @@ namespace Tizen.System
                 s_tvOutConnected -= value;
                 if (s_tvOutConnected == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.TvOut));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.TvOut));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -633,11 +633,11 @@ namespace Tizen.System
             {
                 if (s_audioJackConnectorChanged == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJackConnector), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJackConnector), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_audioJackConnectorChanged += value;
@@ -647,11 +647,11 @@ namespace Tizen.System
                 s_audioJackConnectorChanged -= value;
                 if (s_audioJackConnectorChanged == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJackConnector));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJackConnector));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -665,11 +665,11 @@ namespace Tizen.System
             {
                 if (s_chargerConnected == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Charger), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Charger), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_chargerConnected += value;
@@ -679,11 +679,11 @@ namespace Tizen.System
                 s_chargerConnected -= value;
                 if (s_chargerConnected == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Charger));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Charger));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
@@ -697,11 +697,11 @@ namespace Tizen.System
             {
                 if (s_autoRotationEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AutoRotation), s_runtimeInfoChangedCallback, IntPtr.Zero);
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AutoRotation), s_runtimeInfoChangedCallback, IntPtr.Zero);
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
                 s_autoRotationEnabled += value;
@@ -711,11 +711,11 @@ namespace Tizen.System
                 s_autoRotationEnabled -= value;
                 if (s_autoRotationEnabled == null)
                 {
-                    int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AutoRotation));
-                    if (ret != (int)RuntimeInfoError.None)
+                    InformationError ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AutoRotation));
+                    if (ret != InformationError.None)
                     {
-                        Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
-                        RuntimeInfoErrorFactory.ThrowException(ret);
+                        Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
+                        InformationErrorFactory.ThrowException(ret);
                     }
                 }
             }
index b551c1b8d838f259af250c999c072dd874a7130d..5f410e78d9923253228e9777caf7c83e66f4d6da 100755 (executable)
@@ -24,25 +24,23 @@ namespace Tizen.System
     /// </summary>
     public static class SystemInfo
     {
-        private const string LogTag = "Tizen.System";
-
         [EditorBrowsable(EditorBrowsableState.Never)]
         private static Interop.SystemInfo.SystemInfoType GetValueType(string key, out Interop.SystemInfo.SystemInfoValueType valueType)
         {
-            Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.SystemInfoGetPlatformType(key, out valueType);
-            if (err == Interop.SystemInfo.ErrorCode.None)
+            InformationError err = Interop.SystemInfo.SystemInfoGetPlatformType(key, out valueType);
+            if (err == InformationError.None)
             {
                 return Interop.SystemInfo.SystemInfoType.platform;
             }
 
-            Log.Debug(LogTag, string.Format("Key {0} not in platform system info", key));
+            Log.Debug(InformationErrorFactory.LogTag, string.Format("Key {0} not in platform system info", key));
             err = Interop.SystemInfo.SystemInfoGetCustomType(key, out valueType);
-            if (err == Interop.SystemInfo.ErrorCode.None)
+            if (err == InformationError.None)
             {
                 return Interop.SystemInfo.SystemInfoType.Custom;
             }
 
-            Log.Debug(LogTag, string.Format("Key {0} not in custom system info", key));
+            Log.Debug(InformationErrorFactory.LogTag, string.Format("Key {0} not in custom system info", key));
             return Interop.SystemInfo.SystemInfoType.None;
         }
 
@@ -142,7 +140,7 @@ namespace Tizen.System
             Interop.SystemInfo.SystemInfoValueType valueType;
             Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
 
-            Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter;
+            InformationError err = InformationError.InvalidParameter;
             if (keyType == Interop.SystemInfo.SystemInfoType.platform)
             {
                 err = Interop.SystemInfo.SystemInfoGetPlatformBool(key, out value);
@@ -155,9 +153,9 @@ namespace Tizen.System
                 value = false;
             }
 
-            if (err != Interop.SystemInfo.ErrorCode.None)
+            if (err != InformationError.None)
             {
-                Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
+                Log.Warn(InformationErrorFactory.LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
                 return false;
             }
 
@@ -176,7 +174,7 @@ namespace Tizen.System
             Interop.SystemInfo.SystemInfoValueType valueType;
             Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
 
-            Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter;
+            InformationError err = InformationError.InvalidParameter;
             if (keyType == Interop.SystemInfo.SystemInfoType.platform)
             {
                 err = Interop.SystemInfo.SystemInfoGetPlatformInt(key, out value);
@@ -190,9 +188,9 @@ namespace Tizen.System
                 value = 0;
             }
 
-            if (err != Interop.SystemInfo.ErrorCode.None)
+            if (err != InformationError.None)
             {
-                Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
+                Log.Warn(InformationErrorFactory.LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
                 return false;
             }
 
@@ -211,7 +209,7 @@ namespace Tizen.System
             Interop.SystemInfo.SystemInfoValueType valueType;
             Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
 
-            Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter;
+            InformationError err = InformationError.InvalidParameter;
             if (keyType == Interop.SystemInfo.SystemInfoType.platform)
             {
                 err = Interop.SystemInfo.SystemInfoGetPlatformDouble(key, out value);
@@ -225,9 +223,9 @@ namespace Tizen.System
                 value = 0;
             }
 
-            if (err != Interop.SystemInfo.ErrorCode.None)
+            if (err != InformationError.None)
             {
-                Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
+                Log.Warn(InformationErrorFactory.LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
                 return false;
             }
 
@@ -246,7 +244,7 @@ namespace Tizen.System
             Interop.SystemInfo.SystemInfoValueType valueType;
             Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType);
 
-            Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter;
+            InformationError err = InformationError.InvalidParameter;
             if (keyType == Interop.SystemInfo.SystemInfoType.platform)
             {
                 err = Interop.SystemInfo.SystemInfoGetPlatformString(key, out value);
@@ -260,9 +258,9 @@ namespace Tizen.System
                 value = string.Empty;
             }
 
-            if (err != Interop.SystemInfo.ErrorCode.None)
+            if (err != InformationError.None)
             {
-                Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
+                Log.Warn(InformationErrorFactory.LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err));
                 return false;
             }
 
index b664c1bf5a4b1e6f85d01364b5b9fc555511be95..75a579c37273b39a25412dbce200763e5082cf8f 100755 (executable)
@@ -64,8 +64,8 @@ namespace Tizen.System
                 if (pid == Pids[i])
                     return Usages[i].UTime;
 
-            Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid pid");
-            RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+            Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+            InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             return 0;
         }
 
@@ -82,8 +82,8 @@ namespace Tizen.System
                 if (pid == Pids[i])
                     return Usages[i].STime;
 
-            Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid pid");
-            RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+            Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+            InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             return 0;
         }
 
@@ -99,17 +99,17 @@ namespace Tizen.System
         /// <exception cref="UnauthorizedAccessException">Thrown when the caller does not have privilege to use this method.</exception>
         public void Update(IEnumerable<int> pid)
         {
-            int ret;
+            InformationError ret;
 
             Pids = pid.ToArray<int>();
             IntPtr ptr = new IntPtr();
             Count = Pids.Count<int>();
 
             ret = Interop.RuntimeInfo.GetProcessCpuUsage(Pids, Count, ref ptr);
-            if (ret != (int)RuntimeInfoError.None)
+            if (ret != InformationError.None)
             {
-                Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Process cpu usage");
-                RuntimeInfoErrorFactory.ThrowException(ret);
+                Log.Error(InformationErrorFactory.LogTag, "Interop failed to get Process cpu usage");
+                InformationErrorFactory.ThrowException(ret);
             }
 
             Usages = new Interop.RuntimeInfo.ProcessCpuUsage[Count];
index b1bd7d6d6074d98660435bc9673cb02ccc6eaea4..c10c8c9c26cfcc85a2376318e620325a464db36e 100755 (executable)
@@ -64,8 +64,8 @@ namespace Tizen.System
                 if (pid == Pids[i])
                     return Usages[i].Vsz;
 
-            Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid pid");
-            RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+            Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+            InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             return 0;
         }
 
@@ -82,8 +82,8 @@ namespace Tizen.System
                 if (pid == Pids[i])
                     return Usages[i].Rss;
 
-            Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid pid");
-            RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+            Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+            InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             return 0;
         }
 
@@ -100,8 +100,8 @@ namespace Tizen.System
                 if (pid == Pids[i])
                     return Usages[i].Pss;
 
-            Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid pid");
-            RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+            Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+            InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             return 0;
         }
 
@@ -118,8 +118,8 @@ namespace Tizen.System
                 if (pid == Pids[i])
                     return Usages[i].SharedClean;
 
-            Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid pid");
-            RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+            Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+            InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             return 0;
         }
 
@@ -136,8 +136,8 @@ namespace Tizen.System
                 if (pid == Pids[i])
                     return Usages[i].SharedDirty;
 
-            Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid pid");
-            RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+            Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+            InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             return 0;
         }
 
@@ -154,8 +154,8 @@ namespace Tizen.System
                 if (pid == Pids[i])
                     return Usages[i].PrivateClean;
 
-            Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid pid");
-            RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+            Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+            InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             return 0;
         }
 
@@ -172,8 +172,8 @@ namespace Tizen.System
                 if (pid == Pids[i])
                     return Usages[i].PrivateDirty;
 
-            Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid pid");
-            RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+            Log.Error(InformationErrorFactory.LogTag, "Invalid pid");
+            InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             return 0;
         }
 
@@ -189,17 +189,17 @@ namespace Tizen.System
         /// <exception cref="UnauthorizedAccessException">Thrown when the caller does not have privilege to use this method.</exception>
         public void Update(IEnumerable<int> pid)
         {
-            int ret;
+            InformationError ret;
 
             Pids = pid.ToArray<int>();
             IntPtr ptr = new IntPtr();
             Count = Pids.Count<int>();
 
             ret = Interop.RuntimeInfo.GetProcessMemoryInfo(Pids, Count, ref ptr);
-            if (ret != (int)RuntimeInfoError.None)
+            if (ret != InformationError.None)
             {
-                Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Process cpu usage");
-                RuntimeInfoErrorFactory.ThrowException(ret);
+                Log.Error(InformationErrorFactory.LogTag, "Interop failed to get Process cpu usage");
+                InformationErrorFactory.ThrowException(ret);
             }
 
             Usages = new Interop.RuntimeInfo.ProcessMemoryInfo[Count];
index 32d007a32ede305aa5ac044b9e377b09227f9fbc..5573e0e260ac9b82380bbc9339b10c8781abce50 100755 (executable)
@@ -104,8 +104,8 @@ namespace Tizen.System
         {
             if(coreId < 0 || coreId >= ProcessorCount)
             {
-                Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid core ID " + coreId);
-                RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+                Log.Error(InformationErrorFactory.LogTag, "Invalid core ID " + coreId);
+                InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             }
 
             return CurrentFrequencies[coreId];
@@ -122,8 +122,8 @@ namespace Tizen.System
         {
             if (coreId < 0 || coreId >= ProcessorCount)
             {
-                Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid core ID " + coreId);
-                RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+                Log.Error(InformationErrorFactory.LogTag, "Invalid core ID " + coreId);
+                InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
             }
 
             return MaxFrequencies[coreId];
@@ -137,21 +137,21 @@ namespace Tizen.System
         /// <exception cref="NotSupportedException">Thrown when this system does not store the current CPU frequency.</exception>
         public void Update()
         {
-            int ret;
+            InformationError ret;
             int count;
 
             ret = Interop.RuntimeInfo.GetCpuUsage(out Usage);
-            if (ret != (int)RuntimeInfoError.None)
+            if (ret != InformationError.None)
             {
-                Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get cpu usage");
-                RuntimeInfoErrorFactory.ThrowException(ret);
+                Log.Error(InformationErrorFactory.LogTag, "Interop failed to get cpu usage");
+                InformationErrorFactory.ThrowException(ret);
             }
 
             ret = Interop.RuntimeInfo.GetProcessorCount(out count);
-            if (ret != (int)RuntimeInfoError.None)
+            if (ret != InformationError.None)
             {
-                Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Processor count");
-                RuntimeInfoErrorFactory.ThrowException(ret);
+                Log.Error(InformationErrorFactory.LogTag, "Interop failed to get Processor count");
+                InformationErrorFactory.ThrowException(ret);
                 return;
             }
 
@@ -162,17 +162,17 @@ namespace Tizen.System
             for (int coreId = 0; coreId < ProcessorCount; coreId++)
             {
                 ret = Interop.RuntimeInfo.GetProcessorCurrentFrequency(coreId, out CurrentFrequencies[coreId]);
-                if (ret != (int)RuntimeInfoError.None)
+                if (ret != InformationError.None)
                 {
-                    Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get the current frequency of processor " + coreId);
-                    RuntimeInfoErrorFactory.ThrowException(ret);
+                    Log.Error(InformationErrorFactory.LogTag, "Interop failed to get the current frequency of processor " + coreId);
+                    InformationErrorFactory.ThrowException(ret);
                 }
 
                 ret = Interop.RuntimeInfo.GetProcessorMaxFrequency(coreId, out MaxFrequencies[coreId]);
-                if (ret != (int)RuntimeInfoError.None)
+                if (ret != InformationError.None)
                 {
-                    Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get the max frequency of processor " + coreId);
-                    RuntimeInfoErrorFactory.ThrowException(ret);
+                    Log.Error(InformationErrorFactory.LogTag, "Interop failed to get the max frequency of processor " + coreId);
+                    InformationErrorFactory.ThrowException(ret);
                 }
             }
         }
index 4c6f718ae55385c498769c5fcd1f4a668927220b..f7508aee76cb7b7cf47bfb6b71954ff1e07c33da 100755 (executable)
@@ -102,11 +102,11 @@ namespace Tizen.System
         /// <exception cref="IOException">Thrown when I/O error occurs while reading from the system.</exception>
         public void Update()
         {
-            int ret = Interop.RuntimeInfo.GetSystemMemoryInfo(out Info);
-            if (ret != (int)RuntimeInfoError.None)
+            InformationError ret = Interop.RuntimeInfo.GetSystemMemoryInfo(out Info);
+            if (ret != InformationError.None)
             {
-                Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get System memory information");
-                RuntimeInfoErrorFactory.ThrowException(ret);
+                Log.Error(InformationErrorFactory.LogTag, "Interop failed to get System memory information");
+                InformationErrorFactory.ThrowException(ret);
             }
         }
     }