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