Skip to content

Commit

Permalink
Add to_underlying in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jepenven-silabs committed Feb 13, 2024
1 parent 96b1ac1 commit 00a209c
Show file tree
Hide file tree
Showing 45 changed files with 110 additions and 109 deletions.
2 changes: 1 addition & 1 deletion examples/all-clusters-app/asr/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void AppTask::OnOffUpdateClusterState(void)

if (status != Status::Success)
{
ASR_LOG("ERR: updating on/off %x", status);
ASR_LOG("ERR: updating on/off %x", to_underlying(status));
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ void AppTask::OnOffUpdateClusterState(intptr_t context)

if (status != Protocols::InteractionModel::Status::Success)
{
P6_LOG("ERR: updating on/off %x", status);
P6_LOG("ERR: updating on/off %x", to_underlying(status));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint)
Protocols::InteractionModel::Status status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0);
if (status != Protocols::InteractionModel::Status::Success)
{
LOG_ERR("Updating feature map %x", status);
LOG_ERR("Updating feature map %x", to_underlying(status));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint)
Protocols::InteractionModel::Status status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0);
if (status != Protocols::InteractionModel::Status::Success)
{
LOG_ERR("Updating feature map %x", status);
LOG_ERR("Updating feature map %x", to_underlying(status));
}
}
2 changes: 1 addition & 1 deletion examples/all-clusters-minimal-app/asr/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void AppTask::OnOffUpdateClusterState(void)

if (status != Protocols::InteractionModel::Status::Success)
{
ASR_LOG("ERR: updating on/off %x", status);
ASR_LOG("ERR: updating on/off %x", to_underlying(status));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ void AppTask::OnOffUpdateClusterState(intptr_t context)

if (status != Protocols::InteractionModel::Status::Success)
{
P6_LOG("ERR: updating on/off %x", status);
P6_LOG("ERR: updating on/off %x", to_underlying(status));
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/bridge-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,12 @@ void AppTask::UpdateClusterState(void)

if (status != Protocols::InteractionModel::Status::Success)
{
LOG_ERR("Update OnOff fail: %x", status);
LOG_ERR("Update OnOff fail: %x", to_underlying(status));
}
uint8_t setLevel = sAppTask.mPwmRgbBlueLed.GetLevel();
status = Clusters::LevelControl::Attributes::CurrentLevel::Set(kExampleEndpointId, setLevel);
if (status != Protocols::InteractionModel::Status::Success)
{
LOG_ERR("Update CurrentLevel fail: %x", status);
LOG_ERR("Update CurrentLevel fail: %x", to_underlying(status));
}
}
2 changes: 1 addition & 1 deletion examples/common/imgui_ui/windows/light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void Light::UpdateState()

if (status != chip::Protocols::InteractionModel::Status::Success)
{
ChipLogError(AppServer, "Failed to set on/off value: %d", status);
ChipLogError(AppServer, "Failed to set on/off value: %d", to_underlying(status));
}

mTargetLightIsOn.ClearValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg)
Protocols::InteractionModel::Status status = app::Clusters::BooleanState::Attributes::StateValue::Set(1, newValue);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ERR: updating boolean status value %x", status);
ChipLogError(NotSpecified, "ERR: updating boolean status value %x", to_underlying(status));
}
logBooleanStateEvent(newValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg)

if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ERR: updating boolean status value %x", status);
ChipLogError(NotSpecified, "ERR: updating boolean status value %x", to_underlying(status));
}
logBooleanStateEvent(newValue);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/contact-sensor-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg)
Protocols::InteractionModel::Status status = app::Clusters::BooleanState::Attributes::StateValue::Set(1, newValue);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ERR: updating boolean status value %x", status);
ChipLogError(NotSpecified, "ERR: updating boolean status value %x", to_underlying(status));
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/qpg/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ void AppTask::UpdateClusterState(void)
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ERR: updating on/off %x", status);
ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status));
}
*/
}
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/asr/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ bool IsLightOn()

if (status != Protocols::InteractionModel::Status::Success)
{
ASR_LOG("Error Read OnOff Attribute 0x%02x\n", status);
ASR_LOG("Error Read OnOff Attribute 0x%02x\n", to_underlying(status));
}

return on != false;
Expand All @@ -103,7 +103,7 @@ uint8_t GetLightLevel()

if (status != Protocols::InteractionModel::Status::Success)
{
ASR_LOG("Error Read CurrentLevel Attribute 0x%02x\n", status);
ASR_LOG("Error Read CurrentLevel Attribute 0x%02x\n", to_underlying(status));
return -1;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ void AppTask::UpdateClusterState()

if (status != Protocols::InteractionModel::Status::Success)
{
ESP_LOGE(TAG, "Updating on/off cluster failed: %x", status);
ESP_LOGE(TAG, "Updating on/off cluster failed: %x", to_underlying(status));
}

ESP_LOGI(TAG, "Writing to Current Level cluster");
status = Clusters::LevelControl::Attributes::CurrentLevel::Set(kLightEndpointId, AppLED.GetLevel());

if (status != Protocols::InteractionModel::Status::Success)
{
ESP_LOGE(TAG, "Updating level cluster failed: %x", status);
ESP_LOGE(TAG, "Updating level cluster failed: %x", to_underlying(status));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bool LightingManager::IsLightOn(void)

if (status != Protocols::InteractionModel::Status::Success)
{
printf("Error ReadServerAttribute 0x%02x\n", status);
printf("Error ReadServerAttribute 0x%02x\n", to_underlying(status));
}

return on != false;
Expand Down Expand Up @@ -103,7 +103,7 @@ void LightingManager::WriteClusterState(uint8_t value)

if (status != Protocols::InteractionModel::Status::Success)
{
printf("Error WriteServerAttribute 0x%02x\n", status);
printf("Error WriteServerAttribute 0x%02x\n", to_underlying(status));
}
}

Expand All @@ -113,6 +113,6 @@ void LightingManager::WriteClusterLevel(uint8_t value)

if (status != Protocols::InteractionModel::Status::Success)
{
printf("Error WriteServerAttribute 0x%02x\n", status);
printf("Error WriteServerAttribute 0x%02x\n", to_underlying(status));
}
}
2 changes: 1 addition & 1 deletion examples/lighting-app/infineon/psoc6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ void AppTask::UpdateClusterState(intptr_t context)
Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue);
if (status != Protocols::InteractionModel::Status::Success)
{
P6_LOG("ERR: updating on/off %x", status);
P6_LOG("ERR: updating on/off %x", to_underlying(status));
}
}
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/mbed/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ void AppTask::UpdateClusterState()
Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, onoff);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "Updating on/off cluster failed: %x", status);
ChipLogError(NotSpecified, "Updating on/off cluster failed: %x", to_underlying(status));
}

uint8_t level = LightingMgr().GetLevel();
Expand All @@ -474,6 +474,6 @@ void AppTask::UpdateClusterState()

if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "Updating level cluster failed: %x", status);
ChipLogError(NotSpecified, "Updating level cluster failed: %x", to_underlying(status));
}
}
4 changes: 2 additions & 2 deletions examples/lighting-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,15 +694,15 @@ void AppTask::UpdateClusterState()

if (status != Protocols::InteractionModel::Status::Success)
{
LOG_ERR("Updating on/off cluster failed: %x", status);
LOG_ERR("Updating on/off cluster failed: %x", to_underlying(status));
}

// write the current level
status = Clusters::LevelControl::Attributes::CurrentLevel::Set(kLightEndpointId, mPWMDevice.GetLevel());

if (status != Protocols::InteractionModel::Status::Success)
{
LOG_ERR("Updating level cluster failed: %x", status);
LOG_ERR("Updating level cluster failed: %x", to_underlying(status));
}
});
}
2 changes: 1 addition & 1 deletion examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg)
Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ERR: updating on/off %x", status);
ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status));
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ void AppTask::UpdateClusterStateInternal(intptr_t arg)
Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ERR: updating on/off %x", status);
ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status));
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/qpg/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,14 +647,14 @@ void AppTask::UpdateClusterState(void)

if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ERR: updating on/off %x", status);
ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status));
}

// Write new level value
status = Clusters::LevelControl::Attributes::CurrentLevel::Set(QPG_LIGHT_ENDPOINT_ID, LightingMgr().GetLevel());
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ERR: updating level %x", status);
ChipLogError(NotSpecified, "ERR: updating level %x", to_underlying(status));
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,6 @@ void AppTask::UpdateClusterState(intptr_t context)

if (status != Protocols::InteractionModel::Status::Success)
{
SILABS_LOG("ERR: updating on/off %x", status);
SILABS_LOG("ERR: updating on/off %x", to_underlying(status));
}
}
4 changes: 2 additions & 2 deletions examples/lighting-app/stm32/src/STM32WB5/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,14 +448,14 @@ void AppTask::UpdateClusterState(void)
Clusters::OnOff::Attributes::OnOff::Set(STM32_LIGHT_ENDPOINT_ID, LightingMgr().IsTurnedOn());
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ERR: updating on/off %x", status);
ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status));
}

// Write new level value
status = Clusters::LevelControl::Attributes::CurrentLevel::Set(STM32_LIGHT_ENDPOINT_ID, LightingMgr().GetLevel());
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ERR: updating level %x", status);
ChipLogError(NotSpecified, "ERR: updating level %x", to_underlying(status));
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ void AppTask::UpdateClusterState(void)
status = Clusters::OnOff::Attributes::OnOff::Set(kExampleEndpointId, isTurnedOn);
if (status != Protocols::InteractionModel::Status::Success)
{
LOG_ERR("Update OnOff fail: %x", status);
LOG_ERR("Update OnOff fail: %x", to_underlying(status));
}

status = Clusters::LevelControl::Attributes::CurrentLevel::Set(kExampleEndpointId, setLevel);
if (status != Protocols::InteractionModel::Status::Success)
{
LOG_ERR("Update CurrentLevel fail: %x", status);
LOG_ERR("Update CurrentLevel fail: %x", to_underlying(status));
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/asr/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ void AppTask::UpdateCluster(intptr_t context)
: Protocols::InteractionModel::Status::Failure;
if (status != Protocols::InteractionModel::Status::Success)
{
ASR_LOG("ERR: updating lock state %x", status);
ASR_LOG("ERR: updating lock state %x", to_underlying(status));
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,6 @@ void AppTask::UpdateClusterState(intptr_t context)
Protocols::InteractionModel::Status status = chip::app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue);
if (status != Protocols::InteractionModel::Status::Success)
{
ESP_LOGI(TAG, "ERR: updating on/off %x", status);
ESP_LOGI(TAG, "ERR: updating on/off %x", to_underlying(status));
}
}
2 changes: 1 addition & 1 deletion examples/lock-app/genio/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,6 @@ void AppTask::UpdateClusterState(intptr_t context)

if (status != Protocols::InteractionModel::Status::Success)
{
MT793X_LOG("ERR: updating lock state %x", status);
MT793X_LOG("ERR: updating lock state %x", to_underlying(status));
}
}
12 changes: 6 additions & 6 deletions examples/lock-app/genio/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,31 +66,31 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint)
status = DoorLock::Attributes::LockType::Set(endpoint, DlLockType::kDeadBolt);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(Zcl, "Failed to set LockType %x", status);
ChipLogError(Zcl, "Failed to set LockType %x", to_underlying(status));
}

status = DoorLock::Attributes::NumberOfTotalUsersSupported::Set(endpoint, CONFIG_LOCK_NUM_USERS);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(Zcl, "Failed to set number of users %x", status);
ChipLogError(Zcl, "Failed to set number of users %x", to_underlying(status));
}

status = DoorLock::Attributes::NumberOfPINUsersSupported::Set(endpoint, CONFIG_LOCK_NUM_USERS);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(Zcl, "Failed to set number of PIN users %x", status);
ChipLogError(Zcl, "Failed to set number of PIN users %x", to_underlying(status));
}

status = DoorLock::Attributes::NumberOfRFIDUsersSupported::Set(endpoint, 0);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(Zcl, "Failed to set number of RFID users %x", status);
ChipLogError(Zcl, "Failed to set number of RFID users %x", to_underlying(status));
}

status = DoorLock::Attributes::NumberOfCredentialsSupportedPerUser::Set(endpoint, CONFIG_LOCK_NUM_CREDENTIALS_PER_USER);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(Zcl, "Failed to set number of credentials per user %x", status);
ChipLogError(Zcl, "Failed to set number of credentials per user %x", to_underlying(status));
}

// Note: Due to current logic of credential, do not enable PIN and RFID
Expand All @@ -99,7 +99,7 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint)
status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0x101);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(Zcl, "Failed to set number of credentials per user %x", status);
ChipLogError(Zcl, "Failed to set number of credentials per user %x", to_underlying(status));
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/infineon/cyw30739/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ void UpdateClusterState(intptr_t context)

if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(Zcl, "ERR: updating lock state %x", status);
ChipLogError(Zcl, "ERR: updating lock state %x", to_underlying(status));
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/infineon/psoc6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ void AppTask::UpdateCluster(intptr_t context)
: Protocols::InteractionModel::Status::Failure;
if (status != Protocols::InteractionModel::Status::Success)
{
P6_LOG("ERR: updating lock state %x", status);
P6_LOG("ERR: updating lock state %x", to_underlying(status));
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/mbed/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,6 @@ void AppTask::UpdateClusterState()
Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue);
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(NotSpecified, "ZCL update failed: %lx", status);
ChipLogError(NotSpecified, "ZCL update failed: %lx", to_underlying(status));
}
}
2 changes: 1 addition & 1 deletion examples/lock-app/nrfconnect/main/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint)
const auto logOnFailure = [](Protocols::InteractionModel::Status status, const char * attributeName) {
if (status != Protocols::InteractionModel::Status::Success)
{
ChipLogError(Zcl, "Failed to set DoorLock %s: %x", attributeName, status);
ChipLogError(Zcl, "Failed to set DoorLock %s: %x", attributeName, to_underlying(status));
}
};

Expand Down
Loading

0 comments on commit 00a209c

Please sign in to comment.