Line data Source code
1 : /*
2 : *
3 : * Copyright (c) 2021 Project CHIP Authors
4 : * All rights reserved.
5 : *
6 : * Licensed under the Apache License, Version 2.0 (the "License");
7 : * you may not use this file except in compliance with the License.
8 : * You may obtain a copy of the License at
9 : *
10 : * http://www.apache.org/licenses/LICENSE-2.0
11 : *
12 : * Unless required by applicable law or agreed to in writing, software
13 : * distributed under the License is distributed on an "AS IS" BASIS,
14 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 : * See the License for the specific language governing permissions and
16 : * limitations under the License.
17 : */
18 :
19 : #pragma once
20 :
21 : #include <app/AttributePathParams.h>
22 : #include <app/DataVersionFilter.h>
23 : #include <app/EventPathParams.h>
24 : #include <app/InteractionModelTimeout.h>
25 : #include <app/util/basic-types.h>
26 : #include <lib/core/CHIPCore.h>
27 : #include <lib/core/TLV.h>
28 : #include <messaging/ExchangeMgr.h>
29 :
30 : namespace chip {
31 : namespace app {
32 :
33 : struct ReadPrepareParams
34 : {
35 : SessionHolder mSessionHolder;
36 : EventPathParams * mpEventPathParamsList = nullptr;
37 : size_t mEventPathParamsListSize = 0;
38 : AttributePathParams * mpAttributePathParamsList = nullptr;
39 : size_t mAttributePathParamsListSize = 0;
40 : DataVersionFilter * mpDataVersionFilterList = nullptr;
41 : size_t mDataVersionFilterListSize = 0;
42 : Optional<EventNumber> mEventNumber;
43 : // The timeout for waiting for the response or System::Clock::kZero to let the interaction model decide the timeout based on the
44 : // MRP timeouts of the session.
45 : System::Clock::Timeout mTimeout = System::Clock::kZero;
46 : uint16_t mMinIntervalFloorSeconds = 0;
47 : uint16_t mMaxIntervalCeilingSeconds = 0;
48 : bool mKeepSubscriptions = false;
49 : bool mIsFabricFiltered = true;
50 :
51 : // If set to true, indicates that the peer device is known to be a LIT ICD. This can be set by the application if it has prior
52 : // knowledge of the peer's operating mode (e.g. from previous reads of IcdManagementCluster::OperatingMode). This is useful for
53 : // subscriptions that do not include the OperatingMode attribute in the set of paths that are subscribed to.
54 : //
55 : // This field is ignored for read operations.
56 : bool mIsPeerLIT = false;
57 :
58 : // Set mRegisteredCheckInToken to true to indicate that the application has registered a check-in token
59 : // with this peer, and therefore subscription drops can usefully wait for a check-in message before trying
60 : // to resubscribe. This field is ignored for read operations.
61 : bool mRegisteredCheckInToken = false;
62 :
63 1121 : ReadPrepareParams() {}
64 0 : ReadPrepareParams(const SessionHandle & sessionHandle) { mSessionHolder.Grab(sessionHandle); }
65 : ReadPrepareParams(ReadPrepareParams && other) : mSessionHolder(other.mSessionHolder)
66 : {
67 : mKeepSubscriptions = other.mKeepSubscriptions;
68 : mpEventPathParamsList = other.mpEventPathParamsList;
69 : mEventPathParamsListSize = other.mEventPathParamsListSize;
70 : mpAttributePathParamsList = other.mpAttributePathParamsList;
71 : mAttributePathParamsListSize = other.mAttributePathParamsListSize;
72 : mpDataVersionFilterList = other.mpDataVersionFilterList;
73 : mDataVersionFilterListSize = other.mDataVersionFilterListSize;
74 : mEventNumber = other.mEventNumber;
75 : mMinIntervalFloorSeconds = other.mMinIntervalFloorSeconds;
76 : mMaxIntervalCeilingSeconds = other.mMaxIntervalCeilingSeconds;
77 : mTimeout = other.mTimeout;
78 : mIsFabricFiltered = other.mIsFabricFiltered;
79 : mIsPeerLIT = other.mIsPeerLIT;
80 : mRegisteredCheckInToken = other.mRegisteredCheckInToken;
81 : other.mpEventPathParamsList = nullptr;
82 : other.mEventPathParamsListSize = 0;
83 : other.mpAttributePathParamsList = nullptr;
84 : other.mAttributePathParamsListSize = 0;
85 : }
86 :
87 227 : ReadPrepareParams & operator=(ReadPrepareParams && other)
88 : {
89 227 : if (&other == this)
90 0 : return *this;
91 :
92 227 : mKeepSubscriptions = other.mKeepSubscriptions;
93 227 : mSessionHolder = other.mSessionHolder;
94 227 : mpEventPathParamsList = other.mpEventPathParamsList;
95 227 : mEventPathParamsListSize = other.mEventPathParamsListSize;
96 227 : mpAttributePathParamsList = other.mpAttributePathParamsList;
97 227 : mAttributePathParamsListSize = other.mAttributePathParamsListSize;
98 227 : mpDataVersionFilterList = other.mpDataVersionFilterList;
99 227 : mDataVersionFilterListSize = other.mDataVersionFilterListSize;
100 227 : mEventNumber = other.mEventNumber;
101 227 : mMinIntervalFloorSeconds = other.mMinIntervalFloorSeconds;
102 227 : mMaxIntervalCeilingSeconds = other.mMaxIntervalCeilingSeconds;
103 227 : mTimeout = other.mTimeout;
104 227 : mIsFabricFiltered = other.mIsFabricFiltered;
105 227 : mIsPeerLIT = other.mIsPeerLIT;
106 227 : mRegisteredCheckInToken = other.mRegisteredCheckInToken;
107 227 : other.mpEventPathParamsList = nullptr;
108 227 : other.mEventPathParamsListSize = 0;
109 227 : other.mpAttributePathParamsList = nullptr;
110 227 : other.mAttributePathParamsListSize = 0;
111 227 : return *this;
112 : }
113 : };
114 : } // namespace app
115 : } // namespace chip
|