Skip to content

Commit

Permalink
[Telink] Lock app refactoring & fix TC-DRLK-2.10 (#30301)
Browse files Browse the repository at this point in the history
* [Telink]: Updated lock app to the latest lock cluster signatures

Updated lock app to latest cluster, passes TC-DRLK-2.10

Signed-off-by: Misha Tkachenko <[email protected]>

* [Telink]: Refactor Lock App

Added storage to save user credentials, fixed test DRLK-2.10

Signed-off-by: Misha Tkachenko <[email protected]>

* [Telink]: Updated code style and configs

Updated code style and configs in Lock App

* [Telink]: Updated lock app definitions

Updated lock app definitions

* Restyled by whitespace

* Restyled by clang-format

* [Telink]: Updated CI Job for Lock App

Excluded retention build from Lock App CI due to lack of retention RAM

---------

Signed-off-by: Misha Tkachenko <[email protected]>
Co-authored-by: Misha Tkachenko <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Misha Tkachenko <[email protected]>
  • Loading branch information
4 people authored and pull[bot] committed Feb 20, 2024
1 parent bef4063 commit 50a12a2
Show file tree
Hide file tree
Showing 13 changed files with 1,561 additions and 530 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ jobs:
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B92 retention) Lock App with DFU
- name: Build example Telink (B92) Lock App with DFU
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a_retention-lock-dfu' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-lock-dfu' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a_retention lock-app-dfu \
out/telink-tlsr9528a_retention-lock-dfu/zephyr/zephyr.elf \
telink tlsr9528a lock-app-dfu \
out/telink-tlsr9528a-lock-dfu/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
Expand Down
3 changes: 2 additions & 1 deletion examples/lock-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ add_definitions(
target_sources(app PRIVATE
src/AppTask.cpp
src/ZclCallbacks.cpp
src/BoltLockManager.cpp
src/LockManager.cpp
src/LockSettingsStorage.cpp
${TELINK_COMMON}/common/src/mainCommon.cpp
${TELINK_COMMON}/common/src/AppTaskCommon.cpp
${TELINK_COMMON}/util/src/LEDWidget.cpp
Expand Down
9 changes: 9 additions & 0 deletions examples/lock-app/telink/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@

// ---- Lock Example App Config ----

#define LOCK_MANAGER_CONFIG_USE_NVM_CREDENTIAL_STORAGE 1
#define LOCK_MANAGER_ACTUATOR_MOVEMENT_TIME_MS 2000

#define APP_DEFAULT_USERS_COUNT 5
#define APP_DEFAULT_CREDENTIAL_COUNT 5
#define APP_DEFAULT_WEEKDAY_SCHEDULE_PER_USER_COUNT 5
#define APP_DEFAULT_YEARDAY_SCHEDULE_PER_USER_COUNT 5
#define APP_DEFAULT_HOLYDAY_SCHEDULE_PER_USER_COUNT 5

#define APP_USE_EXAMPLE_START_BUTTON 1
#define APP_USE_BLE_START_BUTTON 0
#define APP_USE_THREAD_START_BUTTON 0
Expand Down
16 changes: 11 additions & 5 deletions examples/lock-app/telink/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,28 @@

#pragma once

#include "AppConfig.h"
#include "AppTaskCommon.h"
#include "BoltLockManager.h"
#include "LockManager.h"

#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01)
#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02)
#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03)
#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04)
#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05)
#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06)
#define APP_ERROR_ALLOCATION_FAILED CHIP_APPLICATION_ERROR(0x07)

class AppTask : public AppTaskCommon
{
public:
void UpdateClusterState(BoltLockManager::State state, BoltLockManager::OperationSource source);

private:
friend AppTask & GetAppTask(void);
friend class AppTaskCommon;

CHIP_ERROR Init(void);

static void LockActionEventHandler(AppEvent * event);
static void LockStateChanged(BoltLockManager::State state, BoltLockManager::OperationSource source);
static void LockStateChanged(LockManager::State_t state);

static AppTask sAppTask;
};
Expand Down
129 changes: 0 additions & 129 deletions examples/lock-app/telink/include/BoltLockManager.h

This file was deleted.

Loading

0 comments on commit 50a12a2

Please sign in to comment.