# Copyright (c) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//plugins/bluetooth/bluetooth.gni")

java_library("bluetooth_android_java") {
  java_files = [
    "java/src/ohos/ace/plugin/bluetoothplugin/BluetoothErrorCode.java",
    "java/src/ohos/ace/plugin/bluetoothplugin/BluetoothGattClient.java",
    "java/src/ohos/ace/plugin/bluetoothplugin/BluetoothHelper.java",
    "java/src/ohos/ace/plugin/bluetoothplugin/BluetoothPlugin.java",
    "java/src/ohos/ace/plugin/bluetoothplugin/CustomBluetoothManager.java",
    "java/src/ohos/ace/plugin/bluetoothplugin/CustomGattServer.java",
  ]
  classpath_deps = [
    "//foundation/arkui/ace_engine/adapter/android/build:ace_android_adapter_java"
  ]

  subsystem_name = "plugins"
  part_name = "bluetooth"
}

ohos_combine_jars("bluetooth_java") {
  deps = [ ":bluetooth_android_java" ]
  jar_path = "${root_out_dir}/plugins/bluetooth/ace_bluetooth_android.jar"

  subsystem_name = "plugins"
  part_name = "bluetooth"
}

ohos_source_set("bluetooth_manager_android") {
  include_dirs = [
    "$ace_root/frameworks/",
    "$ace_root/frameworks/base/utils",
    "$ace_root/interfaces/inner_api/ace_kit/include",
    "$bluetooth_inner_root/include",
    "$bluetooth_inner_root/ipc/common",
    "$bluetooth_inner_root/ipc/interface",
    "$bluetooth_inner_root/ipc/parcel",
    "$c_utils_root/base/include",
    "$subsystem_root/bluetooth/interfaces/inner_api/include",
    "//plugins/bluetooth/common/include",
    "//plugins/bluetooth/common/mock",
    "//plugins/bluetooth/impl/android/include",
    "//plugins/bluetooth/impl/android/java/jni",
    "//plugins/interfaces/native/inner_api",
    "//third_party/json/include",
  ]

  sources = [
    "bluetooth_a2dp_impl.cpp",
    "bluetooth_ble_advertiser_impl.cpp",
    "bluetooth_ble_centralmanager_impl.cpp",
    "bluetooth_gatt_client_impl.cpp",
    "bluetooth_gatt_server_impl.cpp",
    "bluetooth_host_impl.cpp",
    "bluetooth_impl_utils.cpp",
    "java/jni/bluetooth_jni.cpp",
  ]

  deps = [
    ":bluetooth_java",
    "$hilog_root/interfaces/native/innerkits:libhilog_android",
    "//plugins/interfaces/native:ace_plugin_util_android",
  ]

  subsystem_name = "plugins"
  part_name = "bluetooth"
}