From 21471200b7af9ac6910bd6ef6639e67ef14b6a06 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 7 Aug 2023 09:21:36 -0400 Subject: [PATCH] Remove special-case in ToInteractionModelStatus. (#28538) EMBER_ZCL_STATUS_DUPLICATE_EXISTS is now only returned from emberAfSetDynamicEndpoint, which is never on any IM codepaths. --- src/app/chip_data_model.cmake | 1 - src/app/chip_data_model.gni | 1 - src/app/util/error-mapping.cpp | 37 ------------------- src/app/util/error-mapping.h | 5 ++- .../Matter.xcodeproj/project.pbxproj | 4 -- 5 files changed, 4 insertions(+), 44 deletions(-) delete mode 100644 src/app/util/error-mapping.cpp diff --git a/src/app/chip_data_model.cmake b/src/app/chip_data_model.cmake index 63ebf1b4ef1eee..fb18dd8b16c5fc 100644 --- a/src/app/chip_data_model.cmake +++ b/src/app/chip_data_model.cmake @@ -140,7 +140,6 @@ function(chip_configure_data_model APP_TARGET) ${CHIP_APP_BASE_DIR}/icd/IcdManagementServer.cpp ${CHIP_APP_BASE_DIR}/util/DataModelHandler.cpp ${CHIP_APP_BASE_DIR}/util/ember-compatibility-functions.cpp - ${CHIP_APP_BASE_DIR}/util/error-mapping.cpp ${CHIP_APP_BASE_DIR}/util/generic-callback-stubs.cpp ${CHIP_APP_BASE_DIR}/util/message.cpp ${CHIP_APP_BASE_DIR}/util/privilege-storage.cpp diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index 1724d1048a304c..20b1f9d0e18e1e 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -171,7 +171,6 @@ template("chip_data_model") { "${_app_root}/util/binding-table.cpp", "${_app_root}/util/binding-table.h", "${_app_root}/util/ember-compatibility-functions.cpp", - "${_app_root}/util/error-mapping.cpp", "${_app_root}/util/generic-callback-stubs.cpp", "${_app_root}/util/message.cpp", "${_app_root}/util/privilege-storage.cpp", diff --git a/src/app/util/error-mapping.cpp b/src/app/util/error-mapping.cpp deleted file mode 100644 index 4bdc398d7479f6..00000000000000 --- a/src/app/util/error-mapping.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright (c) 2020 Project CHIP Authors - * - * 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. - */ - -#include "error-mapping.h" - -namespace chip { -namespace app { - -Protocols::InteractionModel::Status ToInteractionModelStatus(EmberAfStatus code) -{ - using imcode = Protocols::InteractionModel::Status; - if (code == EMBER_ZCL_STATUS_DUPLICATE_EXISTS /* 0x8A */) - { - // For now, this is still used, and should be mapped to success. Once - // we update bindings to no longer use it, this case can go away. - return imcode::Success; - } - - return static_cast(code); -} - -} // namespace app -} // namespace chip diff --git a/src/app/util/error-mapping.h b/src/app/util/error-mapping.h index 17c994ec7ad57a..de47b27f859d59 100644 --- a/src/app/util/error-mapping.h +++ b/src/app/util/error-mapping.h @@ -28,7 +28,10 @@ inline EmberAfStatus ToEmberAfStatus(Protocols::InteractionModel::Status code) return static_cast(code); } -Protocols::InteractionModel::Status ToInteractionModelStatus(EmberAfStatus code); +inline Protocols::InteractionModel::Status ToInteractionModelStatus(EmberAfStatus code) +{ + return static_cast(code); +} } // namespace app } // namespace chip diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 93d491bf23ac1f..5481acdf5ea66a 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -111,7 +111,6 @@ 2CB7163B252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CB71638252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.h */; }; 2CB7163C252E8A7C0026E2BB /* MTRDeviceControllerDelegateBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2CB71639252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.mm */; }; 2CB7163F252F731E0026E2BB /* MTRDeviceControllerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CB7163E252F731E0026E2BB /* MTRDeviceControllerDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2FD775552695557E00FF4B12 /* error-mapping.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2FD775542695557E00FF4B12 /* error-mapping.cpp */; }; 3CF134A7289D8ADA0017A19E /* MTRCSRInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CF134A6289D8AD90017A19E /* MTRCSRInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3CF134A9289D8D800017A19E /* MTRCSRInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3CF134A8289D8D800017A19E /* MTRCSRInfo.mm */; }; 3CF134AB289D8DF70017A19E /* MTRDeviceAttestationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CF134AA289D8DF70017A19E /* MTRDeviceAttestationInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -392,7 +391,6 @@ 2CB71638252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerDelegateBridge.h; sourceTree = ""; }; 2CB71639252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceControllerDelegateBridge.mm; sourceTree = ""; }; 2CB7163E252F731E0026E2BB /* MTRDeviceControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerDelegate.h; sourceTree = ""; }; - 2FD775542695557E00FF4B12 /* error-mapping.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "error-mapping.cpp"; path = "util/error-mapping.cpp"; sourceTree = ""; }; 3CF134A6289D8AD90017A19E /* MTRCSRInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRCSRInfo.h; sourceTree = ""; }; 3CF134A8289D8D800017A19E /* MTRCSRInfo.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRCSRInfo.mm; sourceTree = ""; }; 3CF134AA289D8DF70017A19E /* MTRDeviceAttestationInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceAttestationInfo.h; sourceTree = ""; }; @@ -852,7 +850,6 @@ 1E857311265519DE0050A4D9 /* app */ = { isa = PBXGroup; children = ( - 2FD775542695557E00FF4B12 /* error-mapping.cpp */, 5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */, 51431AFA27D29CA4008A7943 /* ota-provider.cpp */, 3D84374A29498BAE0070D20A /* privilege-storage.cpp */, @@ -1513,7 +1510,6 @@ 5ACDDD7D27CD16D200EFD68A /* MTRClusterStateCacheContainer.mm in Sources */, 513DDB8A2761F6F900DAA01A /* MTRAttributeTLVValueDecoder.mm in Sources */, 5117DD3829A931AE00FFA1AA /* MTROperationalBrowser.mm in Sources */, - 2FD775552695557E00FF4B12 /* error-mapping.cpp in Sources */, 3D843757294AD25A0070D20A /* MTRCertificateInfo.mm in Sources */, 5A7947E427C0129600434CF2 /* MTRDeviceController+XPC.mm in Sources */, 5A6FEC9027B563D900F25F42 /* MTRDeviceControllerOverXPC.mm in Sources */,