#
# 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("../iotc.gni")
iotc_adapter_inc = [
"$iotc_adapter_path/include",
]
if (defined(ohos_lite)) {
iotc_adapter_inc += [
"//third_party/cJSON",
"//third_party/bounds_checking_function/include",
]
}
iotc_adapter_src = [
"$iotc_adapter_path/crypto/mbedtls/iotc_aes.c",
"$iotc_adapter_path/crypto/mbedtls/iotc_base64.c",
"$iotc_adapter_path/crypto/mbedtls/iotc_drbg.c",
"$iotc_adapter_path/crypto/mbedtls/iotc_kdf.c",
"$iotc_adapter_path/crypto/mbedtls/iotc_md.c",
"$iotc_adapter_path/crypto/mbedtls/iotc_mpi.c",
"$iotc_adapter_path/crypto/mbedtls/iotc_rsa.c",
"$iotc_adapter_path/json/cjson/iotc_json.c",
"$iotc_adapter_path/log/iotc_log_inner.c",
"$iotc_adapter_path/mem/stdlib/iotc_mem.c",
"$iotc_adapter_path/tls/mbedtls/iotc_tls.c",
]
iotc_adapter_def = []
iotc_adapter_dep = []
if (iot_connect_ble_support) {
if (defined(ohos_lite)) {
iotc_adapter_src += ["$iotc_adapter_path/ble/ohos_lite/iotc_ble.c"]
} else {
iotc_adapter_src += ["$iotc_adapter_path/ble/ohos_standard/iotc_ble.c"]
}
iotc_adapter_def += ["IOTC_CONF_BLE_SUPPORT=1"]
if (board_name == "rtl8720") {
iotc_adapter_inc += ["//device/realtek/rtl8720/sdk-ameba-v7.1d/component/common/bluetooth/realtek/sdk/example/bt_harmony_adapter"]
} else if (defined(ohos_lite)) {
iotc_adapter_inc += ["//foundation/communication/bluetooth/interfaces/inner_api/include/c_header"]
if (board_hi3863) {
iotc_adapter_inc += ["//device/soc/hisilicon/hi3863v100/sdk_liteos/open_source/mbedtls/mbedtls_v3.1.0/include"]
} else {
iotc_adapter_inc += ["//third_party/mbedtls/include"]
}
}
}
if (iot_connect_sle_support) {
if (defined(ohos_lite)) {
iotc_adapter_src += ["$iotc_adapter_path/sle/ohos_lite/iotc_sle_server.c"]
iotc_adapter_src += ["$iotc_adapter_path/sle/ohos_lite/iotc_sle_host.c"]
iotc_adapter_src += ["$iotc_adapter_path/sle/ohos_lite/iotc_sle_announce.c"]
iotc_adapter_src += ["$iotc_adapter_path/sle/ohos_lite/iotc_sle_ext.c"]
iotc_adapter_inc += ["//foundation/communication/bluetooth/interfaces/inner_api/include/c_header"]
iotc_adapter_inc += ["//third_party/mbedtls/include"]
iotc_adapter_inc += ["//device/soc/hisilicon/hi3863v100/sdk_liteos/include/middleware/services/bts/sle"]
} else {
iotc_adapter_src += ["$iotc_adapter_path/sle/ohos_standard/iotc_sle.c"]
}
iotc_adapter_def += ["IOTC_CONF_SLE_SUPPORT=1"]
}
if (iot_connect_wifi_support) {
iotc_adapter_src += ["$iotc_adapter_path/socket/iotc_socket.c"]
if (ohos_kernel_type == "liteos_m") {
iotc_adapter_src += [
"$iotc_adapter_path/wifi/oh_lite/iotc_network.c",
"$iotc_adapter_path/wifi/oh_lite/iotc_wifi.c",
]
} else {
iotc_adapter_src += [
"$iotc_adapter_path/wifi/oh_standard/iotc_network.c",
"$iotc_adapter_path/wifi/oh_standard/iotc_wifi.c",
]
}
iotc_adapter_def += ["IOTC_CONF_WIFI_SUPPORT=1"]
if (defined(ohos_lite)) {
iotc_adapter_inc += ["//foundation/communication/wifi_lite/interfaces/wifiservice"]
}
}
if (defined(ohos_lite)) {
if (ohos_kernel_type == "liteos_m") {
iotc_adapter_inc += ["//kernel/liteos_m/kal/cmsis"]
iotc_adapter_src += ["$iotc_adapter_path/os/cmsis2/iotc_os.c"]
iotc_adapter_src += ["$iotc_adapter_path/kv/oh_lite/iotc_kv.c"]
if (board_hi3863) {
iotc_adapter_src += ["$iotc_adapter_path/log/hilog_m/iotc_log.c"]
iotc_adapter_inc += ["//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite"]
} else {
iotc_adapter_src += ["$iotc_adapter_path/log/printf/iotc_log.c"]
}
iotc_adapter_def += ["IOTC_CONF_LITEOS_M_SUPPORT=1"]
if (board_name == "rtl8720") {
iotc_adapter_inc += [
"//device/realtek/rtl8720/sdk-ameba-v7.1d/component/common/network/ssl/mbedtls-2.16.4/include",
"//device/realtek/rtl8720/sdk-ameba-v7.1d/component/common/network/lwip/lwip_v2.0.2/src/include/posix",
]
} else {
iotc_adapter_dep += [
"//third_party/cJSON:cjson_static",
"//third_party/mbedtls:mbedtls",
]
if (board_hi3863) {
# device/soc/hisilicon/hi3863v100/sdk_liteos/open_source/mbedtls/mbedtls_v3.1.0/include/mbedtls/ctr_drbg.h
iotc_adapter_inc += ["//device/soc/hisilicon/hi3863v100/sdk_liteos/open_source/mbedtls/mbedtls_v3.1.0/include"]
} else {
iotc_adapter_inc += ["//third_party/mbedtls/include"]
}
}
if (board_hi3863) {
iotc_adapter_def += ["IOTC_CONF_LITEOS_M_LOG_PRINTF=1"]
iotc_adapter_dep -=[
"//third_party/cJSON:cjson_static",
]
}
} else {
iotc_adapter_src += ["$iotc_adapter_path/os/posix/iotc_os.c"]
iotc_adapter_src += ["$iotc_adapter_path/kv/posix/iotc_kv.c"]
iotc_adapter_dep += [
"//third_party/cJSON:cjson_shared",
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/mbedtls:mbedtls",
]
iotc_adapter_inc += ["//third_party/mbedtls/include"]
}
} else {
iotc_adapter_src += ["$iotc_adapter_path/os/posix/iotc_os.c"]
iotc_adapter_src += ["$iotc_adapter_path/kv/posix/iotc_kv.c"]
if (iotc_hilog_support) {
iotc_adapter_src += ["$iotc_adapter_path/log/hilog/iotc_log.c"]
} else {
iotc_adapter_src += ["$iotc_adapter_path/log/printf/iotc_log.c"]
}
}
if (iot_connect_mbedtls_v2_support) {
iotc_adapter_def += ["IOTC_CONF_ADAPTER_MBEDTLS_MAJOR_VERSION=2"]
}
if (!iot_connect_mbedtls_psk_support) {
iotc_adapter_def += ["IOTC_CONF_ADAPTER_MBEDTLS_TLS_PSK_SUPPORT=0"]
}
if (!iot_connect_mbedtls_ccm_support) {
iotc_adapter_def += ["IOTC_CONF_ADAPTER_MBEDTLS_CCM_SUPPORT=0"]
}