Skip to content

Commit

Permalink
Restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Oct 3, 2023
1 parent b182143 commit e764c84
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 25 deletions.
13 changes: 9 additions & 4 deletions examples/platform/ameba/Rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,17 @@ class AmebaDevice final : public Device
pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override
{
TickType_t delayMs = kRebootTimerPeriodMs;
if (request.delay_ms != 0) {
if (request.delay_ms != 0)
{
delayMs = request.delay_ms;
} else {
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast<int>(kRebootTimerPeriodMs));
}
mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(kRebootTimerPeriodMs), false, nullptr, RebootHandler, &mRebootTimerBuffer);
else
{
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms",
static_cast<int>(kRebootTimerPeriodMs));
}
mRebootTimer =
xTimerCreateStatic("Reboot", pdMS_TO_TICKS(kRebootTimerPeriodMs), false, nullptr, RebootHandler, &mRebootTimerBuffer);
xTimerStart(mRebootTimer, 0);
return pw::OkStatus();
}
Expand Down
10 changes: 7 additions & 3 deletions examples/platform/bouffalolab/common/rpc/Rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,14 @@ class BouffaloDevice final : public Device
}

TickType_t delayMs = kRebootTimerPeriodMs;
if (request.delay_ms != 0) {
if (request.delay_ms != 0)
{
delayMs = request.delay_ms;
} else {
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast<int>(kRebootTimerPeriodMs));
}
else
{
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms",
static_cast<int>(kRebootTimerPeriodMs));
}
mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(delayMs), false, nullptr, RebootHandler, &mRebootTimerBuffer);
xTimerStart(mRebootTimer, 0);
Expand Down
14 changes: 8 additions & 6 deletions examples/platform/esp32/Rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,14 @@ class Esp32Device final : public Device
pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override
{
TickType_t delayMs = kRebootTimerPeriodMs;
if (request.delay_ms != 0) {
if (request.delay_ms != 0)
{
delayMs = request.delay_ms;
} else {
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast<int>(kRebootTimerPeriodMs));
}
else
{
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms",
static_cast<int>(kRebootTimerPeriodMs));
}
mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(delayMs), false, nullptr, RebootHandler, &mRebootTimerBuffer);

Expand All @@ -131,9 +135,7 @@ class Esp32Device final : public Device
TimerHandle_t mRebootTimer;
StaticTimer_t mRebootTimerBuffer;

static void RebootHandler(TimerHandle_t) {
esp_restart();
}
static void RebootHandler(TimerHandle_t) { esp_restart(); }
};
#endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE

Expand Down
7 changes: 5 additions & 2 deletions examples/platform/nrfconnect/Rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ class NrfDevice final : public Device
pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override
{
k_timeout_t delay;
if (request.delay_ms != 0) {
if (request.delay_ms != 0)
{
delay = K_MSEC(request.delay_ms);
} else {
}
else
{
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to 1s");
delay = K_SECONDS(1);
}
Expand Down
12 changes: 7 additions & 5 deletions examples/platform/qpg/Rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ class QpgDevice final : public Device
{
Clock::Timeout delay;

if (request.delay_ms != 0) {
if (request.delay_ms != 0)
{
delay = System::Clock::Milliseconds64(request.delay_ms);
} else {
}
else
{
delay = System::Clock::Seconds32(1);
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to 1s");
}
Expand All @@ -82,10 +85,9 @@ class QpgDevice final : public Device
TriggerOTAQuery();
return pw::OkStatus();
}

private:
static void RebootImpl(System::Layer *, void *) {
qvCHIP_ResetSystem();
}
static void RebootImpl(System::Layer *, void *) { qvCHIP_ResetSystem(); }
};
#endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE

Expand Down
10 changes: 7 additions & 3 deletions examples/platform/silabs/Rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ class Efr32Device final : public Device
pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override
{
TickType_t delayMs = kRebootTimerPeriodMs;
if (request.delay_ms != 0) {
if (request.delay_ms != 0)
{
delayMs = request.delay_ms;
} else {
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms", static_cast<int>(kRebootTimerPeriodMs));
}
else
{
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to %d ms",
static_cast<int>(kRebootTimerPeriodMs));
}
mRebootTimer = xTimerCreateStatic("Reboot", pdMS_TO_TICKS(delayMs), false, nullptr, RebootHandler, &mRebootTimerBuffer);
xTimerStart(mRebootTimer, 0);
Expand Down
7 changes: 5 additions & 2 deletions examples/platform/telink/Rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ class TelinkDevice final : public Device
pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override
{
k_timeout_t delay;
if (request.delay_ms != 0) {
if (request.delay_ms != 0)
{
delay = K_MSEC(request.delay_ms);
} else {
}
else
{
ChipLogProgress(NotSpecified, "Did not receive a reboot delay. Defaulting to 1s");
delay = K_SECONDS(1);
}
Expand Down

0 comments on commit e764c84

Please sign in to comment.