3 * Copyright (c) 2020 Project CHIP Authors
4 * Copyright (c) 2019 Nest Labs, Inc.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * Provides an implementation of the ConfigurationManager object
22 * for EFR32 platforms using the Silicon Labs SDK.
27 #include <platform/internal/GenericConfigurationManagerImpl.h>
29 #include "EFR32Config.h"
32 namespace DeviceLayer {
35 * Concrete implementation of the ConfigurationManager singleton object for the EFR32 platform.
37 class ConfigurationManagerImpl final : public ConfigurationManager,
38 public Internal::GenericConfigurationManagerImpl<ConfigurationManagerImpl>,
39 private Internal::EFR32Config
41 // Allow the ConfigurationManager interface class to delegate method calls to
42 // the implementation methods provided by this class.
43 friend class ConfigurationManager;
45 // Allow the GenericConfigurationManagerImpl base class to access helper methods and types
46 // defined on this class.
47 #ifndef DOXYGEN_SHOULD_SKIP_THIS
48 friend class Internal::GenericConfigurationManagerImpl<ConfigurationManagerImpl>;
52 // ===== Members that implement the ConfigurationManager public interface.
54 CHIP_ERROR _Init(void);
55 CHIP_ERROR _GetPrimaryWiFiMACAddress(uint8_t * buf);
56 bool _CanFactoryReset(void);
57 void _InitiateFactoryReset(void);
58 CHIP_ERROR _ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value);
59 CHIP_ERROR _WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value);
61 // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>.
63 // ===== Members for internal use by the following friends.
65 friend ConfigurationManager & ConfigurationMgr(void);
66 friend ConfigurationManagerImpl & ConfigurationMgrImpl(void);
68 static ConfigurationManagerImpl sInstance;
70 // ===== Private members reserved for use by this class only.
72 static void DoFactoryReset(intptr_t arg);
76 * Returns the public interface of the ConfigurationManager singleton object.
78 * Chip applications should use this to access features of the ConfigurationManager object
79 * that are common to all platforms.
81 inline ConfigurationManager & ConfigurationMgr(void)
83 return ConfigurationManagerImpl::sInstance;
87 * Returns the platform-specific implementation of the ConfigurationManager singleton object.
89 * Chip applications can use this to gain access to features of the ConfigurationManager
90 * that are specific to the ESP32 platform.
92 inline ConfigurationManagerImpl & ConfigurationMgrImpl(void)
94 return ConfigurationManagerImpl::sInstance;
97 inline CHIP_ERROR ConfigurationManagerImpl::_GetPrimaryWiFiMACAddress(uint8_t * buf)
99 return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
102 } // namespace DeviceLayer