Skip to content

Commit 1469fa9

Browse files
committed
Fix compiler errors
1 parent adf4b68 commit 1469fa9

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/app/clusters/chime-server/chime-server.cpp

+17-17
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace Clusters {
4141

4242
ChimeServer::ChimeServer(EndpointId endpointId, ChimeDelegate & delegate) :
4343
AttributeAccessInterface(MakeOptional(endpointId), Chime::Id), CommandHandlerInterface(MakeOptional(endpointId), Chime::Id),
44-
mDelegate(delegate), mActiveChimeID(0), mEnabled(true)
44+
mDelegate(delegate), mSelectedChime(0), mEnabled(true)
4545
{
4646
mDelegate.SetChimeServer(this);
4747
}
@@ -68,17 +68,17 @@ CHIP_ERROR ChimeServer::Init()
6868
void ChimeServer::LoadPersistentAttributes()
6969
{
7070
// Load Active Chime ID
71-
uint8_t storedActiveChimeID;
71+
uint8_t storedSelectedChime;
7272
CHIP_ERROR err = GetSafeAttributePersistenceProvider()->ReadScalarValue(
73-
ConcreteAttributePath(GetEndpointId(), Chime::Id, ActiveChimeID::Id), storedActiveChimeID);
73+
ConcreteAttributePath(GetEndpointId(), Chime::Id, SelectedChime::Id), storedSelectedChime);
7474
if (err == CHIP_NO_ERROR)
7575
{
76-
mActiveChimeID = storedActiveChimeID;
76+
mSelectedChime = storedSelectedChime;
7777
}
7878
else
7979
{
8080
// otherwise defaults
81-
ChipLogDetail(Zcl, "Chime: Unable to load the ActiveChimeID attribute from the KVS. Defaulting to %u", mActiveChimeID);
81+
ChipLogDetail(Zcl, "Chime: Unable to load the SelectedChime attribute from the KVS. Defaulting to %u", mSelectedChime);
8282
}
8383

8484
// Load Enabled
@@ -103,8 +103,8 @@ CHIP_ERROR ChimeServer::Read(const ConcreteReadAttributePath & aPath, AttributeV
103103

104104
switch (aPath.mAttributeId)
105105
{
106-
case ActiveChimeID::Id:
107-
ReturnErrorOnFailure(aEncoder.Encode(mActiveChimeID));
106+
case SelectedChime::Id:
107+
ReturnErrorOnFailure(aEncoder.Encode(mSelectedChime));
108108
break;
109109
case Enabled::Id:
110110
ReturnErrorOnFailure(aEncoder.Encode(mEnabled));
@@ -119,9 +119,9 @@ CHIP_ERROR ChimeServer::Read(const ConcreteReadAttributePath & aPath, AttributeV
119119
return CHIP_NO_ERROR;
120120
}
121121

122-
uint8_t ChimeServer::GetActiveChimeID() const
122+
uint8_t ChimeServer::GetSelectedChime() const
123123
{
124-
return mActiveChimeID;
124+
return mSelectedChime;
125125
}
126126

127127
bool ChimeServer::GetEnabled() const
@@ -184,10 +184,10 @@ CHIP_ERROR ChimeServer::Write(const ConcreteDataAttributePath & aPath, Attribute
184184

185185
switch (aPath.mAttributeId)
186186
{
187-
case ActiveChimeID::Id: {
187+
case SelectedChime::Id: {
188188
uint8_t newValue;
189189
ReturnErrorOnFailure(aDecoder.Decode(newValue));
190-
status = SetActiveChimeID(newValue);
190+
status = SetSelectedChime(newValue);
191191
return StatusIB(status).ToChipError();
192192
}
193193
case Enabled::Id: {
@@ -203,22 +203,22 @@ CHIP_ERROR ChimeServer::Write(const ConcreteDataAttributePath & aPath, Attribute
203203
}
204204
}
205205

206-
Status ChimeServer::SetActiveChimeID(uint8_t chimeID)
206+
Status ChimeServer::SetSelectedChime(uint8_t chimeID)
207207
{
208208
if (!IsSupportedChimeID(chimeID))
209209
{
210210
return Protocols::InteractionModel::Status::ConstraintError;
211211
}
212212

213-
bool activeIDChanged = !(mActiveChimeID == chimeID);
213+
bool activeIDChanged = !(mSelectedChime == chimeID);
214214
if (activeIDChanged)
215215
{
216-
mActiveChimeID = chimeID;
216+
mSelectedChime = chimeID;
217217

218218
// Write new value to persistent storage.
219219
auto endpointId = GetEndpointId();
220-
ConcreteAttributePath path = ConcreteAttributePath(endpointId, Chime::Id, ActiveChimeID::Id);
221-
GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mActiveChimeID);
220+
ConcreteAttributePath path = ConcreteAttributePath(endpointId, Chime::Id, SelectedChime::Id);
221+
GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mSelectedChime);
222222

223223
// and mark as dirty
224224
MatterReportingAttributeChangeCallback(path);
@@ -252,7 +252,7 @@ void ChimeServer::InvokeCommand(HandlerContext & ctx)
252252
{
253253
case Commands::PlayChimeSound::Id:
254254
CommandHandlerInterface::HandleCommand<Commands::PlayChimeSound::DecodableType>(
255-
ctx, [this](HandlerContext & ctx, const auto & req) { HandlePlayChimeSound(ctx, req); });
255+
ctx, [this](HandlerContext & innerCtx, const auto & req) { HandlePlayChimeSound(innerCtx, req); });
256256
break;
257257
}
258258
}

src/app/clusters/chime-server/chime-server.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ class ChimeServer : private AttributeAccessInterface, private CommandHandlerInte
5353

5454
// Attribute Setters
5555
/**
56-
* Sets the ActiveChimeID attribute. Note, this also handles writing the new value into non-volatile storage.
57-
* @param chimeSoundID The value to which the ActiveChimeID is to be set.
56+
* Sets the SelectedChime attribute. Note, this also handles writing the new value into non-volatile storage.
57+
* @param chimeSoundID The value to which the SelectedChime is to be set.
5858
* @return Returns a ConstraintError if the chimeSoundID value is not valid. Returns Success otherwise.
5959
*/
60-
Protocols::InteractionModel::Status SetActiveChimeID(uint8_t chimeSoundID);
60+
Protocols::InteractionModel::Status SetSelectedChime(uint8_t chimeSoundID);
6161

6262
/**
6363
* Sets the Enabled attribute. Note, this also handles writing the new value into non-volatile storage.
@@ -67,9 +67,9 @@ class ChimeServer : private AttributeAccessInterface, private CommandHandlerInte
6767

6868
// Attribute Getters
6969
/**
70-
* @return The Current ActiveChimeID.
70+
* @return The Current SelectedChime.
7171
*/
72-
uint8_t GetActiveChimeID() const;
72+
uint8_t GetSelectedChime() const;
7373

7474
/**
7575
* @return The Enabled attribute..
@@ -95,7 +95,7 @@ class ChimeServer : private AttributeAccessInterface, private CommandHandlerInte
9595
ChimeDelegate & mDelegate;
9696

9797
// Attribute local storage
98-
uint8_t mActiveChimeID;
98+
uint8_t mSelectedChime;
9999
bool mEnabled;
100100

101101
// AttributeAccessInterface

0 commit comments

Comments
 (0)