Skip to content

Commit e8d59d7

Browse files
authored
Merge branch 'master' into telink_docker_update
2 parents b4eae04 + 630531c commit e8d59d7

File tree

12 files changed

+73
-51
lines changed

12 files changed

+73
-51
lines changed

.github/workflows/java-tests.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,6 @@ jobs:
260260
--factoryreset \
261261
'
262262
- name: Run Pairing Onnetwork and get diagnostic log Test
263-
# TODO: test below is disabled because it seems flaky (crashes on pool not being empty on app exit)
264-
# See: https://github.com/project-chip/connectedhomeip/issues/36734
265-
if: false
266263
run: |
267264
scripts/run_in_python_env.sh out/venv \
268265
'./scripts/tests/run_java_test.py \

examples/java-matter-controller/java/src/com/matter/controller/commands/bdx/PairOnNetworkLongDownloadLogCommand.kt

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.matter.controller.commands.pairing.PairingCommand
99
import com.matter.controller.commands.pairing.PairingModeType
1010
import com.matter.controller.commands.pairing.PairingNetworkType
1111
import java.io.File
12+
import java.util.concurrent.TimeUnit
1213
import java.util.logging.Level
1314
import java.util.logging.Logger
1415

@@ -85,12 +86,19 @@ class PairOnNetworkLongDownloadLogCommand(
8586
)
8687
logger.log(Level.INFO, "Waiting response : ${getTimeoutMillis()}")
8788
waitCompleteMs(getTimeoutMillis())
89+
// For waiting both side terminating.
90+
try {
91+
TimeUnit.SECONDS.sleep(WAIT_FOR_TERMINATE)
92+
} catch (e: InterruptedException) {
93+
throw RuntimeException(e)
94+
}
8895
}
8996

9097
companion object {
9198
private val logger = Logger.getLogger(PairOnNetworkLongDownloadLogCommand::class.java.name)
9299

93100
private const val MATTER_PORT = 5540
94101
private const val MS_TO_SEC = 1000
102+
private const val WAIT_FOR_TERMINATE = 1L
95103
}
96104
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
96 : [Telink] Update Docker image (Zephyr update)
1+
97 : [Telink] Update Docker image (Zephyr update)

integrations/docker/images/stage-2/chip-build-nxp/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ WORKDIR /opt/nxp/
1313
ARG NXP_SDK_EXAMPLE_PATH=nxp_matter_support/github_sdk/common_sdk/repo/examples
1414

1515
RUN set -x \
16-
&& git clone --branch v1.4.0-pvw1 https://github.com/NXP/nxp_matter_support.git \
16+
&& git clone --branch matter-sdk-2.16.100-support https://github.com/NXP/nxp_matter_support.git \
1717
&& pip3 install --break-system-packages -U --no-cache-dir west \
1818
&& ./nxp_matter_support/scripts/update_nxp_sdk.py \
1919
&& cd $NXP_SDK_EXAMPLE_PATH \

kotlin-detect-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ exceptions:
232232
TooGenericExceptionThrown:
233233
excludes:
234234
- "**/examples/java-matter-controller/java/src/com/matter/controller/commands/bdx/DownloadLogCommand.kt"
235+
- "**/examples/java-matter-controller/java/src/com/matter/controller/commands/bdx/PairOnNetworkLongDownloadLogCommand.kt"
235236
- "**/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.kt"
236237
- "**/src/controller/java/generated/java/**/*"
237238
ThrowingExceptionsWithoutMessageOrCause:

src/controller/java/AndroidLogDownloadFromNode.cpp

+43-35
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ CHIP_ERROR AndroidLogDownloadFromNode::SendRetrieveLogsRequest(Messaging::Exchan
9999
if (err != CHIP_NO_ERROR)
100100
{
101101
ChipLogError(Controller, "Make BDX URI failure : %" CHIP_ERROR_FORMAT, err.Format());
102-
FinishLogDownloadFromNode(err);
102+
FinishLogDownloadFromNode(static_cast<void *>(this), err);
103103
}
104104

105105
mBdxReceiver =
@@ -132,18 +132,14 @@ void AndroidLogDownloadFromNode::OnDeviceConnectedFn(void * context, Messaging::
132132
if (err != CHIP_NO_ERROR)
133133
{
134134
ChipLogError(Controller, "Log Download failure : %" CHIP_ERROR_FORMAT, err.Format());
135-
self->FinishLogDownloadFromNode(err);
135+
FinishLogDownloadFromNode(context, err);
136136
}
137137
}
138138

139139
void AndroidLogDownloadFromNode::OnDeviceConnectionFailureFn(void * context, const ScopedNodeId & peerId, CHIP_ERROR err)
140140
{
141141
ChipLogProgress(Controller, "OnDeviceConnectionFailureFn: %" CHIP_ERROR_FORMAT, err.Format());
142-
143-
auto * self = static_cast<AndroidLogDownloadFromNode *>(context);
144-
VerifyOrReturn(self != nullptr, ChipLogProgress(Controller, "Device connected failure callback with null context. Ignoring"));
145-
146-
self->FinishLogDownloadFromNode(err);
142+
FinishLogDownloadFromNode(context, err);
147143
}
148144

149145
void AndroidLogDownloadFromNode::OnResponseRetrieveLogs(void * context,
@@ -162,25 +158,25 @@ void AndroidLogDownloadFromNode::OnResponseRetrieveLogs(void * context,
162158
{
163159
CHIP_ERROR err = CHIP_NO_ERROR;
164160
self->OnTransferCallback(self->mController->GetFabricIndex(), self->mRemoteNodeId, data.logContent, &err);
165-
self->FinishLogDownloadFromNode(err);
161+
FinishLogDownloadFromNode(context, err);
166162
}
167163
else if (data.status == StatusEnum::kNoLogs)
168164
{
169165
CHIP_ERROR err = CHIP_NO_ERROR;
170166
self->OnTransferCallback(self->mController->GetFabricIndex(), self->mRemoteNodeId, ByteSpan(), &err);
171-
self->FinishLogDownloadFromNode(err);
167+
FinishLogDownloadFromNode(context, err);
172168
}
173169
else if (data.status == StatusEnum::kBusy)
174170
{
175-
self->FinishLogDownloadFromNode(CHIP_ERROR_BUSY);
171+
FinishLogDownloadFromNode(context, CHIP_ERROR_BUSY);
176172
}
177173
else if (data.status == StatusEnum::kDenied)
178174
{
179-
self->FinishLogDownloadFromNode(CHIP_ERROR_ACCESS_DENIED);
175+
FinishLogDownloadFromNode(context, CHIP_ERROR_ACCESS_DENIED);
180176
}
181177
else
182178
{
183-
self->FinishLogDownloadFromNode(CHIP_ERROR_INVALID_DATA_LIST);
179+
FinishLogDownloadFromNode(context, CHIP_ERROR_INVALID_DATA_LIST);
184180
}
185181
}
186182

@@ -191,48 +187,60 @@ void AndroidLogDownloadFromNode::OnCommandFailure(void * context, CHIP_ERROR err
191187
auto * self = static_cast<AndroidLogDownloadFromNode *>(context);
192188
VerifyOrReturn(self != nullptr, ChipLogProgress(Controller, "Send command failure callback with null context. Ignoring"));
193189

194-
self->FinishLogDownloadFromNode(err);
190+
FinishLogDownloadFromNode(context, err);
195191
}
196192

197-
void AndroidLogDownloadFromNode::FinishLogDownloadFromNode(CHIP_ERROR err)
193+
void AndroidLogDownloadFromNode::FinishLogDownloadFromNode(void * context, CHIP_ERROR err)
198194
{
199-
CHIP_ERROR jniErr = CHIP_NO_ERROR;
200-
if (mBdxReceiver != nullptr)
195+
auto * self = static_cast<AndroidLogDownloadFromNode *>(context);
196+
VerifyOrReturn(self != nullptr, ChipLogProgress(Controller, "Finish Log Download with null context. Ignoring"));
197+
198+
if (self->mBdxReceiver != nullptr)
201199
{
202-
if (mTimeout > 0)
200+
if (self->mTimeout > 0 && err != CHIP_ERROR_TIMEOUT)
203201
{
204-
mBdxReceiver->CancelBDXTransferTimeout();
202+
self->mBdxReceiver->CancelBDXTransferTimeout();
205203
}
206-
delete mBdxReceiver;
207-
mBdxReceiver = nullptr;
204+
delete self->mBdxReceiver;
205+
self->mBdxReceiver = nullptr;
208206
}
209207

210-
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
208+
CHIP_ERROR jniErr = CHIP_NO_ERROR;
209+
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
211210
JniLocalReferenceScope scope(env);
212211

212+
jobject jCallback = self->mJavaCallback.ObjectRef();
213+
jint jFabricIndex = self->mController->GetFabricIndex();
214+
jlong jremoteNodeId = self->mRemoteNodeId;
215+
216+
VerifyOrExit(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread"));
217+
213218
if (err == CHIP_NO_ERROR)
214219
{
215220
ChipLogProgress(Controller, "Log Download succeeded.");
216221
jmethodID onSuccessMethod;
217222
// Java method signature : boolean onSuccess(int fabricIndex, long nodeId)
218-
jniErr = JniReferences::GetInstance().FindMethod(env, mJavaCallback.ObjectRef(), "onSuccess", "(IJ)V", &onSuccessMethod);
223+
jniErr = JniReferences::GetInstance().FindMethod(env, jCallback, "onSuccess", "(IJ)V", &onSuccessMethod);
219224

220-
VerifyOrReturn(jniErr == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find onSuccess method"));
225+
VerifyOrExit(jniErr == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find onSuccess method"));
221226

222-
env->CallVoidMethod(mJavaCallback.ObjectRef(), onSuccessMethod, static_cast<jint>(mController->GetFabricIndex()),
223-
static_cast<jlong>(mRemoteNodeId));
224-
return;
227+
env->CallVoidMethod(jCallback, onSuccessMethod, jFabricIndex, jremoteNodeId);
225228
}
229+
else
230+
{
231+
ChipLogError(Controller, "Log Download Failed : %" CHIP_ERROR_FORMAT, err.Format());
226232

227-
ChipLogError(Controller, "Log Download Failed : %" CHIP_ERROR_FORMAT, err.Format());
233+
jmethodID onErrorMethod;
234+
// Java method signature : void onError(int fabricIndex, long nodeId, long errorCode)
235+
jniErr = JniReferences::GetInstance().FindMethod(env, jCallback, "onError", "(IJJ)V", &onErrorMethod);
236+
VerifyOrExit(jniErr == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find onError method"));
228237

229-
jmethodID onErrorMethod;
230-
// Java method signature : void onError(int fabricIndex, long nodeId, long errorCode)
231-
jniErr = JniReferences::GetInstance().FindMethod(env, mJavaCallback.ObjectRef(), "onError", "(IJJ)V", &onErrorMethod);
232-
VerifyOrReturn(jniErr == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find onError method"));
238+
env->CallVoidMethod(jCallback, onErrorMethod, jFabricIndex, jremoteNodeId, static_cast<jlong>(err.AsInteger()));
239+
}
233240

234-
env->CallVoidMethod(mJavaCallback.ObjectRef(), onErrorMethod, static_cast<jint>(mController->GetFabricIndex()),
235-
static_cast<jlong>(mRemoteNodeId), static_cast<jlong>(err.AsInteger()));
241+
exit:
242+
// Finish this function, this object will be deleted.
243+
delete self;
236244
}
237245

238246
void AndroidLogDownloadFromNode::OnBdxTransferCallback(void * context, FabricIndex fabricIndex, NodeId remoteNodeId,
@@ -277,7 +285,7 @@ void AndroidLogDownloadFromNode::OnBdxTransferSuccessCallback(void * context, Fa
277285
auto * self = static_cast<AndroidLogDownloadFromNode *>(context);
278286
VerifyOrReturn(self != nullptr, ChipLogProgress(Controller, "Send command failure callback with null context. Ignoring"));
279287

280-
self->FinishLogDownloadFromNode(CHIP_NO_ERROR);
288+
FinishLogDownloadFromNode(context, CHIP_NO_ERROR);
281289
}
282290

283291
void AndroidLogDownloadFromNode::OnBdxTransferFailureCallback(void * context, FabricIndex fabricIndex, NodeId remoteNodeId,
@@ -288,7 +296,7 @@ void AndroidLogDownloadFromNode::OnBdxTransferFailureCallback(void * context, Fa
288296
auto * self = static_cast<AndroidLogDownloadFromNode *>(context);
289297
VerifyOrReturn(self != nullptr, ChipLogProgress(Controller, "Send command failure callback with null context. Ignoring"));
290298

291-
self->FinishLogDownloadFromNode(status);
299+
FinishLogDownloadFromNode(context, status);
292300
}
293301
} // namespace Controller
294302
} // namespace chip

src/controller/java/AndroidLogDownloadFromNode.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class AndroidLogDownloadFromNode
5454
AndroidLogDownloadFromNode(DeviceController * controller, NodeId remoteNodeId, app::Clusters::DiagnosticLogs::IntentEnum intent,
5555
uint16_t timeout, jobject javaCallback);
5656

57+
~AndroidLogDownloadFromNode() {}
58+
5759
DeviceController * mController = nullptr;
5860

5961
chip::Callback::Callback<OnDeviceConnected> mOnDeviceConnectedCallback;
@@ -76,7 +78,7 @@ class AndroidLogDownloadFromNode
7678
CHIP_ERROR SendRetrieveLogsRequest(Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle);
7779
void OnTransferCallback(FabricIndex fabricIndex, NodeId remoteNodeId, const chip::ByteSpan & data,
7880
CHIP_ERROR * errInfoOnFailure);
79-
void FinishLogDownloadFromNode(CHIP_ERROR err);
81+
static void FinishLogDownloadFromNode(void * context, CHIP_ERROR err);
8082

8183
static void OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle);
8284
static void OnDeviceConnectionFailureFn(void * context, const ScopedNodeId & peerId, CHIP_ERROR error);

src/lib/support/BufferWriter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ BufferWriter & BufferWriter::Put(const void * buf, size_t len)
3030
{
3131
size_t available = Available();
3232

33-
if (available > 0)
33+
if (available > 0 && len > 0)
3434
{
3535
memmove(mBuf + mNeeded, buf, available < len ? available : len);
3636
}

src/platform/ESP32/CHIPDevicePlatformConfig.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@
121121
#define CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MAX CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MAX
122122
#define CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION CONFIG_CHIPOBLE_SINGLE_CONNECTION
123123
#define CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART
124-
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS CONFIG_ENABLE_TEST_SETUP_PARAMS
124+
125+
#ifdef CONFIG_ENABLE_TEST_SETUP_PARAMS
126+
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS 1
127+
#else
128+
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS 0
129+
#endif // CONFIG_ENABLE_TEST_SETUP_PARAMS
130+
125131
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER CONFIG_USE_TEST_SERIAL_NUMBER
126132

127133
#ifdef CONFIG_ENABLE_THREAD_TELEMETRY

src/platform/silabs/wifi/SiWx/WifiInterface.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ extern "C" {
7777
#include "sl_si91x_power_manager.h"
7878
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE
7979

80-
// Temmporary work-around for wifi-init failure in ACX modules with WiseConnect v3.3.3. This can be removed after integrating with
81-
// WiseConnect v3.4.0
82-
#if (SL_SI91X_ACX_MODULE == 1)
80+
// TODO : Temporary work-around for wifi-init failure in 917NCP and 917SOC ACX module boards.
81+
// Can be removed after Wiseconnect fixes region code for all ACX module boards.
82+
#if (SL_SI91X_ACX_MODULE == 1) || defined(EXP_BOARD)
8383
#define REGION_CODE IGNORE_REGION
8484
#else
8585
#define REGION_CODE US

src/transport/SessionManager.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1297,15 +1297,15 @@ Optional<SessionHandle> SessionManager::FindSecureSessionForNode(ScopedNodeId pe
12971297
{
12981298
#if INET_CONFIG_ENABLE_TCP_ENDPOINT
12991299
// Set up a TCP transport based session as standby
1300-
if ((tcpSession == nullptr || tcpSession->GetLastActivityTime() < session->GetLastActivityTime()) &&
1300+
if ((tcpSession == nullptr || tcpSession->GetLastPeerActivityTime() < session->GetLastPeerActivityTime()) &&
13011301
session->GetTCPConnection() != nullptr)
13021302
{
13031303
tcpSession = session;
13041304
}
13051305
#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
13061306
}
13071307

1308-
if ((mrpSession == nullptr) || (mrpSession->GetLastActivityTime() < session->GetLastActivityTime()))
1308+
if ((mrpSession == nullptr) || (mrpSession->GetLastPeerActivityTime() < session->GetLastPeerActivityTime()))
13091309
{
13101310
mrpSession = session;
13111311
}

src/transport/tests/TestSessionManager.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -998,19 +998,19 @@ TEST_F(TestSessionManager, TestFindSecureSessionForNode)
998998
CHIP_ERROR err = sessionManager.InjectCaseSessionWithTestKey(aliceToBobSession, 2, 1, aliceNodeId, bobNodeId, aliceFabricIndex,
999999
peer, CryptoContext::SessionRole::kInitiator);
10001000
EXPECT_EQ(err, CHIP_NO_ERROR);
1001-
aliceToBobSession->AsSecureSession()->MarkActive();
1001+
aliceToBobSession->AsSecureSession()->MarkActiveRx();
10021002

10031003
SessionHolder newAliceToBobSession;
10041004
err = sessionManager.InjectCaseSessionWithTestKey(newAliceToBobSession, 3, 4, aliceNodeId, bobNodeId, aliceFabricIndex, peer,
10051005
CryptoContext::SessionRole::kInitiator);
10061006
EXPECT_EQ(err, CHIP_NO_ERROR);
10071007

1008-
while (System::SystemClock().GetMonotonicTimestamp() <= aliceToBobSession->AsSecureSession()->GetLastActivityTime())
1008+
while (System::SystemClock().GetMonotonicTimestamp() <= aliceToBobSession->AsSecureSession()->GetLastPeerActivityTime())
10091009
{
10101010
// Wait for the clock to advance so the new session is
10111011
// more-recently-active.
10121012
}
1013-
newAliceToBobSession->AsSecureSession()->MarkActive();
1013+
newAliceToBobSession->AsSecureSession()->MarkActiveRx();
10141014

10151015
auto foundSession = sessionManager.FindSecureSessionForNode(ScopedNodeId(bobNodeId, aliceFabricIndex),
10161016
MakeOptional(SecureSession::Type::kCASE));

0 commit comments

Comments
 (0)