Skip to content

Commit 0789366

Browse files
committed
Changing bridge app to support the new arrtibute endpointUniqueId
1 parent a41f8f9 commit 0789366

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

examples/bridge-app/linux/main.cpp

+20-14
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ DECLARE_DYNAMIC_ATTRIBUTE(Descriptor::Attributes::DeviceTypeList::Id, ARRAY, kDe
121121
DECLARE_DYNAMIC_ATTRIBUTE(Descriptor::Attributes::ServerList::Id, ARRAY, kDescriptorAttributeArraySize, 0), /* server list */
122122
DECLARE_DYNAMIC_ATTRIBUTE(Descriptor::Attributes::ClientList::Id, ARRAY, kDescriptorAttributeArraySize, 0), /* client list */
123123
DECLARE_DYNAMIC_ATTRIBUTE(Descriptor::Attributes::PartsList::Id, ARRAY, kDescriptorAttributeArraySize, 0), /* parts list */
124+
DECLARE_DYNAMIC_ATTRIBUTE(Descriptor::Attributes::EndpointUniqueId::Id, ARRAY, 32, 0), /* parts list */
124125
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();
125126

126127
// Declare Bridged Device Basic Information cluster attributes
@@ -258,7 +259,8 @@ DataVersion gComposedTempSensor2DataVersions[MATTER_ARRAY_SIZE(bridgedTempSensor
258259
// ---------------------------------------------------------------------------
259260

260261
int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const Span<const EmberAfDeviceType> & deviceTypeList,
261-
const Span<DataVersion> & dataVersionStorage, chip::EndpointId parentEndpointId = chip::kInvalidEndpointId)
262+
const Span<DataVersion> & dataVersionStorage, chip::CharSpan epUniqueId,
263+
chip::EndpointId parentEndpointId = chip::kInvalidEndpointId)
262264
{
263265
uint8_t index = 0;
264266
while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT)
@@ -274,7 +276,7 @@ int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const Span<const E
274276
dev->SetEndpointId(gCurrentEndpointId);
275277
dev->SetParentEndpointId(parentEndpointId);
276278
err =
277-
emberAfSetDynamicEndpoint(index, gCurrentEndpointId, ep, dataVersionStorage, deviceTypeList, parentEndpointId);
279+
emberAfSetDynamicEndpoint(index, gCurrentEndpointId, ep, dataVersionStorage, deviceTypeList, epUniqueId, parentEndpointId);
278280
if (err == CHIP_NO_ERROR)
279281
{
280282
ChipLogProgress(DeviceLayer, "Added device %s to dynamic endpoint %d (index=%d)", dev->GetName(),
@@ -798,7 +800,7 @@ void * bridge_polling_thread(void * context)
798800
{
799801
// TC-BR-2 step 2, Add Light2
800802
AddDeviceEndpoint(&Light2, &bridgedLightEndpoint, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes),
801-
Span<DataVersion>(gLight2DataVersions), 1);
803+
Span<DataVersion>(gLight2DataVersions), chip::CharSpan(), 1);
802804
light2_added = true;
803805
}
804806
else if (ch == '4' && light1_added == true)
@@ -811,7 +813,7 @@ void * bridge_polling_thread(void * context)
811813
{
812814
// TC-BR-2 step 5, Add Light 1 back
813815
AddDeviceEndpoint(&Light1, &bridgedLightEndpoint, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes),
814-
Span<DataVersion>(gLight1DataVersions), 1);
816+
Span<DataVersion>(gLight1DataVersions), chip::CharSpan(), 1);
815817
light1_added = true;
816818
}
817819
if (ch == 'b')
@@ -955,33 +957,37 @@ void ApplicationInit()
955957

956958
// Add light 1 -> will be mapped to ZCL endpoints 3
957959
AddDeviceEndpoint(&Light1, &bridgedLightEndpoint, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes),
958-
Span<DataVersion>(gLight1DataVersions), 1);
960+
Span<DataVersion>(gLight1DataVersions), chip::CharSpan(), 1);
959961

960962
// Add Temperature Sensor devices --> will be mapped to endpoints 4,5
961963
AddDeviceEndpoint(&TempSensor1, &bridgedTempSensorEndpoint, Span<const EmberAfDeviceType>(gBridgedTempSensorDeviceTypes),
962-
Span<DataVersion>(gTempSensor1DataVersions), 1);
964+
Span<DataVersion>(gTempSensor1DataVersions), chip::CharSpan(), 1);
963965
AddDeviceEndpoint(&TempSensor2, &bridgedTempSensorEndpoint, Span<const EmberAfDeviceType>(gBridgedTempSensorDeviceTypes),
964-
Span<DataVersion>(gTempSensor2DataVersions), 1);
966+
Span<DataVersion>(gTempSensor2DataVersions), chip::CharSpan(), 1);
965967

966968
// Add composed Device with two temperature sensors and a power source
967969
AddDeviceEndpoint(&gComposedDevice, &bridgedComposedDeviceEndpoint, Span<const EmberAfDeviceType>(gBridgedComposedDeviceTypes),
968-
Span<DataVersion>(gComposedDeviceDataVersions), 1);
970+
Span<DataVersion>(gComposedDeviceDataVersions), chip::CharSpan(), 1);
969971
AddDeviceEndpoint(&ComposedTempSensor1, &bridgedTempSensorEndpoint,
970972
Span<const EmberAfDeviceType>(gComposedTempSensorDeviceTypes),
971-
Span<DataVersion>(gComposedTempSensor1DataVersions), gComposedDevice.GetEndpointId());
973+
Span<DataVersion>(gComposedTempSensor1DataVersions),
974+
chip::CharSpan("AABBCCDDEEFFGGHHIIJJKKLLMMNNOO01", strlen("AABBCCDDEEFFGGHHIIJJKKLLMMNNOO01")),
975+
gComposedDevice.GetEndpointId());
972976
AddDeviceEndpoint(&ComposedTempSensor2, &bridgedTempSensorEndpoint,
973977
Span<const EmberAfDeviceType>(gComposedTempSensorDeviceTypes),
974-
Span<DataVersion>(gComposedTempSensor2DataVersions), gComposedDevice.GetEndpointId());
978+
Span<DataVersion>(gComposedTempSensor2DataVersions),
979+
chip::CharSpan("AABBCCDDEEFFGGHHIIJJKKLLMMNNOO02", strlen("AABBCCDDEEFFGGHHIIJJKKLLMMNNOO02")),
980+
gComposedDevice.GetEndpointId());
975981

976982
// Add 4 lights for the Action Clusters tests
977983
AddDeviceEndpoint(&ActionLight1, &bridgedLightEndpoint, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes),
978-
Span<DataVersion>(gActionLight1DataVersions), 1);
984+
Span<DataVersion>(gActionLight1DataVersions), chip::CharSpan(), 1);
979985
AddDeviceEndpoint(&ActionLight2, &bridgedLightEndpoint, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes),
980-
Span<DataVersion>(gActionLight2DataVersions), 1);
986+
Span<DataVersion>(gActionLight2DataVersions), chip::CharSpan(), 1);
981987
AddDeviceEndpoint(&ActionLight3, &bridgedLightEndpoint, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes),
982-
Span<DataVersion>(gActionLight3DataVersions), 1);
988+
Span<DataVersion>(gActionLight3DataVersions), chip::CharSpan(), 1);
983989
AddDeviceEndpoint(&ActionLight4, &bridgedLightEndpoint, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes),
984-
Span<DataVersion>(gActionLight4DataVersions), 1);
990+
Span<DataVersion>(gActionLight4DataVersions), chip::CharSpan(), 1);
985991

986992
// Because the power source is on the same endpoint as the composed device, it needs to be explicitly added
987993
gDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT] = &ComposedPowerSource;

0 commit comments

Comments
 (0)