@@ -92,7 +92,7 @@ class EnumeratorCommandFinder
92
92
93
93
static Loop HandlerCallbackFn (CommandId id, void * context)
94
94
{
95
- EnumeratorCommandFinder * self = static_cast <EnumeratorCommandFinder *>(context);
95
+ auto self = static_cast <EnumeratorCommandFinder *>(context);
96
96
return self->HandlerCallback (id);
97
97
}
98
98
};
@@ -572,9 +572,7 @@ DataModel::CommandEntry CodegenDataModelProvider::FirstAcceptedCommand(const Con
572
572
573
573
if ((err == CHIP_NO_ERROR) && firstId.has_value ())
574
574
{
575
- DataModel::CommandEntry result;
576
- result.path = ConcreteCommandPath (path.mEndpointId , path.mClusterId , *firstId);
577
- return result;
575
+ return CommandEntryFrom (path, *firstId);
578
576
}
579
577
580
578
return DataModel::CommandEntry::kInvalid ;
@@ -603,13 +601,11 @@ DataModel::CommandEntry CodegenDataModelProvider::NextAcceptedCommand(const Conc
603
601
604
602
if (err != CHIP_ERROR_NOT_IMPLEMENTED)
605
603
{
606
- auto beforeId = finder.GetFound ();
604
+ auto nextId = finder.GetFound ();
607
605
608
- if ((err == CHIP_NO_ERROR) && beforeId .has_value ())
606
+ if ((err == CHIP_NO_ERROR) && nextId .has_value ())
609
607
{
610
- DataModel::CommandEntry result;
611
- result.path = ConcreteCommandPath (before.mEndpointId , before.mClusterId , *beforeId);
612
- return result;
608
+ return CommandEntryFrom (before, *nextId);
613
609
}
614
610
615
611
return DataModel::CommandEntry::kInvalid ;
@@ -641,9 +637,10 @@ std::optional<DataModel::CommandInfo> CodegenDataModelProvider::GetAcceptedComma
641
637
{
642
638
auto commandId = finder.GetFound ();
643
639
644
- if ((err == CHIP_NO_ERROR) && firstId .has_value ())
640
+ if ((err == CHIP_NO_ERROR) && commandId .has_value ())
645
641
{
646
- return std::make_optional<DataModel::CommandInfo>() // definitive answer: command exists
642
+ // definitive answer: command exists
643
+ return CommandEntryFrom (path, *commandId).info ;
647
644
}
648
645
649
646
return std::nullopt;
0 commit comments