3 * Copyright (c) 2020 Project CHIP Authors
4 * Copyright (c) 2018 Nest Labs, Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 * Provides an implementation of the PlatformManager object
23 * for the ESP32 platform.
28 #include <platform/internal/GenericPlatformManagerImpl_FreeRTOS.h>
31 namespace DeviceLayer {
34 * Concrete implementation of the PlatformManager singleton object for the ESP32 platform.
36 class PlatformManagerImpl final : public PlatformManager, public Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>
38 // Allow the PlatformManager interface class to delegate method calls to
39 // the implementation methods provided by this class.
40 friend PlatformManager;
42 // Allow the generic implementation base class to call helper methods on
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
45 friend Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>;
49 // ===== Platform-specific members that may be accessed directly by the application.
51 CHIP_ERROR InitLwIPCoreLock(void);
52 static void HandleESPSystemEvent(void * arg, esp_event_base_t eventBase, int32_t eventId, void * eventData);
55 // ===== Methods that implement the PlatformManager abstract interface.
57 CHIP_ERROR _InitChipStack(void);
59 // ===== Members for internal use by the following friends.
61 friend PlatformManager & PlatformMgr(void);
62 friend PlatformManagerImpl & PlatformMgrImpl(void);
64 static PlatformManagerImpl sInstance;
68 * Returns the public interface of the PlatformManager singleton object.
70 * Chip applications should use this to access features of the PlatformManager object
71 * that are common to all platforms.
73 inline PlatformManager & PlatformMgr(void)
75 return PlatformManagerImpl::sInstance;
79 * Returns the platform-specific implementation of the PlatformManager singleton object.
81 * Chip applications can use this to gain access to features of the PlatformManager
82 * that are specific to the ESP32 platform.
84 inline PlatformManagerImpl & PlatformMgrImpl(void)
86 return PlatformManagerImpl::sInstance;
89 } // namespace DeviceLayer