• 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    "$SUBSYSTEM_DIR/bluetooth/interfaces/inner_api/include/c_header",
120  ]
121
122  defines = []
123  if (is_asan || use_clang_coverage) {
124    defines += [ "DTFUZZ_TEST" ]
125  }
126  if (bluetooth_service_resourceschedule) {
127    defines += [ "RES_SCHED_SUPPORT" ]
128  }
129}
130
131config("btframework_public_config") {
132  visibility = [ "*" ]
133  include_dirs = [
134    "$SUBSYSTEM_DIR/bluetooth/interfaces/inner_api/include",
135    "$SUBSYSTEM_DIR/bluetooth/interfaces/inner_api/include/c_header",
136  ]
137}
138
139ohos_shared_library("btframework") {
140  branch_protector_ret = "pac_ret"  # Enable PAC CFI
141  configs = [ ":btframework_config" ]
142  public_configs = [ ":btframework_public_config" ]
143  innerapi_tags = [ "platformsdk" ]
144  sources = FwkSrc
145  sources += FwkCAdapterSrc
146  sources += FwkIpcSrc
147
148  deps = [ ":btcommon" ]
149
150  external_deps = [
151    "c_utils:utils",
152    "common_event_service:cesfwk_innerkits",
153    "eventhandler:libeventhandler",
154    "ffrt:libffrt",
155    "hilog:libhilog",
156    "hisysevent:libhisysevent",
157    "init:libbegetutil",
158    "ipc:ipc_core",
159    "samgr:samgr_proxy",
160  ]
161
162  if (bluetooth_service_resourceschedule) {
163    external_deps += [ "resource_schedule_service:ressched_client" ]
164  }
165
166  sanitize = {
167    cfi = true  # Enable/disable control flow integrity detection
168    boundary_sanitize = true  # Enable boundary san detection
169    cfi_cross_dso = true  # Cross-SO CFI Checks
170    integer_overflow = true  # Enable integer overflow detection
171    ubsan = true  # Enable some Ubsan options
172    debug = false
173  }
174  subsystem_name = "communication"
175  part_name = "bluetooth"
176}
177
178config("btcommon_config") {
179  include_dirs = [ "include" ]
180}
181
182config("btcommon_public_config") {
183  include_dirs = [
184    "ipc/common",
185    "ipc/interface",
186    "ipc/parcel",
187  ]
188}
189
190ohos_shared_library("btcommon") {
191  branch_protector_ret = "pac_ret"  # Enable PAC CFI
192  configs = [ ":btcommon_config" ]
193  public_configs = [ ":btcommon_public_config" ]
194  innerapi_tags = [ "chipsetsdk" ]
195  sanitize = {
196    cfi = true  # Enable/disable control flow integrity detection
197    boundary_sanitize = true  # Enable boundary san detection
198    cfi_cross_dso = true  # Cross-SO CFI Checks
199    integer_overflow = true  # Enable integer overflow detection
200    ubsan = true  # Enable some Ubsan options
201    debug = false
202  }
203  sources = [
204    "ipc/common/avrcp_media.cpp",
205    "ipc/common/ble_parcel_data.cpp",
206    "ipc/common/ble_service_data.cpp",
207    "ipc/common/bt_trust_pair_device.cpp",
208    "ipc/common/bt_uuid.cpp",
209    "ipc/common/gatt_data.cpp",
210    "ipc/common/hands_free_unit_calls.cpp",
211    "ipc/common/opp_transfer_information.cpp",
212    "ipc/common/raw_address.cpp",
213    "ipc/parcel/bluetooth_a2dp_a2dpCodecInfo.cpp",
214    "ipc/parcel/bluetooth_a2dp_a2dpCodecStatus.cpp",
215    "ipc/parcel/bluetooth_avrcp_meItem.cpp",
216    "ipc/parcel/bluetooth_avrcp_mpItem.cpp",
217    "ipc/parcel/bluetooth_ble_advertiser_data.cpp",
218    "ipc/parcel/bluetooth_ble_advertiser_settings.cpp",
219    "ipc/parcel/bluetooth_ble_scan_filter.cpp",
220    "ipc/parcel/bluetooth_ble_scan_result.cpp",
221    "ipc/parcel/bluetooth_ble_scan_settings.cpp",
222    "ipc/parcel/bluetooth_bt_uuid.cpp",
223    "ipc/parcel/bluetooth_device_battery_info.cpp",
224    "ipc/parcel/bluetooth_gatt_characteristic_parcel.cpp",
225    "ipc/parcel/bluetooth_gatt_descriptor_parcel.cpp",
226    "ipc/parcel/bluetooth_gatt_device.cpp",
227    "ipc/parcel/bluetooth_gatt_service_parcel.cpp",
228    "ipc/parcel/bluetooth_hfp_hf_call.cpp",
229    "ipc/parcel/bluetooth_opp_transfer_information.cpp",
230    "ipc/parcel/bluetooth_phone_state.cpp",
231    "ipc/parcel/bluetooth_raw_address.cpp",
232    "ipc/parcel/bluetooth_remote_device_info.cpp",
233    "ipc/parcel/bluetooth_sensing_info.cpp",
234    "ipc/parcel/bluetooth_socket_coc.cpp",
235    "ipc/parcel/bluetooth_trust_pair_device.cpp",
236    "ipc/parcel/parcel_bt_uuid.cpp",
237  ]
238
239  deps = []
240
241  external_deps = [
242    "c_utils:utils",
243    "hilog:libhilog",
244    "hisysevent:libhisysevent",
245    "ipc:ipc_core",
246  ]
247
248  subsystem_name = "communication"
249  part_name = "bluetooth"
250}
251