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 authored and stingchang committed May 2, 2024
1 parent 76e25cb commit e9fe6f8
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 42 deletions.
22 changes: 12 additions & 10 deletions examples/chef/common/chef-rvc-mode-delegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,21 @@ void RvcRunMode::Shutdown()
}

chip::Protocols::InteractionModel::Status chefRvcRunModeWriteCallback(chip::EndpointId endpointId, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer)
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer)
{
chip::Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success;

VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
VerifyOrDie(gRvcRunModeInstance != nullptr);

ModeBase::Instance * clusterInstance = gRvcRunModeInstance;
chip::AttributeId attributeId = attributeMetadata->attributeId;
chip::AttributeId attributeId = attributeMetadata->attributeId;

switch (attributeId)
{
case chip::app::Clusters::RvcRunMode::Attributes::CurrentMode::Id: {
uint8_t m = static_cast<uint8_t>(buffer[0]);
uint8_t m = static_cast<uint8_t>(buffer[0]);
chip::Protocols::InteractionModel::Status status = clusterInstance->UpdateCurrentMode(m);
if (chip::Protocols::InteractionModel::Status::Success == status)
{
Expand All @@ -142,8 +143,8 @@ chip::Protocols::InteractionModel::Status chefRvcRunModeWriteCallback(chip::Endp
}

chip::Protocols::InteractionModel::Status chefRvcRunModeReadCallback(chip::EndpointId endpointId, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
uint16_t maxReadLength)
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer, uint16_t maxReadLength)
{

return chip::Protocols::InteractionModel::Status::Success;
Expand Down Expand Up @@ -243,20 +244,21 @@ void RvcCleanMode::Shutdown()
}

chip::Protocols::InteractionModel::Status chefRvcCleanModeWriteCallback(chip::EndpointId endpointId, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer)
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer)
{
chip::Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Success;

VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
VerifyOrDie(gRvcCleanModeInstance != nullptr);

ModeBase::Instance * clusterInstance = gRvcCleanModeInstance;
chip::AttributeId attributeId = attributeMetadata->attributeId;
chip::AttributeId attributeId = attributeMetadata->attributeId;

switch (attributeId)
{
case chip::app::Clusters::RvcCleanMode::Attributes::CurrentMode::Id: {
uint8_t m = static_cast<uint8_t>(buffer[0]);
uint8_t m = static_cast<uint8_t>(buffer[0]);
Protocols::InteractionModel::Status status = clusterInstance->UpdateCurrentMode(m);
if (Protocols::InteractionModel::Status::Success == status)
{
Expand All @@ -276,8 +278,8 @@ chip::Protocols::InteractionModel::Status chefRvcCleanModeWriteCallback(chip::En
}

chip::Protocols::InteractionModel::Status chefRvcCleanModeReadCallback(chip::EndpointId endpointId, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
uint16_t maxReadLength)
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer, uint16_t maxReadLength)
{
return chip::Protocols::InteractionModel::Status::Success;
}
Expand Down
14 changes: 8 additions & 6 deletions examples/chef/common/chef-rvc-mode-delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,18 @@ void Shutdown();

#ifdef MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER
chip::Protocols::InteractionModel::Status chefRvcRunModeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer);
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer);
chip::Protocols::InteractionModel::Status chefRvcRunModeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
uint16_t maxReadLength);
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer, uint16_t maxReadLength);
#endif // MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER

#ifdef MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER
chip::Protocols::InteractionModel::Status chefRvcCleanModeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer);
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer);
chip::Protocols::InteractionModel::Status chefRvcCleanModeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
uint16_t maxReadLength);
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer, uint16_t maxReadLength);
#endif // MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER
24 changes: 12 additions & 12 deletions examples/chef/common/chef-rvc-operational-state-delegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ using chip::Protocols::InteractionModel::Status;
static RvcOperationalState::Instance * gRvcOperationalStateInstance = nullptr;
static RvcOperationalStateDelegate * gRvcOperationalStateDelegate = nullptr;


static void onOperationalStateTimerTick(System::Layer * systemLayer, void * data);

DataModel::Nullable<uint32_t> RvcOperationalStateDelegate::GetCountdownTime()
Expand Down Expand Up @@ -184,19 +183,21 @@ void RvcOperationalState::Shutdown()
}
}

chip::Protocols::InteractionModel::Status chefRvcOperationalStateWriteCallback(chip::EndpointId endpointId, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer)
chip::Protocols::InteractionModel::Status chefRvcOperationalStateWriteCallback(chip::EndpointId endpointId,
chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer)
{
chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success;
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
VerifyOrDie(gRvcOperationalStateInstance != nullptr);
chip::AttributeId attributeId = attributeMetadata->attributeId;
chip::AttributeId attributeId = attributeMetadata->attributeId;

switch (attributeId)
{
case chip::app::Clusters::RvcOperationalState::Attributes::CurrentPhase::Id: {
uint8_t m = static_cast<uint8_t>(buffer[0]);
DataModel::Nullable<uint8_t> aPhase(m);
uint8_t m = static_cast<uint8_t>(buffer[0]);
DataModel::Nullable<uint8_t> aPhase(m);
CHIP_ERROR err = gRvcOperationalStateInstance->SetCurrentPhase(aPhase);
if (CHIP_NO_ERROR == err)
{
Expand All @@ -207,7 +208,7 @@ chip::Protocols::InteractionModel::Status chefRvcOperationalStateWriteCallback(c
}
break;
case chip::app::Clusters::RvcOperationalState::Attributes::OperationalState::Id: {
uint8_t m = static_cast<uint8_t>(buffer[0]);
uint8_t m = static_cast<uint8_t>(buffer[0]);
CHIP_ERROR err = gRvcOperationalStateInstance->SetOperationalState(m);
if (CHIP_NO_ERROR == err)
{
Expand All @@ -226,10 +227,9 @@ chip::Protocols::InteractionModel::Status chefRvcOperationalStateWriteCallback(c
return ret;
}

chip::Protocols::InteractionModel::Status
chefRvcOperationalStateReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
uint16_t maxReadLength)
chip::Protocols::InteractionModel::Status chefRvcOperationalStateReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer, uint16_t maxReadLength)
{
return chip::Protocols::InteractionModel::Status::Success;
}
Expand All @@ -239,7 +239,7 @@ void emberAfRvcOperationalStateClusterInitCallback(chip::EndpointId endpointId)
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
VerifyOrDie(gRvcOperationalStateInstance == nullptr && gRvcOperationalStateDelegate == nullptr);

gRvcOperationalStateDelegate = new chip::app::Clusters::RvcOperationalState::RvcOperationalStateDelegate();
gRvcOperationalStateDelegate = new chip::app::Clusters::RvcOperationalState::RvcOperationalStateDelegate();
EndpointId operationalStateEndpoint = 0x01;
gRvcOperationalStateInstance = new RvcOperationalState::Instance(gRvcOperationalStateDelegate, operationalStateEndpoint);

Expand Down
20 changes: 8 additions & 12 deletions examples/chef/common/chef-rvc-operational-state-delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ namespace RvcOperationalState {
class RvcOperationalStateDelegate : public RvcOperationalState::Delegate
{
public:

RvcOperationalStateDelegate()
{
mOperationalStateList = Span<const OperationalState::GenericOperationalState>(rvcOpStateList);
}
RvcOperationalStateDelegate() { mOperationalStateList = Span<const OperationalState::GenericOperationalState>(rvcOpStateList); }

/**
* Get the countdown time. This attribute is not used in this application.
Expand Down Expand Up @@ -100,6 +96,7 @@ class RvcOperationalStateDelegate : public RvcOperationalState::Delegate
uint32_t mRunningTime = 0;
uint32_t mPausedTime = 0;
app::DataModel::Nullable<uint32_t> mCountDownTime;

private:
Span<const OperationalState::GenericOperationalState> mOperationalStateList;
Span<const CharSpan> mOperationalPhaseList;
Expand All @@ -123,11 +120,10 @@ void Shutdown();
} // namespace app
} // namespace chip

chip::Protocols::InteractionModel::Status
chefRvcOperationalStateWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer);
chip::Protocols::InteractionModel::Status
chefRvcOperationalStateReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
uint16_t maxReadLength);
chip::Protocols::InteractionModel::Status chefRvcOperationalStateWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer);
chip::Protocols::InteractionModel::Status chefRvcOperationalStateReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer, uint16_t maxReadLength);
#endif // MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER
3 changes: 1 addition & 2 deletions examples/chef/common/stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include "chef-concentration-measurement.h"
#endif

#if defined(MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER) || \
defined(MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER)
#if defined(MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER) || defined(MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER)
#include "chef-rvc-mode-delegate.h"
#endif

Expand Down

0 comments on commit e9fe6f8

Please sign in to comment.