2 * Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
20 namespace Tizen.System
22 /// This class is for a TV product. It will be removed.
23 internal static class TvProductHelper
25 private static int is_TV_product = -1;
27 private static readonly Dictionary<RuntimeInfoKey, int> s_keyTVkeyMapping = new Dictionary<RuntimeInfoKey, int>
29 [RuntimeInfoKey.Bluetooth] = 5,
30 [RuntimeInfoKey.WifiHotspot] = 6,
31 [RuntimeInfoKey.BluetoothTethering] = 7,
32 [RuntimeInfoKey.UsbTethering] = 8,
33 [RuntimeInfoKey.PacketData] = 13,
34 [RuntimeInfoKey.DataRoaming] = 14,
35 [RuntimeInfoKey.Vibration] = 16,
36 [RuntimeInfoKey.AudioJack] = 20,
37 [RuntimeInfoKey.BatteryIsCharging] = 22,
38 [RuntimeInfoKey.TvOut] = 18,
39 [RuntimeInfoKey.Charger] = 26,
40 [RuntimeInfoKey.AutoRotation] = 28,
41 [RuntimeInfoKey.Gps] = 21,
42 [RuntimeInfoKey.AudioJackConnector] = 20
45 private static void CheckTvProduct()
47 bool is_key_existed = false;
50 #pragma warning disable CS0618 // Type or member is obsolete
51 is_key_existed = SystemInfo.TryGetValue<string>("http://com.samsung/build_config/product_type", out profile);
52 #pragma warning restore CS0618 // Type or member is obsolete
53 if (is_key_existed && (String.Compare(profile, "TV") == 0 || String.Compare(profile, "AV") == 0))
63 internal static RuntimeInfoKey ConvertKeyIfTvProduct(RuntimeInfoKey key)
65 if (is_TV_product == -1)
70 if (is_TV_product == 1)
72 if (!s_keyTVkeyMapping.TryGetValue(key, out int key_TV))
74 InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
76 return (RuntimeInfoKey)key_TV;
84 internal static RuntimeInfoKey ReconvertKeyIfTvProduct(RuntimeInfoKey key)
86 if (is_TV_product == -1)
91 if (is_TV_product == 1)
93 foreach (KeyValuePair<RuntimeInfoKey, int> kvp in s_keyTVkeyMapping)
95 if (kvp.Value == (int)key)
99 Log.Error(InformationErrorFactory.LogTag, "Key mapping failed");