Skip to content

Commit

Permalink
[Ameba] Run restyle-diff.sh, and modified cmake configuration to add …
Browse files Browse the repository at this point in the history
…additional implementation
  • Loading branch information
pankore committed Oct 9, 2023
1 parent 9f2648a commit 76f6ed4
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 175 deletions.
11 changes: 9 additions & 2 deletions examples/all-clusters-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,12 @@ list(
APPEND ${list_chip_main_sources}

${chip_dir}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp
Expand All @@ -167,10 +169,15 @@ list(
${chip_dir}/examples/all-clusters-app/ameba/main/CHIPDeviceManager.cpp
${chip_dir}/examples/all-clusters-app/ameba/main/Globals.cpp
${chip_dir}/examples/all-clusters-app/ameba/main/LEDWidget.cpp
${chip_dir}/examples/all-clusters-app/ameba/main/OperationalStateManager.cpp
${chip_dir}/examples/all-clusters-app/ameba/main/ManualOperationCommand.cpp
${chip_dir}/examples/all-clusters-app/ameba/main/SmokeCOAlarmManager.cpp

${chip_dir}/examples/platform/ameba/route_hook/ameba_route_hook.c
${chip_dir}/examples/platform/ameba/route_hook/ameba_route_table.c

${chip_dir}/examples/platform/ameba/test_event_trigger/AmebaTestEventTriggerDelegate.cpp

${chip_dir}/examples/providers/DeviceInfoProviderImpl.cpp
)

Expand Down
40 changes: 22 additions & 18 deletions examples/all-clusters-app/ameba/main/ManualOperationCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
*/

#include "ManualOperationCommand.h"
#include "ManualDishWasherAlarmCommand.h"
#include "ManualOperationalStateCommand.h"
#include "ManualRVCModesCommand.h"
#include "ManualRefrigeratorAlarmCommand.h"
#include "ManualDishWasherAlarmCommand.h"

#include "app/server/Server.h"
#include "platform/CHIPDeviceLayer.h"
Expand Down Expand Up @@ -109,32 +109,36 @@ static void RegisterManualOperationCommands()
{ &ManualRVCCleanModeCommandHelpHandler, "help", "Usage: manual rvc cleanmode <subcommand>" },
{ &ManualRVCCleanModeSetModeCommandHandler, "set-mode", "set-mode Usage: manual rvc cleanmode set-mode <mode>" },
};
static const shell_command_t sManualRefrigeratorAlarmStateSubCommands[] = {
{ &ManualRefrigeratorAlarmCommandHelpHandler, "help", "Usage: manual refalm <subcommand>" },
{ &ManualRefrigeratorAlarmDoorOpenCommandHandler, "door-open", "door-open Usage: manual refalm door-open" },
{ &ManualRefrigeratorAlarmDoorCloseCommandHandler, "door-close", "door-close Usage: manual refalm door-close" },
{ &ManualRefrigeratorAlarmSuppressCommandHandler, "suppress-alarm", "suppress-alarm Usage: manual refalm suppress-alarm" },
};

static const shell_command_t sManualDishWasherAlarmSubCommands[] = {
{ &ManualDishWasherAlarmCommandHelpHandler, "help", "Usage: manual dishalm <subcommand>" },
{ &ManualDishWasherAlarmSetRaiseCommandHandler, "raise", "raise Usage: manual dishalm raise"},
{ &ManualDishWasherAlarmSetLowerCommandHandler, "lower", "lower Usage: manual dishalm lower" },
};

static const shell_command_t sManualRefrigeratorAlarmStateSubCommands[] = {
{ &ManualRefrigeratorAlarmCommandHelpHandler, "help", "Usage: manual refalm <subcommand>" },
{ &ManualRefrigeratorAlarmDoorOpenCommandHandler, "door-open", "door-open Usage: manual refalm door-open" },
{ &ManualRefrigeratorAlarmDoorCloseCommandHandler, "door-close", "door-close Usage: manual refalm door-close" },
{ &ManualRefrigeratorAlarmSuppressCommandHandler, "suppress-alarm", "suppress-alarm Usage: manual refalm suppress-alarm" },
};

static const shell_command_t sManualDishWasherAlarmSubCommands[] = {
{ &ManualDishWasherAlarmCommandHelpHandler, "help", "Usage: manual dishalm <subcommand>" },
{ &ManualDishWasherAlarmSetRaiseCommandHandler, "raise", "raise Usage: manual dishalm raise" },
{ &ManualDishWasherAlarmSetLowerCommandHandler, "lower", "lower Usage: manual dishalm lower" },
};

static const shell_command_t sManualOperationCommand = { &ManualOperationCommandHandler, "manual",
"Manual Operation commands. Usage: manual <subcommand>" };

// Register commands
sShellManualOperationSubCommands.RegisterCommands(sManualOperationSubCommands, ArraySize(sManualOperationSubCommands));
sShellManualOperationalStateSubCommands.RegisterCommands(sManualOperationalStateSubCommands, ArraySize(sManualOperationalStateSubCommands));
sShellManualOperationalStateSubCommands.RegisterCommands(sManualOperationalStateSubCommands,
ArraySize(sManualOperationalStateSubCommands));
sShellManualRVCSubCommands.RegisterCommands(sManualRVCSubCommands, ArraySize(sManualRVCSubCommands));
sShellManualRVCOperationalStateSubCommands.RegisterCommands(sManualRVCOperationalStateSubCommands, ArraySize(sManualRVCOperationalStateSubCommands));
sShellManualRVCOperationalStateSubCommands.RegisterCommands(sManualRVCOperationalStateSubCommands,
ArraySize(sManualRVCOperationalStateSubCommands));
sShellManualRVCRunModeSubCommands.RegisterCommands(sManualRVCRunModeSubCommands, ArraySize(sManualRVCRunModeSubCommands));
sShellManualRVCCleanModeSubCommands.RegisterCommands(sManualRVCCleanModeSubCommands, ArraySize(sManualRVCCleanModeSubCommands));
sShellManualRefrigeratorAlarmStateSubCommands.RegisterCommands(sManualRefrigeratorAlarmStateSubCommands, ArraySize(sManualRefrigeratorAlarmStateSubCommands));
sShellManualDishWasherAlarmStateSubCommands.RegisterCommands(sManualDishWasherAlarmSubCommands, ArraySize(sManualDishWasherAlarmSubCommands));
sShellManualRefrigeratorAlarmStateSubCommands.RegisterCommands(sManualRefrigeratorAlarmStateSubCommands,
ArraySize(sManualRefrigeratorAlarmStateSubCommands));
sShellManualDishWasherAlarmStateSubCommands.RegisterCommands(sManualDishWasherAlarmSubCommands,
ArraySize(sManualDishWasherAlarmSubCommands));

Engine::Root().RegisterCommands(&sManualOperationCommand, 1);
}
Expand Down
24 changes: 12 additions & 12 deletions examples/all-clusters-app/ameba/main/OperationalStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using namespace chip::app::Clusters;
using namespace chip::app::Clusters::OperationalState;
using namespace chip::app::Clusters::RvcOperationalState;

CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalStateAtIndex(size_t index, GenericOperationalState &operationalState)
CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalStateAtIndex(size_t index, GenericOperationalState & operationalState)
{
if (index >= mOperationalStateList.size())
{
Expand All @@ -33,7 +33,7 @@ CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalStateAtIndex(size_
return CHIP_NO_ERROR;
}

CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalPhaseAtIndex(size_t index, GenericOperationalPhase &operationalPhase)
CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalPhaseAtIndex(size_t index, GenericOperationalPhase & operationalPhase)
{
if (index >= mOperationalPhaseList.size())
{
Expand All @@ -43,7 +43,7 @@ CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalPhaseAtIndex(size_
return CHIP_NO_ERROR;
}

void GenericOperationalStateDelegateImpl::HandlePauseStateCallback(GenericOperationalError &err)
void GenericOperationalStateDelegateImpl::HandlePauseStateCallback(GenericOperationalError & err)
{
auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kPaused));
if (error == CHIP_NO_ERROR)
Expand All @@ -56,7 +56,7 @@ void GenericOperationalStateDelegateImpl::HandlePauseStateCallback(GenericOperat
}
}

void GenericOperationalStateDelegateImpl::HandleResumeStateCallback(GenericOperationalError &err)
void GenericOperationalStateDelegateImpl::HandleResumeStateCallback(GenericOperationalError & err)
{
auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning));
if (error == CHIP_NO_ERROR)
Expand All @@ -69,7 +69,7 @@ void GenericOperationalStateDelegateImpl::HandleResumeStateCallback(GenericOpera
}
}

void GenericOperationalStateDelegateImpl::HandleStartStateCallback(GenericOperationalError &err)
void GenericOperationalStateDelegateImpl::HandleStartStateCallback(GenericOperationalError & err)
{
auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning));
if (error == CHIP_NO_ERROR)
Expand All @@ -82,7 +82,7 @@ void GenericOperationalStateDelegateImpl::HandleStartStateCallback(GenericOperat
}
}

void GenericOperationalStateDelegateImpl::HandleStopStateCallback(GenericOperationalError &err)
void GenericOperationalStateDelegateImpl::HandleStopStateCallback(GenericOperationalError & err)
{
auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kStopped));
if (error == CHIP_NO_ERROR)
Expand All @@ -97,8 +97,8 @@ void GenericOperationalStateDelegateImpl::HandleStopStateCallback(GenericOperati

// Init Operational State cluster

static OperationalState::Instance *gOperationalStateInstance = nullptr;
static OperationalStateDelegate *gOperationalStateDelegate = nullptr;
static OperationalState::Instance * gOperationalStateInstance = nullptr;
static OperationalStateDelegate * gOperationalStateDelegate = nullptr;

void OperationalState::Shutdown()
{
Expand All @@ -114,7 +114,7 @@ void OperationalState::Shutdown()
}
}

OperationalState::Instance *OperationalState::GetOperationalStateInstance()
OperationalState::Instance * OperationalState::GetOperationalStateInstance()
{
return gOperationalStateInstance;
}
Expand All @@ -135,10 +135,10 @@ void emberAfOperationalStateClusterInitCallback(chip::EndpointId endpointId)

// Init RVC Operational State cluster

static OperationalState::Instance *gRvcOperationalStateInstance = nullptr;
static RvcOperationalStateDelegate *gRvcOperationalStateDelegate = nullptr;
static OperationalState::Instance * gRvcOperationalStateInstance = nullptr;
static RvcOperationalStateDelegate * gRvcOperationalStateDelegate = nullptr;

OperationalState::Instance *OperationalState::GetRVCOperationalStateInstance()
OperationalState::Instance * OperationalState::GetRVCOperationalStateInstance()
{
return gRvcOperationalStateInstance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CHIP_ERROR SmokeCoAlarmManager::Init()

void SmokeCoAlarmManager::StartSelfTesting()
{
//Currently selftest is not implemented
// Currently selftest is not implemented
}

bool emberAfHandleEventTrigger(uint64_t eventTrigger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,33 @@ CHIP_ERROR ManualDishWasherAlarmSetRaiseCommandHandler(int argc, char ** argv)
{
CHIP_ERROR err = CHIP_NO_ERROR;
EmberAfStatus status;
DishwasherAlarmServer& serverInstance = DishwasherAlarmServer::Instance();

status = serverInstance.SetSupportedValue(1,47);
if (status != EMBER_ZCL_STATUS_SUCCESS) {
err = CHIP_ERROR_INTERNAL;
goto exit;
}

status = serverInstance.SetMaskValue(1, 47);
if (status != EMBER_ZCL_STATUS_SUCCESS) {
err = CHIP_ERROR_INTERNAL;
goto exit;
}

status = serverInstance.SetStateValue(1, 14, 0);
if (status != EMBER_ZCL_STATUS_SUCCESS) {
err = CHIP_ERROR_INTERNAL;
goto exit;
}
DishwasherAlarmServer & serverInstance = DishwasherAlarmServer::Instance();

status = serverInstance.SetSupportedValue(1, 47);
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
err = CHIP_ERROR_INTERNAL;
goto exit;
}

status = serverInstance.SetMaskValue(1, 47);
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
err = CHIP_ERROR_INTERNAL;
goto exit;
}

status = serverInstance.SetStateValue(1, 14, 0);
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
err = CHIP_ERROR_INTERNAL;
goto exit;
}
exit:
if (err != CHIP_NO_ERROR) {
ChipLogError(DeviceLayer, "ManualDishWasherAlarmSetRaiseCommandHandler Failed!\r\n");
}
if (err != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "ManualDishWasherAlarmSetRaiseCommandHandler Failed!\r\n");
}

return err;
}
Expand All @@ -92,29 +96,33 @@ CHIP_ERROR ManualDishWasherAlarmSetLowerCommandHandler(int argc, char ** argv)
{
CHIP_ERROR err = CHIP_NO_ERROR;
EmberAfStatus status;
DishwasherAlarmServer& serverInstance = DishwasherAlarmServer::Instance();

status = serverInstance.SetSupportedValue(1,47);
if (status != EMBER_ZCL_STATUS_SUCCESS) {
err = CHIP_ERROR_INTERNAL;
goto exit;
}

status = serverInstance.SetMaskValue(1, 47);
if (status != EMBER_ZCL_STATUS_SUCCESS) {
err = CHIP_ERROR_INTERNAL;
goto exit;
}

status = serverInstance.SetStateValue(1, 14, 0);
if (status != EMBER_ZCL_STATUS_SUCCESS) {
err = CHIP_ERROR_INTERNAL;
goto exit;
}
DishwasherAlarmServer & serverInstance = DishwasherAlarmServer::Instance();

status = serverInstance.SetSupportedValue(1, 47);
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
err = CHIP_ERROR_INTERNAL;
goto exit;
}

status = serverInstance.SetMaskValue(1, 47);
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
err = CHIP_ERROR_INTERNAL;
goto exit;
}

status = serverInstance.SetStateValue(1, 14, 0);
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
err = CHIP_ERROR_INTERNAL;
goto exit;
}
exit:
if (err != CHIP_NO_ERROR) {
ChipLogError(DeviceLayer, "ManualDishWasherAlarmSetLowerCommandHandler Failed!\r\n");
}
if (err != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "ManualDishWasherAlarmSetLowerCommandHandler Failed!\r\n");
}

return err;
}
Expand Down
Loading

0 comments on commit 76f6ed4

Please sign in to comment.