Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / cc13x2_26x2 / ConfigurationManagerImpl.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    Copyright (c) 2020 Texas Instruments Incorporated
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
21  *          Provides an implementation of the ConfigurationManager object
22  *          for the Texas Instruments CC1352 platform.
23  */
24
25 #pragma once
26
27 #include <platform/cc13x2_26x2/CC13X2_26X2Config.h>
28 #include <platform/internal/GenericConfigurationManagerImpl.h>
29
30 namespace chip {
31 namespace DeviceLayer {
32
33 /**
34  * Concrete implementation of the ConfigurationManager singleton object for the CC13X2_26X2 platform.
35  */
36 class ConfigurationManagerImpl final : public ConfigurationManager,
37                                        public Internal::GenericConfigurationManagerImpl<ConfigurationManagerImpl>,
38                                        private Internal::CC13X2_26X2Config
39 {
40     // Allow the ConfigurationManager interface class to delegate method calls to
41     // the implementation methods provided by this class.
42     friend class ConfigurationManager;
43
44     // Allow the GenericConfigurationManagerImpl base class to access helper methods and types
45     // defined on this class.
46     friend class Internal::GenericConfigurationManagerImpl<ConfigurationManagerImpl>;
47
48 private:
49     // ===== Members that implement the ConfigurationManager public interface.
50
51     CHIP_ERROR _Init(void);
52     CHIP_ERROR _GetPrimaryWiFiMACAddress(uint8_t * buf);
53     bool _CanFactoryReset(void);
54     void _InitiateFactoryReset(void);
55     CHIP_ERROR _ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value);
56     CHIP_ERROR _WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value);
57
58     // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>.
59
60     // ===== Members for internal use by the following friends.
61
62     friend ConfigurationManager & ConfigurationMgr(void);
63     friend ConfigurationManagerImpl & ConfigurationMgrImpl(void);
64
65     static ConfigurationManagerImpl sInstance;
66
67     // ===== Private members reserved for use by this class only.
68
69     static void DoFactoryReset(intptr_t arg);
70 };
71
72 /**
73  * Returns the public interface of the ConfigurationManager singleton object.
74  *
75  * chip applications should use this to access features of the ConfigurationManager object
76  * that are common to all platforms.
77  */
78 inline ConfigurationManager & ConfigurationMgr(void)
79 {
80     return ConfigurationManagerImpl::sInstance;
81 }
82
83 /**
84  * Returns the platform-specific implementation of the ConfigurationManager singleton object.
85  *
86  * chip applications can use this to gain access to features of the ConfigurationManager
87  * that are specific to the CC1352 SoC
88  */
89 inline ConfigurationManagerImpl & ConfigurationMgrImpl(void)
90 {
91     return ConfigurationManagerImpl::sInstance;
92 }
93
94 inline CHIP_ERROR ConfigurationManagerImpl::_GetPrimaryWiFiMACAddress(uint8_t * buf)
95 {
96     return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
97 }
98
99 } // namespace DeviceLayer
100 } // namespace chip