blob: cc2b0eefe94c318cd7dc1cb54b928e62abc61f60 [file] [log] [blame]
* Copyright (c) 2020 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and
* limitations under the License.
* @file
* Provides an implementation of the PlatformManager object
* for the ESP32 platform.
#pragma once
#include <platform/internal/GenericPlatformManagerImpl_FreeRTOS.h>
#include <system/SystemClock.h>
namespace chip {
namespace DeviceLayer {
* Concrete implementation of the PlatformManager singleton object for the ESP32 platform.
class PlatformManagerImpl final : public PlatformManager, public Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>
// Allow the PlatformManager interface class to delegate method calls to
// the implementation methods provided by this class.
friend PlatformManager;
// Allow the generic implementation base class to call helper methods on
// this class.
friend Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>;
// ===== Platform-specific members that may be accessed directly by the application.
CHIP_ERROR InitLwIPCoreLock(void);
static void HandleESPSystemEvent(void * arg, esp_event_base_t eventBase, int32_t eventId, void * eventData);
System::Clock::Timestamp GetStartTime() { return mStartTime; }
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack(void);
void _Shutdown();
// ===== Members for internal use by the following friends.
friend PlatformManager & PlatformMgr(void);
friend PlatformManagerImpl & PlatformMgrImpl(void);
System::Clock::Timestamp mStartTime = System::Clock::kZero;
static PlatformManagerImpl sInstance;
* Returns the public interface of the PlatformManager singleton object.
* Chip applications should use this to access features of the PlatformManager object
* that are common to all platforms.
inline PlatformManager & PlatformMgr(void)
return PlatformManagerImpl::sInstance;
* Returns the platform-specific implementation of the PlatformManager singleton object.
* Chip applications can use this to gain access to features of the PlatformManager
* that are specific to the ESP32 platform.
inline PlatformManagerImpl & PlatformMgrImpl(void)
return PlatformManagerImpl::sInstance;
} // namespace DeviceLayer
} // namespace chip