Skip to content

Commit 5621ff6

Browse files
[nrfconnect] Moved NFC mgr impl from Zephyr to nrfconnect (project-chip#37629)
The NFCOnboardingPayloadManagerImpl that is currently located in Zephyr is actually nrfconnect specific implementation, as it includes nrf internal headers that are not available for any other platform. It seems it was accidentally added to Zephyr in the past, so it should be moved to nrfconnect.
1 parent 409ad66 commit 5621ff6

5 files changed

+49
-82
lines changed

src/platform/Zephyr/BUILD.gn

-7
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ static_library("Zephyr") {
7676
}
7777
}
7878

79-
if (chip_enable_nfc_onboarding_payload) {
80-
sources += [
81-
"NFCOnboardingPayloadManagerImpl.cpp",
82-
"NFCOnboardingPayloadManagerImpl.h",
83-
]
84-
}
85-
8679
if (chip_malloc_sys_heap) {
8780
sources += [ "SysHeapMalloc.cpp" ]
8881
}

src/platform/Zephyr/NFCOnboardingPayloadManagerImpl.h

-69
This file was deleted.

src/platform/nrfconnect/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static_library("nrfconnect") {
120120

121121
if (chip_enable_nfc_onboarding_payload) {
122122
sources += [
123-
"../Zephyr/NFCOnboardingPayloadManagerImpl.cpp",
123+
"NFCOnboardingPayloadManagerImpl.cpp",
124124
"NFCOnboardingPayloadManagerImpl.h",
125125
]
126126
}

src/platform/Zephyr/NFCOnboardingPayloadManagerImpl.cpp src/platform/nrfconnect/NFCOnboardingPayloadManagerImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2021 Project CHIP Authors
3+
* Copyright (c) 2021-2025 Project CHIP Authors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

src/platform/nrfconnect/NFCOnboardingPayloadManagerImpl.h

+47-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2021 Project CHIP Authors
3+
* Copyright (c) 2021-2025 Project CHIP Authors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -17,10 +17,53 @@
1717

1818
/**
1919
* @file
20-
* Provides an implementation of the NFCOnboardingPayloadManager interface for nRF Connect
21-
* SDK platform, by including Zephyr platform implementation.
20+
* Platform-specific NFCOnboardingPayloadManager implementation for nrfconnect.
2221
*/
2322

2423
#pragma once
2524

26-
#include <platform/Zephyr/NFCOnboardingPayloadManagerImpl.h>
25+
#include <cstddef>
26+
#include <cstdint>
27+
28+
namespace chip {
29+
namespace DeviceLayer {
30+
31+
class NFCOnboardingPayloadManagerImpl final : public NFCOnboardingPayloadManager
32+
{
33+
friend class NFCOnboardingPayloadManager;
34+
35+
private:
36+
// ===== Members that implement the NFCOnboardingPayloadManager internal interface.
37+
38+
CHIP_ERROR _Init();
39+
CHIP_ERROR _StartTagEmulation(const char * payload, size_t payloadLength);
40+
CHIP_ERROR _StopTagEmulation();
41+
bool _IsTagEmulationStarted() const { return mIsStarted; };
42+
43+
// ===== Members for internal use by this class.
44+
45+
constexpr static uint8_t kNdefBufferSize = 128;
46+
47+
uint8_t mNdefBuffer[kNdefBufferSize];
48+
bool mIsStarted;
49+
50+
// ===== Members for internal use by the following friends.
51+
52+
friend NFCOnboardingPayloadManager & NFCOnboardingPayloadMgr();
53+
friend NFCOnboardingPayloadManagerImpl & NFCOnboardingPayloadMgrImpl();
54+
55+
static NFCOnboardingPayloadManagerImpl sInstance;
56+
};
57+
58+
inline NFCOnboardingPayloadManager & NFCOnboardingPayloadMgr()
59+
{
60+
return NFCOnboardingPayloadManagerImpl::sInstance;
61+
}
62+
63+
inline NFCOnboardingPayloadManagerImpl & NFCOnboardingPayloadMgrImpl()
64+
{
65+
return NFCOnboardingPayloadManagerImpl::sInstance;
66+
}
67+
68+
} // namespace DeviceLayer
69+
} // namespace chip

0 commit comments

Comments
 (0)