3 * Copyright (c) 2020 Project CHIP Authors
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 * Provides an implementation of the ConfigurationManager object
21 * for QPG6100 platforms.
26 #include <platform/internal/GenericConfigurationManagerImpl.h>
27 #include <platform/qpg6100/qpg6100Config.h>
30 namespace DeviceLayer {
33 * Concrete implementation of the ConfigurationManager singleton object for the platform.
35 class ConfigurationManagerImpl final : public ConfigurationManager,
36 public Internal::GenericConfigurationManagerImpl<ConfigurationManagerImpl>,
37 private Internal::QPG6100Config
39 // Allow the ConfigurationManager interface class to delegate method calls to
40 // the implementation methods provided by this class.
41 friend class ConfigurationManager;
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>;
50 // ===== Members that implement the ConfigurationManager public interface.
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);
59 // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>.
61 // ===== Members for internal use by the following friends.
63 friend ConfigurationManager & ConfigurationMgr(void);
64 friend ConfigurationManagerImpl & ConfigurationMgrImpl(void);
66 static ConfigurationManagerImpl sInstance;
68 // ===== Private members reserved for use by this class only.
70 static void DoFactoryReset(intptr_t arg);
74 * Returns the public interface of the ConfigurationManager singleton object.
76 * chip applications should use this to access features of the ConfigurationManager object
77 * that are common to all platforms.
79 inline ConfigurationManager & ConfigurationMgr(void)
81 return ConfigurationManagerImpl::sInstance;
85 * Returns the platform-specific implementation of the ConfigurationManager singleton object.
87 * chip applications can use this to gain access to features of the ConfigurationManager
88 * that are specific to the platform.
90 inline ConfigurationManagerImpl & ConfigurationMgrImpl(void)
92 return ConfigurationManagerImpl::sInstance;
95 inline CHIP_ERROR ConfigurationManagerImpl::_GetPrimaryWiFiMACAddress(uint8_t * buf)
97 return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
100 } // namespace DeviceLayer