Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / EFR32 / SoftwareUpdateManagerImpl.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    Copyright (c) 2019 Google LLC.
5  *
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
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18
19 #pragma once
20
21 #if CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER
22
23 #include <platform/internal/GenericSoftwareUpdateManagerImpl.h>
24 #include <platform/internal/GenericSoftwareUpdateManagerImpl_BDX.h>
25
26 namespace chip {
27 namespace DeviceLayer {
28
29 /**
30  * Concrete implementation of the SoftwareUpdateManager singleton object for the
31  * Silicon Labs EFR32 platforms.
32  */
33 class SoftwareUpdateManagerImpl final : public SoftwareUpdateManager,
34                                         public Internal::GenericSoftwareUpdateManagerImpl<SoftwareUpdateManagerImpl>,
35                                         public Internal::GenericSoftwareUpdateManagerImpl_BDX<SoftwareUpdateManagerImpl>
36 {
37     // Allow the SoftwareUpdateManager interface class to delegate method calls to
38     // the implementation methods provided by this class.
39     friend class SoftwareUpdateManager;
40
41     // Allow the GenericSoftwareUpdateManagerImpl base class to access helper methods
42     // and types defined on this class.
43     friend class Internal::GenericSoftwareUpdateManagerImpl<SoftwareUpdateManagerImpl>;
44
45     // Allow the GenericSoftwareUpdateManagerImpl_BDX base class to access helper methods
46     // and types defined on this class.
47     friend class Internal::GenericSoftwareUpdateManagerImpl_BDX<SoftwareUpdateManagerImpl>;
48
49 public:
50     // ===== Members for internal use by the following friends.
51
52     friend ::chip::DeviceLayer::SoftwareUpdateManager & SoftwareUpdateMgr(void);
53     friend SoftwareUpdateManagerImpl & SoftwareUpdateMgrImpl(void);
54
55     static SoftwareUpdateManagerImpl sInstance;
56
57 private:
58     // ===== Members that implement the SoftwareUpdateManager abstract interface.
59
60     CHIP_ERROR _Init(void);
61 };
62
63 /**
64  * Returns a reference to the public interface of the SoftwareUpdateManager singleton object.
65  *
66  * Internal components should use this to access features of the SoftwareUpdateManager object
67  * that are common to all platforms.
68  */
69 inline SoftwareUpdateManager & SoftwareUpdateMgr(void)
70 {
71     return SoftwareUpdateManagerImpl::sInstance;
72 }
73
74 /**
75  * Returns the platform-specific implementation of the SoftwareUpdateManager singleton object.
76  *
77  * Internal components can use this to gain access to features of the SoftwareUpdateManager
78  * that are specific to the EFR32 platform.
79  */
80 inline SoftwareUpdateManagerImpl & SoftwareUpdateMgrImpl(void)
81 {
82     return SoftwareUpdateManagerImpl::sInstance;
83 }
84
85 } // namespace DeviceLayer
86 } // namespace chip
87
88 #endif // CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER