Line data Source code
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 : #pragma once
18 :
19 : #include <app/icd/server/ICDMonitoringTable.h>
20 : #include <lib/core/CHIPError.h>
21 :
22 : namespace chip {
23 : namespace app {
24 :
25 : /**
26 : * @brief This class defines the necessary interface a ICD Check-In BackOff strategy needs to implment to be consummed by the
27 : * ICDManager class. The strategy is injected with the init server params when initializing the device Server class.
28 : */
29 : class ICDCheckInBackOffStrategy
30 : {
31 : public:
32 12 : virtual ~ICDCheckInBackOffStrategy() = default;
33 :
34 : /**
35 : * @brief Function is used by the ICDManager to determine if a Check-In message should be sent to the given entry based on the
36 : * Check-In BackOff strategy.
37 : *
38 : * There are no requirements on how the Check-In BackOff strategy should behave.
39 : * The only specified requirement is the maximum time between to Check-In message, MaximumCheckInBackOff.
40 : * All strategies must respect this requirement.
41 : *
42 : * @param entry ICDMonitoringEntry for which we are about to send a Check-In message to.
43 : *
44 : * @return true ICDCheckInBackOffStrategy determines that we SHOULD send a Check-In message to the given entry
45 : * @return false ICDCheckInBackOffStrategy determines that we SHOULD NOT send a Check-In message to the given entry
46 : */
47 : virtual bool ShouldSendCheckInMessage(const ICDMonitoringEntry & entry) = 0;
48 :
49 : /**
50 : * @brief Function is used within the test event trigger to force the maximum BackOff state of the ICD Check-In BackOff
51 : * strategy. This enables to validate the strategy and to certify it respects the MaximumCheckInBackOff interval during
52 : * certification.
53 : *
54 : * Function sets the maxmimum BackOff state for all clients registered with the ICD
55 : *
56 : * @return CHIP_ERROR Any error returned during the forcing of the maximum BackOff state
57 : */
58 : virtual CHIP_ERROR ForceMaximumCheckInBackoff() = 0;
59 : };
60 :
61 : } // namespace app
62 : } // namespace chip
|