Skip to content

Commit f964d0a

Browse files
authored
Merge branch 'master' into feature/app-install-flow-public
2 parents 198e80a + af976f1 commit f964d0a

File tree

311 files changed

+3630
-892
lines changed

Some content is hidden

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

311 files changed

+3630
-892
lines changed

docs/testing/python.md

+180-159
Large diffs are not rendered by default.

examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn

+22-3
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,32 @@
1313
# limitations under the License.
1414

1515
import("//build_overrides/chip.gni")
16-
1716
import("${chip_root}/src/app/chip_data_model.gni")
1817

18+
config("config") {
19+
include_dirs = [ "include" ]
20+
}
21+
1922
chip_data_model("fabric-bridge-common") {
2023
zap_file = "fabric-bridge-app.zap"
21-
2224
is_server = true
23-
2425
cflags = [ "-DDYNAMIC_ENDPOINT_COUNT=16" ]
2526
}
27+
28+
source_set("fabric-bridge-lib") {
29+
public_configs = [ ":config" ]
30+
31+
sources = [
32+
"include/CHIPProjectAppConfig.h",
33+
"include/Device.h",
34+
"include/DeviceManager.h",
35+
"src/Device.cpp",
36+
"src/DeviceManager.cpp",
37+
"src/ZCLCallbacks.cpp",
38+
]
39+
40+
deps = [
41+
"${chip_root}/examples/fabric-bridge-app/fabric-bridge-common",
42+
"${chip_root}/src/lib",
43+
]
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "DeviceManager.h"
19+
20+
#include <app-common/zap-generated/cluster-objects.h>
21+
#include <app-common/zap-generated/ids/Attributes.h>
22+
#include <app-common/zap-generated/ids/Clusters.h>
23+
#include <lib/support/ZclString.h>
24+
25+
using namespace ::chip;
26+
using namespace ::chip::app::Clusters;
27+
28+
#define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u)
29+
#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION (2u)
30+
#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP (0u)
31+
32+
// External attribute read callback function
33+
Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId,
34+
const EmberAfAttributeMetadata * attributeMetadata,
35+
uint8_t * buffer, uint16_t maxReadLength)
36+
{
37+
uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint);
38+
AttributeId attributeId = attributeMetadata->attributeId;
39+
40+
Device * dev = DeviceMgr().GetDevice(endpointIndex);
41+
if (dev != nullptr && clusterId == app::Clusters::BridgedDeviceBasicInformation::Id)
42+
{
43+
using namespace app::Clusters::BridgedDeviceBasicInformation::Attributes;
44+
ChipLogProgress(NotSpecified, "HandleReadBridgedDeviceBasicAttribute: attrId=%d, maxReadLength=%d", attributeId,
45+
maxReadLength);
46+
47+
if ((attributeId == Reachable::Id) && (maxReadLength == 1))
48+
{
49+
*buffer = dev->IsReachable() ? 1 : 0;
50+
}
51+
else if ((attributeId == NodeLabel::Id) && (maxReadLength == 32))
52+
{
53+
MutableByteSpan zclNameSpan(buffer, maxReadLength);
54+
MakeZclCharString(zclNameSpan, dev->GetName());
55+
}
56+
else if ((attributeId == ClusterRevision::Id) && (maxReadLength == 2))
57+
{
58+
uint16_t rev = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION;
59+
memcpy(buffer, &rev, sizeof(rev));
60+
}
61+
else if ((attributeId == FeatureMap::Id) && (maxReadLength == 4))
62+
{
63+
uint32_t featureMap = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP;
64+
memcpy(buffer, &featureMap, sizeof(featureMap));
65+
}
66+
else
67+
{
68+
return Protocols::InteractionModel::Status::Failure;
69+
}
70+
return Protocols::InteractionModel::Status::Success;
71+
}
72+
73+
return Protocols::InteractionModel::Status::Failure;
74+
}
75+
76+
// External attribute write callback function
77+
Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId,
78+
const EmberAfAttributeMetadata * attributeMetadata,
79+
uint8_t * buffer)
80+
{
81+
uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint);
82+
Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure;
83+
84+
Device * dev = DeviceMgr().GetDevice(endpointIndex);
85+
if (dev != nullptr && dev->IsReachable())
86+
{
87+
ChipLogProgress(NotSpecified, "emberAfExternalAttributeWriteCallback: ep=%d, clusterId=%d", endpoint, clusterId);
88+
ret = Protocols::InteractionModel::Status::Success;
89+
}
90+
91+
return ret;
92+
}

examples/fabric-bridge-app/linux/BUILD.gn

+1-4
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,12 @@ if (bridge_enable_pw_rpc) {
3333
executable("fabric-bridge-app") {
3434
sources = [
3535
"${chip_root}/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h",
36-
"Device.cpp",
37-
"DeviceManager.cpp",
38-
"include/Device.h",
39-
"include/DeviceManager.h",
4036
"main.cpp",
4137
]
4238

4339
deps = [
4440
"${chip_root}/examples/fabric-bridge-app/fabric-bridge-common",
41+
"${chip_root}/examples/fabric-bridge-app/fabric-bridge-common:fabric-bridge-lib",
4542
"${chip_root}/examples/platform/linux:app-main",
4643
"${chip_root}/src/lib",
4744
]

examples/fabric-bridge-app/linux/main.cpp

+6-68
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "DeviceManager.h"
2424

2525
#include <app/AttributeAccessInterfaceRegistry.h>
26-
#include <lib/support/ZclString.h>
2726

2827
#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE
2928
#include "RpcClient.h"
@@ -40,10 +39,6 @@ using namespace chip::app;
4039
using namespace chip::app::Clusters;
4140
using namespace chip::app::Clusters::AdministratorCommissioning;
4241

43-
#define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u)
44-
#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION (2u)
45-
#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP (0u)
46-
4742
namespace {
4843

4944
constexpr uint16_t kPollIntervalMs = 100;
@@ -158,6 +153,8 @@ AdministratorCommissioningCommandHandler gAdministratorCommissioningCommandHandl
158153

159154
void ApplicationInit()
160155
{
156+
ChipLogDetail(NotSpecified, "Fabric-Bridge: ApplicationInit()");
157+
161158
InteractionModelEngine::GetInstance()->RegisterCommandHandler(&gAdministratorCommissioningCommandHandler);
162159

163160
#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE
@@ -172,7 +169,10 @@ void ApplicationInit()
172169
DeviceMgr().Init();
173170
}
174171

175-
void ApplicationShutdown() {}
172+
void ApplicationShutdown()
173+
{
174+
ChipLogDetail(NotSpecified, "Fabric-Bridge: ApplicationShutdown()");
175+
}
176176

177177
int main(int argc, char * argv[])
178178
{
@@ -185,65 +185,3 @@ int main(int argc, char * argv[])
185185

186186
return 0;
187187
}
188-
189-
// External attribute read callback function
190-
Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId,
191-
const EmberAfAttributeMetadata * attributeMetadata,
192-
uint8_t * buffer, uint16_t maxReadLength)
193-
{
194-
uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint);
195-
AttributeId attributeId = attributeMetadata->attributeId;
196-
197-
Device * dev = DeviceMgr().GetDevice(endpointIndex);
198-
if (dev != nullptr && clusterId == app::Clusters::BridgedDeviceBasicInformation::Id)
199-
{
200-
using namespace app::Clusters::BridgedDeviceBasicInformation::Attributes;
201-
ChipLogProgress(NotSpecified, "HandleReadBridgedDeviceBasicAttribute: attrId=%d, maxReadLength=%d", attributeId,
202-
maxReadLength);
203-
204-
if ((attributeId == Reachable::Id) && (maxReadLength == 1))
205-
{
206-
*buffer = dev->IsReachable() ? 1 : 0;
207-
}
208-
else if ((attributeId == NodeLabel::Id) && (maxReadLength == 32))
209-
{
210-
MutableByteSpan zclNameSpan(buffer, maxReadLength);
211-
MakeZclCharString(zclNameSpan, dev->GetName());
212-
}
213-
else if ((attributeId == ClusterRevision::Id) && (maxReadLength == 2))
214-
{
215-
uint16_t rev = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION;
216-
memcpy(buffer, &rev, sizeof(rev));
217-
}
218-
else if ((attributeId == FeatureMap::Id) && (maxReadLength == 4))
219-
{
220-
uint32_t featureMap = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP;
221-
memcpy(buffer, &featureMap, sizeof(featureMap));
222-
}
223-
else
224-
{
225-
return Protocols::InteractionModel::Status::Failure;
226-
}
227-
return Protocols::InteractionModel::Status::Success;
228-
}
229-
230-
return Protocols::InteractionModel::Status::Failure;
231-
}
232-
233-
// External attribute write callback function
234-
Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId,
235-
const EmberAfAttributeMetadata * attributeMetadata,
236-
uint8_t * buffer)
237-
{
238-
uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint);
239-
Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure;
240-
241-
Device * dev = DeviceMgr().GetDevice(endpointIndex);
242-
if (dev != nullptr && dev->IsReachable())
243-
{
244-
ChipLogProgress(NotSpecified, "emberAfExternalAttributeWriteCallback: ep=%d, clusterId=%d", endpoint, clusterId);
245-
ret = Protocols::InteractionModel::Status::Success;
246-
}
247-
248-
return ret;
249-
}

examples/light-switch-app/infineon/cyw30739/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform.
1212
- [Installing ModusToolbox™ Software](#installing-modustoolbox-software)
1313
- [ModusToolbox™ tools package](#modustoolbox-tools-package)
1414
- [Note for WSL (Windows Subsystem for Linux)](#note-for-wsl-windows-subsystem-for-linux)
15-
- [Checkout Submodules](#checkout-submodules)
15+
- [Checkout Submodules and Bootstrap](#checkout-submodules-and-bootstrap)
1616
- [Building](#building)
1717
- [Factory Data](#factory-data)
1818
- [Commissionable Data](#commissionable-data)
@@ -65,14 +65,15 @@ If you are using WSL, please ensure you have installed the ModusToolbox™
6565
Software for Linux. Running Windows tools directly from the WSL command line
6666
would cause path resolution failure in the build process.
6767

68-
### Checkout Submodules
68+
### Checkout Submodules and Bootstrap
6969

7070
Before building the example, check out the Matter repository and sync submodules
7171
using the following command:
7272

7373
```bash
7474
$ cd ~/connectedhomeip
7575
$ scripts/checkout_submodules.py --platform infineon
76+
$ bash scripts/bootstrap.sh -p all,infineon
7677
```
7778

7879
## Building

examples/lighting-app/infineon/cyw30739/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform.
1212
- [Installing ModusToolbox™ Software](#installing-modustoolbox-software)
1313
- [ModusToolbox™ tools package](#modustoolbox-tools-package)
1414
- [Note for WSL (Windows Subsystem for Linux)](#note-for-wsl-windows-subsystem-for-linux)
15-
- [Checkout Submodules](#checkout-submodules)
15+
- [Checkout Submodules and Bootstrap](#checkout-submodules-and-bootstrap)
1616
- [Building](#building)
1717
- [Factory Data](#factory-data)
1818
- [Commissionable Data](#commissionable-data)
@@ -65,14 +65,15 @@ If you are using WSL, please ensure you have installed the ModusToolbox™
6565
Software for Linux. Running Windows tools directly from the WSL command line
6666
would cause path resolution failure in the build process.
6767

68-
### Checkout Submodules
68+
### Checkout Submodules and Bootstrap
6969

7070
Before building the example, check out the Matter repository and sync submodules
7171
using the following command:
7272

7373
```bash
7474
$ cd ~/connectedhomeip
7575
$ scripts/checkout_submodules.py --platform infineon
76+
$ bash scripts/bootstrap.sh -p all,infineon
7677
```
7778

7879
## Building

examples/lock-app/infineon/cyw30739/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform.
1212
- [Installing ModusToolbox™ Software](#installing-modustoolbox-software)
1313
- [ModusToolbox™ tools package](#modustoolbox-tools-package)
1414
- [Note for WSL (Windows Subsystem for Linux)](#note-for-wsl-windows-subsystem-for-linux)
15-
- [Checkout Submodules](#checkout-submodules)
15+
- [Checkout Submodules and Bootstrap](#checkout-submodules-and-bootstrap)
1616
- [Building](#building)
1717
- [Factory Data](#factory-data)
1818
- [Commissionable Data](#commissionable-data)
@@ -65,14 +65,15 @@ If you are using WSL, please ensure you have installed the ModusToolbox™
6565
Software for Linux. Running Windows tools directly from the WSL command line
6666
would cause path resolution failure in the build process.
6767

68-
### Checkout Submodules
68+
### Checkout Submodules and Bootstrap
6969

7070
Before building the example, check out the Matter repository and sync submodules
7171
using the following command:
7272

7373
```bash
7474
$ cd ~/connectedhomeip
7575
$ scripts/checkout_submodules.py --platform infineon
76+
$ bash scripts/bootstrap.sh -p all,infineon
7677
```
7778

7879
## Building

0 commit comments

Comments
 (0)