1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("../../../core/common/dfx/dsoftbus_dfx.gni")
15import("../../../dsoftbus.gni")
16
17adapter_bus_center_path = "$softbus_adapter_common/bus_center"
18
19bus_center_adapter_src = []
20bus_center_adapter_inc = [
21  "$softbus_adapter_common/bus_center/include",
22  "$dsoftbus_root_path/core/common/dfx/interface/include",
23]
24bus_center_adapter_deps =
25    [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ]
26
27if (!defined(global_parts_info) ||
28    defined(global_parts_info.notification_common_event_service)) {
29  has_ces_part = true
30} else {
31  has_ces_part = false
32}
33
34if (defined(ohos_lite)) {
35  if (ohos_kernel_type == "liteos_m") {
36    if (dsoftbus_feature_lnn_net) {
37      bus_center_adapter_src += [
38        "$adapter_bus_center_path/driver/lnn_driver_monitor_virtual.c",
39        "$adapter_bus_center_path/driver/lnn_driver_request_virtual.c",
40        "$adapter_bus_center_path/network/lnn_linkwatch_virtual.c",
41        "$adapter_bus_center_path/network/lnn_lwip_monitor.c",
42        "$adapter_bus_center_path/network/lnn_netlink_monitor_virtual.c",
43        "$adapter_bus_center_path/platform/lnn_product_monitor_virtual.c",
44        "$adapter_bus_center_path/boot_event/lnn_boot_event_monitor_virtual.cpp",
45        "$adapter_bus_center_path/common_event/lnn_common_event_monitor_virtual.cpp",
46        "$adapter_bus_center_path/wlan/lnn_wifiservice_monitor_virtual.cpp",
47        "$adapter_bus_center_path/network/lnn_netmanager_listener_virtual.cpp",
48      ]
49    }
50  } else if (ohos_kernel_type == "linux") {
51    if (dsoftbus_feature_lnn_net) {
52      bus_center_adapter_src += [
53        "$adapter_bus_center_path/driver/lnn_driver_monitor_virtual.c",
54        "$adapter_bus_center_path/driver/lnn_driver_request_virtual.c",
55        "$adapter_bus_center_path/network/lnn_linkwatch.c",
56        "$adapter_bus_center_path/network/lnn_lwip_monitor_virtual.c",
57        "$adapter_bus_center_path/network/lnn_netlink_monitor.c",
58        "$adapter_bus_center_path/platform/lnn_product_monitor_virtual.c",
59        "$adapter_bus_center_path/boot_event/lnn_boot_event_monitor_virtual.cpp",
60        "$adapter_bus_center_path/common_event/lnn_common_event_monitor_virtual.cpp",
61        "$adapter_bus_center_path/wlan/lnn_wifiservice_monitor_virtual.cpp",
62        "$adapter_bus_center_path/network/lnn_netmanager_listener_virtual.cpp",
63      ]
64    }
65  } else if (ohos_kernel_type == "liteos_a") {
66    bus_center_adapter_inc += [
67      "//drivers/hdf_core/adapter/uhdf/posix/include",
68      "//drivers/hdf_core/framework/include/utils",
69      "//drivers/hdf_core/framework/include/core",
70      "//drivers/hdf_core/framework/ability/sbuf/include",
71    ]
72    if (dsoftbus_feature_lnn_net) {
73      bus_center_adapter_src += [
74        "$adapter_bus_center_path/driver/lnn_hdf_driver_monitor.c",
75        "$adapter_bus_center_path/driver/lnn_hdf_driver_request.c",
76        "$adapter_bus_center_path/network/lnn_linkwatch_virtual.c",
77        "$adapter_bus_center_path/network/lnn_lwip_monitor_virtual.c",
78        "$adapter_bus_center_path/network/lnn_netlink_monitor_virtual.c",
79        "$adapter_bus_center_path/platform/lnn_product_monitor.c",
80        "$adapter_bus_center_path/boot_event/lnn_boot_event_monitor_virtual.cpp",
81        "$adapter_bus_center_path/common_event/lnn_common_event_monitor_virtual.cpp",
82        "$adapter_bus_center_path/wlan/lnn_wifiservice_monitor_virtual.cpp",
83        "$adapter_bus_center_path/network/lnn_netmanager_listener_virtual.cpp",
84      ]
85      bus_center_adapter_inc += [
86        "//drivers/hdf_core/framework/core/shared/include",
87        "//drivers/hdf_core/framework/include",
88      ]
89      bus_center_adapter_deps += [
90        "//drivers/hdf_core/adapter/uhdf/manager:hdf_core",
91        "//drivers/hdf_core/adapter/uhdf/platform:hdf_platform",
92        "//drivers/hdf_core/adapter/uhdf/posix:hdf_posix_osal",
93      ]
94    }
95  }
96} else {
97  bus_center_adapter_external_deps = []
98  if (has_ces_part) {
99    bus_center_adapter_src += [
100      "$adapter_bus_center_path/boot_event/lnn_boot_event_monitor.cpp",
101      "$adapter_bus_center_path/common_event/lnn_common_event_monitor.cpp",
102      "$adapter_bus_center_path/network/lnn_netmanager_listener.cpp",
103    ]
104    bus_center_adapter_external_deps += [
105      "ability_base:want",
106      "common_event_service:cesfwk_innerkits",
107      "init:libbeget_proxy",
108      "netmanager_base:net_conn_manager_if",
109      "power_manager:powermgr_client",
110    ]
111  } else {
112    bus_center_adapter_src += [
113      "$adapter_bus_center_path/boot_event/lnn_boot_event_monitor_virtual.cpp",
114      "$adapter_bus_center_path/common_event/lnn_common_event_monitor_virtual.cpp",
115      "$adapter_bus_center_path/network/lnn_netmanager_listener_virtual.cpp",
116    ]
117  }
118  if (dsoftbus_feature_lnn_net) {
119    bus_center_adapter_src += [
120      "$adapter_bus_center_path/driver/lnn_driver_monitor_virtual.c",
121      "$adapter_bus_center_path/driver/lnn_driver_request_virtual.c",
122      "$adapter_bus_center_path/network/lnn_linkwatch.c",
123      "$adapter_bus_center_path/network/lnn_lwip_monitor_virtual.c",
124      "$adapter_bus_center_path/network/lnn_netlink_monitor.c",
125      "$adapter_bus_center_path/platform/lnn_product_monitor_virtual.c",
126    ]
127    if (dsoftbus_feature_lnn_wifiservice_dependence && has_ces_part) {
128      bus_center_adapter_src +=
129          [ "$adapter_bus_center_path/wlan/lnn_wifiservice_monitor.cpp" ]
130      bus_center_adapter_external_deps += [
131        "ability_base:want",
132        "wifi:wifi_sdk",
133      ]
134    } else {
135      bus_center_adapter_src += [
136        "$adapter_bus_center_path/wlan/lnn_wifiservice_monitor_virtual.cpp",
137      ]
138    }
139  }
140}
141
142if (dsoftbus_feature_lnn_net) {
143  if (support_bluetooth &&
144      (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) {
145    bus_center_adapter_src +=
146        [ "$adapter_bus_center_path/network/lnn_bt_monitor.c" ]
147    bus_center_adapter_inc += [
148      "$softbus_adapter_common/net/bluetooth/include",
149      "$dsoftbus_root_path/core/common/dfx/interface/include",
150    ]
151    bus_center_adapter_external_deps += [ "wifi:wifi_sdk" ]
152    bus_center_adapter_deps +=
153        [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ]
154  } else {
155    bus_center_adapter_src +=
156        [ "$adapter_bus_center_path/network/lnn_bt_monitor_virtual.c" ]
157  }
158}
159