Skip to content

Commit d344a19

Browse files
restyled-commitsnivi-apple
authored andcommitted
Restyled by clang-format
1 parent 0a5f615 commit d344a19

7 files changed

+34
-37
lines changed

src/darwin/Framework/CHIP/MTROTAImageTransferHandler.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class MTROTAImageTransferHandler : public chip::bdx::AsyncResponder
4646
chip::System::PacketBufferHandle && payload) override;
4747

4848
private:
49-
CHIP_ERROR PrepareForTransfer(chip::System::Layer * layer, chip::Messaging::ExchangeContext * exchangeCtx, chip::FabricIndex fabricIndex,
50-
chip::NodeId nodeId);
49+
CHIP_ERROR PrepareForTransfer(chip::System::Layer * layer, chip::Messaging::ExchangeContext * exchangeCtx,
50+
chip::FabricIndex fabricIndex, chip::NodeId nodeId);
5151

5252
CHIP_ERROR ConfigureState(chip::FabricIndex fabricIndex, chip::NodeId nodeId);
5353

@@ -67,7 +67,7 @@ class MTROTAImageTransferHandler : public chip::bdx::AsyncResponder
6767

6868
// The OTA provider delegate used by the controller.
6969
id<MTROTAProviderDelegate> mDelegate = nil;
70-
chip::System::Layer * mSystemLayer = nil;
70+
chip::System::Layer * mSystemLayer = nil;
7171

7272
// The OTA provider delegate queue used by the controller.
7373
dispatch_queue_t mDelegateNotificationQueue = nil;

src/darwin/Framework/CHIP/MTROTAImageTransferHandler.mm

+2-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
MTROTAUnsolicitedBDXMessageHandler::DecrementNumberOfDelegates();
6666
}
6767

68-
6968
CHIP_ERROR MTROTAImageTransferHandler::OnTransferSessionBegin(TransferSession::OutputEvent & event)
7069
{
7170
assertChipStackLockedByCurrentThread();
@@ -291,8 +290,8 @@
291290
case TransferSession::OutputEventType::kQueryReceived:
292291
err = OnBlockQuery(event);
293292
if (err != CHIP_NO_ERROR) {
294-
LogErrorOnFailure(err);
295-
AsyncResponder::NotifyEventHandled(event, err);
293+
LogErrorOnFailure(err);
294+
AsyncResponder::NotifyEventHandled(event, err);
296295
}
297296
break;
298297
case TransferSession::OutputEventType::kNone:

src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#include <MTRError_Internal.h>
3434
#include <messaging/ExchangeMgr.h>
3535
#include <platform/LockTracker.h>
36-
#include <protocols/bdx/BdxUri.h>
3736
#include <protocols/bdx/AsyncTransferFacilitator.h>
37+
#include <protocols/bdx/BdxUri.h>
3838

3939
using namespace chip;
4040
using namespace chip::app;
@@ -93,7 +93,6 @@
9393
mOtaUnsolicitedBDXMsgHandler.ControllerShuttingDown(controller);
9494
}
9595

96-
9796
namespace {
9897
// Return false if we could not get peer node info (a running controller for
9998
// the fabric and a node id). In that case we will have already added an

src/darwin/Framework/CHIP/MTROTAUnsolicitedBDXMessageHandler.h

+8-7
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ NS_ASSUME_NONNULL_BEGIN
3333
* returns CHIP_ERROR_INCORRECT_STATE.
3434
*
3535
*/
36-
class MTROTAUnsolicitedBDXMessageHandler : public chip::Messaging::UnsolicitedMessageHandler
37-
{
36+
class MTROTAUnsolicitedBDXMessageHandler : public chip::Messaging::UnsolicitedMessageHandler {
3837
public:
39-
MTROTAUnsolicitedBDXMessageHandler() : mExchangeMgr(nullptr) {}
38+
MTROTAUnsolicitedBDXMessageHandler()
39+
: mExchangeMgr(nullptr)
40+
{
41+
}
4042
~MTROTAUnsolicitedBDXMessageHandler() { mExchangeMgr = nullptr; }
4143

4244
CHIP_ERROR Init(chip::Messaging::ExchangeManager * exchangeManager);
@@ -50,14 +52,13 @@ class MTROTAUnsolicitedBDXMessageHandler : public chip::Messaging::UnsolicitedMe
5052
// Decrease the number of delegates handling BDX transfers by 1.
5153
static void DecrementNumberOfDelegates();
5254

53-
void Shutdown();
55+
void Shutdown();
5456

55-
void ControllerShuttingDown(MTRDeviceController * controller);
57+
void ControllerShuttingDown(MTRDeviceController * controller);
5658

5759
private:
58-
5960
CHIP_ERROR OnUnsolicitedMessageReceived(const chip::PayloadHeader & payloadHeader, const chip::SessionHandle & session,
60-
chip::Messaging::ExchangeDelegate * _Nonnull & newDelegate) override;
61+
chip::Messaging::ExchangeDelegate * _Nonnull & newDelegate) override;
6162

6263
void OnExchangeCreationFailed(chip::Messaging::ExchangeDelegate * _Nonnull delegate) override;
6364

src/darwin/Framework/CHIP/MTROTAUnsolicitedBDXMessageHandler.mm

+3-5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
}
5757

5858
CHIP_ERROR MTROTAUnsolicitedBDXMessageHandler::OnUnsolicitedMessageReceived(const PayloadHeader & payloadHeader, const SessionHandle & session,
59-
ExchangeDelegate * _Nonnull & newDelegate)
59+
ExchangeDelegate * _Nonnull & newDelegate)
6060
{
6161
assertChipStackLockedByCurrentThread();
6262

@@ -65,14 +65,12 @@
6565

6666
VerifyOrReturnError(mExchangeMgr != nullptr, CHIP_ERROR_INCORRECT_STATE);
6767

68-
if (GetNumberOfDelegates() >= 1)
69-
{
68+
if (GetNumberOfDelegates() >= 1) {
7069
return CHIP_ERROR_BUSY;
7170
}
7271

7372
// Only proceed if there is a valid fabric index for the SessionHandle.
74-
if (session->IsSecureSession() && session->AsSecureSession() != nullptr && session->AsSecureSession()->GetFabricIndex() != kUndefinedFabricIndex)
75-
{
73+
if (session->IsSecureSession() && session->AsSecureSession() != nullptr && session->AsSecureSession()->GetFabricIndex() != kUndefinedFabricIndex) {
7674
// If we receive a ReceiveInit BDX message, create a new MTROTAImageTransferHandler and register it
7775
// as the handler for all BDX messages that will come over this exchange and increment the number of delegates.
7876
if (payloadHeader.HasMessageType(MessageType::ReceiveInit)) {

src/protocols/bdx/AsyncTransferFacilitator.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ void AsyncTransferFacilitator::CleanUp()
3939
this);
4040
}
4141

42-
AsyncTransferFacilitator::~AsyncTransferFacilitator()
43-
{
44-
}
42+
AsyncTransferFacilitator::~AsyncTransferFacilitator() {}
4543

4644
bdx::StatusCode AsyncTransferFacilitator::GetBdxStatusCodeFromChipError(CHIP_ERROR err)
4745
{
@@ -57,9 +55,10 @@ bdx::StatusCode AsyncTransferFacilitator::GetBdxStatusCodeFromChipError(CHIP_ERR
5755
}
5856

5957
/**
60-
* Calls the GetNextAction on the TransferSession to get the next output events until it receives TransferSession::OutputEventType::kNone
61-
* If the output event is of type TransferSession::OutputEventType::kMsgToSend, it sends the message over the exchange context, otherwise it
62-
* calls the HandleTransferSessionOutput method implemented by the subclass to handle the BDX message.
58+
* Calls the GetNextAction on the TransferSession to get the next output events until it receives
59+
* TransferSession::OutputEventType::kNone If the output event is of type TransferSession::OutputEventType::kMsgToSend, it sends the
60+
* message over the exchange context, otherwise it calls the HandleTransferSessionOutput method implemented by the subclass to
61+
* handle the BDX message.
6362
*/
6463
void AsyncTransferFacilitator::HandleNextOutputEvents()
6564
{
@@ -92,7 +91,8 @@ void AsyncTransferFacilitator::HandleNextOutputEvents()
9291
mHandlingOutputEvents = false;
9392
}
9493

95-
CHIP_ERROR AsyncTransferFacilitator::SendMessage(const TransferSession::MessageTypeData msgTypeData, System::PacketBufferHandle & msgBuf)
94+
CHIP_ERROR AsyncTransferFacilitator::SendMessage(const TransferSession::MessageTypeData msgTypeData,
95+
System::PacketBufferHandle & msgBuf)
9696
{
9797
VerifyOrReturnError(mExchange, CHIP_ERROR_INCORRECT_STATE);
9898

@@ -138,7 +138,6 @@ CHIP_ERROR AsyncTransferFacilitator::OnMessageReceived(Messaging::ExchangeContex
138138
// This should notify the tranfer object to abort transfer so it can send a status report across the exchange
139139
// when we call HandleNextOutputEvents below.
140140
mTransfer.AbortTransfer(AsyncResponder::GetBdxStatusCodeFromChipError(err));
141-
142141
}
143142
else if (!payloadHeader.HasMessageType(MessageType::BlockAckEOF))
144143
{
@@ -171,7 +170,7 @@ CHIP_ERROR AsyncResponder::PrepareForTransfer(System::Layer * layer, Messaging::
171170
VerifyOrReturnError(!mExchange, CHIP_ERROR_INCORRECT_STATE);
172171

173172
mSystemLayer = layer;
174-
mTimeout = timeout;
173+
mTimeout = timeout;
175174

176175
ReturnErrorOnFailure(mTransfer.WaitForTransfer(role, xferControlOpts, maxBlockSize, mTimeout));
177176

@@ -195,7 +194,8 @@ void AsyncResponder::NotifyEventHandled(TransferSession::OutputEvent & event, CH
195194
return;
196195
}
197196

198-
// If there was an error handling the output event, this should notify the tranfer object to abort transfer so it can send a status report
197+
// If there was an error handling the output event, this should notify the tranfer object to abort transfer so it can send a
198+
// status report
199199
// across the exchange when we call HandleNextOutputEvents below.
200200
if (error != CHIP_NO_ERROR)
201201
{

src/protocols/bdx/AsyncTransferFacilitator.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ namespace bdx {
2929
/**
3030
* An abstract class with methods for handling BDX messages received from an ExchangeContext. Once a message is receievd, this
3131
* class passes the message to the TransferSession to process the received message and gets the next output events from the
32-
* TransferSession state machine and either sends a message accross the exchange or calls the HandleTransferSessionOutput virtual method
33-
* to notify the subclass of the event generated. It keeps getting the next output event until it receieves an output event of type
34-
* TransferSession::OutputEventType::kNone. For messages that are sent to the HandleTransferSessionOutput method, the subclass must call the
35-
* NotifyEventHandled to notify the AsyncTransferFacilitator that the event has been handled and returns an error code for error cases or success.
32+
* TransferSession state machine and either sends a message accross the exchange or calls the HandleTransferSessionOutput virtual
33+
* method to notify the subclass of the event generated. It keeps getting the next output event until it receieves an output event
34+
* of type TransferSession::OutputEventType::kNone. For messages that are sent to the HandleTransferSessionOutput method, the
35+
* subclass must call the NotifyEventHandled to notify the AsyncTransferFacilitator that the event has been handled and returns an
36+
* error code for error cases or success.
3637
*
3738
* This class does not define any methods for beginning a transfer or initializing the underlying TransferSession object.
3839
* See AsyncResponder for a class that does.
@@ -85,7 +86,6 @@ class AsyncTransferFacilitator : public Messaging::ExchangeDelegate
8586
System::Layer * mSystemLayer;
8687

8788
private:
88-
8989
bool mHandlingOutputEvents;
9090
};
9191

@@ -116,8 +116,8 @@ class AsyncResponder : public AsyncTransferFacilitator
116116
/**
117117
* This is called by the subclass implementing HandleTransferSessionOutput to notify the AsyncTransferFacilitator
118118
* that it has handled the OutputEvent specified in event and returns an error code (if any) or success in the error paramter.
119-
* Once this is called the AsyncTransferFacilitator either aborts the transfer if an error has ocurred or drives the TransferSession
120-
* state machine to generate the next output events to establish and continue the BDX session further.
119+
* Once this is called the AsyncTransferFacilitator either aborts the transfer if an error has ocurred or drives the
120+
* TransferSession state machine to generate the next output events to establish and continue the BDX session further.
121121
*
122122
*
123123
* @param[in] event The OutputEvent that was handled by the subclass.

0 commit comments

Comments
 (0)