Skip to content

Commit 687b1ac

Browse files
committed
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip into add_presets_to_Sdk
# Conflicts: # src/app/clusters/thermostat-server/thermostat-server.cpp
2 parents 5c6312b + 2740112 commit 687b1ac

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

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

+16-17
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,9 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath,
849849
{
850850
VerifyOrDie(aPath.mClusterId == Thermostat::Id);
851851

852-
EndpointId endpoint = aPath.mEndpointId;
853-
const Access::SubjectDescriptor subjectDescriptor = aDecoder.GetSubjectDescriptor();
854-
ScopedNodeId scopedNodeId = ScopedNodeId();
852+
EndpointId endpoint = aPath.mEndpointId;
853+
auto & subjectDescriptor = aDecoder.GetSubjectDescriptor();
854+
ScopedNodeId scopedNodeId = ScopedNodeId();
855855

856856
// Get the node id if the authentication mode is CASE.
857857
if (subjectDescriptor.authMode == Access::AuthMode::kCase)
@@ -1322,7 +1322,7 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback(
13221322
return true;
13231323
}
13241324

1325-
bool validAtomicAttributes(const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData)
1325+
bool validAtomicAttributes(const Commands::AtomicRequest::DecodableType & commandData)
13261326
{
13271327
auto attributeIdsIter = commandData.attributeRequests.begin();
13281328
bool requestedPresets = false, requestedSchedules = false;
@@ -1359,7 +1359,7 @@ bool validAtomicAttributes(const chip::app::Clusters::Thermostat::Commands::Atom
13591359
}
13601360

13611361
bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
1362-
const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData)
1362+
const Commands::AtomicRequest::DecodableType & commandData)
13631363
{
13641364
EndpointId endpoint = commandPath.mEndpointId;
13651365

@@ -1386,14 +1386,13 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const chip::app::
13861386

13871387
if (gThermostatAttrAccess.InAtomicWrite(endpoint))
13881388
{
1389-
// Some other client has an open atomic write, return busy
1390-
chip::app::Clusters::Thermostat::Commands::AtomicResponse::Type response;
1389+
Commands::AtomicResponse::Type response;
13911390
Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = {
1392-
{ .attributeID = Presets::Id, .statusCode = static_cast<uint8_t>(imcode::Busy) },
1393-
{ .attributeID = Schedules::Id, .statusCode = static_cast<uint8_t>(imcode::Busy) }
1391+
{ .attributeID = Presets::Id, .statusCode = to_underlying(imcode::Busy) },
1392+
{ .attributeID = Schedules::Id, .statusCode = to_underlying(imcode::Busy) }
13941393
};
13951394

1396-
response.statusCode = static_cast<uint8_t>(imcode::Failure);
1395+
response.statusCode = to_underlying(imcode::Failure);
13971396
response.attributeStatus = attributeStatus;
13981397
commandObj->AddResponse(commandPath, response);
13991398
return true;
@@ -1407,13 +1406,13 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const chip::app::
14071406
ScheduleTimer(endpoint, static_cast<System::Clock::Milliseconds16>(timeout));
14081407
gThermostatAttrAccess.SetAtomicWrite(endpoint, true);
14091408
gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, GetSourceScopedNodeId(commandObj));
1410-
chip::app::Clusters::Thermostat::Commands::AtomicResponse::Type response;
1409+
Commands::AtomicResponse::Type response;
14111410
Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = {
1412-
{ .attributeID = Presets::Id, .statusCode = static_cast<uint8_t>(imcode::Success) },
1413-
{ .attributeID = Schedules::Id, .statusCode = static_cast<uint8_t>(imcode::Success) }
1411+
{ .attributeID = Presets::Id, .statusCode = to_underlying(imcode::Success) },
1412+
{ .attributeID = Schedules::Id, .statusCode = to_underlying(imcode::Success) }
14141413
};
14151414

1416-
response.statusCode = static_cast<uint8_t>(imcode::Success);
1415+
response.statusCode = to_underlying(imcode::Success);
14171416
response.attributeStatus = attributeStatus;
14181417
response.timeout.Emplace(timeout);
14191418
commandObj->AddResponse(commandPath, response);
@@ -1422,7 +1421,7 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const chip::app::
14221421
}
14231422

14241423
bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
1425-
const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData)
1424+
const Commands::AtomicRequest::DecodableType & commandData)
14261425
{
14271426
if (!validAtomicAttributes(commandData))
14281427
{
@@ -1569,7 +1568,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app:
15691568
return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError);
15701569
}
15711570

1572-
// If the preset type for the preset scenario does not support name and a name is specified, return CONSTRAINT_ERROR.
1571+
// If the preset type for the preset scenario does not support names and a name is specified, return CONSTRAINT_ERROR.
15731572
if (!PresetTypeSupportsNames(delegate, presetScenario) && pendingPreset.GetName().HasValue())
15741573
{
15751574
return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError);
@@ -1621,7 +1620,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app:
16211620
}
16221621

16231622
bool handleAtomicRollback(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
1624-
const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData)
1623+
const Commands::AtomicRequest::DecodableType & commandData)
16251624
{
16261625
if (!validAtomicAttributes(commandData))
16271626
{

0 commit comments

Comments
 (0)