Skip to content

Commit

Permalink
Separate Warning and Critical Triggered Event
Browse files Browse the repository at this point in the history
  • Loading branch information
hare-siterwell committed Jul 12, 2023
1 parent cebea3f commit 89038c9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ class SmokeCoAlarmManager

enum TriggeredEvent_t
{
kTriggeredEvent_SmokeAlarm = 0xffffffff00000090,
kTriggeredEvent_WarningSmokeAlarm = 0xffffffff00000090,
kTriggeredEvent_CriticalSmokeAlarm = 0xffffffff0000009c,
kTriggeredEvent_SmokeAlarmClear = 0xffffffff000000a0,
kTriggeredEvent_COAlarm = 0xffffffff00000091,
kTriggeredEvent_WarningCOAlarm = 0xffffffff00000091,
kTriggeredEvent_CriticalCOAlarm = 0xffffffff0000009d,
kTriggeredEvent_COAlarmClear = 0xffffffff000000a1,
kTriggeredEvent_BatteryAlert = 0xffffffff00000095,
kTriggeredEvent_WarningBatteryAlert = 0xffffffff00000095,
kTriggeredEvent_CriticalBatteryAlert = 0xffffffff0000009e,
kTriggeredEvent_BatteryAlertClear = 0xffffffff000000a5,
kTriggeredEvent_HardwareFaultAlert = 0xffffffff00000093,
kTriggeredEvent_HardwareFaultAlertClear = 0xffffffff000000a3,
Expand Down
30 changes: 27 additions & 3 deletions examples/smoke-co-alarm-app/silabs/src/SmokeCoAlarmManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,22 @@ bool SmokeCoAlarmManager::OnEventTriggerHandle(uint64_t eventTrigger)

switch (eventTrigger)
{
case kTriggeredEvent_SmokeAlarm:
case kTriggeredEvent_WarningSmokeAlarm:
success = SmokeCoAlarmServer::Instance().SetSmokeState(1, AlarmStateEnum::kWarning);
if (success)
{
success = AlarmMgr().SetExpressedState(1, ExpressedStateEnum::kSmokeAlarm, true);
}
break;

case kTriggeredEvent_CriticalSmokeAlarm:
success = SmokeCoAlarmServer::Instance().SetSmokeState(1, AlarmStateEnum::kCritical);
if (success)
{
success = AlarmMgr().SetExpressedState(1, ExpressedStateEnum::kSmokeAlarm, true);
}
break;

case kTriggeredEvent_SmokeAlarmClear:
success = SmokeCoAlarmServer::Instance().SetSmokeState(1, AlarmStateEnum::kNormal);
if (success)
Expand All @@ -230,14 +238,22 @@ bool SmokeCoAlarmManager::OnEventTriggerHandle(uint64_t eventTrigger)
}
break;

case kTriggeredEvent_COAlarm:
case kTriggeredEvent_WarningCOAlarm:
success = SmokeCoAlarmServer::Instance().SetCOState(1, AlarmStateEnum::kWarning);
if (success)
{
success = AlarmMgr().SetExpressedState(1, ExpressedStateEnum::kCOAlarm, true);
}
break;

case kTriggeredEvent_CriticalCOAlarm:
success = SmokeCoAlarmServer::Instance().SetCOState(1, AlarmStateEnum::kCritical);
if (success)
{
success = AlarmMgr().SetExpressedState(1, ExpressedStateEnum::kCOAlarm, true);
}
break;

case kTriggeredEvent_COAlarmClear:
success = SmokeCoAlarmServer::Instance().SetCOState(1, AlarmStateEnum::kNormal);
if (success)
Expand All @@ -246,14 +262,22 @@ bool SmokeCoAlarmManager::OnEventTriggerHandle(uint64_t eventTrigger)
}
break;

case kTriggeredEvent_BatteryAlert:
case kTriggeredEvent_WarningBatteryAlert:
success = SmokeCoAlarmServer::Instance().SetBatteryAlert(1, AlarmStateEnum::kWarning);
if (success)
{
success = AlarmMgr().SetExpressedState(1, ExpressedStateEnum::kBatteryAlert, true);
}
break;

case kTriggeredEvent_CriticalBatteryAlert:
success = SmokeCoAlarmServer::Instance().SetBatteryAlert(1, AlarmStateEnum::kCritical);
if (success)
{
success = AlarmMgr().SetExpressedState(1, ExpressedStateEnum::kBatteryAlert, true);
}
break;

case kTriggeredEvent_BatteryAlertClear:
success = SmokeCoAlarmServer::Instance().SetBatteryAlert(1, AlarmStateEnum::kNormal);
if (success)
Expand Down

0 comments on commit 89038c9

Please sign in to comment.