195489c19Sopenharmony_ci# Copyright (C) 2021-2023 Huawei Device Co., Ltd. 295489c19Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 395489c19Sopenharmony_ci# you may not use this file except in compliance with the License. 495489c19Sopenharmony_ci# You may obtain a copy of the License at 595489c19Sopenharmony_ci# 695489c19Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 795489c19Sopenharmony_ci# 895489c19Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 995489c19Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1095489c19Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1195489c19Sopenharmony_ci# See the License for the specific language governing permissions and 1295489c19Sopenharmony_ci# limitations under the License. 1395489c19Sopenharmony_ci 1495489c19Sopenharmony_ciimport("//build/ohos.gni") 1595489c19Sopenharmony_ciimport("//build/ohos_var.gni") 1695489c19Sopenharmony_ciimport("//foundation/communication/bluetooth/bluetooth.gni") 1795489c19Sopenharmony_ci 1895489c19Sopenharmony_ciSUBSYSTEM_DIR = "//foundation/communication" 1995489c19Sopenharmony_ciJS_NAPI_DIR = "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi" 2095489c19Sopenharmony_ci 2195489c19Sopenharmony_ciFwkCAdapterSrc = [ 2295489c19Sopenharmony_ci "c_adapter/ohos_bt_adapter_utils.cpp", 2395489c19Sopenharmony_ci "c_adapter/ohos_bt_gap.cpp", 2495489c19Sopenharmony_ci "c_adapter/ohos_bt_gatt.cpp", 2595489c19Sopenharmony_ci "c_adapter/ohos_bt_gatt_utils.cpp", 2695489c19Sopenharmony_ci "c_adapter/ohos_bt_gatt_client.cpp", 2795489c19Sopenharmony_ci "c_adapter/ohos_bt_gatt_server.cpp", 2895489c19Sopenharmony_ci "c_adapter/ohos_bt_spp.cpp", 2995489c19Sopenharmony_ci "c_adapter/ohos_bt_socket.cpp", 3095489c19Sopenharmony_ci] 3195489c19Sopenharmony_ci 3295489c19Sopenharmony_ciFwkSrc = [ 3395489c19Sopenharmony_ci "src/bluetooth_a2dp_snk.cpp", 3495489c19Sopenharmony_ci "src/bluetooth_a2dp_src.cpp", 3595489c19Sopenharmony_ci "src/bluetooth_avrcp_ct.cpp", 3695489c19Sopenharmony_ci "src/bluetooth_avrcp_tg.cpp", 3795489c19Sopenharmony_ci "src/bluetooth_ble_advertiser.cpp", 3895489c19Sopenharmony_ci "src/bluetooth_ble_central_manager.cpp", 3995489c19Sopenharmony_ci "src/bluetooth_device_class.cpp", 4095489c19Sopenharmony_ci "src/bluetooth_gatt_characteristic.cpp", 4195489c19Sopenharmony_ci "src/bluetooth_gatt_client.cpp", 4295489c19Sopenharmony_ci "src/bluetooth_gatt_descriptor.cpp", 4395489c19Sopenharmony_ci "src/bluetooth_gatt_manager.cpp", 4495489c19Sopenharmony_ci "src/bluetooth_gatt_server.cpp", 4595489c19Sopenharmony_ci "src/bluetooth_gatt_service.cpp", 4695489c19Sopenharmony_ci "src/bluetooth_hfp_ag.cpp", 4795489c19Sopenharmony_ci "src/bluetooth_hfp_hf.cpp", 4895489c19Sopenharmony_ci "src/bluetooth_hid_host.cpp", 4995489c19Sopenharmony_ci "src/bluetooth_host.cpp", 5095489c19Sopenharmony_ci "src/bluetooth_map_mse.cpp", 5195489c19Sopenharmony_ci "src/bluetooth_opp.cpp", 5295489c19Sopenharmony_ci "src/bluetooth_pan.cpp", 5395489c19Sopenharmony_ci "src/bluetooth_profile_manager.cpp", 5495489c19Sopenharmony_ci "src/bluetooth_pbap_pse.cpp", 5595489c19Sopenharmony_ci "src/bluetooth_proxy_manager.cpp", 5695489c19Sopenharmony_ci "src/bluetooth_remote_device.cpp", 5795489c19Sopenharmony_ci "src/bluetooth_socket.cpp", 5895489c19Sopenharmony_ci "src/bluetooth_socket_inputstream.cpp", 5995489c19Sopenharmony_ci "src/bluetooth_socket_outputstream.cpp", 6095489c19Sopenharmony_ci "src/bluetooth_timer.cpp", 6195489c19Sopenharmony_ci "src/bluetooth_utils.cpp", 6295489c19Sopenharmony_ci "src/bluetooth_host_load_callback.cpp", 6395489c19Sopenharmony_ci "src/bluetooth_audio_manager.cpp", 6495489c19Sopenharmony_ci "src/uuid.cpp", 6595489c19Sopenharmony_ci "src/bluetooth_switch_module.cpp", 6695489c19Sopenharmony_ci "$JS_NAPI_DIR/src/common/napi_async_callback.cpp", 6795489c19Sopenharmony_ci "$JS_NAPI_DIR/src/common/napi_async_work.cpp", 6895489c19Sopenharmony_ci "$JS_NAPI_DIR/src/common/napi_bluetooth_error.cpp", 6995489c19Sopenharmony_ci "$JS_NAPI_DIR/src/common/napi_bluetooth_event.cpp", 7095489c19Sopenharmony_ci "$JS_NAPI_DIR/src/common/napi_bluetooth_utils.cpp", 7195489c19Sopenharmony_ci "$JS_NAPI_DIR/src/common/napi_event_subscribe_module.cpp", 7295489c19Sopenharmony_ci "$JS_NAPI_DIR/src/common/napi_native_object.cpp", 7395489c19Sopenharmony_ci "$JS_NAPI_DIR/src/common/napi_timer.cpp", 7495489c19Sopenharmony_ci "$JS_NAPI_DIR/src/parser/napi_parser_utils.cpp", 7595489c19Sopenharmony_ci] 7695489c19Sopenharmony_ci 7795489c19Sopenharmony_ciBT_IPCSRC_DIR = "ipc/src" 7895489c19Sopenharmony_ciFwkIpcSrc = [ 7995489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_a2dp_sink_observer_stub.cpp", 8095489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_a2dp_sink_proxy.cpp", 8195489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_a2dp_src_observer_stub.cpp", 8295489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_a2dp_src_proxy.cpp", 8395489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_avrcp_ct_observer_stub.cpp", 8495489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_avrcp_ct_proxy.cpp", 8595489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_avrcp_tg_observer_stub.cpp", 8695489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_avrcp_tg_proxy.cpp", 8795489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_ble_advertise_callback_stub.cpp", 8895489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_ble_advertiser_proxy.cpp", 8995489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_ble_central_manager_callback_stub.cpp", 9095489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_ble_central_manager_proxy.cpp", 9195489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_ble_peripheral_observer_stub.cpp", 9295489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_gatt_client_callback_stub.cpp", 9395489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_gatt_client_proxy.cpp", 9495489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_gatt_server_callback_stub.cpp", 9595489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_gatt_server_proxy.cpp", 9695489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_hfp_ag_observer_stub.cpp", 9795489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_hfp_ag_proxy.cpp", 9895489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_hfp_hf_observer_stub.cpp", 9995489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_hfp_hf_proxy.cpp", 10095489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_hid_host_observer_stub.cpp", 10195489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_hid_host_proxy.cpp", 10295489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_opp_observer_stub.cpp", 10395489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_opp_proxy.cpp", 10495489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_host_observer_stub.cpp", 10595489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_host_proxy.cpp", 10695489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_map_mse_observer_stub.cpp", 10795489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_map_mse_proxy.cpp", 10895489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_pan_observer_stub.cpp", 10995489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_pan_proxy.cpp", 11095489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_pbap_pse_observer_stub.cpp", 11195489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_pbap_pse_proxy.cpp", 11295489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_remote_device_observer_stub.cpp", 11395489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_socket_proxy.cpp", 11495489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_socket_observer_stub.cpp", 11595489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_audio_manager_proxy.cpp", 11695489c19Sopenharmony_ci "$BT_IPCSRC_DIR/bluetooth_resource_manager_observer_stub.cpp", 11795489c19Sopenharmony_ci] 11895489c19Sopenharmony_ci 11995489c19Sopenharmony_ciconfig("btframework_config") { 12095489c19Sopenharmony_ci cflags_cc = [ 12195489c19Sopenharmony_ci "-fPIC", 12295489c19Sopenharmony_ci "-Wno-unused-parameter", 12395489c19Sopenharmony_ci "-Wno-return-type-c-linkage", 12495489c19Sopenharmony_ci "-Wunused-private-field", 12595489c19Sopenharmony_ci ] 12695489c19Sopenharmony_ci include_dirs = [ 12795489c19Sopenharmony_ci "include", 12895489c19Sopenharmony_ci "ipc/include", 12995489c19Sopenharmony_ci "$SUBSYSTEM_DIR/bluetooth/interfaces/inner_api/include/c_header", 13095489c19Sopenharmony_ci "$JS_NAPI_DIR/include", 13195489c19Sopenharmony_ci ] 13295489c19Sopenharmony_ci 13395489c19Sopenharmony_ci defines = [] 13495489c19Sopenharmony_ci if (is_asan || use_clang_coverage) { 13595489c19Sopenharmony_ci defines += [ "DTFUZZ_TEST" ] 13695489c19Sopenharmony_ci } 13795489c19Sopenharmony_ci if (bluetooth_service_resourceschedule) { 13895489c19Sopenharmony_ci defines += [ "RES_SCHED_SUPPORT" ] 13995489c19Sopenharmony_ci } 14095489c19Sopenharmony_ci} 14195489c19Sopenharmony_ci 14295489c19Sopenharmony_ciconfig("btframework_public_config") { 14395489c19Sopenharmony_ci visibility = [ "*" ] 14495489c19Sopenharmony_ci include_dirs = [ 14595489c19Sopenharmony_ci "$SUBSYSTEM_DIR/bluetooth/interfaces/inner_api/include", 14695489c19Sopenharmony_ci "$SUBSYSTEM_DIR/bluetooth/interfaces/inner_api/include/c_header", 14795489c19Sopenharmony_ci ] 14895489c19Sopenharmony_ci} 14995489c19Sopenharmony_ci 15095489c19Sopenharmony_ciohos_shared_library("btframework") { 15195489c19Sopenharmony_ci branch_protector_ret = "pac_ret" # Enable PAC CFI 15295489c19Sopenharmony_ci configs = [ ":btframework_config" ] 15395489c19Sopenharmony_ci public_configs = [ ":btframework_public_config" ] 15495489c19Sopenharmony_ci innerapi_tags = [ "platformsdk" ] 15595489c19Sopenharmony_ci sources = FwkSrc 15695489c19Sopenharmony_ci sources += FwkCAdapterSrc 15795489c19Sopenharmony_ci sources += FwkIpcSrc 15895489c19Sopenharmony_ci 15995489c19Sopenharmony_ci deps = [ ":btcommon" ] 16095489c19Sopenharmony_ci 16195489c19Sopenharmony_ci external_deps = [ 16295489c19Sopenharmony_ci "bundle_framework:appexecfwk_base", 16395489c19Sopenharmony_ci "bundle_framework:appexecfwk_core", 16495489c19Sopenharmony_ci "c_utils:utils", 16595489c19Sopenharmony_ci "common_event_service:cesfwk_innerkits", 16695489c19Sopenharmony_ci "eventhandler:libeventhandler", 16795489c19Sopenharmony_ci "ffrt:libffrt", 16895489c19Sopenharmony_ci "hilog:libhilog", 16995489c19Sopenharmony_ci "hisysevent:libhisysevent", 17095489c19Sopenharmony_ci "init:libbegetutil", 17195489c19Sopenharmony_ci "ipc:ipc_core", 17295489c19Sopenharmony_ci "libuv:uv", 17395489c19Sopenharmony_ci "napi:ace_napi", 17495489c19Sopenharmony_ci "samgr:samgr_proxy", 17595489c19Sopenharmony_ci ] 17695489c19Sopenharmony_ci 17795489c19Sopenharmony_ci if (bluetooth_service_resourceschedule) { 17895489c19Sopenharmony_ci external_deps += [ "resource_schedule_service:ressched_client" ] 17995489c19Sopenharmony_ci } 18095489c19Sopenharmony_ci 18195489c19Sopenharmony_ci sanitize = { 18295489c19Sopenharmony_ci cfi = true # Enable/disable control flow integrity detection 18395489c19Sopenharmony_ci boundary_sanitize = true # Enable boundary san detection 18495489c19Sopenharmony_ci cfi_cross_dso = true # Cross-SO CFI Checks 18595489c19Sopenharmony_ci integer_overflow = true # Enable integer overflow detection 18695489c19Sopenharmony_ci ubsan = true # Enable some Ubsan options 18795489c19Sopenharmony_ci debug = false 18895489c19Sopenharmony_ci } 18995489c19Sopenharmony_ci subsystem_name = "communication" 19095489c19Sopenharmony_ci part_name = "bluetooth" 19195489c19Sopenharmony_ci} 19295489c19Sopenharmony_ci 19395489c19Sopenharmony_ciconfig("btcommon_config") { 19495489c19Sopenharmony_ci include_dirs = [ "include" ] 19595489c19Sopenharmony_ci} 19695489c19Sopenharmony_ci 19795489c19Sopenharmony_ciconfig("btcommon_public_config") { 19895489c19Sopenharmony_ci include_dirs = [ 19995489c19Sopenharmony_ci "ipc/common", 20095489c19Sopenharmony_ci "ipc/interface", 20195489c19Sopenharmony_ci "ipc/parcel", 20295489c19Sopenharmony_ci ] 20395489c19Sopenharmony_ci} 20495489c19Sopenharmony_ci 20595489c19Sopenharmony_ciohos_shared_library("btcommon") { 20695489c19Sopenharmony_ci branch_protector_ret = "pac_ret" # Enable PAC CFI 20795489c19Sopenharmony_ci configs = [ ":btcommon_config" ] 20895489c19Sopenharmony_ci public_configs = [ ":btcommon_public_config" ] 20995489c19Sopenharmony_ci innerapi_tags = [ "chipsetsdk" ] 21095489c19Sopenharmony_ci sanitize = { 21195489c19Sopenharmony_ci cfi = true # Enable/disable control flow integrity detection 21295489c19Sopenharmony_ci boundary_sanitize = true # Enable boundary san detection 21395489c19Sopenharmony_ci cfi_cross_dso = true # Cross-SO CFI Checks 21495489c19Sopenharmony_ci integer_overflow = true # Enable integer overflow detection 21595489c19Sopenharmony_ci ubsan = true # Enable some Ubsan options 21695489c19Sopenharmony_ci debug = false 21795489c19Sopenharmony_ci } 21895489c19Sopenharmony_ci sources = [ 21995489c19Sopenharmony_ci "ipc/common/avrcp_media.cpp", 22095489c19Sopenharmony_ci "ipc/common/ble_parcel_data.cpp", 22195489c19Sopenharmony_ci "ipc/common/ble_service_data.cpp", 22295489c19Sopenharmony_ci "ipc/common/bt_uuid.cpp", 22395489c19Sopenharmony_ci "ipc/common/gatt_data.cpp", 22495489c19Sopenharmony_ci "ipc/common/hands_free_unit_calls.cpp", 22595489c19Sopenharmony_ci "ipc/common/opp_transfer_information.cpp", 22695489c19Sopenharmony_ci "ipc/common/raw_address.cpp", 22795489c19Sopenharmony_ci "ipc/parcel/bluetooth_a2dp_a2dpCodecInfo.cpp", 22895489c19Sopenharmony_ci "ipc/parcel/bluetooth_a2dp_a2dpCodecStatus.cpp", 22995489c19Sopenharmony_ci "ipc/parcel/bluetooth_avrcp_meItem.cpp", 23095489c19Sopenharmony_ci "ipc/parcel/bluetooth_avrcp_mpItem.cpp", 23195489c19Sopenharmony_ci "ipc/parcel/bluetooth_ble_advertiser_data.cpp", 23295489c19Sopenharmony_ci "ipc/parcel/bluetooth_ble_advertiser_settings.cpp", 23395489c19Sopenharmony_ci "ipc/parcel/bluetooth_ble_scan_filter.cpp", 23495489c19Sopenharmony_ci "ipc/parcel/bluetooth_ble_scan_result.cpp", 23595489c19Sopenharmony_ci "ipc/parcel/bluetooth_ble_scan_settings.cpp", 23695489c19Sopenharmony_ci "ipc/parcel/bluetooth_bt_uuid.cpp", 23795489c19Sopenharmony_ci "ipc/parcel/bluetooth_device_battery_info.cpp", 23895489c19Sopenharmony_ci "ipc/parcel/bluetooth_gatt_characteristic_parcel.cpp", 23995489c19Sopenharmony_ci "ipc/parcel/bluetooth_gatt_descriptor_parcel.cpp", 24095489c19Sopenharmony_ci "ipc/parcel/bluetooth_gatt_device.cpp", 24195489c19Sopenharmony_ci "ipc/parcel/bluetooth_gatt_service_parcel.cpp", 24295489c19Sopenharmony_ci "ipc/parcel/bluetooth_hfp_hf_call.cpp", 24395489c19Sopenharmony_ci "ipc/parcel/bluetooth_opp_transfer_information.cpp", 24495489c19Sopenharmony_ci "ipc/parcel/bluetooth_phone_state.cpp", 24595489c19Sopenharmony_ci "ipc/parcel/bluetooth_raw_address.cpp", 24695489c19Sopenharmony_ci "ipc/parcel/bluetooth_remote_device_info.cpp", 24795489c19Sopenharmony_ci "ipc/parcel/bluetooth_sensing_info.cpp", 24895489c19Sopenharmony_ci "ipc/parcel/bluetooth_socket_coc.cpp", 24995489c19Sopenharmony_ci "ipc/parcel/parcel_bt_uuid.cpp", 25095489c19Sopenharmony_ci ] 25195489c19Sopenharmony_ci 25295489c19Sopenharmony_ci deps = [] 25395489c19Sopenharmony_ci 25495489c19Sopenharmony_ci external_deps = [ 25595489c19Sopenharmony_ci "c_utils:utils", 25695489c19Sopenharmony_ci "hilog:libhilog", 25795489c19Sopenharmony_ci "hisysevent:libhisysevent", 25895489c19Sopenharmony_ci "ipc:ipc_core", 25995489c19Sopenharmony_ci ] 26095489c19Sopenharmony_ci 26195489c19Sopenharmony_ci subsystem_name = "communication" 26295489c19Sopenharmony_ci part_name = "bluetooth" 26395489c19Sopenharmony_ci} 264