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 : bool mIsPeerLIT = false;
51 :
52 1051 : ReadPrepareParams() {}
53 0 : ReadPrepareParams(const SessionHandle & sessionHandle) { mSessionHolder.Grab(sessionHandle); }
54 : ReadPrepareParams(ReadPrepareParams && other) : mSessionHolder(other.mSessionHolder)
55 : {
56 : mKeepSubscriptions = other.mKeepSubscriptions;
57 : mpEventPathParamsList = other.mpEventPathParamsList;
58 : mEventPathParamsListSize = other.mEventPathParamsListSize;
59 : mpAttributePathParamsList = other.mpAttributePathParamsList;
60 : mAttributePathParamsListSize = other.mAttributePathParamsListSize;
61 : mpDataVersionFilterList = other.mpDataVersionFilterList;
62 : mDataVersionFilterListSize = other.mDataVersionFilterListSize;
63 : mEventNumber = other.mEventNumber;
64 : mMinIntervalFloorSeconds = other.mMinIntervalFloorSeconds;
65 : mMaxIntervalCeilingSeconds = other.mMaxIntervalCeilingSeconds;
66 : mTimeout = other.mTimeout;
67 : mIsFabricFiltered = other.mIsFabricFiltered;
68 : mIsPeerLIT = other.mIsPeerLIT;
69 : other.mpEventPathParamsList = nullptr;
70 : other.mEventPathParamsListSize = 0;
71 : other.mpAttributePathParamsList = nullptr;
72 : other.mAttributePathParamsListSize = 0;
73 : }
74 :
75 157 : ReadPrepareParams & operator=(ReadPrepareParams && other)
76 : {
77 157 : if (&other == this)
78 0 : return *this;
79 :
80 157 : mKeepSubscriptions = other.mKeepSubscriptions;
81 157 : mSessionHolder = other.mSessionHolder;
82 157 : mpEventPathParamsList = other.mpEventPathParamsList;
83 157 : mEventPathParamsListSize = other.mEventPathParamsListSize;
84 157 : mpAttributePathParamsList = other.mpAttributePathParamsList;
85 157 : mAttributePathParamsListSize = other.mAttributePathParamsListSize;
86 157 : mpDataVersionFilterList = other.mpDataVersionFilterList;
87 157 : mDataVersionFilterListSize = other.mDataVersionFilterListSize;
88 157 : mEventNumber = other.mEventNumber;
89 157 : mMinIntervalFloorSeconds = other.mMinIntervalFloorSeconds;
90 157 : mMaxIntervalCeilingSeconds = other.mMaxIntervalCeilingSeconds;
91 157 : mTimeout = other.mTimeout;
92 157 : mIsFabricFiltered = other.mIsFabricFiltered;
93 157 : mIsPeerLIT = other.mIsPeerLIT;
94 157 : other.mpEventPathParamsList = nullptr;
95 157 : other.mEventPathParamsListSize = 0;
96 157 : other.mpAttributePathParamsList = nullptr;
97 157 : other.mAttributePathParamsListSize = 0;
98 157 : return *this;
99 : }
100 : };
101 : } // namespace app
102 : } // namespace chip
|