Skip to content

Commit

Permalink
Merge branch 'silabs' into RC_2.3.0-1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinez-silabs committed Jan 12, 2024
2 parents af7b9b5 + 0d18261 commit db3f65c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ class OperationalStateDelegate : public Delegate

/**
* Get the list of supported operational phases.
* Fills in the provided GenericOperationalPhase with the phase at index `index` if there is one,
* Fills in the provided MutableCharSpan with the phase at index `index` if there is one,
* or returns CHIP_ERROR_NOT_FOUND if the index is out of range for the list of phases.
*
* If CHIP_ERROR_NOT_FOUND is returned for index 0, that indicates that the PhaseList attribute is null
* (there are no phases defined at all).
*
* @param index The index of the phase, with 0 representing the first phase.
* @param operationalPhase The GenericOperationalPhase is filled.
* @param operationalPhase The MutableCharSpan is filled.
*/
CHIP_ERROR GetOperationalPhaseAtIndex(size_t index, GenericOperationalPhase & operationalPhase) override;
CHIP_ERROR GetOperationalPhaseAtIndex(size_t index, MutableCharSpan & operationalPhase) override;

// command callback
/**
Expand Down Expand Up @@ -103,13 +107,7 @@ class OperationalStateDelegate : public Delegate
};

app::DataModel::List<const GenericOperationalState> mOperationalStateList = Span<const GenericOperationalState>(rvcOpStateList);

const GenericOperationalPhase opPhaseList[1] = {
// Phase List is null
GenericOperationalPhase(DataModel::Nullable<CharSpan>()),
};

Span<const GenericOperationalPhase> mOperationalPhaseList = Span<const GenericOperationalPhase>(opPhaseList);
const Span<const CharSpan> mOperationalPhaseList;
};

OperationalState::Instance* GetInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ CHIP_ERROR OperationalStateDelegate::GetOperationalStateAtIndex(size_t index, Ge
return CHIP_NO_ERROR;
}

CHIP_ERROR OperationalStateDelegate::GetOperationalPhaseAtIndex(size_t index, GenericOperationalPhase & operationalPhase)
CHIP_ERROR OperationalStateDelegate::GetOperationalPhaseAtIndex(size_t index, MutableCharSpan & operationalPhase)
{
if (index > mOperationalPhaseList.size() - 1)
if (index >= mOperationalPhaseList.size())
{
return CHIP_ERROR_NOT_FOUND;
}
operationalPhase = mOperationalPhaseList[index];
return CHIP_NO_ERROR;
return CopyCharSpanToMutableCharSpan(mOperationalPhaseList[index], operationalPhase);
}

void OperationalStateDelegate::HandlePauseStateCallback(GenericOperationalError & err)
Expand Down

0 comments on commit db3f65c

Please sign in to comment.