2 * Copyright (c) 2020 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.
16 #include "tethering_vconf.h"
24 static bool tethering_mock_vconf_result;
31 } tethering_mock_enabled_state_s;
33 static tethering_mock_enabled_state_s tethering_mock_enabled_state;
35 extern int __real_vconf_get_int(const char *in_key, int *intval);
37 void tethering_mock_set_vconf_result(bool result)
39 tethering_mock_vconf_result = result;
42 void tethering_mock_set_enabled_state(bool usb, bool wifi, bool bluetooth, bool p2p)
44 tethering_mock_enabled_state.usb = usb;
45 tethering_mock_enabled_state.wifi = wifi;
46 tethering_mock_enabled_state.bluetooth = bluetooth;
47 tethering_mock_enabled_state.p2p = p2p;
50 int __wrap_vconf_get_int(const char *in_key, int *intval)
52 if (!tethering_mock_vconf_result)
55 if (strcmp(in_key, VCONFKEY_MOBILE_HOTSPOT_MODE) == 0) {
56 *intval |= tethering_mock_enabled_state.usb ? VCONFKEY_MOBILE_HOTSPOT_MODE_USB : 0;
57 *intval |= tethering_mock_enabled_state.wifi ? VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI : 0;
58 *intval |= tethering_mock_enabled_state.bluetooth ? VCONFKEY_MOBILE_HOTSPOT_MODE_BT : 0;
59 *intval |= tethering_mock_enabled_state.p2p ? VCONFKEY_MOBILE_HOTSPOT_MODE_P2P : 0;
60 } else if (strcmp(in_key, VCONFKEY_MOBILE_HOTSPOT_SECURITY) == 0) {
69 int __wrap_vconf_set_int(const char *key, int intval)
71 if (!tethering_mock_vconf_result)
77 char *__wrap_vconf_get_str(const char *key)
79 if (!tethering_mock_vconf_result)
82 return strdup("vconf result string");