--- /dev/null
+/*
+* 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");
+ }
+ }
+ }
+}
}
[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);
}
}
* 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,
}
[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);
}
}
+++ /dev/null
-/*
-* 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");
- }
- }
- }
-}
{
if (!s_keyTVkeyMapping.TryGetValue(key, out key_TV))
{
- RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
+ InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
}
return (RuntimeInformationKey)key_TV;
}
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;
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;
{
if (!s_keyDataTypeMapping.ContainsKey(key))
{
- Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid data type");
+ Log.Error(InformationErrorFactory.LogTag, "Invalid data type");
throw new ArgumentException("Invalid parameter");
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
{
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;
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);
}
}
}
/// </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;
}
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);
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;
}
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);
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;
}
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);
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;
}
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);
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;
}
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;
}
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;
}
/// <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];
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
/// <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];
{
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];
{
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];
/// <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;
}
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);
}
}
}
/// <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);
}
}
}