2 * Samsung Ukraine R&D Center (SRK under a contract between)
3 * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
4 * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
19 #include "app_control_stub.h"
23 static IAppControl* app_control = nullptr;
25 void app_control_set_implementation(IAppControl* impl)
30 IAppControl* app_control_from_handle(app_control_h handle)
33 IAppControl** p = reinterpret_cast<IAppControl**>(handle);
39 IAppControl::IAppControl()
41 app_control_set_implementation(this);
43 IAppControl::~IAppControl()
45 app_control_set_implementation(nullptr);
48 int app_control_create(app_control_h* handle)
51 int ret = app_control->app_control_create(handle);
52 *handle = (app_control_h)&app_control;
55 int app_control_destroy(app_control_h handle)
58 IAppControl** p = reinterpret_cast<IAppControl**>(handle);
59 if (p != nullptr && *p != nullptr && *p == app_control) {
60 (*p)->app_control_destroy();
65 int app_control_set_operation(app_control_h handle, const char* operation)
67 return app_control_from_handle(handle)->app_control_set_operation(operation);
69 int app_control_set_app_id(app_control_h handle, const char* app_id)
71 return app_control_from_handle(handle)->app_control_set_app_id(app_id);
73 int app_control_add_extra_data(app_control_h handle, const char* key, const char* value)
75 return app_control_from_handle(handle)->app_control_add_extra_data(key, value);
78 int app_control_send_launch_request(app_control_h handle, app_control_reply_cb callback, void* user_data)
80 return app_control_from_handle(handle)->app_control_send_launch_request(callback, user_data);