• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021-2023 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("//build/ohos.gni")
15import("//build/ohos_var.gni")
16import("//foundation/communication/bluetooth/bluetooth.gni")
17
18SUBSYSTEM_DIR = "//foundation/communication"
19
20FwkCAdapterSrc = [
21  "c_adapter/ohos_bt_adapter_utils.cpp",
22  "c_adapter/ohos_bt_gap.cpp",
23  "c_adapter/ohos_bt_gatt.cpp",
24  "c_adapter/ohos_bt_gatt_utils.cpp",
25  "c_adapter/ohos_bt_gatt_client.cpp",
26  "c_adapter/ohos_bt_gatt_server.cpp",
27  "c_adapter/ohos_bt_spp.cpp",
28  "c_adapter/ohos_bt_socket.cpp",
29]
30
31FwkSrc = [
32  "src/bluetooth_a2dp_snk.cpp",
33  "src/bluetooth_a2dp_src.cpp",
34  "src/bluetooth_avrcp_ct.cpp",
35  "src/bluetooth_avrcp_tg.cpp",
36  "src/bluetooth_ble_advertiser.cpp",
37  "src/bluetooth_ble_central_manager.cpp",
38  "src/bluetooth_device_class.cpp",
39  "src/bluetooth_gatt_characteristic.cpp",
40  "src/bluetooth_gatt_client.cpp",
41  "src/bluetooth_gatt_descriptor.cpp",
42  "src/bluetooth_gatt_manager.cpp",
43  "src/bluetooth_gatt_server.cpp",
44  "src/bluetooth_gatt_service.cpp",
45  "src/bluetooth_hfp_ag.cpp",
46  "src/bluetooth_hfp_hf.cpp",
47  "src/bluetooth_hid_host.cpp",
48  "src/bluetooth_host.cpp",
49  "src/bluetooth_map_mse.cpp",
50  "src/bluetooth_opp.cpp",
51  "src/bluetooth_pan.cpp",
52  "src/bluetooth_profile_manager.cpp",
53  "src/bluetooth_pbap_pse.cpp",
54  "src/bluetooth_proxy_manager.cpp",
55  "src/bluetooth_remote_device.cpp",
56  "src/bluetooth_socket.cpp",
57  "src/bluetooth_socket_inputstream.cpp",
58  "src/bluetooth_socket_outputstream.cpp",
59  "src/bluetooth_timer.cpp",
60  "src/bluetooth_utils.cpp",
61  "src/bluetooth_host_load_callback.cpp",
62  "src/bluetooth_audio_manager.cpp",
63  "src/uuid.cpp",
64  "src/bluetooth_switch_module.cpp",
65]
66
67BT_IPCSRC_DIR = "ipc/src"
68FwkIpcSrc = [
69  "$BT_IPCSRC_DIR/bluetooth_a2dp_sink_observer_stub.cpp",
70  "$BT_IPCSRC_DIR/bluetooth_a2dp_sink_proxy.cpp",
71  "$BT_IPCSRC_DIR/bluetooth_a2dp_src_observer_stub.cpp",
72  "$BT_IPCSRC_DIR/bluetooth_a2dp_src_proxy.cpp",
73  "$BT_IPCSRC_DIR/bluetooth_avrcp_ct_observer_stub.cpp",
74  "$BT_IPCSRC_DIR/bluetooth_avrcp_ct_proxy.cpp",
75  "$BT_IPCSRC_DIR/bluetooth_avrcp_tg_observer_stub.cpp",
76  "$BT_IPCSRC_DIR/bluetooth_avrcp_tg_proxy.cpp",
77  "$BT_IPCSRC_DIR/bluetooth_ble_advertise_callback_stub.cpp",
78  "$BT_IPCSRC_DIR/bluetooth_ble_advertiser_proxy.cpp",
79  "$BT_IPCSRC_DIR/bluetooth_ble_central_manager_callback_stub.cpp",
80  "$BT_IPCSRC_DIR/bluetooth_ble_central_manager_proxy.cpp",
81  "$BT_IPCSRC_DIR/bluetooth_ble_peripheral_observer_stub.cpp",
82  "$BT_IPCSRC_DIR/bluetooth_gatt_client_callback_stub.cpp",
83  "$BT_IPCSRC_DIR/bluetooth_gatt_client_proxy.cpp",
84  "$BT_IPCSRC_DIR/bluetooth_gatt_server_callback_stub.cpp",
85  "$BT_IPCSRC_DIR/bluetooth_gatt_server_proxy.cpp",
86  "$BT_IPCSRC_DIR/bluetooth_hfp_ag_observer_stub.cpp",
87  "$BT_IPCSRC_DIR/bluetooth_hfp_ag_proxy.cpp",
88  "$BT_IPCSRC_DIR/bluetooth_hfp_hf_observer_stub.cpp",
89  "$BT_IPCSRC_DIR/bluetooth_hfp_hf_proxy.cpp",
90  "$BT_IPCSRC_DIR/bluetooth_hid_host_observer_stub.cpp",
91  "$BT_IPCSRC_DIR/bluetooth_hid_host_proxy.cpp",
92  "$BT_IPCSRC_DIR/bluetooth_opp_observer_stub.cpp",
93  "$BT_IPCSRC_DIR/bluetooth_opp_proxy.cpp",
94  "$BT_IPCSRC_DIR/bluetooth_host_observer_stub.cpp",
95  "$BT_IPCSRC_DIR/bluetooth_host_proxy.cpp",
96  "$BT_IPCSRC_DIR/bluetooth_map_mse_observer_stub.cpp",
97  "$BT_IPCSRC_DIR/bluetooth_map_mse_proxy.cpp",
98  "$BT_IPCSRC_DIR/bluetooth_pan_observer_stub.cpp",
99  "$BT_IPCSRC_DIR/bluetooth_pan_proxy.cpp",
100  "$BT_IPCSRC_DIR/bluetooth_pbap_pse_observer_stub.cpp",
101  "$BT_IPCSRC_DIR/bluetooth_pbap_pse_proxy.cpp",
102  "$BT_IPCSRC_DIR/bluetooth_remote_device_observer_stub.cpp",
103  "$BT_IPCSRC_DIR/bluetooth_socket_proxy.cpp",
104  "$BT_IPCSRC_DIR/bluetooth_socket_observer_stub.cpp",
105  "$BT_IPCSRC_DIR/bluetooth_audio_manager_proxy.cpp",
106  "$BT_IPCSRC_DIR/bluetooth_resource_manager_observer_stub.cpp",
107]
108
109config("btframework_config") {
110  cflags_cc = [
111    "-fPIC",
112    "-Wno-unused-parameter",
113    "-Wno-return-type-c-linkage",
114    "-Wunused-private-field",
115  ]
116  include_dirs = [
117    "include",
118    "ipc/include",
119    "ipc",
120    "$SUBSYSTEM_DIR/bluetooth/interfaces/inner_api/include/c_header",
121    "$SUBSYSTEM_DIR/bluetooth/frameworks/inner/ipc/include",
122    "$SUBSYSTEM_DIR/bluetooth/frameworks/inner/include",
123  ]
124
125  defines = []
126  if (is_asan || use_clang_coverage) {
127    defines += [ "DTFUZZ_TEST" ]
128  }
129  if (bluetooth_service_resourceschedule) {
130    defines += [ "RES_SCHED_SUPPORT" ]
131  }
132}
133
134config("btframework_public_config") {
135  visibility = [ "*" ]
136  include_dirs = [
137    "$SUBSYSTEM_DIR/bluetooth/interfaces/inner_api/include",
138    "$SUBSYSTEM_DIR/bluetooth/interfaces/inner_api/include/c_header",
139  ]
140}
141
142ohos_shared_library("btframework") {
143  branch_protector_ret = "pac_ret"  # Enable PAC CFI
144  configs = [ ":btframework_config" ]
145  public_configs = [ ":btframework_public_config" ]
146  innerapi_tags = [ "platformsdk" ]
147  sources = FwkSrc
148  sources += FwkCAdapterSrc
149  sources += FwkIpcSrc
150
151  deps = [ ":btcommon" ]
152
153  external_deps = [
154    "c_utils:utils",
155    "common_event_service:cesfwk_innerkits",
156    "eventhandler:libeventhandler",
157    "ffrt:libffrt",
158    "hilog:libhilog",
159    "hisysevent:libhisysevent",
160    "init:libbegetutil",
161    "ipc:ipc_core",
162    "samgr:samgr_proxy",
163  ]
164
165  if (bluetooth_service_resourceschedule) {
166    external_deps += [ "resource_schedule_service:ressched_client" ]
167  }
168
169  sanitize = {
170    cfi = true  # Enable/disable control flow integrity detection
171    boundary_sanitize = true  # Enable boundary san detection
172    cfi_cross_dso = true  # Cross-SO CFI Checks
173    integer_overflow = true  # Enable integer overflow detection
174    ubsan = true  # Enable some Ubsan options
175    debug = false
176  }
177  subsystem_name = "communication"
178  part_name = "bluetooth"
179}
180
181config("btcommon_config") {
182  include_dirs = [
183    "include",
184    "ipc",
185    ]
186}
187
188config("btcommon_public_config") {
189  include_dirs = [
190    "ipc",
191    "ipc/common",
192    "ipc/interface",
193    "ipc/parcel",
194    "$SUBSYSTEM_DIR/bluetooth/frameworks/inner/ipc",
195    "$SUBSYSTEM_DIR/bluetooth/frameworks/inner/include",
196  ]
197}
198
199ohos_shared_library("btcommon") {
200  branch_protector_ret = "pac_ret"  # Enable PAC CFI
201  configs = [ ":btcommon_config" ]
202  public_configs = [ ":btcommon_public_config" ]
203  innerapi_tags = [ "chipsetsdk" ]
204  sanitize = {
205    cfi = true  # Enable/disable control flow integrity detection
206    boundary_sanitize = true  # Enable boundary san detection
207    cfi_cross_dso = true  # Cross-SO CFI Checks
208    integer_overflow = true  # Enable integer overflow detection
209    ubsan = true  # Enable some Ubsan options
210    debug = false
211  }
212  sources = [
213    "ipc/common/avrcp_media.cpp",
214    "ipc/common/ble_parcel_data.cpp",
215    "ipc/common/ble_service_data.cpp",
216    "ipc/common/bt_trust_pair_device.cpp",
217    "ipc/common/bt_uuid.cpp",
218    "ipc/common/gatt_data.cpp",
219    "ipc/common/hands_free_unit_calls.cpp",
220    "ipc/common/opp_transfer_information.cpp",
221    "ipc/common/raw_address.cpp",
222    "ipc/parcel/bluetooth_a2dp_a2dpCodecInfo.cpp",
223    "ipc/parcel/bluetooth_a2dp_a2dpCodecStatus.cpp",
224    "ipc/parcel/bluetooth_avrcp_meItem.cpp",
225    "ipc/parcel/bluetooth_avrcp_mpItem.cpp",
226    "ipc/parcel/bluetooth_ble_advertiser_data.cpp",
227    "ipc/parcel/bluetooth_ble_advertiser_settings.cpp",
228    "ipc/parcel/bluetooth_ble_scan_filter.cpp",
229    "ipc/parcel/bluetooth_ble_scan_result.cpp",
230    "ipc/parcel/bluetooth_ble_scan_settings.cpp",
231    "ipc/parcel/bluetooth_bt_uuid.cpp",
232    "ipc/parcel/bluetooth_device_battery_info.cpp",
233    "ipc/parcel/bluetooth_gatt_characteristic_parcel.cpp",
234    "ipc/parcel/bluetooth_gatt_descriptor_parcel.cpp",
235    "ipc/parcel/bluetooth_gatt_device.cpp",
236    "ipc/parcel/bluetooth_gatt_service_parcel.cpp",
237    "ipc/parcel/bluetooth_hfp_hf_call.cpp",
238    "ipc/parcel/bluetooth_opp_transfer_information.cpp",
239    "ipc/parcel/bluetooth_phone_state.cpp",
240    "ipc/parcel/bluetooth_raw_address.cpp",
241    "ipc/parcel/bluetooth_remote_device_info.cpp",
242    "ipc/parcel/bluetooth_sensing_info.cpp",
243    "ipc/parcel/bluetooth_socket_coc.cpp",
244    "ipc/parcel/bluetooth_trust_pair_device.cpp",
245    "ipc/parcel/parcel_bt_uuid.cpp",
246  ]
247
248  deps = []
249
250  external_deps = [
251    "c_utils:utils",
252    "hilog:libhilog",
253    "hisysevent:libhisysevent",
254    "ipc:ipc_core",
255  ]
256
257  subsystem_name = "communication"
258  part_name = "bluetooth"
259}
260