Skip to content

Commit

Permalink
[Telink]: Added draft smoke sensor
Browse files Browse the repository at this point in the history
Added draft smoke sensor app for telink platform

Signed-off-by: dmytro.k <ur6lal@gmail.com>
  • Loading branch information
UR6LAL authored and s07641069 committed Jul 7, 2023
1 parent b95b597 commit 1136784
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/smoke-co-alarm-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ set(CONF_FILE ${CHIP_ROOT}/config/telink/app/zephyr.conf prj.conf)
list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})

project(chip-telink-smohe-co-alarm-example)
project(chip-telink-smoke-co-alarm-example)

include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake)
include(${CHIP_ROOT}/src/app/chip_data_model.cmake)
Expand Down
8 changes: 8 additions & 0 deletions examples/smoke-co-alarm-app/telink/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

#include "AppTaskCommon.h"

#ifdef CONFIG_CHIP_PW_RPC
#include "Rpc.h"
#endif

// Application-defined error codes in the CHIP_ERROR space.
#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03)

Expand All @@ -30,6 +34,10 @@ class AppTask : public AppTaskCommon
friend class AppTaskCommon;

CHIP_ERROR Init(void);

static void SelfTestEventHandler(AppEvent * aEvent);
void SelfTestHandler(void);

static AppTask sAppTask;
};

Expand Down
20 changes: 20 additions & 0 deletions examples/smoke-co-alarm-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@

#include "AppTask.h"
#include "SmokeCoAlarmManager.h"
#include "platform/CHIPDeviceLayer.h"

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

AppTask AppTask::sAppTask;

CHIP_ERROR AppTask::Init(void)
{
#if APP_USE_EXAMPLE_START_BUTTON
SetExampleButtonCallbacks(SelfTestEventHandler);
#endif
InitCommonParts();

CHIP_ERROR err = AlarmMgr().Init();
Expand All @@ -43,3 +47,19 @@ CHIP_ERROR AppTask::Init(void)

return CHIP_NO_ERROR;
}

void AppTask::SelfTestEventHandler(AppEvent * aEvent)
{
AppEvent event;
if (aEvent->Type == AppEvent::kEventType_Button)
{
event.ButtonEvent.Action = kButtonPushEvent;
event.Handler = FactoryResetHandler;
GetAppTask().PostEvent(&event);
}
}

void AppTask::SelfTestHandler(void)
{
AlarmMgr().StartSelfTesting();
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ bool SmokeCoAlarmManager::StartSelfTesting()

return success;
}

// void SmokeCoAlarmManager::COAlarm(uint8_t status)
// {

// AlarmStateEnum currentAlarmState = (AlarmStateEnum)status;
// SmokeCoAlarmServer::Instance().SetCOState(1,currentAlarmState);
// }

0 comments on commit 1136784

Please sign in to comment.