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 Darwin platforms.
26 #include <platform/internal/GenericConfigurationManagerImpl.h>
28 #include <platform/Darwin/PosixConfig.h>
31 namespace DeviceLayer {
34 * Concrete implementation of the ConfigurationManager singleton object for the Darwin platform.
36 class ConfigurationManagerImpl final : public ConfigurationManager,
37 public Internal::GenericConfigurationManagerImpl<ConfigurationManagerImpl>,
38 private Internal::PosixConfig
40 // Allow the ConfigurationManager interface class to delegate method calls to
41 // the implementation methods provided by this class.
42 friend class ConfigurationManager;
44 // Allow the GenericConfigurationManagerImpl base class to access helper methods and types
45 // defined on this class.
46 #ifndef DOXYGEN_SHOULD_SKIP_THIS
47 friend class Internal::GenericConfigurationManagerImpl<ConfigurationManagerImpl>;
51 // ===== Members that implement the ConfigurationManager public interface.
53 CHIP_ERROR _Init(void);
54 CHIP_ERROR _GetPrimaryWiFiMACAddress(uint8_t * buf);
55 bool _CanFactoryReset(void);
56 void _InitiateFactoryReset(void);
57 CHIP_ERROR _ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value);
58 CHIP_ERROR _WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value);
60 // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>.
62 // ===== Members for internal use by the following friends.
64 friend ConfigurationManager & ConfigurationMgr(void);
65 friend ConfigurationManagerImpl & ConfigurationMgrImpl(void);
67 static ConfigurationManagerImpl sInstance;
71 * Returns the public interface of the ConfigurationManager singleton object.
73 * chip applications should use this to access features of the ConfigurationManager object
74 * that are common to all platforms.
76 inline ConfigurationManager & ConfigurationMgr(void)
78 return ConfigurationManagerImpl::sInstance;
82 * Returns the platform-specific implementation of the ConfigurationManager singleton object.
84 * chip applications can use this to gain access to features of the ConfigurationManager
85 * that are specific to the ESP32 platform.
87 inline ConfigurationManagerImpl & ConfigurationMgrImpl(void)
89 return ConfigurationManagerImpl::sInstance;
92 } // namespace DeviceLayer