Line data Source code
1 : /*
2 : * Copyright (c) 2024 Project CHIP Authors
3 : *
4 : * Licensed under the Apache License, Version 2.0 (the "License");
5 : * you may not use this file except in compliance with the License.
6 : * You may obtain a copy of the License at
7 : *
8 : * http://www.apache.org/licenses/LICENSE-2.0
9 : *
10 : * Unless required by applicable law or agreed to in writing, software
11 : * distributed under the License is distributed on an "AS IS" BASIS,
12 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 : * See the License for the specific language governing permissions and
14 : * limitations under the License.
15 : */
16 : #include "MatterCallbacks.h"
17 :
18 : namespace chip {
19 : namespace {
20 :
21 : DataModelCallbacks gNoopCallbacks;
22 : DataModelCallbacks * gInstance = &gNoopCallbacks;
23 :
24 : } // namespace
25 :
26 13325 : DataModelCallbacks * DataModelCallbacks::GetInstance()
27 : {
28 13325 : return gInstance;
29 : }
30 :
31 0 : DataModelCallbacks * DataModelCallbacks::SetInstance(DataModelCallbacks * newInstance)
32 : {
33 0 : return std::exchange(gInstance, newInstance);
34 : }
35 :
36 : } // namespace chip
37 :
38 : /// Strong-link callbacks for backwards compatibiltiy error reporting
39 : ///
40 : /// We used to have these as __attribute__(weak) linkage in previous releases, so
41 : /// we define these as non-weak now so that we get compile errors in case anyone tries
42 : /// to link with them on the assumption they work (because they do not anymore)
43 : ///
44 : /// TODO(future): we should be able to remove these once we assume everyone is updated
45 : /// to the latest code.
46 0 : void MatterPreAttributeReadCallback(const chip::app::ConcreteAttributePath & attributePath) {}
47 0 : void MatterPostAttributeReadCallback(const chip::app::ConcreteAttributePath & attributePath) {}
48 0 : void MatterPreAttributeWriteCallback(const chip::app::ConcreteAttributePath & attributePath) {}
49 0 : void MatterPostAttributeWriteCallback(const chip::app::ConcreteAttributePath & attributePath) {}
50 0 : CHIP_ERROR MatterPreCommandReceivedCallback(const chip::app::ConcreteCommandPath & commandPath,
51 : const chip::Access::SubjectDescriptor & subjectDescriptor)
52 : {
53 0 : return CHIP_NO_ERROR;
54 : }
55 0 : void MatterPostCommandReceivedCallback(const chip::app::ConcreteCommandPath & commandPath,
56 : const chip::Access::SubjectDescriptor & subjectDescriptor)
57 0 : {}
|