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 : #include "reporting.h"
18 :
19 : #include <app/AttributePathParams.h>
20 : #include <app/InteractionModelEngine.h>
21 : #include <app/data-model-provider/Provider.h>
22 : #include <app/util/attribute-storage.h>
23 : #include <lib/support/CodeUtils.h>
24 : #include <platform/LockTracker.h>
25 :
26 : using namespace chip;
27 : using namespace chip::app;
28 :
29 0 : void MatterReportingAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId)
30 : {
31 : // Attribute writes have asserted this already, but this assert should catch
32 : // applications notifying about changes from their end.
33 0 : assertChipStackLockedByCurrentThread();
34 :
35 0 : DataModel::Provider * provider = InteractionModelEngine::GetInstance()->GetDataModelProvider();
36 0 : VerifyOrReturn(provider != nullptr);
37 :
38 0 : provider->Temporary_ReportAttributeChanged(AttributePathParams(endpoint, clusterId, attributeId));
39 : }
40 :
41 0 : void MatterReportingAttributeChangeCallback(const ConcreteAttributePath & aPath)
42 : {
43 : // Attribute writes have asserted this already, but this assert should catch
44 : // applications notifying about changes from their end.
45 0 : assertChipStackLockedByCurrentThread();
46 :
47 0 : DataModel::Provider * provider = InteractionModelEngine::GetInstance()->GetDataModelProvider();
48 0 : VerifyOrReturn(provider != nullptr);
49 :
50 0 : provider->Temporary_ReportAttributeChanged(AttributePathParams(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId));
51 : }
52 :
53 0 : void MatterReportingAttributeChangeCallback(EndpointId endpoint)
54 : {
55 : // Attribute writes have asserted this already, but this assert should catch
56 : // applications notifying about changes from their end.
57 0 : assertChipStackLockedByCurrentThread();
58 :
59 0 : DataModel::Provider * provider = InteractionModelEngine::GetInstance()->GetDataModelProvider();
60 0 : VerifyOrReturn(provider != nullptr);
61 :
62 0 : provider->Temporary_ReportAttributeChanged(AttributePathParams(endpoint));
63 : }
|