Skip to content

Commit

Permalink
Add logging for OTA QueryImage, AnnounceOTAProvider, and BDX
Browse files Browse the repository at this point in the history
- These logs are to be parsed from testing side for verification
  • Loading branch information
carol-apple committed Oct 30, 2021
1 parent bf585f8 commit 7d31a5c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,16 @@ EmberAfStatus ExampleOTARequestor::HandleAnnounceOTAProvider(
mProviderNodeId = providerLocation;
mProviderFabricIndex = commandObj->GetExchangeContext()->GetSessionHandle().GetFabricIndex();

ChipLogProgress(SoftwareUpdate, "Notified of Provider at NodeID: 0x" ChipLogFormatX64 " on FabricIndex 0x%" PRIu8,
ChipLogValueX64(mProviderNodeId), mProviderFabricIndex);

ChipLogProgress(SoftwareUpdate, "OTA Requestor received AnnounceOTAProvider");
ChipLogDetail(SoftwareUpdate, " FabricIndex: %" PRIu8, mProviderFabricIndex);
ChipLogDetail(SoftwareUpdate, " ProviderNodeID: %" PRIu64, mProviderNodeId);
ChipLogDetail(SoftwareUpdate, " VendorID: %" PRIu16, commandData.vendorId);
ChipLogDetail(SoftwareUpdate, " AnnouncementReason: %" PRIu8, announcementReason);
if (commandData.metadataForNode.HasValue())
{
ChipLogDetail(SoftwareUpdate, " MetadataForNode: %.*s", static_cast<int>(commandData.metadataForNode.Value().size()), commandData.metadataForNode.Value().data());
}

// If reason is URGENT_UPDATE_AVAILABLE, we start OTA immediately. Otherwise, respect the timer value set in mOtaStartDelayMs.
// This is done to exemplify what a real-world OTA Requestor might do while also being configurable enough to use as a test app.
uint32_t msToStart = 0;
Expand Down
10 changes: 9 additions & 1 deletion src/app/clusters/ota-provider/ota-provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,15 @@ bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(app::CommandHandl
return true;
};

ChipLogDetail(Zcl, "OTA Provider received QueryImage");
ChipLogProgress(Zcl, "OTA Provider received QueryImage");
ChipLogDetail(Zcl, " VendorID: %" PRIu16, vendorId);
ChipLogDetail(Zcl, " ProductID: %" PRIu16, productId);
ChipLogDetail(Zcl, " SoftwareVersion: %" PRIu32, softwareVersion);
ChipLogDetail(Zcl, " ProtocolsSupported: %" PRIu8, protocolsSupported);
ChipLogDetail(Zcl, " HardwareVersion: %" PRIu16, hardwareVersion);
ChipLogDetail(Zcl, " Location: %.*s", static_cast<int>(location.size()), location.data());
ChipLogDetail(Zcl, " RequestorCanConsent: %" PRIu8, requestorCanConsent);
ChipLogDetail(Zcl, " MetadataForProvider: %.*s", static_cast<int>(metadataForProvider.size()), metadataForProvider.data());

if (location.size() != kLocationLen)
{
Expand Down

0 comments on commit 7d31a5c

Please sign in to comment.