Skip to content

Commit

Permalink
Merge branch 'master' into telink_develop
Browse files Browse the repository at this point in the history
  • Loading branch information
s07641069 authored May 2, 2023
2 parents bf437b7 + fa505f6 commit 4813272
Show file tree
Hide file tree
Showing 57 changed files with 1,024 additions and 561 deletions.
3 changes: 3 additions & 0 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ config("strict_warnings") {

cflags_cc = [ "-Wnon-virtual-dtor" ]

configs = []
ldflags = []

if (is_clang) {
Expand All @@ -269,6 +270,8 @@ config("strict_warnings") {
"-Wformat-type-confusion",
]

configs += [ "$dir_pw_build:clang_thread_safety_warnings" ]

# TODO: can make this back fatal in once pigweed updates can be taken again.
# See https://github.com/project-chip/connectedhomeip/pull/22079
#
Expand Down
6 changes: 3 additions & 3 deletions config/esp32/components/chip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ menu "CHIP Core"
int "Set threshold in ms"
default 700
help
Time threshold for events dispatching. By default set to 0 to
to disable event dispatching time measurement and suppress the
logs for Long dispatch time.
Time threshold for warning that dispatched took too long. You can
set this default set to 0 to to disable event dispatching time
measurement and suppress the logs "Long dispatch time:...".

# TODO: add log level selection

Expand Down
1 change: 1 addition & 0 deletions docs/ERROR_CODES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This file was **AUTOMATICALLY** generated by
| 2 | 0x02 | `CHIP_ERROR_CONNECTION_ABORTED` |
| 3 | 0x03 | `CHIP_ERROR_INCORRECT_STATE` |
| 4 | 0x04 | `CHIP_ERROR_MESSAGE_TOO_LONG` |
| 5 | 0x05 | `CHIP_ERROR_RECURSION_DEPTH_LIMIT` |
| 6 | 0x06 | `CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS` |
| 7 | 0x07 | `CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER` |
| 8 | 0x08 | `CHIP_ERROR_NO_CONNECTION_HANDLER` |
Expand Down
5 changes: 4 additions & 1 deletion examples/chip-tool/include/CHIPProjectAppConfig.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2020-2022 Project CHIP Authors
* Copyright (c) 2020-2023 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -63,4 +63,7 @@
// Enable some test-only interaction model APIs.
#define CONFIG_BUILD_FOR_HOST_UNIT_TEST 1

// Allow us, for test purposes, to encode invalid enum values.
#define CHIP_CONFIG_IM_ENABLE_ENCODING_SENTINEL_ENUM_VALUES 1

#endif /* CHIPPROJECTCONFIG_H */
6 changes: 6 additions & 0 deletions examples/darwin-framework-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ action("build-darwin-framework") {
args += [ "--no-clang" ]
}

if (config_enable_yaml_tests) {
args += [ "--enable_encoding_sentinel_enum_values" ]
} else {
args += [ "--no-enable_encoding_sentinel_enum_values" ]
}

output_name = "Matter.framework"
outputs = [
"${root_out_dir}/macos_framework_output/Build/Products/${output_sdk_type}/${output_name}",
Expand Down
11 changes: 11 additions & 0 deletions examples/darwin-framework-tool/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,15 @@ import("//build_overrides/chip.gni")

import("${chip_root}/config/standalone/args.gni")

import("${chip_root}/examples/chip-tool/chip-tool.gni")

chip_crypto = "boringssl"

if (config_enable_yaml_tests) {
chip_device_project_config_include = "<CHIPProjectAppConfig.h>"
chip_project_config_include = "<CHIPProjectAppConfig.h>"

chip_project_config_include_dirs =
[ "${chip_root}/examples/darwin-framework-tool/include" ]
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
}
31 changes: 31 additions & 0 deletions examples/darwin-framework-tool/include/CHIPProjectAppConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2023 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file
* Project configuration for Darwin Framework Tool.
*
*/
#ifndef CHIPPROJECTCONFIG_H
#define CHIPPROJECTCONFIG_H

// Enable some test-only interaction model APIs.
#define CONFIG_BUILD_FOR_HOST_UNIT_TEST 1

// Allow us, for test purposes, to encode invalid enum values.
#define CHIP_CONFIG_IM_ENABLE_ENCODING_SENTINEL_ENUM_VALUES 1

#endif /* CHIPPROJECTCONFIG_H */
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj)
SILABS_LOG("APP: Wait WiFi Init");
while (!wfx_hw_ready())
{
vTaskDelay(10);
vTaskDelay(pdMS_TO_TICKS(10));
}
SILABS_LOG("APP: Done WiFi Init");
/* We will init server when we get IP */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void handleDisconnect() {
* TvCastingApp
*/
private boolean initJni() {
tvCastingApp = new TvCastingApp();
tvCastingApp = TvCastingApp.getInstance();

tvCastingApp.setDACProvider(new DACProviderStub());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,30 @@ public class TvCastingApp {
private static final List<Long> DISCOVERY_TARGET_DEVICE_TYPE_FILTER =
Arrays.asList(35L); // Video player = 35;

private static TvCastingApp sInstance;
private Context applicationContext;
private ChipAppServer chipAppServer;
private NsdManagerServiceResolver.NsdManagerResolverAvailState nsdManagerResolverAvailState;
private boolean discoveryStarted = false;
private Object discoveryLock = new Object();

private WifiManager.MulticastLock multicastLock;
private NsdManager nsdManager;
private NsdDiscoveryListener nsdDiscoveryListener;

private TvCastingApp() {}

public static TvCastingApp getInstance() {
if (sInstance == null) {
sInstance = new TvCastingApp();
}
return sInstance;
}

public boolean initApp(Context applicationContext, AppParameters appParameters) {
if (applicationContext == null || appParameters == null) {
if (applicationContext == null
|| appParameters == null
|| appParameters.getConfigurationManager() == null) {
return false;
}

Expand Down Expand Up @@ -106,50 +119,62 @@ public boolean initApp(Context applicationContext, AppParameters appParameters)
public void discoverVideoPlayerCommissioners(
SuccessCallback<DiscoveredNodeData> discoverySuccessCallback,
FailureCallback discoveryFailureCallback) {
Log.d(TAG, "TvCastingApp.discoverVideoPlayerCommissioners called");
synchronized (discoveryLock) {
Log.d(TAG, "TvCastingApp.discoverVideoPlayerCommissioners called");

if (this.discoveryStarted) {
Log.d(TAG, "Discovery already started, stopping before starting again");
stopVideoPlayerDiscovery();
}
if (this.discoveryStarted) {
Log.d(TAG, "Discovery already started, stopping before starting again");
stopVideoPlayerDiscovery();
}

List<VideoPlayer> preCommissionedVideoPlayers = readCachedVideoPlayers();

WifiManager wifiManager =
(WifiManager) applicationContext.getSystemService(Context.WIFI_SERVICE);
multicastLock = wifiManager.createMulticastLock("multicastLock");
multicastLock.setReferenceCounted(true);
multicastLock.acquire();

nsdManager = (NsdManager) applicationContext.getSystemService(Context.NSD_SERVICE);
nsdDiscoveryListener =
new NsdDiscoveryListener(
nsdManager,
DISCOVERY_TARGET_SERVICE_TYPE,
DISCOVERY_TARGET_DEVICE_TYPE_FILTER,
preCommissionedVideoPlayers,
discoverySuccessCallback,
discoveryFailureCallback,
nsdManagerResolverAvailState);

nsdManager.discoverServices(
DISCOVERY_TARGET_SERVICE_TYPE, NsdManager.PROTOCOL_DNS_SD, nsdDiscoveryListener);
Log.d(TAG, "TvCastingApp.discoverVideoPlayerCommissioners started");
this.discoveryStarted = true;
List<VideoPlayer> preCommissionedVideoPlayers = readCachedVideoPlayers();

WifiManager wifiManager =
(WifiManager) applicationContext.getSystemService(Context.WIFI_SERVICE);
multicastLock = wifiManager.createMulticastLock("multicastLock");
multicastLock.setReferenceCounted(true);
multicastLock.acquire();

nsdManager = (NsdManager) applicationContext.getSystemService(Context.NSD_SERVICE);
nsdDiscoveryListener =
new NsdDiscoveryListener(
nsdManager,
DISCOVERY_TARGET_SERVICE_TYPE,
DISCOVERY_TARGET_DEVICE_TYPE_FILTER,
preCommissionedVideoPlayers,
discoverySuccessCallback,
discoveryFailureCallback,
nsdManagerResolverAvailState);

nsdManager.discoverServices(
DISCOVERY_TARGET_SERVICE_TYPE, NsdManager.PROTOCOL_DNS_SD, nsdDiscoveryListener);
Log.d(TAG, "TvCastingApp.discoverVideoPlayerCommissioners started");
this.discoveryStarted = true;
}
}

public void stopVideoPlayerDiscovery() {
Log.d(TAG, "TvCastingApp trying to stop video player discovery");
if (this.discoveryStarted
&& nsdManager != null
&& multicastLock != null
&& nsdDiscoveryListener != null) {
Log.d(TAG, "TvCastingApp stopping Video Player commissioner discovery");
nsdManager.stopServiceDiscovery(nsdDiscoveryListener);
if (multicastLock.isHeld()) {
multicastLock.release();
synchronized (discoveryLock) {
Log.d(TAG, "TvCastingApp trying to stop video player discovery");
if (this.discoveryStarted
&& nsdManager != null
&& multicastLock != null
&& nsdDiscoveryListener != null) {
Log.d(TAG, "TvCastingApp stopping Video Player commissioner discovery");
try {
nsdManager.stopServiceDiscovery(nsdDiscoveryListener);
} catch (IllegalArgumentException e) {
Log.w(
TAG,
"TvCastingApp received exception on calling nsdManager.stopServiceDiscovery() "
+ e.getMessage());
}

if (multicastLock.isHeld()) {
multicastLock.release();
}
this.discoveryStarted = false;
}
this.discoveryStarted = false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2023,7 +2023,7 @@ endpoint 0 {
ram attribute lastNetworkingStatus;
ram attribute lastNetworkID;
ram attribute lastConnectErrorValue;
ram attribute featureMap default = 5;
ram attribute featureMap default = 1;
ram attribute clusterRevision default = 1;
}

Expand Down
Loading

0 comments on commit 4813272

Please sign in to comment.