Skip to content

Commit 5d09b88

Browse files
[PushAV] Update to latest spec for Push Events and TransportOptions (project-chip#41327)
* Update to latest spec for Push Events and TransportOptions * Restyled by clang-format * Backout erroneous changes * Remove erroneous changes * Remove erroneous changes * Remove erroneous changes * Zap regen * Reformat * Formatting * Format * Remove trailing spaces * White space * Update field name * Restyled by clang-format * Zap update * Avoid Zap gen of unrelated content * Add missing endpoint -> TLSEndpoint * Empty commit --------- Co-authored-by: Restyled.io <[email protected]>
1 parent c08588e commit 5d09b88

File tree

46 files changed

+229
-351
lines changed

Some content is hidden

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

46 files changed

+229
-351
lines changed

examples/all-clusters-app/all-clusters-common/all-clusters-app.matter

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6684,6 +6684,7 @@ provisional cluster PushAvStreamTransport = 1365 {
66846684
kInvalidTransportStatus = 8;
66856685
kInvalidOptions = 9;
66866686
kInvalidStreamUsage = 10;
6687+
kInvalidTime = 11;
66876688
}
66886689

66896690
enum TransportStatusEnum : enum8 {
@@ -6748,7 +6749,7 @@ provisional cluster PushAvStreamTransport = 1365 {
67486749
StreamUsageEnum streamUsage = 0;
67496750
optional nullable int16u videoStreamID = 1;
67506751
optional nullable int16u audioStreamID = 2;
6751-
int16u endpointID = 3;
6752+
int16u TLSEndpointID = 3;
67526753
long_char_string<2000> url = 4;
67536754
TransportTriggerOptionsStruct triggerOptions = 5;
67546755
IngestMethodsEnum ingestMethod = 6;
@@ -6776,8 +6777,6 @@ provisional cluster PushAvStreamTransport = 1365 {
67766777

67776778
info event PushTransportEnd = 1 {
67786779
int16u connectionID = 0;
6779-
TransportTriggerTypeEnum triggerType = 1;
6780-
optional TriggerActivationReasonEnum activationReason = 2;
67816780
}
67826781

67836782
readonly attribute SupportedFormatStruct supportedFormats[] = 0;

examples/camera-app/camera-common/camera-app.matter

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2391,6 +2391,11 @@ cluster UserLabel = 65 {
23912391
provisional cluster ZoneManagement = 1360 {
23922392
revision 1;
23932393

2394+
enum StatusCodeEnum : enum8 {
2395+
kZoneNotFound = 2;
2396+
kZoneInUse = 3;
2397+
}
2398+
23942399
enum ZoneEventStoppedReasonEnum : enum8 {
23952400
kActionStopped = 0;
23962401
kTimeout = 1;
@@ -2428,7 +2433,7 @@ provisional cluster ZoneManagement = 1360 {
24282433
}
24292434

24302435
struct TwoDCartesianZoneStruct {
2431-
char_string<32> name = 0;
2436+
char_string<16> name = 0;
24322437
ZoneUseEnum use = 1;
24332438
TwoDCartesianVertexStruct vertices[] = 2;
24342439
optional char_string<9> color = 3;
@@ -2502,11 +2507,11 @@ provisional cluster ZoneManagement = 1360 {
25022507
command access(invoke: manage) CreateTwoDCartesianZone(CreateTwoDCartesianZoneRequest): CreateTwoDCartesianZoneResponse = 0;
25032508
/** The UpdateTwoDCartesianZone SHALL update a stored TwoD Cartesian Zone. */
25042509
command access(invoke: manage) UpdateTwoDCartesianZone(UpdateTwoDCartesianZoneRequest): DefaultSuccess = 2;
2505-
/** This command SHALL remove the Zone mapped to the passed in ZoneID. */
2510+
/** This command SHALL remove the user-defined Zone indicated by ZoneID. */
25062511
command access(invoke: manage) RemoveZone(RemoveZoneRequest): DefaultSuccess = 3;
25072512
/** This command is used to create or update a Trigger for the specified motion Zone. */
25082513
command access(invoke: manage) CreateOrUpdateTrigger(CreateOrUpdateTriggerRequest): DefaultSuccess = 4;
2509-
/** This command SHALL remove the Trigger mapped to the provided ZoneID. */
2514+
/** This command SHALL remove the Trigger for the provided ZoneID. */
25102515
command access(invoke: manage) RemoveTrigger(RemoveTriggerRequest): DefaultSuccess = 5;
25112516
}
25122517

@@ -3042,6 +3047,7 @@ provisional cluster PushAvStreamTransport = 1365 {
30423047
kInvalidTransportStatus = 8;
30433048
kInvalidOptions = 9;
30443049
kInvalidStreamUsage = 10;
3050+
kInvalidTime = 11;
30453051
}
30463052

30473053
enum TransportStatusEnum : enum8 {
@@ -3106,7 +3112,7 @@ provisional cluster PushAvStreamTransport = 1365 {
31063112
StreamUsageEnum streamUsage = 0;
31073113
optional nullable int16u videoStreamID = 1;
31083114
optional nullable int16u audioStreamID = 2;
3109-
int16u endpointID = 3;
3115+
int16u TLSEndpointID = 3;
31103116
long_char_string<2000> url = 4;
31113117
TransportTriggerOptionsStruct triggerOptions = 5;
31123118
IngestMethodsEnum ingestMethod = 6;
@@ -3134,8 +3140,6 @@ provisional cluster PushAvStreamTransport = 1365 {
31343140

31353141
info event PushTransportEnd = 1 {
31363142
int16u connectionID = 0;
3137-
TransportTriggerTypeEnum triggerType = 1;
3138-
optional TriggerActivationReasonEnum activationReason = 2;
31393143
}
31403144

31413145
readonly attribute SupportedFormatStruct supportedFormats[] = 0;

examples/camera-app/linux/src/pushav-clip-recorder.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,12 @@ void PushAVClipRecorder::Stop()
246246

247247
uint16_t connectionID = mConnectionID;
248248
auto triggerType = mTriggerType;
249-
auto reasonType = mReasonType;
250249
auto * server = mPushAvStreamTransportServer;
251250

252-
std::thread([server, connectionID, triggerType, reasonType]() {
251+
std::thread([server, connectionID, triggerType]() {
253252
ChipLogProgress(Camera, "Async thread: Calling NotifyTransportStopped for connection %u", connectionID);
254253
chip::DeviceLayer::PlatformMgr().LockChipStack();
255-
server->NotifyTransportStopped(connectionID, triggerType, reasonType);
254+
server->NotifyTransportStopped(connectionID, triggerType);
256255
chip::DeviceLayer::PlatformMgr().UnlockChipStack();
257256
ChipLogProgress(Camera, "Async thread: NotifyTransportStopped completed for connection %u", connectionID);
258257
}).detach();

src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-cluster.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,12 @@ class PushAvStreamTransportServer : public DefaultServerCluster
9393
*
9494
* @param connectionID The connection ID of the transport that stopped
9595
* @param triggerType The type of trigger that started the transport
96-
* @param activationReason Optional reason for the deactivation
9796
* @return Status::Success if event was generated successfully, failure otherwise
9897
*/
99-
Protocols::InteractionModel::Status
100-
NotifyTransportStopped(uint16_t connectionID, PushAvStreamTransport::TransportTriggerTypeEnum triggerType,
101-
Optional<PushAvStreamTransport::TriggerActivationReasonEnum> activationReason =
102-
Optional<PushAvStreamTransport::TriggerActivationReasonEnum>())
98+
Protocols::InteractionModel::Status NotifyTransportStopped(uint16_t connectionID,
99+
PushAvStreamTransport::TransportTriggerTypeEnum triggerType)
103100
{
104-
return mLogic.NotifyTransportStopped(connectionID, triggerType, activationReason);
101+
return mLogic.NotifyTransportStopped(connectionID, triggerType);
105102
}
106103

107104
CHIP_ERROR Init() { return mLogic.Init(); }

src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-logic.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ Status PushAvStreamTransportServerLogic::ValidateIncomingTransportOptions(
274274
transportOptions.videoStreamID.HasValue() || transportOptions.audioStreamID.HasValue(), Status::InvalidCommand,
275275
ChipLogError(Zcl, "Transport Options verification from command data[ep=%d]: Missing videoStreamID and audioStreamID",
276276
mEndpointId));
277-
VerifyOrReturnValue(transportOptions.endpointID <= kMaxEndpointId, Status::ConstraintError,
277+
VerifyOrReturnValue(transportOptions.TLSEndpointID <= kMaxEndpointId, Status::ConstraintError,
278278
ChipLogError(Zcl,
279279
"Transport Options verification from command data[ep=%d]: EndpointID field Constraint Error",
280280
mEndpointId));
@@ -572,7 +572,7 @@ PushAvStreamTransportServerLogic::HandleAllocatePushTransport(CommandHandler & h
572572
if (mTLSClientManagementDelegate != nullptr)
573573
{
574574
Status tlsEndpointValidityStatus = mTLSClientManagementDelegate->FindProvisionedEndpointByID(
575-
commandPath.mEndpointId, handler.GetAccessingFabricIndex(), commandData.transportOptions.endpointID, TLSEndpoint);
575+
commandPath.mEndpointId, handler.GetAccessingFabricIndex(), commandData.transportOptions.TLSEndpointID, TLSEndpoint);
576576

577577
VerifyOrDo(tlsEndpointValidityStatus == Status::Success, {
578578
ChipLogError(Zcl, "HandleAllocatePushTransport[ep=%d]: TLSEndpointID of command data is not valid/Provisioned",
@@ -1239,16 +1239,12 @@ PushAvStreamTransportServerLogic::GeneratePushTransportBeginEvent(const uint16_t
12391239
return Status::Success;
12401240
}
12411241

1242-
Status PushAvStreamTransportServerLogic::GeneratePushTransportEndEvent(const uint16_t connectionID,
1243-
const TransportTriggerTypeEnum triggerType,
1244-
const Optional<TriggerActivationReasonEnum> activationReason)
1242+
Status PushAvStreamTransportServerLogic::GeneratePushTransportEndEvent(const uint16_t connectionID)
12451243
{
12461244
Events::PushTransportEnd::Type event;
12471245
EventNumber eventNumber;
12481246

1249-
event.connectionID = connectionID;
1250-
event.triggerType = triggerType;
1251-
event.activationReason = activationReason;
1247+
event.connectionID = connectionID;
12521248

12531249
CHIP_ERROR err = LogEvent(event, mEndpointId, eventNumber);
12541250
if (CHIP_NO_ERROR != err)
@@ -1278,8 +1274,7 @@ Status PushAvStreamTransportServerLogic::NotifyTransportStarted(uint16_t connect
12781274
return GeneratePushTransportBeginEvent(connectionID, triggerType, activationReason);
12791275
}
12801276

1281-
Status PushAvStreamTransportServerLogic::NotifyTransportStopped(uint16_t connectionID, TransportTriggerTypeEnum triggerType,
1282-
Optional<TriggerActivationReasonEnum> activationReason)
1277+
Status PushAvStreamTransportServerLogic::NotifyTransportStopped(uint16_t connectionID, TransportTriggerTypeEnum triggerType)
12831278
{
12841279
ChipLogProgress(Zcl, "NotifyTransportStopped called for connectionID %u with triggerType %u", connectionID,
12851280
to_underlying(triggerType));
@@ -1293,7 +1288,7 @@ Status PushAvStreamTransportServerLogic::NotifyTransportStopped(uint16_t connect
12931288
}
12941289

12951290
// Generate the PushTransportEnd event
1296-
return GeneratePushTransportEndEvent(connectionID, triggerType, activationReason);
1291+
return GeneratePushTransportEndEvent(connectionID);
12971292
}
12981293

12991294
} // namespace Clusters

src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-logic.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ class PushAvStreamTransportServerLogic
5858
Optional<PushAvStreamTransport::TriggerActivationReasonEnum> activationReason =
5959
Optional<PushAvStreamTransport::TriggerActivationReasonEnum>());
6060

61-
Protocols::InteractionModel::Status
62-
NotifyTransportStopped(uint16_t connectionID, PushAvStreamTransport::TransportTriggerTypeEnum triggerType,
63-
Optional<PushAvStreamTransport::TriggerActivationReasonEnum> activationReason =
64-
Optional<PushAvStreamTransport::TriggerActivationReasonEnum>());
61+
Protocols::InteractionModel::Status NotifyTransportStopped(uint16_t connectionID,
62+
PushAvStreamTransport::TransportTriggerTypeEnum triggerType);
6563

6664
enum class UpsertResultEnum : uint8_t
6765
{
@@ -122,9 +120,7 @@ class PushAvStreamTransportServerLogic
122120
Protocols::InteractionModel::Status
123121
GeneratePushTransportBeginEvent(const uint16_t connectionID, const PushAvStreamTransport::TransportTriggerTypeEnum triggerType,
124122
const Optional<PushAvStreamTransport::TriggerActivationReasonEnum> activationReason);
125-
Protocols::InteractionModel::Status
126-
GeneratePushTransportEndEvent(const uint16_t connectionID, const PushAvStreamTransport::TransportTriggerTypeEnum triggerType,
127-
const Optional<PushAvStreamTransport::TriggerActivationReasonEnum> activationReason);
123+
Protocols::InteractionModel::Status GeneratePushTransportEndEvent(const uint16_t connectionID);
128124

129125
private:
130126
PushAvStreamTransportDelegate * mDelegate = nullptr;

src/app/clusters/push-av-stream-transport-server/push-av-stream-transport-storage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ struct TransportOptionsStorage : public TransportOptionsStruct
267267
streamUsage = aTransportOptionsStorage.streamUsage;
268268
videoStreamID = aTransportOptionsStorage.videoStreamID;
269269
audioStreamID = aTransportOptionsStorage.audioStreamID;
270-
endpointID = aTransportOptionsStorage.endpointID;
270+
TLSEndpointID = aTransportOptionsStorage.TLSEndpointID;
271271

272272
// Deep copy the URL buffer
273273
std::memcpy(mUrlBuffer, aTransportOptionsStorage.mUrlBuffer, kMaxUrlLength);
@@ -292,7 +292,7 @@ struct TransportOptionsStorage : public TransportOptionsStruct
292292
streamUsage = transportOptions.streamUsage;
293293
videoStreamID = transportOptions.videoStreamID;
294294
audioStreamID = transportOptions.audioStreamID;
295-
endpointID = transportOptions.endpointID;
295+
TLSEndpointID = transportOptions.TLSEndpointID;
296296

297297
MutableCharSpan urlBuffer(mUrlBuffer);
298298
// ValidateIncomingTransportOptions() function already checked the url length

src/app/clusters/push-av-stream-transport-server/tests/TestPushAVStreamTransportCluster.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ TEST_F(TestPushAVStreamTransportServerLogic, TestTransportOptionsConstraints)
496496
transportOptions.streamUsage = StreamUsageEnum::kAnalysis;
497497
transportOptions.videoStreamID.SetValue(1);
498498
transportOptions.audioStreamID.SetValue(2);
499-
transportOptions.endpointID = 1;
499+
transportOptions.TLSEndpointID = 1;
500500
transportOptions.url = Span(url.data(), url.size());
501501
transportOptions.triggerOptions = triggerOptions;
502502
transportOptions.containerOptions = containerOptions;
@@ -663,7 +663,7 @@ TEST_F(TestPushAVStreamTransportServerLogic, Test_AllocateTransport_AllocateTran
663663
transportOptions.streamUsage = StreamUsageEnum::kAnalysis;
664664
transportOptions.videoStreamID.SetValue(1);
665665
transportOptions.audioStreamID.SetValue(2);
666-
transportOptions.endpointID = 1;
666+
transportOptions.TLSEndpointID = 1;
667667
transportOptions.url = Span(url.data(), url.size());
668668
transportOptions.triggerOptions = triggerOptions;
669669
transportOptions.containerOptions = containerOptions;
@@ -742,7 +742,7 @@ TEST_F(TestPushAVStreamTransportServerLogic, Test_AllocateTransport_AllocateTran
742742
EXPECT_EQ(respTransportOptions.streamUsage, StreamUsageEnum::kAnalysis);
743743
EXPECT_EQ(respTransportOptions.videoStreamID, 1);
744744
EXPECT_EQ(respTransportOptions.audioStreamID, 2);
745-
EXPECT_EQ(respTransportOptions.endpointID, 1);
745+
EXPECT_EQ(respTransportOptions.TLSEndpointID, 1);
746746
std::string respUrlStr(respTransportOptions.url.data(), respTransportOptions.url.size());
747747
EXPECT_EQ(respUrlStr, "rtsp://192.168.1.100:554/stream");
748748

@@ -877,7 +877,7 @@ TEST_F(TestPushAVStreamTransportServerLogic, Test_AllocateTransport_AllocateTran
877877
EXPECT_EQ(readTransportOptions.streamUsage, StreamUsageEnum::kAnalysis);
878878
EXPECT_EQ(readTransportOptions.videoStreamID, 1);
879879
EXPECT_EQ(readTransportOptions.audioStreamID, 2);
880-
EXPECT_EQ(readTransportOptions.endpointID, 1);
880+
EXPECT_EQ(readTransportOptions.TLSEndpointID, 1);
881881

882882
std::string urlStr(readTransportOptions.url.data(), readTransportOptions.url.size());
883883
EXPECT_EQ(urlStr, "rtsp://192.168.1.100:554/stream");
@@ -1050,7 +1050,7 @@ TEST_F(MockEventLogging, Test_AllocateTransport_ModifyTransport_FindTransport_Fi
10501050
transportOptions.streamUsage = StreamUsageEnum::kAnalysis;
10511051
transportOptions.videoStreamID.SetValue(1);
10521052
transportOptions.audioStreamID.SetValue(2);
1053-
transportOptions.endpointID = 1;
1053+
transportOptions.TLSEndpointID = 1;
10541054
transportOptions.url = Span(url.data(), url.size());
10551055
transportOptions.triggerOptions = triggerOptions;
10561056
transportOptions.containerOptions = containerOptions;
@@ -1149,7 +1149,7 @@ TEST_F(MockEventLogging, Test_AllocateTransport_ModifyTransport_FindTransport_Fi
11491149
transportOptions.streamUsage = StreamUsageEnum::kAnalysis;
11501150
transportOptions.videoStreamID.SetValue(11);
11511151
transportOptions.audioStreamID.SetValue(22);
1152-
transportOptions.endpointID = 1;
1152+
transportOptions.TLSEndpointID = 1;
11531153
url = "rtsp://192.168.1.100:554/modify-stream";
11541154
transportOptions.url = Span(url.data(), url.size());
11551155
transportOptions.triggerOptions = triggerOptions;
@@ -1230,7 +1230,7 @@ TEST_F(MockEventLogging, Test_AllocateTransport_ModifyTransport_FindTransport_Fi
12301230
EXPECT_EQ(findTransportOptions.streamUsage, StreamUsageEnum::kAnalysis);
12311231
EXPECT_EQ(findTransportOptions.videoStreamID, 11);
12321232
EXPECT_EQ(findTransportOptions.audioStreamID, 22);
1233-
EXPECT_EQ(findTransportOptions.endpointID, 1);
1233+
EXPECT_EQ(findTransportOptions.TLSEndpointID, 1);
12341234

12351235
std::string findUrlStr(findTransportOptions.url.data(), findTransportOptions.url.size());
12361236
EXPECT_EQ(findUrlStr, "rtsp://192.168.1.100:554/modify-stream");
@@ -1385,7 +1385,7 @@ TEST_F(MockEventLogging, Test_AllocateTransport_SetTransportStatus_ManuallyTrigg
13851385
transportOptions.streamUsage = StreamUsageEnum::kAnalysis;
13861386
transportOptions.videoStreamID.SetValue(1);
13871387
transportOptions.audioStreamID.SetValue(2);
1388-
transportOptions.endpointID = 1;
1388+
transportOptions.TLSEndpointID = 1;
13891389
transportOptions.url = Span(url.data(), url.size());
13901390
transportOptions.triggerOptions = triggerOptions;
13911391
transportOptions.containerOptions = containerOptions;

0 commit comments

Comments
 (0)