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 7d31a5c commit 5a2249a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void BdxOtaSender::HandleTransferSessionOutput(TransferSession::OutputEvent & ev

if (event.EventType != TransferSession::OutputEventType::kNone)
{
ChipLogDetail(BDX, "OutputEvent type: %d", static_cast<uint16_t>(event.EventType));
ChipLogDetail(BDX, "OutputEvent type: %s", event.ToString(event.EventType));
}

switch (event.EventType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void BdxDownloader::HandleTransferSessionOutput(TransferSession::OutputEvent & e

if (event.EventType != TransferSession::OutputEventType::kNone)
{
ChipLogDetail(BDX, "OutputEvent type: %d", static_cast<uint16_t>(event.EventType));
ChipLogDetail(BDX, "OutputEvent type: %s", event.ToString(event.EventType));
}

switch (event.EventType)
Expand Down
31 changes: 31 additions & 0 deletions src/protocols/bdx/BdxTransferSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,37 @@ bool TransferSession::IsTransferLengthDefinite()
return (mTransferLength > 0);
}

const char * TransferSession::OutputEvent::ToString(OutputEventType outputEventType)
{
switch (outputEventType)
{
case OutputEventType::kNone:
return "None";
case OutputEventType::kMsgToSend:
return "MsgToSend";
case OutputEventType::kInitReceived:
return "InitReceived";
case OutputEventType::kAcceptReceived:
return "AcceptReceived";
case OutputEventType::kBlockReceived:
return "BlockReceived";
case OutputEventType::kQueryReceived:
return "QueryReceived";
case OutputEventType::kAckReceived:
return "AckReceived";
case OutputEventType::kAckEOFReceived:
return "AckEOFReceived";
case OutputEventType::kStatusReceived:
return "StatusReceived";
case OutputEventType::kInternalError:
return "InternalError";
case OutputEventType::kTransferTimeout:
return "TransferTimeout";
default:
return "Unknown";
}
}

TransferSession::OutputEvent TransferSession::OutputEvent::TransferInitEvent(TransferInitData data, System::PacketBufferHandle msg)
{
OutputEvent event(OutputEventType::kInitReceived);
Expand Down
2 changes: 2 additions & 0 deletions src/protocols/bdx/BdxTransferSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ class DLL_EXPORT TransferSession
OutputEvent() : EventType(OutputEventType::kNone) { statusData = { StatusCode::kNone }; }
OutputEvent(OutputEventType type) : EventType(type) { statusData = { StatusCode::kNone }; }

const char * ToString(OutputEventType outputEventType);

static OutputEvent TransferInitEvent(TransferInitData data, System::PacketBufferHandle msg);
static OutputEvent TransferAcceptEvent(TransferAcceptData data);
static OutputEvent TransferAcceptEvent(TransferAcceptData data, System::PacketBufferHandle msg);
Expand Down

0 comments on commit 5a2249a

Please sign in to comment.