Skip to content

Commit

Permalink
[Ameba] Updated switch case at ManualOperationalStateCommand.h and up…
Browse files Browse the repository at this point in the history
…dated raise and lower alarm function at ManualDishWasherAlarmCommand.h
  • Loading branch information
pankore committed Oct 13, 2023
1 parent 7245b90 commit b9de5a5
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,49 @@ CHIP_ERROR ManualDishWasherAlarmCommandHandler(int argc, char ** argv)

CHIP_ERROR ManualDishWasherAlarmSetRaiseCommandHandler(int argc, char ** argv)
{
if (argc != 0)
{
return ManualDishWasherAlarmCommandHelpHandler(argc, argv);
}

CHIP_ERROR err = CHIP_NO_ERROR;
EmberAfStatus status;
DishwasherAlarmServer & serverInstance = DishwasherAlarmServer::Instance();

status = serverInstance.SetSupportedValue(1, 47);
BitMask<AlarmMap> supported; // Set dishwasher alarm supported value
supported.SetField(AlarmMap::kInflowError, 1); // 0x01, 1
supported.SetField(AlarmMap::kDrainError, 1); // 0x02, 2
supported.SetField(AlarmMap::kDoorError, 1); // 0x04, 4
supported.SetField(AlarmMap::kTempTooLow, 1); // 0x08, 8
supported.SetField(AlarmMap::kWaterLevelError, 1); // 0x20, 32

BitMask<AlarmMap> mask; // Set dishwasher alarm mask value
mask.SetField(AlarmMap::kInflowError, 1); // 0x01, 1
mask.SetField(AlarmMap::kDrainError, 1); // 0x02, 2
mask.SetField(AlarmMap::kDoorError, 1); // 0x04, 4
mask.SetField(AlarmMap::kTempTooLow, 1); // 0x08, 8
mask.SetField(AlarmMap::kWaterLevelError, 1); // 0x20, 32

BitMask<AlarmMap> state; // Set dishwasher alarm state value
state.SetField(AlarmMap::kDrainError, 1); // 0x02, 2
state.SetField(AlarmMap::kDoorError, 1); // 0x04, 4
state.SetField(AlarmMap::kTempTooLow, 1); // 0x08, 8

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

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

status = serverInstance.SetStateValue(1, 14, 0);
status = serverInstance.SetStateValue(1, state); // 0x0E, 14
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
err = CHIP_ERROR_INTERNAL;
Expand All @@ -94,25 +118,44 @@ CHIP_ERROR ManualDishWasherAlarmSetRaiseCommandHandler(int argc, char ** argv)

CHIP_ERROR ManualDishWasherAlarmSetLowerCommandHandler(int argc, char ** argv)
{
if (argc != 0)
{
return ManualDishWasherAlarmCommandHelpHandler(argc, argv);
}

CHIP_ERROR err = CHIP_NO_ERROR;
EmberAfStatus status;
DishwasherAlarmServer & serverInstance = DishwasherAlarmServer::Instance();

status = serverInstance.SetSupportedValue(1, 47);
BitMask<AlarmMap> supported; // Set dishwasher alarm supported value
supported.SetField(AlarmMap::kInflowError, 1); // 0x01, 1
supported.SetField(AlarmMap::kDrainError, 1); // 0x02, 2
supported.SetField(AlarmMap::kDoorError, 1); // 0x04, 4
supported.SetField(AlarmMap::kTempTooLow, 1); // 0x08, 8
supported.SetField(AlarmMap::kWaterLevelError, 1); // 0x20, 32

BitMask<AlarmMap> mask; // Set dishwasher alarm mask value
mask.SetField(AlarmMap::kInflowError, 1); // 0x01, 1
mask.SetField(AlarmMap::kDrainError, 1); // 0x02, 2
mask.SetField(AlarmMap::kDoorError, 1); // 0x04, 4
mask.SetField(AlarmMap::kTempTooLow, 1); // 0x08, 8
mask.SetField(AlarmMap::kWaterLevelError, 1); // 0x20, 32

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

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

status = serverInstance.SetStateValue(1, 14, 0);
status = serverInstance.SetStateValue(1, 0); // Set dishwasher alarm state value 0x00, 0
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
err = CHIP_ERROR_INTERNAL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,10 @@ CHIP_ERROR ManualOperationalStateSetErrorCommandHandler(int argc, char ** argv)
switch (error)
{
case to_underlying(OperationalState::ErrorStateEnum::kNoError):
err.errorStateID = to_underlying(OperationalState::ErrorStateEnum::kNoError);
break;
case to_underlying(OperationalState::ErrorStateEnum::kUnableToStartOrResume):
err.errorStateID = to_underlying(OperationalState::ErrorStateEnum::kUnableToStartOrResume);
break;
case to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation):
err.errorStateID = to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation);
break;
case to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState):
err.errorStateID = to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState);
err.errorStateID = error;
break;
default:
err.errorStateID = to_underlying(OperationalState::ErrorStateEnum::kUnknownEnumValue);
Expand Down Expand Up @@ -165,41 +159,19 @@ CHIP_ERROR ManualRVCOperationalStateSetErrorCommandHandler(int argc, char ** arg

switch (error)
{
case to_underlying(OperationalState::ErrorStateEnum::kNoError): // 0x00, 0
err.errorStateID = to_underlying(OperationalState::ErrorStateEnum::kNoError);
break;
case to_underlying(OperationalState::ErrorStateEnum::kUnableToStartOrResume): // 0x01, 1
err.errorStateID = to_underlying(OperationalState::ErrorStateEnum::kUnableToStartOrResume);
break;
case to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation): // 0x02, 2
err.errorStateID = to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation);
break;
case to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState): // 0x03, 3
err.errorStateID = to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState);
break;
case to_underlying(OperationalState::ErrorStateEnum::kNoError): // 0x00, 0
case to_underlying(OperationalState::ErrorStateEnum::kUnableToStartOrResume): // 0x01, 1
case to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation): // 0x02, 2
case to_underlying(OperationalState::ErrorStateEnum::kCommandInvalidInState): // 0x03, 3
case to_underlying(RvcOperationalState::ErrorStateEnum::kFailedToFindChargingDock): // 0x40, 64
err.errorStateID = to_underlying(RvcOperationalState::ErrorStateEnum::kFailedToFindChargingDock);
break;
case to_underlying(RvcOperationalState::ErrorStateEnum::kStuck): // 0x41, 65
err.errorStateID = to_underlying(RvcOperationalState::ErrorStateEnum::kStuck);
break;
case to_underlying(RvcOperationalState::ErrorStateEnum::kDustBinMissing): // 0x42, 66
err.errorStateID = to_underlying(RvcOperationalState::ErrorStateEnum::kDustBinMissing);
break;
case to_underlying(RvcOperationalState::ErrorStateEnum::kDustBinFull): // 0x43, 67
err.errorStateID = to_underlying(RvcOperationalState::ErrorStateEnum::kDustBinFull);
break;
case to_underlying(RvcOperationalState::ErrorStateEnum::kWaterTankEmpty): // 0x44, 68
err.errorStateID = to_underlying(RvcOperationalState::ErrorStateEnum::kWaterTankEmpty);
break;
case to_underlying(RvcOperationalState::ErrorStateEnum::kWaterTankMissing): // 0x45, 69
err.errorStateID = to_underlying(RvcOperationalState::ErrorStateEnum::kWaterTankMissing);
break;
case to_underlying(RvcOperationalState::ErrorStateEnum::kWaterTankLidOpen): // 0x46, 70
err.errorStateID = to_underlying(RvcOperationalState::ErrorStateEnum::kWaterTankLidOpen);
break;
case to_underlying(RvcOperationalState::ErrorStateEnum::kMopCleaningPadMissing): // 0x47, 71
err.errorStateID = to_underlying(RvcOperationalState::ErrorStateEnum::kMopCleaningPadMissing);
case to_underlying(RvcOperationalState::ErrorStateEnum::kStuck): // 0x41, 65
case to_underlying(RvcOperationalState::ErrorStateEnum::kDustBinMissing): // 0x42, 66
case to_underlying(RvcOperationalState::ErrorStateEnum::kDustBinFull): // 0x43, 67
case to_underlying(RvcOperationalState::ErrorStateEnum::kWaterTankEmpty): // 0x44, 68
case to_underlying(RvcOperationalState::ErrorStateEnum::kWaterTankMissing): // 0x45, 69
case to_underlying(RvcOperationalState::ErrorStateEnum::kWaterTankLidOpen): // 0x46, 70
case to_underlying(RvcOperationalState::ErrorStateEnum::kMopCleaningPadMissing): // 0x47, 71
err.errorStateID = error;
break;
default:
err.errorStateID = to_underlying(RvcOperationalState::ErrorStateEnum::kUnknownEnumValue);
Expand Down

0 comments on commit b9de5a5

Please sign in to comment.