From 2ee446766c36fae145d24128d04ee0087a9f79fe Mon Sep 17 00:00:00 2001 From: linzlinz <2495670683@qq.com> Date: Tue, 6 May 2025 20:16:15 +0800 Subject: [PATCH] add errorCode for gatt ble Signed-off-by: linzlinz <2495670683@qq.com> Change-Id: I136257edc5b9dbc9938abac83c1b0571f6e15b87 add errorCode for adv 0327 Signed-off-by: linzlinz <2495670683@qq.com> Change-Id: I6066b9b8d87449d6b9e1b8760b20a94842d6cbf5 --- frameworks/inner/ipc/common/bt_def.h | 2 ++ .../inner/src/bluetooth_ble_advertiser.cpp | 16 ++++++--- .../inner/src/bluetooth_gatt_client.cpp | 24 ++++++------- .../napi/include/napi_bluetooth_gatt_client.h | 3 ++ .../js/napi/src/ble/napi_bluetooth_ble.cpp | 6 ++-- .../src/ble/napi_bluetooth_gatt_client.cpp | 36 +++++++++++++++++++ .../napi_bluetooth_gatt_client_callback.cpp | 6 ++++ interfaces/inner_api/include/bluetooth_def.h | 4 +++ .../inner_api/include/bluetooth_errorcode.h | 8 +++++ 9 files changed, 85 insertions(+), 20 deletions(-) diff --git a/frameworks/inner/ipc/common/bt_def.h b/frameworks/inner/ipc/common/bt_def.h index db04e00f..fb513c32 100644 --- a/frameworks/inner/ipc/common/bt_def.h +++ b/frameworks/inner/ipc/common/bt_def.h @@ -342,6 +342,8 @@ enum class GattPermission : uint16_t { enum class GattConnectionPriority : int { BALANCED, HIGH, LOW_POWER }; enum GattStatus { + AUTHENTICATION_FAILED = -33, + GATT_CONGESTION = -32, EMPTY_FILTER = -31, MAX_FILTERS = -30, INVALID_REMOTE_DEVICE = -29, diff --git a/frameworks/inner/src/bluetooth_ble_advertiser.cpp b/frameworks/inner/src/bluetooth_ble_advertiser.cpp index d3bba56e..e52eee4e 100644 --- a/frameworks/inner/src/bluetooth_ble_advertiser.cpp +++ b/frameworks/inner/src/bluetooth_ble_advertiser.cpp @@ -316,12 +316,12 @@ int32_t BleAdvertiser::impl::CheckAdvertiserData(const BluetoothBleAdvertiserSet uint32_t size = GetAdvertiserTotalBytes(advData, setting.IsConnectable()); if (size > maxSize) { HILOGE("bleAdvertiserData size = %{public}d, maxSize = %{public}d", size, maxSize); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_BLE_ADV_DATA_EXCEED_LIMIT; } size = GetAdvertiserTotalBytes(scanResponse, false); if (size > maxSize) { HILOGE("bleScanResponse size = %{public}d, maxSize = %{public}d,", size, maxSize); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_BLE_ADV_DATA_EXCEED_LIMIT; } return BT_NO_ERROR; } @@ -366,7 +366,13 @@ int BleAdvertiser::StartAdvertising(const BleAdvertiserSettings &settings, const ret = proxy->StartAdvertising(setting, bleAdvertiserData, bleScanResponse, advHandle, duration, false); } else { ret = proxy->GetAdvertiserHandle(advHandle); + // ret will be BT_ERR_MAX_RESOURCES or BT_ERR_INTERNAL_ERROR. if (ret != BT_NO_ERROR || advHandle == BLE_INVALID_ADVERTISING_HANDLE) { + if (ret == BT_ERR_MAX_RESOURCES) { + HILOGE("The number of adv handle reaches the maximum."); + callback->OnStartResultEvent(BT_ERR_MAX_RESOURCES, static_cast(BLE_INVALID_ADVERTISING_HANDLE)); + return ret; + } HILOGE("Invalid advertising handle"); callback->OnStartResultEvent(BT_ERR_INTERNAL_ERROR, static_cast(BLE_INVALID_ADVERTISING_HANDLE)); return ret; @@ -486,7 +492,7 @@ int BleAdvertiser::EnableAdvertising(uint8_t advHandle, uint16_t duration, uint8_t tmpAdvHandle = pimpl->callbacks_.GetAdvertiserHandle(callback); if (tmpAdvHandle == BLE_INVALID_ADVERTISING_HANDLE) { HILOGE("Invalid advertising callback"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_BLE_INVALID_ADV_ID; } std::shared_ptr observer = pimpl->callbacks_.GetAdvertiserObserver(advHandle); @@ -513,7 +519,7 @@ int BleAdvertiser::DisableAdvertising(uint8_t advHandle, std::shared_ptrcallbacks_.GetAdvertiserHandle(callback); if (tmpAdvHandle == BLE_INVALID_ADVERTISING_HANDLE) { HILOGE("Invalid advertising callback"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_BLE_INVALID_ADV_ID; } std::shared_ptr observer = pimpl->callbacks_.GetAdvertiserObserver(advHandle); @@ -541,7 +547,7 @@ int BleAdvertiser::StopAdvertising(std::shared_ptr callbac uint8_t advHandle = pimpl->callbacks_.GetAdvertiserHandle(callback); if (advHandle == BLE_INVALID_ADVERTISING_HANDLE) { HILOGE("Invalid advertising handle"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_BLE_INVALID_ADV_ID; } int ret = proxy->StopAdvertising(advHandle); diff --git a/frameworks/inner/src/bluetooth_gatt_client.cpp b/frameworks/inner/src/bluetooth_gatt_client.cpp index 84e2958b..8540a5a1 100644 --- a/frameworks/inner/src/bluetooth_gatt_client.cpp +++ b/frameworks/inner/src/bluetooth_gatt_client.cpp @@ -797,12 +797,12 @@ int GattClient::ReadCharacteristic(GattCharacteristic &characteristic) std::lock_guard lock(pimpl->connStateMutex_); if (pimpl->connectionState_ != static_cast(BTConnectState::CONNECTED) || !pimpl->isRegisterSucceeded_) { HILOGE("Request not supported"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_GATT_CONNECTION_NOT_ESTABILISHED; } std::lock_guard lck(pimpl->requestInformation_.mutex_); if (pimpl->requestInformation_.doing_) { HILOGE("Remote device busy"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_OPERATION_BUSY; } int result = GattStatus::GATT_FAILURE; HILOGI("applicationId: %{public}d, handle: 0x%{public}04X", pimpl->applicationId_, characteristic.GetHandle()); @@ -834,12 +834,12 @@ int GattClient::ReadDescriptor(GattDescriptor &descriptor) std::lock_guard lck(pimpl->connStateMutex_); if (pimpl->connectionState_ != static_cast(BTConnectState::CONNECTED) || !pimpl->isRegisterSucceeded_) { HILOGE("Request not supported"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_GATT_CONNECTION_NOT_ESTABILISHED; } std::lock_guard lock(pimpl->requestInformation_.mutex_); if (pimpl->requestInformation_.doing_) { HILOGE("Remote device busy"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_OPERATION_BUSY; } int result = BT_ERR_INTERNAL_ERROR; HILOGI("applicationId: %{public}d, handle: 0x%{public}04X", pimpl->applicationId_, descriptor.GetHandle()); @@ -903,12 +903,12 @@ int GattClient::SetNotifyCharacteristicInner(GattCharacteristic &characteristic, std::lock_guard lockConn(pimpl->connStateMutex_); if (pimpl->connectionState_ != static_cast(BTConnectState::CONNECTED)) { HILOGE("Request not supported"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_GATT_CONNECTION_NOT_ESTABILISHED; } std::lock_guard lock(pimpl->requestInformation_.mutex_); if (pimpl->requestInformation_.doing_) { HILOGI("Remote device busy"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_OPERATION_BUSY; } auto descriptor = characteristic.GetDescriptor(UUID::FromString("00002902-0000-1000-8000-00805F9B34FB")); if (descriptor == nullptr) { @@ -996,7 +996,7 @@ int GattClient::WriteCharacteristic(GattCharacteristic &characteristic, std::vec std::lock_guard lockConn(pimpl->connStateMutex_); if (pimpl->connectionState_ != static_cast(BTConnectState::CONNECTED)) { HILOGE("Request not supported"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_GATT_CONNECTION_NOT_ESTABILISHED; } size_t length = value.size(); HILOGD("length:%{public}zu", length); @@ -1007,7 +1007,7 @@ int GattClient::WriteCharacteristic(GattCharacteristic &characteristic, std::vec std::lock_guard lock(pimpl->requestInformation_.mutex_); if (pimpl->requestInformation_.doing_) { HILOGE("Remote device busy"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_OPERATION_BUSY; } BluetoothGattCharacteristic character( bluetooth::Characteristic(characteristic.GetHandle(), value.data(), length)); @@ -1050,7 +1050,7 @@ int GattClient::WriteDescriptor(GattDescriptor &descriptor) std::lock_guard lck(pimpl->connStateMutex_); if (pimpl->connectionState_ != static_cast(BTConnectState::CONNECTED) || !pimpl->isRegisterSucceeded_) { HILOGE("Request not supported"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_GATT_CONNECTION_NOT_ESTABILISHED; } size_t length = 0; auto &characterValue = descriptor.GetValue(&length); @@ -1061,7 +1061,7 @@ int GattClient::WriteDescriptor(GattDescriptor &descriptor) std::lock_guard lock(pimpl->requestInformation_.mutex_); if (pimpl->requestInformation_.doing_) { HILOGE("Remote device busy"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_OPERATION_BUSY; } int result = BT_ERR_INTERNAL_ERROR; sptr proxy = GetRemoteProxy(PROFILE_GATT_CLIENT); @@ -1141,12 +1141,12 @@ int GattClient::ReadRemoteRssiValue() std::lock_guard lock(pimpl->connStateMutex_); if (pimpl->connectionState_ != static_cast(BTConnectState::CONNECTED) || !pimpl->isRegisterSucceeded_) { HILOGE("Request not supported"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_GATT_CONNECTION_NOT_ESTABILISHED; } std::lock_guard lck(pimpl->requestInformation_.mutex_); if (pimpl->requestInformation_.doing_) { HILOGE("Remote device busy"); - return BT_ERR_INTERNAL_ERROR; + return BT_ERR_OPERATION_BUSY; } int result = GattStatus::GATT_FAILURE; HILOGI("applicationId: %{public}d", pimpl->applicationId_); diff --git a/frameworks/js/napi/include/napi_bluetooth_gatt_client.h b/frameworks/js/napi/include/napi_bluetooth_gatt_client.h index bd6dd933..b652f028 100644 --- a/frameworks/js/napi/include/napi_bluetooth_gatt_client.h +++ b/frameworks/js/napi/include/napi_bluetooth_gatt_client.h @@ -58,6 +58,7 @@ public: static napi_value SetBLEMtuSize(napi_env env, napi_callback_info info); static napi_value GetRssiValue(napi_env env, napi_callback_info info); static napi_value GetDeviceName(napi_env env, napi_callback_info info); + static int GattStatusFromService(int status); std::shared_ptr &GetClient() { @@ -87,6 +88,8 @@ public: static thread_local napi_ref consRef_; + // napi (first) <-> service (second) + static const std::vector> g_gattStatusSrvToNapi; private: std::shared_ptr client_ = nullptr; std::shared_ptr callback_; diff --git a/frameworks/js/napi/src/ble/napi_bluetooth_ble.cpp b/frameworks/js/napi/src/ble/napi_bluetooth_ble.cpp index 16b32573..8a9912ff 100644 --- a/frameworks/js/napi/src/ble/napi_bluetooth_ble.cpp +++ b/frameworks/js/napi/src/ble/napi_bluetooth_ble.cpp @@ -970,7 +970,7 @@ napi_value EnableAdvertising(napi_env env, napi_callback_info info) auto status = CheckAdvertisingEnableParams(env, info, advHandle, duration, baseCallback); NAPI_BT_ASSERT_RETURN_UNDEF(env, status == napi_ok, BT_ERR_INVALID_PARAM); // compatible with XTS - NAPI_BT_ASSERT_RETURN_UNDEF(env, advHandle != BLE_INVALID_ADVERTISING_HANDLE, BT_ERR_INTERNAL_ERROR); + NAPI_BT_ASSERT_RETURN_UNDEF(env, advHandle != BLE_INVALID_ADVERTISING_HANDLE, BT_ERR_BLE_INVALID_ADV_ID); std::shared_ptr callback = std::static_pointer_cast(baseCallback); auto func = [advHandle, duration, callback]() { @@ -1024,7 +1024,7 @@ napi_value DisableAdvertising(napi_env env, napi_callback_info info) auto status = CheckAdvertisingDisableParams(env, info, advHandle, baseCallback); NAPI_BT_ASSERT_RETURN_UNDEF(env, status == napi_ok, BT_ERR_INVALID_PARAM); // compatible with XTS - NAPI_BT_ASSERT_RETURN_UNDEF(env, advHandle != BLE_INVALID_ADVERTISING_HANDLE, BT_ERR_INTERNAL_ERROR); + NAPI_BT_ASSERT_RETURN_UNDEF(env, advHandle != BLE_INVALID_ADVERTISING_HANDLE, BT_ERR_BLE_INVALID_ADV_ID); std::shared_ptr callback = std::static_pointer_cast(baseCallback); auto func = [advHandle, callback]() { @@ -1095,7 +1095,7 @@ napi_value StopAdvertising(napi_env env, napi_callback_info info) status = CheckStopAdvWithAdvId(env, argv[PARAM0], advHandle, baseCallback); NAPI_BT_ASSERT_RETURN_UNDEF(env, status == napi_ok, BT_ERR_INVALID_PARAM); // compatible with XTS - NAPI_BT_ASSERT_RETURN_UNDEF(env, advHandle != BLE_INVALID_ADVERTISING_HANDLE, BT_ERR_INTERNAL_ERROR); + NAPI_BT_ASSERT_RETURN_UNDEF(env, advHandle != BLE_INVALID_ADVERTISING_HANDLE, BT_ERR_BLE_INVALID_ADV_ID); std::shared_ptr callback = std::static_pointer_cast(baseCallback); auto func = [bleAdvertiser, callback]() { diff --git a/frameworks/js/napi/src/ble/napi_bluetooth_gatt_client.cpp b/frameworks/js/napi/src/ble/napi_bluetooth_gatt_client.cpp index 6f5c3459..b8a43cce 100644 --- a/frameworks/js/napi/src/ble/napi_bluetooth_gatt_client.cpp +++ b/frameworks/js/napi/src/ble/napi_bluetooth_gatt_client.cpp @@ -37,6 +37,15 @@ using namespace std; thread_local napi_ref NapiGattClient::consRef_ = nullptr; +const std::vector> NapiGattClient::g_gattStatusSrvToNapi = { + { Bluetooth::BT_NO_ERROR, GATT_SUCCESS }, + { Bluetooth::BT_ERR_GATT_WRITE_NOT_PERMITTED, WRITE_NOT_PERMITTED }, + { Bluetooth::BT_ERR_GATT_READ_NOT_PERMITTED, READ_NOT_PERMITTED }, + { Bluetooth::BT_ERR_GATT_CONNECTION_CONGESTED, GATT_CONGESTION }, + { Bluetooth::BT_ERR_GATT_CONNECTION_NOT_ENCRYPTED, INSUFFICIENT_ENCRYPTION }, + { Bluetooth::BT_ERR_GATT_CONNECTION_NOT_AUTHENTICATED, AUTHENTICATION_FAILED }, + { Bluetooth::BT_ERR_GATT_CONNECTION_NOT_AUTHORIZED, INSUFFICIENT_AUTHORIZATION }, +}; static napi_status CheckCreateGattClientDeviceParams(napi_env env, napi_callback_info info, napi_value &outResult) { size_t expectedArgsCount = ARGS_SIZE_ONE; @@ -338,6 +347,7 @@ napi_value NapiGattClient::ReadCharacteristicValue(napi_env env, napi_callback_i int ret = BT_ERR_INTERNAL_ERROR; if (gattClient) { ret = gattClient->ReadCharacteristic(*character); + ret = GattStatusFromService(ret); } return NapiAsyncWorkRet(ret); }; @@ -391,6 +401,7 @@ napi_value NapiGattClient::ReadDescriptorValue(napi_env env, napi_callback_info int ret = BT_ERR_INTERNAL_ERROR; if (gattClient) { ret = gattClient->ReadDescriptor(*descriptor); + ret = GattStatusFromService(ret); } return NapiAsyncWorkRet(ret); }; @@ -524,6 +535,7 @@ napi_value NapiGattClient::GetRssiValue(napi_env env, napi_callback_info info) int ret = BT_ERR_INTERNAL_ERROR; if (gattClient) { ret = gattClient->ReadRemoteRssiValue(); + ret = GattStatusFromService(ret); } return NapiAsyncWorkRet(ret); }; @@ -568,6 +580,27 @@ napi_value NapiGattClient::GetDeviceName(napi_env env, napi_callback_info info) return asyncWork->GetRet(); } +int NapiGattClient::GattStatusFromService(int status) +{ + // if status is from napi, do not deal with. + if (status > 0) { + return status; + } + int ret = BT_ERR_INTERNAL_ERROR; + // statusCode srv -> napi + auto iter = g_gattStatusSrvToNapi.begin(); + for (; iter != g_gattStatusSrvToNapi.end(); iter++) { + if (iter->second == status) { + ret = iter->first; // transfer to napi errorCode. + break; + } + } + if (iter == g_gattStatusSrvToNapi.end()) { + HILOGW("Unsupported error code conversion, status: %{public}d", status); + } + return ret; +} + #ifdef BLUETOOTH_API_SINCE_10 static napi_status CheckWriteCharacteristicValueEx(napi_env env, napi_callback_info info, @@ -616,6 +649,7 @@ napi_value NapiGattClient::WriteCharacteristicValueEx(napi_env env, napi_callbac int ret = BT_ERR_INTERNAL_ERROR; if (gattClient) { ret = gattClient->WriteCharacteristic(*character); + ret = GattStatusFromService(ret); } return NapiAsyncWorkRet(ret); }; @@ -672,6 +706,7 @@ napi_value NapiGattClient::WriteDescriptorValueEx(napi_env env, napi_callback_in int ret = BT_ERR_INTERNAL_ERROR; if (gattClient) { ret = gattClient->WriteDescriptor(*descriptor); + ret = GattStatusFromService(ret); } return NapiAsyncWorkRet(ret); }; @@ -728,6 +763,7 @@ static napi_value setCharacteristicChangeInner(napi_env env, napi_callback_info } else { ret = gattClient->SetIndicateCharacteristic(*character, enable); } + ret = NapiGattClient::GattStatusFromService(ret); } return NapiAsyncWorkRet(ret); }; diff --git a/frameworks/js/napi/src/ble/napi_bluetooth_gatt_client_callback.cpp b/frameworks/js/napi/src/ble/napi_bluetooth_gatt_client_callback.cpp index 5e900374..02059b84 100644 --- a/frameworks/js/napi/src/ble/napi_bluetooth_gatt_client_callback.cpp +++ b/frameworks/js/napi/src/ble/napi_bluetooth_gatt_client_callback.cpp @@ -43,6 +43,7 @@ void NapiGattClientCallback::OnCharacteristicChanged(const GattCharacteristic &c void NapiGattClientCallback::OnCharacteristicReadResult(const GattCharacteristic &characteristic, int ret) { HILOGI("UUID: %{public}s, ret: %{public}d", characteristic.GetUuid().ToString().c_str(), ret); + ret = NapiGattClient::GattStatusFromService(ret); auto napiCharacter = std::make_shared(characteristic); AsyncWorkCallFunction(asyncWorkMap_, NapiAsyncType::GATT_CLIENT_READ_CHARACTER, napiCharacter, ret); } @@ -50,6 +51,7 @@ void NapiGattClientCallback::OnCharacteristicReadResult(const GattCharacteristic void NapiGattClientCallback::OnDescriptorReadResult(const GattDescriptor &descriptor, int ret) { HILOGI("UUID: %{public}s, ret: %{public}d", descriptor.GetUuid().ToString().c_str(), ret); + ret = NapiGattClient::GattStatusFromService(ret); auto napiDescriptor = std::make_shared(descriptor); AsyncWorkCallFunction(asyncWorkMap_, NapiAsyncType::GATT_CLIENT_READ_DESCRIPTOR, napiDescriptor, ret); } @@ -69,6 +71,7 @@ void NapiGattClientCallback::OnServicesDiscovered(int status) void NapiGattClientCallback::OnReadRemoteRssiValueResult(int rssi, int ret) { HILOGI("rssi: %{public}d, ret: %{public}d", rssi, ret); + ret = NapiGattClient::GattStatusFromService(ret); auto napiRssi = std::make_shared(rssi); AsyncWorkCallFunction(asyncWorkMap_, NapiAsyncType::GATT_CLIENT_READ_REMOTE_RSSI_VALUE, napiRssi, ret); } @@ -77,6 +80,7 @@ void NapiGattClientCallback::OnCharacteristicWriteResult(const GattCharacteristi { #ifdef BLUETOOTH_API_SINCE_10 HILOGI("UUID: %{public}s, ret: %{public}d", characteristic.GetUuid().ToString().c_str(), ret); + ret = NapiGattClient::GattStatusFromService(ret); auto napiCharacter = std::make_shared(characteristic); AsyncWorkCallFunction(asyncWorkMap_, NapiAsyncType::GATT_CLIENT_WRITE_CHARACTER, napiCharacter, ret); #endif @@ -86,6 +90,7 @@ void NapiGattClientCallback::OnDescriptorWriteResult(const GattDescriptor &descr { #ifdef BLUETOOTH_API_SINCE_10 HILOGI("UUID: %{public}s, ret: %{public}d", descriptor.GetUuid().ToString().c_str(), ret); + ret = NapiGattClient::GattStatusFromService(ret); auto napiDescriptor = std::make_shared(descriptor); AsyncWorkCallFunction(asyncWorkMap_, NapiAsyncType::GATT_CLIENT_WRITE_DESCRIPTOR, napiDescriptor, ret); #endif @@ -95,6 +100,7 @@ void NapiGattClientCallback::OnSetNotifyCharacteristic(const GattCharacteristic { #ifdef BLUETOOTH_API_SINCE_10 HILOGI("UUID: %{public}s, status: %{public}d", characteristic.GetUuid().ToString().c_str(), status); + status = NapiGattClient::GattStatusFromService(status); AsyncWorkCallFunction(asyncWorkMap_, NapiAsyncType::GATT_CLIENT_ENABLE_CHARACTER_CHANGED, nullptr, status); #endif } diff --git a/interfaces/inner_api/include/bluetooth_def.h b/interfaces/inner_api/include/bluetooth_def.h index a111f450..64e88fc9 100644 --- a/interfaces/inner_api/include/bluetooth_def.h +++ b/interfaces/inner_api/include/bluetooth_def.h @@ -320,6 +320,10 @@ enum class GattConnectionPriority : int { }; enum GattStatus { + AUTHENTICATION_FAILED = -33, + GATT_CONGESTION = -32, + EMPTY_FILTER = -31, + MAX_FILTERS = -30, INVALID_REMOTE_DEVICE = -29, INCLUDE_SERVICE_NOT_FOUND, REFERENCED_BY_OTHER_SERVICE, diff --git a/interfaces/inner_api/include/bluetooth_errorcode.h b/interfaces/inner_api/include/bluetooth_errorcode.h index 286d8a66..67a49891 100644 --- a/interfaces/inner_api/include/bluetooth_errorcode.h +++ b/interfaces/inner_api/include/bluetooth_errorcode.h @@ -42,6 +42,7 @@ enum BtErrCode { BT_ERR_UNAVAILABLE_PROXY = BT_ERR_BASE_SYSCAP + 8, BT_ERR_DIALOG_FOR_USER_CONFIRM = BT_ERR_BASE_SYSCAP + 9, BT_ERR_MAX_RESOURCES = BT_ERR_BASE_SYSCAP + 10, + BT_ERR_OPERATION_BUSY = BT_ERR_BASE_SYSCAP + 11, BT_ERR_INTERNAL_ERROR = BT_ERR_BASE_SYSCAP + 99, BT_ERR_IPC_TRANS_FAILED = BT_ERR_BASE_SYSCAP + 100, @@ -49,6 +50,11 @@ enum BtErrCode { BT_ERR_GATT_READ_NOT_PERMITTED = BT_ERR_BASE_SYSCAP + 1000, BT_ERR_GATT_WRITE_NOT_PERMITTED = BT_ERR_BASE_SYSCAP + 1001, BT_ERR_GATT_MAX_SERVER = BT_ERR_BASE_SYSCAP + 1002, + BT_ERR_GATT_CONNECTION_NOT_ESTABILISHED = BT_ERR_BASE_SYSCAP + 1003, + BT_ERR_GATT_CONNECTION_CONGESTED = BT_ERR_BASE_SYSCAP + 1004, + BT_ERR_GATT_CONNECTION_NOT_ENCRYPTED = BT_ERR_BASE_SYSCAP + 1005, + BT_ERR_GATT_CONNECTION_NOT_AUTHENTICATED = BT_ERR_BASE_SYSCAP + 1006, + BT_ERR_GATT_CONNECTION_NOT_AUTHORIZED = BT_ERR_BASE_SYSCAP + 1007, BT_ERR_SPP_SERVER_STATE = BT_ERR_BASE_SYSCAP + 1050, BT_ERR_SPP_BUSY = BT_ERR_BASE_SYSCAP + 1051, @@ -68,6 +74,8 @@ enum BtErrCode { BT_ERR_BLE_SCAN_MAX_FILTER = BT_ERR_BASE_SYSCAP + 2051, BT_ERR_BLE_CHANGE_SCAN_FILTER_FAIL = BT_ERR_BASE_SYSCAP + 2052, BT_ERR_BLE_CHANGE_SCAN_WRONG_STATE = BT_ERR_BASE_SYSCAP + 2053, + BT_ERR_BLE_ADV_DATA_EXCEED_LIMIT = BT_ERR_BASE_SYSCAP + 2054, + BT_ERR_BLE_INVALID_ADV_ID = BT_ERR_BASE_SYSCAP + 2055, // will deprected NO_ERROR = BT_NO_ERROR, -- Gitee