blob: cb8d470cbb234d1c086d5125998b8ec52660d81f [file] [log] [blame]
mkardous-silabsd61bfd62024-01-30 17:50:01 -05001/*
2 *
3 * Copyright (c) 2024 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/**
20 * @file
mkardous-silabs95263182024-01-31 23:17:45 -050021 * This file defines an interface that exposes all the public subscription information APIs.
mkardous-silabsd61bfd62024-01-30 17:50:01 -050022 * The interface is implemented by the InteractionModelEngine to avoid creating unnecessary dependencies
mkardous-silabs95263182024-01-31 23:17:45 -050023 * since the IMEngine has more dependency than its consummers need.
24 * By leveraging the SubscriptionInfoProvider APIs, a consumer avoids depending on the global data model functions.
mkardous-silabsd61bfd62024-01-30 17:50:01 -050025 */
26
27#pragma once
28
29#include <lib/core/DataModelTypes.h>
30#include <lib/core/NodeId.h>
31
32namespace chip {
33namespace app {
34
mkardous-silabs95263182024-01-31 23:17:45 -050035class SubscriptionsInfoProvider
mkardous-silabsd61bfd62024-01-30 17:50:01 -050036{
37public:
mkardous-silabs95263182024-01-31 23:17:45 -050038 virtual ~SubscriptionsInfoProvider(){};
mkardous-silabsd61bfd62024-01-30 17:50:01 -050039
40 /**
41 * @brief Check if a given subject (CAT or operational NodeId) has at least 1 active subscription.
42 *
43 * @param[in] aFabricIndex fabric index of the subject
mkardous-silabs95263182024-01-31 23:17:45 -050044 * @param[in] subjectID NodeId of the subject
mkardous-silabs83e47bf2024-02-05 15:33:24 -050045 * subjectID may encode a CAT in the reserved section of the NodeID.
mkardous-silabsd61bfd62024-01-30 17:50:01 -050046 *
47 * @return true subject has at least one active subscription with the device
mkardous-silabs95263182024-01-31 23:17:45 -050048 * false subject doesn't have any active subscription with the device
mkardous-silabsd61bfd62024-01-30 17:50:01 -050049 */
mkardous-silabs95263182024-01-31 23:17:45 -050050 virtual bool SubjectHasActiveSubscription(FabricIndex aFabricIndex, NodeId subjectID) = 0;
mkardous-silabsd61bfd62024-01-30 17:50:01 -050051
52 /**
53 * @brief Check if a given subject (CAT or operational NodeId) has at least 1 persisted subscription.
mkardous-silabsd61bfd62024-01-30 17:50:01 -050054 * See the CHIP_CONFIG_PERSIST_SUBSCRIPTIONS for more information on persisted subscriptions.
55 *
56 * @param[in] aFabricIndex fabric index of the subject
mkardous-silabs95263182024-01-31 23:17:45 -050057 * @param[in] subjectID NodeId of the subject
mkardous-silabs83e47bf2024-02-05 15:33:24 -050058 * subjectID may encode a CAT in the reserved section of the NodeID
mkardous-silabsd61bfd62024-01-30 17:50:01 -050059 *
60 * @return true subject has at least one persisted subscription with the device
mkardous-silabs95263182024-01-31 23:17:45 -050061 * false subject doesn't have any persisted subscription with the device
mkardous-silabsd61bfd62024-01-30 17:50:01 -050062 */
mkardous-silabs95263182024-01-31 23:17:45 -050063 virtual bool SubjectHasPersistedSubscription(FabricIndex aFabricIndex, NodeId subjectID) = 0;
mkardous-silabsd61bfd62024-01-30 17:50:01 -050064};
65
66} // namespace app
67} // namespace chip