Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GetAccessingFabricIndex in a few more places. #13395

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * c
{
// TODO: This uses the current node as the provider to supply the OTA image. This can be configurable such that the provider
// supplying the response is not the provider supplying the OTA image.
FabricIndex fabricIndex = commandObj->GetExchangeContext()->GetSessionHandle()->AsSecureSession()->GetFabricIndex();
FabricIndex fabricIndex = commandObj->GetAccessingFabricIndex();
FabricInfo * fabricInfo = Server::GetInstance().GetFabricTable().FindFabricWithIndex(fabricIndex);
NodeId nodeId = fabricInfo->GetPeerId().GetNodeId();

Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/ota-requestor/OTARequestor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ EmberAfStatus OTARequestor::HandleAnnounceOTAProvider(app::CommandHandler * comm
}

mProviderNodeId = providerNodeId;
mProviderFabricIndex = commandObj->GetExchangeContext()->GetSessionHandle()->AsSecureSession()->GetFabricIndex();
mProviderFabricIndex = commandObj->GetAccessingFabricIndex();
mProviderEndpointId = providerEndpoint;

ChipLogProgress(SoftwareUpdate, "OTA Requestor received AnnounceOTAProvider");
Expand Down
21 changes: 7 additions & 14 deletions src/app/clusters/scenes/scenes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ uint8_t emberAfPluginScenesServerEntriesInUse = 0;
EmberAfSceneTableEntry emberAfPluginScenesServerSceneTable[EMBER_AF_PLUGIN_SCENES_TABLE_SIZE];
#endif

static FabricIndex GetFabricIndex(app::CommandHandler * commandObj)
{
VerifyOrReturnError(nullptr != commandObj, 0);
VerifyOrReturnError(nullptr != commandObj->GetExchangeContext(), 0);
return commandObj->GetExchangeContext()->GetSessionHandle()->AsSecureSession()->GetFabricIndex();
}

static bool readServerAttribute(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, const char * name,
uint8_t * data, uint8_t size)
{
Expand Down Expand Up @@ -252,7 +245,7 @@ bool emberAfScenesClusterViewSceneCallback(app::CommandHandler * commandObj, con
bool emberAfScenesClusterRemoveSceneCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::RemoveScene::DecodableType & commandData)
{
auto fabricIndex = GetFabricIndex(commandObj);
auto fabricIndex = commandObj->GetAccessingFabricIndex();
auto & groupId = commandData.groupId;
auto & sceneId = commandData.sceneId;

Expand Down Expand Up @@ -311,7 +304,7 @@ bool emberAfScenesClusterRemoveSceneCallback(app::CommandHandler * commandObj, c
bool emberAfScenesClusterRemoveAllScenesCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::RemoveAllScenes::DecodableType & commandData)
{
auto fabricIndex = GetFabricIndex(commandObj);
auto fabricIndex = commandObj->GetAccessingFabricIndex();
auto & groupId = commandData.groupId;

EmberAfStatus status = EMBER_ZCL_STATUS_INVALID_FIELD;
Expand Down Expand Up @@ -363,7 +356,7 @@ bool emberAfScenesClusterRemoveAllScenesCallback(app::CommandHandler * commandOb
bool emberAfScenesClusterStoreSceneCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::StoreScene::DecodableType & commandData)
{
auto fabricIndex = GetFabricIndex(commandObj);
auto fabricIndex = commandObj->GetAccessingFabricIndex();
auto & groupId = commandData.groupId;
auto & sceneId = commandData.sceneId;

Expand Down Expand Up @@ -399,7 +392,7 @@ bool emberAfScenesClusterStoreSceneCallback(app::CommandHandler * commandObj, co
bool emberAfScenesClusterRecallSceneCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::RecallScene::DecodableType & commandData)
{
auto fabricIndex = GetFabricIndex(commandObj);
auto fabricIndex = commandObj->GetAccessingFabricIndex();
auto & groupId = commandData.groupId;
auto & sceneId = commandData.sceneId;

Expand Down Expand Up @@ -437,7 +430,7 @@ bool emberAfScenesClusterRecallSceneCallback(app::CommandHandler * commandObj, c
bool emberAfScenesClusterGetSceneMembershipCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::GetSceneMembership::DecodableType & commandData)
{
auto fabricIndex = GetFabricIndex(commandObj);
auto fabricIndex = commandObj->GetAccessingFabricIndex();
auto & groupId = commandData.groupId;

CHIP_ERROR err = CHIP_NO_ERROR;
Expand Down Expand Up @@ -768,7 +761,7 @@ bool emberAfPluginScenesServerParseAddScene(
EmberAfSceneTableEntry entry;
EmberAfStatus status;
bool enhanced = (cmd->commandId == ZCL_ENHANCED_ADD_SCENE_COMMAND_ID);
auto fabricIndex = GetFabricIndex(commandObj);
auto fabricIndex = commandObj->GetAccessingFabricIndex();
EndpointId endpoint = cmd->apsFrame->destinationEndpoint;
uint8_t i, index = EMBER_AF_SCENE_TABLE_NULL_INDEX;

Expand Down Expand Up @@ -1105,7 +1098,7 @@ bool emberAfPluginScenesServerParseViewScene(app::CommandHandler * commandObj, c
EmberAfSceneTableEntry entry = {};
EmberAfStatus status = EMBER_ZCL_STATUS_NOT_FOUND;
bool enhanced = (cmd->commandId == ZCL_ENHANCED_VIEW_SCENE_COMMAND_ID);
FabricIndex fabricIndex = GetFabricIndex(commandObj);
FabricIndex fabricIndex = commandObj->GetAccessingFabricIndex();
EndpointId endpoint = cmd->apsFrame->destinationEndpoint;

emberAfScenesClusterPrintln("RX: %pViewScene 0x%2x, 0x%x", (enhanced ? "Enhanced" : ""), groupId, sceneId);
Expand Down