119e95205Sopenharmony_ci# Copyright (C) 2021-2022 Huawei Device Co., Ltd.
219e95205Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
319e95205Sopenharmony_ci# you may not use this file except in compliance with the License.
419e95205Sopenharmony_ci# You may obtain a copy of the License at
519e95205Sopenharmony_ci#
619e95205Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
719e95205Sopenharmony_ci#
819e95205Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
919e95205Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1019e95205Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1119e95205Sopenharmony_ci# See the License for the specific language governing permissions and
1219e95205Sopenharmony_ci# limitations under the License.
1319e95205Sopenharmony_ci
1419e95205Sopenharmony_ciimport("//build/ohos.gni")
1519e95205Sopenharmony_ciimport("//build/ohos_var.gni")
1619e95205Sopenharmony_ciimport("//foundation/communication/bluetooth_service/bluetooth.gni")
1719e95205Sopenharmony_ci
1819e95205Sopenharmony_ciSUBSYSTEM_DIR = "//foundation/communication"
1919e95205Sopenharmony_ciBT_ROOT = "//foundation/communication/bluetooth_service/services/bluetooth"
2019e95205Sopenharmony_ci
2119e95205Sopenharmony_ciohos_shared_library("bluetooth_server") {
2219e95205Sopenharmony_ci  # sanitize = {
2319e95205Sopenharmony_ci  #   cfi = true
2419e95205Sopenharmony_ci  #   blocklist = "./bluetooth_server_blocklist.txt"
2519e95205Sopenharmony_ci  # }
2619e95205Sopenharmony_ci  stack_protector_ret = true
2719e95205Sopenharmony_ci  include_dirs = [
2819e95205Sopenharmony_ci    "include",
2919e95205Sopenharmony_ci    "//foundation/communication/bluetooth/frameworks/inner/include",
3019e95205Sopenharmony_ci    "//foundation/communication/bluetooth/interfaces/inner_api/include",
3119e95205Sopenharmony_ci    "//foundation/communication/bluetooth_service/services/bluetooth/service/include",
3219e95205Sopenharmony_ci    "//foundation/communication/bluetooth_service/services/bluetooth/service/src/ble",
3319e95205Sopenharmony_ci    "//foundation/communication/bluetooth_service/services/bluetooth/service/src/permission",
3419e95205Sopenharmony_ci    "//foundation/communication/bluetooth_service/services/bluetooth/stack/include",
3519e95205Sopenharmony_ci    "$BT_ROOT/common",
3619e95205Sopenharmony_ci  ]
3719e95205Sopenharmony_ci
3819e95205Sopenharmony_ci  sources = [
3919e95205Sopenharmony_ci    "src/bluetooth_ble_advertiser_server.cpp",
4019e95205Sopenharmony_ci    "src/bluetooth_ble_central_manager_server.cpp",
4119e95205Sopenharmony_ci    "src/bluetooth_ble_filter_matcher.cpp",
4219e95205Sopenharmony_ci    "src/bluetooth_gatt_client_server.cpp",
4319e95205Sopenharmony_ci    "src/bluetooth_gatt_server_server.cpp",
4419e95205Sopenharmony_ci    "src/bluetooth_hitrace.cpp",
4519e95205Sopenharmony_ci    "src/bluetooth_host_dumper.cpp",
4619e95205Sopenharmony_ci    "src/bluetooth_host_server.cpp",
4719e95205Sopenharmony_ci    "src/bluetooth_socket_server.cpp",
4819e95205Sopenharmony_ci    "src/bluetooth_utils_server.cpp",
4919e95205Sopenharmony_ci  ]
5019e95205Sopenharmony_ci
5119e95205Sopenharmony_ci  defines = []
5219e95205Sopenharmony_ci
5319e95205Sopenharmony_ci  if (bluetooth_service_a2dp_sink_feature) {
5419e95205Sopenharmony_ci    defines += [ "BLUETOOTH_A2DP_SINK_FEATURE" ]
5519e95205Sopenharmony_ci
5619e95205Sopenharmony_ci    sources += [ "src/bluetooth_a2dp_sink_server.cpp" ]
5719e95205Sopenharmony_ci  }
5819e95205Sopenharmony_ci
5919e95205Sopenharmony_ci  if (bluetooth_service_a2dp_source_feature) {
6019e95205Sopenharmony_ci    defines += [ "BLUETOOTH_A2DP_SRC_FEATURE" ]
6119e95205Sopenharmony_ci
6219e95205Sopenharmony_ci    sources += [ "src/bluetooth_a2dp_source_server.cpp" ]
6319e95205Sopenharmony_ci  }
6419e95205Sopenharmony_ci
6519e95205Sopenharmony_ci  if (bluetooth_service_avrcp_ct_feature) {
6619e95205Sopenharmony_ci    defines += [ "BLUETOOTH_AVRCP_CT_FEATURE" ]
6719e95205Sopenharmony_ci
6819e95205Sopenharmony_ci    sources += [ "src/bluetooth_avrcp_ct_server.cpp" ]
6919e95205Sopenharmony_ci  }
7019e95205Sopenharmony_ci
7119e95205Sopenharmony_ci  if (bluetooth_service_avrcp_tg_feature) {
7219e95205Sopenharmony_ci    defines += [ "BLUETOOTH_AVRCP_TG_FEATURE" ]
7319e95205Sopenharmony_ci
7419e95205Sopenharmony_ci    sources += [ "src/bluetooth_avrcp_tg_server.cpp" ]
7519e95205Sopenharmony_ci  }
7619e95205Sopenharmony_ci
7719e95205Sopenharmony_ci  if (bluetooth_service_hfp_ag_feature) {
7819e95205Sopenharmony_ci    defines += [ "BLUETOOTH_HFP_AG_FEATURE" ]
7919e95205Sopenharmony_ci
8019e95205Sopenharmony_ci    sources += [ "src/bluetooth_hfp_ag_server.cpp" ]
8119e95205Sopenharmony_ci  }
8219e95205Sopenharmony_ci
8319e95205Sopenharmony_ci  if (bluetooth_service_hfp_hf_feature) {
8419e95205Sopenharmony_ci    defines += [ "BLUETOOTH_HFP_HF_FEATURE" ]
8519e95205Sopenharmony_ci
8619e95205Sopenharmony_ci    sources += [ "src/bluetooth_hfp_hf_server.cpp" ]
8719e95205Sopenharmony_ci  }
8819e95205Sopenharmony_ci
8919e95205Sopenharmony_ci  if (bluetooth_service_hid_host_feature) {
9019e95205Sopenharmony_ci    defines += [ "BLUETOOTH_HID_HOST_FEATURE" ]
9119e95205Sopenharmony_ci
9219e95205Sopenharmony_ci    sources += [ "src/bluetooth_hid_host_server.cpp" ]
9319e95205Sopenharmony_ci  }
9419e95205Sopenharmony_ci
9519e95205Sopenharmony_ci  if (bluetooth_service_pan_feature) {
9619e95205Sopenharmony_ci    defines += [ "BLUETOOTH_PAN_FEATURE" ]
9719e95205Sopenharmony_ci
9819e95205Sopenharmony_ci    sources += [ "src/bluetooth_pan_server.cpp" ]
9919e95205Sopenharmony_ci  }
10019e95205Sopenharmony_ci
10119e95205Sopenharmony_ci  deps = [
10219e95205Sopenharmony_ci    "$BT_ROOT/etc/init:etc",
10319e95205Sopenharmony_ci    "$SUBSYSTEM_DIR/bluetooth_service/services/bluetooth/ipc:btipc_service",
10419e95205Sopenharmony_ci    "$SUBSYSTEM_DIR/bluetooth_service/services/bluetooth/service:btservice",
10519e95205Sopenharmony_ci  ]
10619e95205Sopenharmony_ci
10719e95205Sopenharmony_ci  external_deps = [
10819e95205Sopenharmony_ci    "ability_base:base",
10919e95205Sopenharmony_ci    "access_token:libaccesstoken_sdk",
11019e95205Sopenharmony_ci    "bluetooth:btcommon",
11119e95205Sopenharmony_ci    "c_utils:utils",
11219e95205Sopenharmony_ci    "eventhandler:libeventhandler",
11319e95205Sopenharmony_ci    "hilog:libhilog",
11419e95205Sopenharmony_ci    "hisysevent:libhisysevent",
11519e95205Sopenharmony_ci    "hitrace:hitrace_meter",
11619e95205Sopenharmony_ci    "ipc:ipc_core",
11719e95205Sopenharmony_ci    "safwk:system_ability_fwk",
11819e95205Sopenharmony_ci    "samgr:samgr_proxy",
11919e95205Sopenharmony_ci  ]
12019e95205Sopenharmony_ci
12119e95205Sopenharmony_ci  part_name = "bluetooth_service"
12219e95205Sopenharmony_ci  subsystem_name = "communication"
12319e95205Sopenharmony_ci}
12419e95205Sopenharmony_ci
12519e95205Sopenharmony_cigroup("bluetooth_codec") {
12619e95205Sopenharmony_ci  deps = [ "$BT_ROOT/service:btsbc" ]
12719e95205Sopenharmony_ci}
128