[RuntimeInformationKey.AudioJackConnector] = typeof(int)
};
+ internal static readonly Dictionary<RuntimeInformationKey, int> s_keyTVkeyMapping = new Dictionary<RuntimeInformationKey, int>\r
+ {\r
+ [RuntimeInformationKey.Bluetooth] = 5,
+ [RuntimeInformationKey.WifiHotspot] = 6,
+ [RuntimeInformationKey.BluetoothTethering] = 7,
+ [RuntimeInformationKey.UsbTethering] = 8,
+ [RuntimeInformationKey.PacketData] = 13,
+ [RuntimeInformationKey.DataRoaming] = 14,
+ [RuntimeInformationKey.Vibration] = 16,
+ [RuntimeInformationKey.AudioJack] = 20,
+ [RuntimeInformationKey.BatteryIsCharging] = 22,
+ [RuntimeInformationKey.TvOut] = 18,
+ [RuntimeInformationKey.Charger] = 26,
+ [RuntimeInformationKey.AutoRotation] = 28,
+ [RuntimeInformationKey.Gps] = 21,
+ [RuntimeInformationKey.AudioJackConnector] = 20\r
+ };
+
+ internal static int is_TV_product = -1;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ /// This function is for TV product. It will be removed
+ internal static RuntimeInformationKey ConvertKeyIfTvProduct(RuntimeInformationKey key)\r
+ {\r
+ bool is_key_existed = false;\r
+ string profile;\r
+ int key_TV = -1;
+
+ if (is_TV_product == -1)\r
+ {\r
+ is_key_existed = SystemInfo.TryGetValue<string>("http://com.samsung/build_config/product_type", out profile);\r
+ if (is_key_existed && String.Compare(profile, "TV") == 0)\r
+ {\r
+ is_TV_product = 1;\r
+ }\r
+ else\r
+ {\r
+ is_TV_product = 0;\r
+ }\r
+ }\r
+\r
+ if (is_TV_product == 0)\r
+ {\r
+ return key;\r
+ }\r
+ else\r
+ {\r
+ if (!s_keyTVkeyMapping.TryGetValue(key, out key_TV))\r
+ {\r
+ RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);\r
+ }\r
+ return (RuntimeInformationKey)key_TV;\r
+ }\r
+ }
+
[EditorBrowsable(EditorBrowsableState.Never)]
internal static object GetStatus(RuntimeInformationKey key)
{
{
RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter);
}
+
if (s_keyDataTypeMapping[key] == typeof(int))
{
int status;
- int ret = Interop.RuntimeInfo.GetValue(key, out status);
+ int ret = Interop.RuntimeInfo.GetValue(ConvertKeyIfTvProduct(key), out status);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString());
else
{
bool status;
- int ret = Interop.RuntimeInfo.GetValue(key, out status);
+ int ret = Interop.RuntimeInfo.GetValue(ConvertKeyIfTvProduct(key), out status);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString());
/// <param name="key">The runtime information key for which the current should be read </param>
/// <returns>The current status of the given key</returns>.
public static T GetStatus<T>(RuntimeInformationKey key)
- {
+ {\r
return (T)GetStatus(key);
}
{
if (s_bluetoothEnabled == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.Bluetooth, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Bluetooth), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_bluetoothEnabled -= value;
if (s_bluetoothEnabled == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.Bluetooth);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Bluetooth));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_wifiHotspotEnabled == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.WifiHotspot, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.WifiHotspot), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_wifiHotspotEnabled -= value;
if (s_wifiHotspotEnabled == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.WifiHotspot);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.WifiHotspot));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_bluetoothTetheringEnabled == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.BluetoothTethering, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BluetoothTethering), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_bluetoothTetheringEnabled -= value;
if (s_bluetoothTetheringEnabled == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.BluetoothTethering);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BluetoothTethering));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_usbTetheringEnabled == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.UsbTethering, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.UsbTethering), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_usbTetheringEnabled -= value;
if (s_usbTetheringEnabled == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.UsbTethering);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.UsbTethering));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_packetDataEnabled == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.PacketData, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.PacketData), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_packetDataEnabled -= value;
if (s_packetDataEnabled == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.PacketData);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.PacketData));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_dataRoamingEnabled == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.DataRoaming, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.DataRoaming), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_dataRoamingEnabled -= value;
if (s_dataRoamingEnabled == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.DataRoaming);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.DataRoaming));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_vibrationEnabled == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.Vibration, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Vibration), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_vibrationEnabled -= value;
if (s_vibrationEnabled == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.Vibration);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Vibration));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_audioJackConnected == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.AudioJack, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJack), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_audioJackConnected -= value;
if (s_audioJackConnected == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.AudioJack);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJack));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_gpsStatusChanged == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.Gps, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Gps), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_gpsStatusChanged -= value;
if (s_gpsStatusChanged == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.Gps);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Gps));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_batteryIsCharging == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.BatteryIsCharging, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BatteryIsCharging), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_batteryIsCharging -= value;
if (s_batteryIsCharging == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.BatteryIsCharging);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BatteryIsCharging));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_tvOutConnected == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.TvOut, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.TvOut), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_tvOutConnected -= value;
if (s_tvOutConnected == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.TvOut);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.TvOut));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_audioJackConnectorChanged == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.AudioJackConnector, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJackConnector), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_audioJackConnectorChanged -= value;
if (s_audioJackConnectorChanged == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.AudioJackConnector);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJackConnector));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_chargerConnected == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.Charger, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Charger), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_chargerConnected -= value;
if (s_chargerConnected == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.Charger);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Charger));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
{
if (s_autoRotationEnabled == null)
{
- int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(RuntimeInformationKey.AutoRotation, s_runtimeInfoChangedCallback, IntPtr.Zero);
+ int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AutoRotation), s_runtimeInfoChangedCallback, IntPtr.Zero);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");
s_autoRotationEnabled -= value;
if (s_autoRotationEnabled == null)
{
- int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(RuntimeInformationKey.AutoRotation);
+ int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AutoRotation));
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler");