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