Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits committed Jan 6, 2022
1 parent 24c07e5 commit f74daa8
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 203 deletions.
5 changes: 3 additions & 2 deletions examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@

/* OTA related includes */
#include "OTAImageProcessorImpl.h"
#include "OtaSupport.h"
#include "platform/GenericOTARequestorDriver.h"
#include "src/app/clusters/ota-requestor/BDXDownloader.h"
#include "src/app/clusters/ota-requestor/OTARequestor.h"
#include "OtaSupport.h"

#include "Keyboard.h"
#include "LED.h"
Expand Down Expand Up @@ -78,7 +78,8 @@ extern "C" void K32WUartProcess(void);

using namespace ::chip::Credentials;
using namespace ::chip::DeviceLayer;
using namespace chip;;
using namespace chip;
;

AppTask AppTask::sAppTask;

Expand Down
45 changes: 23 additions & 22 deletions src/platform/nxp/k32w/k32w0/OTAImageProcessorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ namespace chip {

CHIP_ERROR OTAImageProcessorImpl::PrepareDownload()
{
if (mParams.imageFile.empty())
{
if (mParams.imageFile.empty())
{
ChipLogError(SoftwareUpdate, "Invalid output image file supplied");
return CHIP_ERROR_INTERNAL;
}
}

DeviceLayer::PlatformMgr().ScheduleWork(HandlePrepareDownload, reinterpret_cast<intptr_t>(this));
return CHIP_NO_ERROR;
Expand Down Expand Up @@ -63,20 +63,20 @@ CHIP_ERROR OTAImageProcessorImpl::Abort()

CHIP_ERROR OTAImageProcessorImpl::ProcessBlock(ByteSpan & block)
{
if ((block.data() == nullptr) || block.empty())
{
return CHIP_ERROR_INVALID_ARGUMENT;
}

// Store block data for HandleProcessBlock to access
CHIP_ERROR err = SetBlock(block);
if (err != CHIP_NO_ERROR)
{
ChipLogError(SoftwareUpdate, "Cannot set block data: %" CHIP_ERROR_FORMAT, err.Format());
}

DeviceLayer::PlatformMgr().ScheduleWork(HandleProcessBlock, reinterpret_cast<intptr_t>(this));
return CHIP_NO_ERROR;
if ((block.data() == nullptr) || block.empty())
{
return CHIP_ERROR_INVALID_ARGUMENT;
}

// Store block data for HandleProcessBlock to access
CHIP_ERROR err = SetBlock(block);
if (err != CHIP_NO_ERROR)
{
ChipLogError(SoftwareUpdate, "Cannot set block data: %" CHIP_ERROR_FORMAT, err.Format());
}

DeviceLayer::PlatformMgr().ScheduleWork(HandleProcessBlock, reinterpret_cast<intptr_t>(this));
return CHIP_NO_ERROR;
}

void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context)
Expand Down Expand Up @@ -129,9 +129,10 @@ void OTAImageProcessorImpl::HandleProcessBlock(intptr_t context)
}

/* Will start an erase of 4K if necessary */
if (gOtaSuccess_c == OTA_MakeHeadRoomForNextBlock(imageProcessor->mBlock.size(), NULL, 0))
if (gOtaSuccess_c == OTA_MakeHeadRoomForNextBlock(imageProcessor->mBlock.size(), NULL, 0))
{
if (gOtaSuccess_c == OTA_PushImageChunk (imageProcessor->mBlock.data(), (uint16_t)imageProcessor->mBlock.size(), NULL, NULL))
if (gOtaSuccess_c ==
OTA_PushImageChunk(imageProcessor->mBlock.data(), (uint16_t) imageProcessor->mBlock.size(), NULL, NULL))
{
imageProcessor->mParams.downloadedBytes += imageProcessor->mBlock.size();
return;
Expand Down Expand Up @@ -176,11 +177,11 @@ void OTAImageProcessorImpl::HandleFinalize(intptr_t context)
}

OTA_CommitImage(NULL);
if(OTA_ImageAuthenticate() == gOtaImageAuthPass_c)
if (OTA_ImageAuthenticate() == gOtaImageAuthPass_c)
{
/* Set the necessary information to inform the SSBL that a new image is available */
OTA_SetNewImageFlag ();
ResetMCU ();
OTA_SetNewImageFlag();
ResetMCU();
}

imageProcessor->ReleaseBlock();
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nxp/k32w/k32w0/OTAImageProcessorImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#pragma once

#include <src/app/clusters/ota-requestor/OTADownloader.h>
#include <src/include/platform/OTAImageProcessor.h>
#include <src/include/platform/CHIPDeviceLayer.h>
#include <src/include/platform/OTAImageProcessor.h>

namespace chip {

Expand Down
Loading

0 comments on commit f74daa8

Please sign in to comment.