@@ -41,7 +41,7 @@ namespace Clusters {
41
41
42
42
ChimeServer::ChimeServer (EndpointId endpointId, ChimeDelegate & delegate) :
43
43
AttributeAccessInterface (MakeOptional(endpointId), Chime::Id), CommandHandlerInterface(MakeOptional(endpointId), Chime::Id),
44
- mDelegate (delegate), mActiveChimeID (0 ), mEnabled (true )
44
+ mDelegate (delegate), mSelectedChime (0 ), mEnabled (true )
45
45
{
46
46
mDelegate .SetChimeServer (this );
47
47
}
@@ -68,17 +68,17 @@ CHIP_ERROR ChimeServer::Init()
68
68
void ChimeServer::LoadPersistentAttributes ()
69
69
{
70
70
// Load Active Chime ID
71
- uint8_t storedActiveChimeID ;
71
+ uint8_t storedSelectedChime ;
72
72
CHIP_ERROR err = GetSafeAttributePersistenceProvider ()->ReadScalarValue (
73
- ConcreteAttributePath (GetEndpointId (), Chime::Id, ActiveChimeID ::Id), storedActiveChimeID );
73
+ ConcreteAttributePath (GetEndpointId (), Chime::Id, SelectedChime ::Id), storedSelectedChime );
74
74
if (err == CHIP_NO_ERROR)
75
75
{
76
- mActiveChimeID = storedActiveChimeID ;
76
+ mSelectedChime = storedSelectedChime ;
77
77
}
78
78
else
79
79
{
80
80
// 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 );
82
82
}
83
83
84
84
// Load Enabled
@@ -103,8 +103,8 @@ CHIP_ERROR ChimeServer::Read(const ConcreteReadAttributePath & aPath, AttributeV
103
103
104
104
switch (aPath.mAttributeId )
105
105
{
106
- case ActiveChimeID ::Id:
107
- ReturnErrorOnFailure (aEncoder.Encode (mActiveChimeID ));
106
+ case SelectedChime ::Id:
107
+ ReturnErrorOnFailure (aEncoder.Encode (mSelectedChime ));
108
108
break ;
109
109
case Enabled::Id:
110
110
ReturnErrorOnFailure (aEncoder.Encode (mEnabled ));
@@ -119,9 +119,9 @@ CHIP_ERROR ChimeServer::Read(const ConcreteReadAttributePath & aPath, AttributeV
119
119
return CHIP_NO_ERROR;
120
120
}
121
121
122
- uint8_t ChimeServer::GetActiveChimeID () const
122
+ uint8_t ChimeServer::GetSelectedChime () const
123
123
{
124
- return mActiveChimeID ;
124
+ return mSelectedChime ;
125
125
}
126
126
127
127
bool ChimeServer::GetEnabled () const
@@ -184,10 +184,10 @@ CHIP_ERROR ChimeServer::Write(const ConcreteDataAttributePath & aPath, Attribute
184
184
185
185
switch (aPath.mAttributeId )
186
186
{
187
- case ActiveChimeID ::Id: {
187
+ case SelectedChime ::Id: {
188
188
uint8_t newValue;
189
189
ReturnErrorOnFailure (aDecoder.Decode (newValue));
190
- status = SetActiveChimeID (newValue);
190
+ status = SetSelectedChime (newValue);
191
191
return StatusIB (status).ToChipError ();
192
192
}
193
193
case Enabled::Id: {
@@ -203,22 +203,22 @@ CHIP_ERROR ChimeServer::Write(const ConcreteDataAttributePath & aPath, Attribute
203
203
}
204
204
}
205
205
206
- Status ChimeServer::SetActiveChimeID (uint8_t chimeID)
206
+ Status ChimeServer::SetSelectedChime (uint8_t chimeID)
207
207
{
208
208
if (!IsSupportedChimeID (chimeID))
209
209
{
210
210
return Protocols::InteractionModel::Status::ConstraintError;
211
211
}
212
212
213
- bool activeIDChanged = !(mActiveChimeID == chimeID);
213
+ bool activeIDChanged = !(mSelectedChime == chimeID);
214
214
if (activeIDChanged)
215
215
{
216
- mActiveChimeID = chimeID;
216
+ mSelectedChime = chimeID;
217
217
218
218
// Write new value to persistent storage.
219
219
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 );
222
222
223
223
// and mark as dirty
224
224
MatterReportingAttributeChangeCallback (path);
@@ -252,7 +252,7 @@ void ChimeServer::InvokeCommand(HandlerContext & ctx)
252
252
{
253
253
case Commands::PlayChimeSound::Id:
254
254
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); });
256
256
break ;
257
257
}
258
258
}
0 commit comments