Skip to content

Commit 91b955d

Browse files
author
Miecznik, Rafał
committed
CI/CD: Promote lib files to ncs-door-lock-app @8974e1364b22
Source commit ID: @8974e1364b22 Signed-off-by: Miecznik, Rafał <rafal.miecznik@nordicsemi.com>
1 parent 32670f4 commit 91b955d

41 files changed

Lines changed: 1577 additions & 2442 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
#
66

77
add_subdirectory(drivers)
8-
add_subdirectory(lib)

app/CMakeLists.txt

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,29 @@ file(GLOB app_sources CONFIGURE_DEPENDS src/*.cpp)
1313

1414
add_subdirectory(src/platform)
1515

16-
if (CONFIG_ACCESS_MANAGER_IMPLEMENTATION_DEFAULT)
17-
add_subdirectory(src/access_manager_impl_default)
18-
elseif (CONFIG_ACCESS_MANAGER_IMPLEMENTATION_CUSTOM)
19-
add_subdirectory(src/access_manager_impl_custom)
20-
else()
21-
message(FATAL_ERROR "No access manager implementation selected")
16+
target_sources(app PRIVATE ${app_sources})
17+
18+
set(PUBLIC_API ${ZEPHYR_NCS_ALIRO_MODULE_DIR})
19+
20+
if(CONFIG_SOC_SERIES_NRF52X)
21+
set(ALIRO_LIB_PATH ${ZEPHYR_NCS_ALIRO_MODULE_DIR}/applications/doorlock/lib/aliro/bin/cortex-m4)
22+
elseif(CONFIG_SOC_SERIES_NRF54LX OR CONFIG_SOC_SERIES_NRF53X)
23+
set(ALIRO_LIB_PATH ${ZEPHYR_NCS_ALIRO_MODULE_DIR}/applications/doorlock/lib/aliro/bin/cortex-m33)
2224
endif()
2325

24-
target_sources(app PRIVATE ${app_sources})
26+
add_library(aliro_stack STATIC IMPORTED GLOBAL)
27+
28+
if(CONFIG_ALIRO_BLE_TP)
29+
set_target_properties(aliro_stack PROPERTIES IMPORTED_LOCATION ${ALIRO_LIB_PATH}/libaliro_ble.a)
30+
else(CONFIG_ALIRO_BLE_TP)
31+
set_target_properties(aliro_stack PROPERTIES IMPORTED_LOCATION ${ALIRO_LIB_PATH}/libaliro.a)
32+
endif(CONFIG_ALIRO_BLE_TP)
33+
34+
target_link_libraries(app PRIVATE aliro_stack)
35+
target_link_libraries(aliro_stack INTERFACE zephyr_interface)
36+
37+
zephyr_include_directories(
38+
${PUBLIC_API}/include
39+
${PUBLIC_API}/interfaces
40+
${PUBLIC_API}/interfaces/crypto/backend_crypto_psa
41+
)

app/Kconfig

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#
66

77
rsource "src/platform/Kconfig"
8+
rsource "../lib/aliro/Kconfig.defconfig"
89

910
menu "Zephyr"
1011
source "Kconfig.zephyr"
@@ -15,25 +16,3 @@ module-str = NCS_DOOR_LOCK_APP
1516
module-dep = LOG
1617
module-help = Enables nRF Connect SDK Door Lock Application log messages.
1718
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
18-
19-
choice ACCESS_MANAGER_IMPLEMENTATION
20-
prompt "Access Manager implementation"
21-
default ACCESS_MANAGER_IMPLEMENTATION_DEFAULT
22-
23-
config ACCESS_MANAGER_IMPLEMENTATION_DEFAULT
24-
bool "Access Manager default implementation"
25-
help
26-
Uses the default implementation of the Access Manager
27-
provided by the Door Lock Reference Application.
28-
29-
config ACCESS_MANAGER_IMPLEMENTATION_CUSTOM
30-
bool "Access Manager custom implementation"
31-
help
32-
Uses a custom implementation of the Access Manager.
33-
This implementation is based on provided template
34-
that can be tailored to specific requirements.
35-
endchoice
36-
37-
if ACCESS_MANAGER_IMPLEMENTATION_DEFAULT
38-
rsource "src/access_manager_impl_default/Kconfig"
39-
endif

app/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
VERSION_MAJOR = 0
2-
VERSION_MINOR = 3
2+
VERSION_MINOR = 1
33
PATCHLEVEL = 0
44
VERSION_TWEAK = 0
55
EXTRAVERSION =

app/prj.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7-
# Aliro stack
8-
CONFIG_NCS_ALIRO=y
9-
107
# Basic system configuration
118
CONFIG_MAIN_STACK_SIZE=4096
129
CONFIG_HEAP_MEM_POOL_SIZE=4096
@@ -15,12 +12,12 @@ CONFIG_STD_CPP17=y
1512
CONFIG_REQUIRES_FULL_LIBCPP=y
1613
CONFIG_RESET_ON_FATAL_ERROR=n
1714
CONFIG_ASSERT=y
18-
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
1915

2016
# Logging
2117
CONFIG_CONSOLE=y
2218
CONFIG_LOG=y
2319
CONFIG_NCS_ALIRO_RFAL_LOG_LEVEL_DBG=y
20+
CONFIG_DEBUG_STATE_MACHINE=y
2421
CONFIG_USE_SEGGER_RTT=n
2522
CONFIG_LOG_BACKEND_RTT=n
2623
CONFIG_LOG_BACKEND_SHOW_COLOR=n
@@ -37,6 +34,9 @@ CONFIG_SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE=1024
3734
# Adjust logs queue size
3835
CONFIG_SHELL_BACKEND_SERIAL_LOG_MESSAGE_QUEUE_SIZE=2048
3936

37+
# Print reader key that can be provisioned to the User Device
38+
CONFIG_ALIRO_PRINT_READER_GROUP_ID=y
39+
4040
# RFAL worker stack size (TODO: optimize)
4141
CONFIG_RFAL_WORKER_THREAD_STACK_SIZE=8192
4242

app/src/main.cpp

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@
66

77
#include "aliro/aliro.h"
88
#include "aliro/shell.h"
9-
#include "aliro/types.h"
109
#include "aliro/utils.h"
1110

12-
#ifdef CONFIG_ACCESS_DECISION_INDICATOR
13-
#include "access_decision_indicator.h"
14-
#endif // CONFIG_ACCESS_DECISION_INDICATOR
15-
16-
#include "access_manager/access_manager.h"
11+
#ifdef CONFIG_ALIRO_BLE_TP
12+
#include "uwb/uwb.h"
13+
#include "uwb_impl.h"
14+
#endif // CONFIG_ALIRO_BLE_TP
1715

1816
#include <zephyr/logging/log.h>
1917
#include <zephyr/shell/shell.h>
2018

19+
#ifdef CONFIG_ACCESS_DECISION_INDICATOR
20+
#include "access_decision_indicator.h"
21+
#endif // CONFIG_ACCESS_DECISION_INDICATOR
22+
2123
#include <cstdio>
2224
#include <stdlib.h>
2325

@@ -36,20 +38,29 @@ int main()
3638
LOG_ERR("Failed to initialize access decision indicator"));
3739
#endif // CONFIG_ACCESS_DECISION_INDICATOR
3840

39-
AccessManagerInstance().Init({ .mAccessGrantedIndicatorClb = Indicator::SignalAccessGranted });
40-
41-
const AliroConfig config{
42-
#ifdef CONFIG_DISABLE_ALIRO_NFC_TP
43-
.mEnableNfc = false,
44-
#endif // CONFIG_DISABLE_ALIRO_NFC_TP
45-
4641
#ifdef CONFIG_ALIRO_BLE_TP
47-
.mMaxBleSessions = CONFIG_ALIRO_BLE_TP_MAX_SESSIONS,
42+
Uwb::UltraWideBandImpl::Callbacks callbacks{};
43+
ec = Uwb::UltraWideBandImpl::Instance().Init(callbacks);
44+
if (ec == ALIRO_ERROR_NOT_IMPLEMENTED) {
45+
LOG_INF("UWB is not implemented");
46+
} else {
47+
VerifyOrReturnValue(ec == ALIRO_NO_ERROR, EXIT_FAILURE, LOG_ERR("Failed to initialize UWB module"));
48+
}
4849
#endif // CONFIG_ALIRO_BLE_TP
49-
};
5050

5151
ec = AliroStack::Instance().Init(
52-
{ .mOnError = [](AliroError error) { LOG_ERR("Aliro error: %s", error.ToString()); } }, config);
52+
{ .mOnAccessAttempt =
53+
[](Status status) {
54+
if (status == Status::Denied) {
55+
LOG_INF("ACCESS DENIED");
56+
} else {
57+
LOG_INF("ACCESS GRANTED");
58+
#ifdef CONFIG_ACCESS_DECISION_INDICATOR
59+
Indicator::SignalAccessGranted();
60+
#endif // CONFIG_ACCESS_DECISION_INDICATOR
61+
}
62+
},
63+
.mOnError = [](AliroError error) { LOG_ERR("Aliro error: %s", error.ToString()); } });
5364

5465
VerifyOrDie(ec == ALIRO_NO_ERROR, "Aliro stack initialization failed");
5566

app/src/platform/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ zephyr_include_directories(.)
99
add_subdirectory(nfc_transport_impl)
1010
add_subdirectory(logger)
1111

12-
add_subdirectory_ifdef(CONFIG_ALIRO_BLE_TP ble)
1312
add_subdirectory_ifdef(CONFIG_ALIRO_BLE_TP uwb_impl)
1413
add_subdirectory_ifdef(CONFIG_ACCESS_DECISION_INDICATOR access_decision_indicator)

app/src/platform/logger/platform_log.cpp

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,51 @@
1010

1111
#include <stdarg.h>
1212

13-
LOG_MODULE_REGISTER(platform, CONFIG_NCS_ALIRO_LOG_LEVEL_VALUE);
13+
LOG_MODULE_REGISTER(platform, CONFIG_NCS_DOOR_LOCK_APP_LOG_LEVEL);
1414

15-
void _AliroPlatformLogHexdump(uint8_t platformLogLevel, const void *data, size_t size, const char *str)
15+
void AliroPlatformLogHexdump(AliroLogLevel logLevel, const void *data, size_t size, const char *str)
1616
{
17-
switch (platformLogLevel) {
18-
case LOG_LEVEL_ERR:
17+
switch (logLevel) {
18+
case ALIRO_LOG_LEVEL_ERROR:
1919
LOG_HEXDUMP_ERR(data, size, str);
2020
break;
21-
case LOG_LEVEL_WRN:
21+
case ALIRO_LOG_LEVEL_WARN:
2222
LOG_HEXDUMP_WRN(data, size, str);
2323
break;
24-
case LOG_LEVEL_INF:
24+
case ALIRO_LOG_LEVEL_INFO:
2525
LOG_HEXDUMP_INF(data, size, str);
2626
break;
27-
case LOG_LEVEL_DBG:
27+
case ALIRO_LOG_LEVEL_DEBUG:
2828
LOG_HEXDUMP_DBG(data, size, str);
2929
break;
30-
case LOG_LEVEL_NONE:
30+
case ALIRO_LOG_LEVEL_NONE:
3131
default:
3232
break;
3333
}
3434
}
3535

36-
void _AliroPlatformLog(uint8_t platformLogLevel, const char *logFormat, ...)
36+
void AliroPlatformLog(AliroLogLevel logLevel, const char *logFormat, ...)
3737
{
3838
#if defined(CONFIG_LOG) && !defined(CONFIG_LOG_MODE_MINIMAL)
3939

40-
if (platformLogLevel > CONFIG_NCS_ALIRO_LOG_LEVEL_VALUE) {
41-
return;
40+
uint8_t platformLogLevel{ LOG_LEVEL_NONE };
41+
42+
switch (logLevel) {
43+
case ALIRO_LOG_LEVEL_ERROR:
44+
platformLogLevel = LOG_LEVEL_ERR;
45+
break;
46+
case ALIRO_LOG_LEVEL_WARN:
47+
platformLogLevel = LOG_LEVEL_WRN;
48+
break;
49+
case ALIRO_LOG_LEVEL_INFO:
50+
platformLogLevel = LOG_LEVEL_INF;
51+
break;
52+
case ALIRO_LOG_LEVEL_DEBUG:
53+
platformLogLevel = LOG_LEVEL_DBG;
54+
break;
55+
case ALIRO_LOG_LEVEL_NONE:
56+
default:
57+
platformLogLevel = LOG_LEVEL_NONE;
4258
}
4359

4460
va_list paramList;
@@ -48,7 +64,7 @@ void _AliroPlatformLog(uint8_t platformLogLevel, const char *logFormat, ...)
4864

4965
#else // defined(CONFIG_LOG) && !defined(CONFIG_LOG_MODE_MINIMAL)
5066

51-
ARG_UNUSED(platformLogLevel);
67+
ARG_UNUSED(logLevel);
5268
ARG_UNUSED(logFormat);
5369

5470
#endif // defined(CONFIG_LOG) && !defined(CONFIG_LOG_MODE_MINIMAL)

app/src/platform/nfc_transport_impl/nfc_transport_rfal.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ K_THREAD_STACK_DEFINE(mStack, CONFIG_RFAL_WORKER_THREAD_STACK_SIZE);
2323
[[noreturn]] void NfcTransportRfal::Run()
2424
{
2525
while (true) {
26-
if (mRecoverPolling && !mSendInProgress) {
26+
if (mRecoverPolling) {
2727
mRecoverPolling = false;
2828
RecoverPolling();
2929
}
@@ -62,18 +62,15 @@ void NfcTransportRfal::RfalNotifyCallback(rfalNfcState state)
6262
case RFAL_NFC_STATE_START_DISCOVERY:
6363
LOG_DBG("RFAL: Start discovery state");
6464
mMultiSel = false;
65-
mSendInProgress = false;
6665
break;
6766
case RFAL_NFC_STATE_DATAEXCHANGE:
6867
LOG_DBG("RFAL: Data exchange state");
6968
break;
7069
case RFAL_NFC_STATE_DATAEXCHANGE_DONE:
71-
mSendInProgress = false;
7270
CaptureRxData();
7371
break;
7472
case RFAL_NFC_STATE_DEACTIVATION:
7573
LOG_DBG("RFAL: Deactivation State");
76-
mSendInProgress = false;
7774
break;
7875
case RFAL_NFC_STATE_ACTIVATED:
7976
LOG_DBG("RFAL: Activated state");
@@ -220,13 +217,11 @@ AliroError NfcTransportRfal::_Init(NfcDriver::Callbacks callbacks)
220217
AliroError NfcTransportRfal::_Send(Data data, [[maybe_unused]] uint32_t maximumFrameDelayTime)
221218
{
222219
LOG_HEXDUMP_DBG(data.mData, data.mLength, "RFAL: TX data:");
223-
mSendInProgress = true;
224220

225221
// use RFAL_FWT_NONE as FWT because the driver with ISO-DEP enabled will ignore it anyway
226222
ReturnCode err = rfalNfcDataExchangeStart(data.mData, data.mLength, &mRxData, &mRcvLen, RFAL_FWT_NONE);
227223
VerifyOrReturnStatus(err == RFAL_ERR_NONE, ALIRO_ERROR_INTERNAL,
228-
LOG_ERR("RFAL: Data exchange failed, return code: %d", err);
229-
mSendInProgress = false);
224+
LOG_ERR("RFAL: Data exchange failed, return code: %d", err));
230225

231226
return ALIRO_NO_ERROR;
232227
}

app/src/platform/nfc_transport_impl/nfc_transport_rfal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class NfcTransportRfal : public IsoDep, public NfcDriver {
6464
uint16_t *mRcvLen{};
6565

6666
bool mRecoverPolling{ false };
67-
bool mSendInProgress{ false };
6867

6968
static constexpr uint32_t sIdleTimerTimeoutMs{ CONFIG_RFAL_IDLE_TIMEOUT_MS };
7069
};

0 commit comments

Comments
 (0)