Skip to content

Commit ba01354

Browse files
authored
Merge branch 'master' into on-off-fan
2 parents cb8469c + e7a2952 commit ba01354

File tree

112 files changed

+3670
-5865
lines changed

Some content is hidden

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

112 files changed

+3670
-5865
lines changed

.github/workflows/docker_img.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ jobs:
105105
- "-nxp-zephyr"
106106
- "-nrf-platform"
107107
- "-telink"
108+
- "-telink-zephyr_3_3"
108109
- "-ti"
109110
- "-tizen"
110111
- "-openiotsdk"

.github/workflows/zap_regeneration.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
zap_regeneration:
2929
name: ZAP Regeneration
3030

31-
runs-on: ubuntu-20.04
31+
runs-on: ubuntu-latest
3232
container:
3333
image: ghcr.io/project-chip/chip-build:119
3434
defaults:

.github/workflows/zap_templates.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
zap_templates:
3434
name: ZAP templates generation
3535

36-
runs-on: ubuntu-20.04
36+
runs-on: ubuntu-latest
3737
container:
3838
image: ghcr.io/project-chip/chip-build:119
3939
defaults:

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,6 @@ stm32/ @STYoannZamaron
6767

6868
telink/ @s07641069
6969
chip-build-telink/ @s07641069
70+
chip-build-telink-zephyr_3_3/ @s07641069
7071

7172
webos/ @joonhaengHeo

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ be useful for quick filtering like `[TC-ABC-1.2]` to tag test changes.
175175
Examples of descriptive titles:
176176

177177
- `[Silabs] Fix compile of SiWx917 if LED and BUTTON are disabled`
178-
- `[Telink] Update build Dockerfile with new Zeprhy SHA: c05c4.....`
178+
- `[Telink] Update build Dockerfile with new Zephyr SHA: c05c4.....`
179179
- `General Commissioning Cluster: use AttributeAccessInterface/CommandHandlerInterface for processing`
180180
- `Scenes Management/CopyScene: set access as manage instead of default to match the spec`
181181
- `Fix build errors due to ChipDeviceEvent default constructor not being available`

config/telink/chip-module/Kconfig.defaults

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ config HEAP_MEM_POOL_SIZE
9090
config COMMON_LIBC_MALLOC_ARENA_SIZE
9191
default 20716 if SOC_SERIES_RISCV_TELINK_B9X_RETENTION || (SOC_RISCV_TELINK_TL321X && ZEPHYR_VERSION_3_3)
9292
default 16384 if SOC_RISCV_TELINK_TL721X || (SOC_RISCV_TELINK_TL321X && !ZEPHYR_VERSION_3_3)
93+
default 13568 if SOC_RISCV_TELINK_W91
9394
default 12288
9495

9596
config NET_IPV6_MLD

examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ using namespace chip::app::Clusters::Actions;
2424
using namespace chip::app::Clusters::Actions::Attributes;
2525
using namespace chip::Protocols::InteractionModel;
2626

27+
namespace {
28+
std::unique_ptr<Clusters::Actions::ActionsDelegateImpl> sActionsDelegateImpl;
29+
std::unique_ptr<Clusters::Actions::ActionsServer> sActionsServer;
30+
} // namespace
31+
2732
CHIP_ERROR ActionsDelegateImpl::ReadActionAtIndex(uint16_t index, ActionStructStorage & action)
2833
{
2934
if (index >= kActionList.size())
@@ -129,3 +134,17 @@ Status ActionsDelegateImpl::HandleDisableActionWithDuration(uint16_t actionId, u
129134
// Not implemented
130135
return Status::NotFound;
131136
}
137+
138+
void emberAfActionsClusterInitCallback(EndpointId endpoint)
139+
{
140+
VerifyOrReturn(endpoint == 1,
141+
ChipLogError(Zcl, "Actions cluster delegate is not implemented for endpoint with id %d.", endpoint));
142+
VerifyOrReturn(emberAfContainsServer(endpoint, Actions::Id) == true,
143+
ChipLogError(Zcl, "Endpoint %d does not support Actions cluster.", endpoint));
144+
VerifyOrReturn(!sActionsDelegateImpl && !sActionsServer);
145+
146+
sActionsDelegateImpl = std::make_unique<Actions::ActionsDelegateImpl>();
147+
sActionsServer = std::make_unique<Actions::ActionsServer>(endpoint, *sActionsDelegateImpl.get());
148+
149+
sActionsServer->Init();
150+
}

examples/all-clusters-app/linux/main-common.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
#include <app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h>
5555
#include <app/server/Server.h>
5656
#include <app/util/attribute-storage.h>
57-
#include <bridged-actions-stub.h>
5857
#include <lib/support/CHIPMem.h>
5958
#include <platform/DeviceInstanceInfoProvider.h>
6059
#include <platform/DiagnosticDataProvider.h>
@@ -87,7 +86,6 @@ Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupporte
8786
Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager;
8887
Clusters::ValveConfigurationAndControl::ValveControlDelegate sValveDelegate;
8988
Clusters::TimeSynchronization::ExtendedTimeSyncDelegate sTimeSyncDelegate;
90-
Clusters::Actions::ActionsDelegateImpl sActionsDelegateImpl;
9189

9290
// Please refer to https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/namespaces
9391
constexpr const uint8_t kNamespaceCommon = 7;
@@ -342,12 +340,6 @@ void emberAfThermostatClusterInitCallback(EndpointId endpoint)
342340
SetDefaultDelegate(endpoint, &delegate);
343341
}
344342

345-
void emberAfActionsClusterInitCallback(EndpointId endpoint)
346-
{
347-
VerifyOrReturn(endpoint == 1);
348-
Clusters::Actions::ActionsServer::Instance().SetDefaultDelegate(endpoint, &sActionsDelegateImpl);
349-
}
350-
351343
Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId,
352344
const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
353345
uint16_t maxReadLength)

examples/platform/silabs/BaseApplication.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ CHIP_ERROR BaseApplication::Init()
272272
* Wait for the WiFi to be initialized
273273
*/
274274
ChipLogProgress(AppServer, "APP: Wait WiFi Init");
275-
while (!IsStationReady())
275+
while (!WifiInterface::GetInstance().IsStationReady())
276276
{
277277
osDelay(pdMS_TO_TICKS(10));
278278
}

examples/platform/silabs/MatterConfig.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName)
318318
#ifdef SL_WIFI
319319
CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
320320
{
321-
return InitWiFiStack();
321+
return WifiInterface::GetInstance().InitWiFiStack();
322322
}
323323
#endif // SL_WIFI
324324

examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java

+19-24
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,21 @@ public void handle(CommissionerDeclaration cd) {
262262
});
263263
}
264264

265+
@Override
266+
public void onStop() {
267+
super.onStop();
268+
// Only stop connection if we are still connecting to the device
269+
if (targetCastingPlayer.getConnectionState() == CastingPlayer.ConnectionState.CONNECTING) {
270+
// NOTE, once stopConnecting() is called, the targetCastingPlayer's native object is freed
271+
MatterError err = targetCastingPlayer.stopConnecting();
272+
if (err.hasError()) {
273+
Log.e(
274+
TAG,
275+
"Going back before connection finishes but stopConnecting() failed due to: " + err);
276+
}
277+
}
278+
}
279+
265280
private void displayPasscodeInputDialog(Context context) {
266281
AlertDialog.Builder builder = new AlertDialog.Builder(context);
267282

@@ -336,18 +351,9 @@ public void onClick(DialogInterface dialog, int which) {
336351
connectionFragmentStatusTextView.setText(
337352
"Casting Player CONTINUE CONNECTING failed due to: "
338353
+ finalErr
339-
+ "\n\n");
354+
+ ". Route back to disconnect & try again. \n\n");
340355
});
341-
Log.e(
342-
TAG,
343-
"displayPasscodeInputDialog() continueConnecting() failed, calling stopConnecting() due to: "
344-
+ err);
345-
// Since continueConnecting() failed, Attempt to cancel the connection attempt with
346-
// the CastingPlayer/Commissioner.
347-
err = targetCastingPlayer.stopConnecting();
348-
if (err.hasError()) {
349-
Log.e(TAG, "displayPasscodeInputDialog() stopConnecting() failed due to: " + err);
350-
}
356+
Log.e(TAG, "displayPasscodeInputDialog() continueConnecting() failed due to: " + err);
351357
}
352358
}
353359
});
@@ -359,20 +365,9 @@ public void onClick(DialogInterface dialog, int which) {
359365
public void onClick(DialogInterface dialog, int which) {
360366
Log.i(
361367
TAG,
362-
"displayPasscodeInputDialog() user cancelled the CastingPlayer/Commissioner-Generated Passcode input dialog. Calling stopConnecting()");
368+
"displayPasscodeInputDialog() user cancelled the CastingPlayer/Commissioner-Generated Passcode input dialog");
363369
connectionFragmentStatusTextView.setText(
364-
"Connection attempt with Casting Player cancelled by the Casting Client/Commissionee user. \n\nRoute back to exit. \n\n");
365-
MatterError err = targetCastingPlayer.stopConnecting();
366-
if (err.hasError()) {
367-
MatterError finalErr = err;
368-
getActivity()
369-
.runOnUiThread(
370-
() -> {
371-
connectionFragmentStatusTextView.setText(
372-
"Casting Player CANCEL failed due to: " + finalErr + "\n\n");
373-
});
374-
Log.e(TAG, "displayPasscodeInputDialog() stopConnecting() failed due to: " + err);
375-
}
370+
"Connection attempt with Casting Player cancelled by the Casting Client/Commissionee user. \n\nRoute back to disconnect & exit. \n\n");
376371
dialog.cancel();
377372
}
378373
});

examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingPlayer.java

+25
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@
2929
* about the service discovered/resolved.
3030
*/
3131
public interface CastingPlayer {
32+
33+
/** @brief CastingPlayer's Conenction State */
34+
public enum ConnectionState {
35+
/** State when CastingPlayer is not connected */
36+
NOT_CONNECTED,
37+
38+
/** State when CastingPlayer is attempting to connect */
39+
CONNECTING,
40+
41+
/** State when CastingPlayer is connnected */
42+
CONNECTED,
43+
}
44+
3245
boolean isConnected();
3346

3447
String getDeviceId();
@@ -152,4 +165,16 @@ MatterError verifyOrEstablishConnection(
152165

153166
/** @brief Sets the internal connection state of this CastingPlayer to "disconnected" */
154167
void disconnect();
168+
169+
/**
170+
* @brief Get CastingPlayer's current ConnectionState.
171+
* @return Current ConnectionState.
172+
*/
173+
ConnectionState getConnectionState();
174+
175+
/**
176+
* @brief Get the Current ConnectionState of a CastingPlayer from the native layer.
177+
* @returns A String representation of the CastingPlayer's current connectation.
178+
*/
179+
String getConnectionStateNative();
155180
}

examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayer.java

+25
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
*/
3333
public class MatterCastingPlayer implements CastingPlayer {
3434
private static final String TAG = MatterCastingPlayer.class.getSimpleName();
35+
3536
/**
3637
* Time (in sec) to keep the commissioning window open, if commissioning is required. Must be >= 3
3738
* minutes.
@@ -267,4 +268,28 @@ public MatterError continueConnecting() {
267268

268269
@Override
269270
public native void disconnect();
271+
272+
/**
273+
* @brief Get CastingPlayer's current ConnectionState.
274+
* @throws IllegalArgumentException or NullPointerException when native layer returns invalid
275+
* state.
276+
* @return Current ConnectionState.
277+
*/
278+
@Override
279+
public ConnectionState getConnectionState() {
280+
return ConnectionState.valueOf(getConnectionStateNative());
281+
}
282+
283+
/*
284+
* @brief Get the Current ConnectionState of a CastingPlayer from the native layer.
285+
*
286+
* @returns A String representation of the CastingPlayer's current connectation.
287+
* Possible return values are
288+
* - "NOT_CONNECTED"
289+
* - "CONNECTING"
290+
* - "CONNECTED"
291+
* - Error message or NULL on error
292+
*/
293+
@Override
294+
public native String getConnectionStateNative();
270295
}

examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp

+39
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,45 @@ JNI_METHOD(void, disconnect)
165165
castingPlayer->Disconnect();
166166
}
167167

168+
JNI_METHOD(jstring, getConnectionStateNative)
169+
(JNIEnv * env, jobject thiz)
170+
{
171+
char error_str[50];
172+
jobject jstr_obj = nullptr;
173+
174+
if (NULL == env)
175+
{
176+
LogErrorOnFailure(
177+
chip::JniReferences::GetInstance().CharToStringUTF(CharSpan::fromCharString("JNIEnv interface is NULL"), jstr_obj));
178+
return static_cast<jstring>(jstr_obj);
179+
}
180+
181+
chip::DeviceLayer::StackLock lock;
182+
ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::getConnectionState()");
183+
184+
CastingPlayer * castingPlayer = support::convertCastingPlayerFromJavaToCpp(thiz);
185+
VerifyOrReturnValue(castingPlayer != nullptr, env->NewStringUTF("Cast Player is nullptr"));
186+
187+
matter::casting::core::ConnectionState state = castingPlayer->GetConnectionState();
188+
switch (state)
189+
{
190+
case matter::casting::core::ConnectionState::CASTING_PLAYER_NOT_CONNECTED:
191+
LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(CharSpan::fromCharString("NOT_CONNECTED"), jstr_obj));
192+
break;
193+
case matter::casting::core::ConnectionState::CASTING_PLAYER_CONNECTING:
194+
LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(CharSpan::fromCharString("CONNECTING"), jstr_obj));
195+
break;
196+
case matter::casting::core::ConnectionState::CASTING_PLAYER_CONNECTED:
197+
LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(CharSpan::fromCharString("CONNECTED"), jstr_obj));
198+
break;
199+
default:
200+
snprintf(error_str, sizeof(error_str), "Unsupported Connection State: %d", state);
201+
LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(CharSpan::fromCharString(error_str), jstr_obj));
202+
break;
203+
}
204+
return static_cast<jstring>(jstr_obj);
205+
}
206+
168207
JNI_METHOD(jobject, getEndpoints)
169208
(JNIEnv * env, jobject thiz)
170209
{

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCastingPlayer.h

+17
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@
2626

2727
@class MCEndpoint;
2828

29+
/**
30+
* @brief Represents CastingPlayer ConnectionState.
31+
* @note Should be kept up to date with matter::casting::core::ConnectionState.
32+
*/
33+
typedef enum {
34+
MC_CASTING_PLAYER_NOT_CONNECTED,
35+
MC_CASTING_PLAYER_CONNECTING,
36+
MC_CASTING_PLAYER_CONNECTED,
37+
} MCCastingPlayerConnectionState;
38+
2939
/**
3040
* @brief MCCastingPlayer represents a Matter commissioner that is able to play media to a physical
3141
* output or to a display screen which is part of the device.
@@ -148,6 +158,13 @@
148158
*/
149159
- (void)disconnect;
150160

161+
/**
162+
* @brief Get the CastingPlayer's connection state
163+
* @param state The current connection state that will be return.
164+
* @return nil if request submitted successfully, otherwise a NSError object corresponding to the error.
165+
*/
166+
- (NSError * _Nullable)getConnectionState:(MCCastingPlayerConnectionState * _Nonnull)state;
167+
151168
- (NSString * _Nonnull)identifier;
152169
- (NSString * _Nonnull)deviceName;
153170
- (uint16_t)vendorId;

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCastingPlayer.mm

+29
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,35 @@ - (void)disconnect
190190
});
191191
}
192192

193+
- (NSError * _Nullable)getConnectionState:(MCCastingPlayerConnectionState * _Nonnull)state;
194+
{
195+
ChipLogProgress(AppServer, "MCCastingPlayer.getConnectionState() called");
196+
VerifyOrReturnValue([[MCCastingApp getSharedInstance] isRunning], [MCErrorUtils NSErrorFromChipError:CHIP_ERROR_INCORRECT_STATE], ChipLogError(AppServer, "MCCastingPlayer.getConnectionState() MCCastingApp NOT running"));
197+
198+
__block matter::casting::core::ConnectionState native_state = matter::casting::core::ConnectionState::CASTING_PLAYER_NOT_CONNECTED;
199+
dispatch_queue_t workQueue = [[MCCastingApp getSharedInstance] getWorkQueue];
200+
dispatch_sync(workQueue, ^{
201+
native_state = _cppCastingPlayer->GetConnectionState();
202+
});
203+
204+
switch (native_state) {
205+
case matter::casting::core::ConnectionState::CASTING_PLAYER_NOT_CONNECTED:
206+
*state = MC_CASTING_PLAYER_NOT_CONNECTED;
207+
break;
208+
case matter::casting::core::ConnectionState::CASTING_PLAYER_CONNECTING:
209+
*state = MC_CASTING_PLAYER_CONNECTING;
210+
break;
211+
case matter::casting::core::ConnectionState::CASTING_PLAYER_CONNECTED:
212+
*state = MC_CASTING_PLAYER_CONNECTED;
213+
break;
214+
default:
215+
[NSException raise:@"Unhandled matter::casting::core::ConnectionState" format:@"%d is not handled", native_state];
216+
break;
217+
}
218+
219+
return nil;
220+
}
221+
193222
- (instancetype _Nonnull)initWithCppCastingPlayer:(matter::casting::memory::Strong<matter::casting::core::CastingPlayer>)cppCastingPlayer
194223
{
195224
if (self = [super init]) {

examples/tv-casting-app/darwin/TvCasting/TvCasting/MCConnectionExampleView.swift

+3
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ struct MCConnectionExampleView: View {
8888
viewModel.connect(selectedCastingPlayer: self.selectedCastingPlayer, useCommissionerGeneratedPasscode: self.useCommissionerGeneratedPasscode)
8989
}
9090
})
91+
.onDisappear(perform: {
92+
viewModel.cancelConnectionAttempt(selectedCastingPlayer: self.selectedCastingPlayer)
93+
})
9194
}
9295
}
9396

0 commit comments

Comments
 (0)