Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and pull[bot] committed Jul 10, 2023
1 parent 12607bf commit 1718509
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 13 deletions.
32 changes: 32 additions & 0 deletions src/app/clusters/scenes/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2023 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.
import("//build_overrides/chip.gni")

static_library("scenes") {
output_name = "libCHIPScenes"

sources = [
"ExtensionFieldSets.h",
"ExtensionFieldSetsImpl.cpp",
"ExtensionFieldSetsImpl.h",
"SceneTable.h",
"SceneTableImpl.cpp",
"SceneTableImpl.h",
]

cflags = [
"-Wconversion",
"-Wshadow",
]
}
2 changes: 1 addition & 1 deletion src/app/clusters/scenes/ExtensionFieldSetsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#include <app/clusters/scenes/ExtensionFieldSetsImpl.h>
#include "ExtensionFieldSetsImpl.h"

namespace chip {
namespace scenes {
Expand Down
7 changes: 1 addition & 6 deletions src/app/server/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ static_library("server") {
output_name = "libCHIPAppServer"

sources = [
"../clusters/scenes/ExtensionFieldSets.h",
"../clusters/scenes/ExtensionFieldSetsImpl.cpp",
"../clusters/scenes/ExtensionFieldSetsImpl.h",
"../clusters/scenes/SceneTable.h",
"../clusters/scenes/SceneTableImpl.cpp",
"../clusters/scenes/SceneTableImpl.h",
"AclStorage.cpp",
"AclStorage.h",
"CommissioningModeProvider.h",
Expand All @@ -56,6 +50,7 @@ static_library("server") {

public_deps = [
"${chip_root}/src/app",
"${chip_root}/src/app/clusters/scenes",
"${chip_root}/src/lib/address_resolve",
"${chip_root}/src/lib/dnssd",
"${chip_root}/src/messaging",
Expand Down
2 changes: 1 addition & 1 deletion src/app/server/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ class Server
app::SubscriptionResumptionStorage * mSubscriptionResumptionStorage;
Credentials::CertificateValidityPolicy * mCertificateValidityPolicy;
Credentials::GroupDataProvider * mGroupsProvider;
scenes::SceneTable * mSceneTable;
scenes::SceneTable * mSceneTable = nullptr;
Crypto::SessionKeystore * mSessionKeystore;
app::DefaultAttributePersistenceProvider mAttributePersister;
GroupDataProviderListener mListener;
Expand Down
11 changes: 7 additions & 4 deletions src/app/tests/TestSceneTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,13 @@ class TestSceneHandler : public scenes::DefaultSceneHandlerImpl
{
case ON_OFF_CID:
err = CHIP_NO_ERROR;
// Warning: OO_buffer needs to be populated before calling this function
memcpy(serialisedBytes.data(), OO_buffer, scenes::kMaxFieldsPerCluster);
serialisedBytes.reduce_size(15); // Used memory for OnOff TLV
break;
case LV_CTR_CID:
err = CHIP_NO_ERROR;
// Warning: LC_buffer needs to be populated before calling this function
memcpy(serialisedBytes.data(), LC_buffer, scenes::kMaxFieldsPerCluster);
serialisedBytes.reduce_size(27); // Used memory for Level Control TLV
break;
Expand All @@ -201,11 +203,13 @@ class TestSceneHandler : public scenes::DefaultSceneHandlerImpl
{
case ON_OFF_CID:
err = CHIP_NO_ERROR;
// Warning: OO_buffer needs to be populated before calling this function
memcpy(serialisedBytes.data(), OO_buffer, scenes::kMaxFieldsPerCluster);
serialisedBytes.reduce_size(15); // Used memory for OnOff TLV
break;
case CC_CTR_CID:
err = CHIP_NO_ERROR;
// Warning: CC_buffer needs to be populated before calling this function
memcpy(serialisedBytes.data(), CC_buffer, scenes::kMaxFieldsPerCluster);
serialisedBytes.reduce_size(99); // Used memory for Color Control TLV
break;
Expand Down Expand Up @@ -272,7 +276,7 @@ class TestSceneHandler : public scenes::DefaultSceneHandlerImpl
}
}

return CHIP_NO_ERROR;
return err;
}
};

Expand All @@ -295,11 +299,10 @@ void TestHandlerRegistration(nlTestSuite * aSuite, void * aContext)
{
NL_TEST_ASSERT(aSuite, sceneTable->mNumHandlers == i);
NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RegisterHandler(&tmpHandler[i]));
printf("Handler : %d | Address : %p \n", i, &tmpHandler[i]);
}

NL_TEST_ASSERT(aSuite, sceneTable->mNumHandlers == scenes::kMaxSceneHandlers);
// Removal at begining
// Removal at beginning
NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->UnregisterHandler(&tmpHandler[0]));
NL_TEST_ASSERT(aSuite, sceneTable->mNumHandlers == static_cast<uint8_t>(scenes::kMaxSceneHandlers - 1));
// Confirm array was compressed and last position is now null
Expand Down Expand Up @@ -669,7 +672,7 @@ void TestRemoveScenes(nlTestSuite * aSuite, void * aContext)
NL_TEST_ASSERT(aSuite, scene == scene10);
iterator->Release();

// Adde scene in middle, a spot should have been freed
// Add scene in middle, a spot should have been freed
NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene9));
iterator = sceneTable->IterateSceneEntry(kFabric1);
NL_TEST_ASSERT(aSuite, iterator->Count() == 8);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/CHIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ extern const char CHIP_NON_PRODUCTION_MARKER[];
#define CHIP_CONFIG_SCENES_TABLE_UNUSED_ENDPOINT_ID 0x00
#endif
/**
* @brief The maximum number of scenes according to spec
* @brief The minimum number of scenes to support according to spec
*/
#ifndef CHIP_CONFIG_SCENES_MAX_NUMBER
#define CHIP_CONFIG_SCENES_MAX_NUMBER 16
Expand Down

0 comments on commit 1718509

Please sign in to comment.