2 * Copyright (c) 2017 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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.
19 using LibTVRefCommonPortable.Utils;
20 using Tizen.Applications;
22 namespace LibTVRefCommonTizen.Ports
25 /// Handles the Appcontrol APIs
27 public class AppControlPort : IAppControl
30 /// The app ID of TV reference home application
32 // TODO : change application later
33 public static string TVHomeAppID = "org.tizen.xahome";
36 /// The app ID of TV reference apps-tray application
38 public static string TVAppsAppID = "org.tizen.xaapps";
41 /// Represents the operation to be performed between TVHome and TVApps
42 /// This operation is sended from TVHomes to TVApps
44 public static string AddAppOperation = "http://xahome.tizen.org/appcontrol/operation/add_app";
47 /// Represents the operation to be performed between TVHome and TVApps
48 /// This operation is sended from TVApps to TVHome
50 public static string AppAddedNotifyOperation = "http://xahome.tizen.org/appcontrol/operation/app_added";
52 public static string KeyAddedAppID = "AddedAppID";
55 /// Sends the launch request
57 /// <param name="AppId"> The app ID to explicitly launch</param>
58 public void SendLaunchRequest(string AppId)
62 AppControl appControl = new AppControl();
64 if (AppId == null || AppId.Length <= 0)
66 DebuggingUtils.Err("The AppID is null or blank");
70 appControl.ApplicationId = AppId;
72 AppControl.SendLaunchRequest(appControl);
74 catch (InvalidOperationException)
76 DebuggingUtils.Err("Failed to create AppControl");
81 /// Sends the 'Add PIN apps' operation to TV Apps
83 public void SendAddAppRequestToApps()
85 AppControl appControl = new AppControl()
87 ApplicationId = TVAppsAppID,
88 Operation = AddAppOperation,
90 AppControl.SendLaunchRequest(appControl);
94 /// Sends the pinned app ID to TV Home
96 /// <param name="addedAddID">The app ID to add PIN list int the TV Home</param>
97 public void SendAppAddedNotificationToHome(string addedAddID)
99 AppControl appControl = new AppControl()
101 ApplicationId = TVHomeAppID,
102 Operation = AppAddedNotifyOperation,
104 appControl.ExtraData.Add(KeyAddedAppID, addedAddID);
105 AppControl.SendLaunchRequest(appControl);