Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / include / platform / 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
25 namespace chip {
26 namespace DeviceLayer {
27
28 /**
29  * Concrete implementation of the SoftwareUpdateManager singleton object for the
30  * nRF52 platforms.
31  */
32 class SoftwareUpdateManagerImpl final : public SoftwareUpdateManager,
33                                         public Internal::GenericSoftwareUpdateManagerImpl<SoftwareUpdateManagerImpl>
34 {
35     // Allow the SoftwareUpdateManager interface class to delegate method calls to
36     // the implementation methods provided by this class.
37     friend class SoftwareUpdateManager;
38
39     // Allow the GenericSoftwareUpdateManagerImpl base class to access helper methods
40     // and types defined on this class.
41     friend class Internal::GenericSoftwareUpdateManagerImpl<SoftwareUpdateManagerImpl>;
42
43 public:
44     // ===== Members for internal use by the following friends.
45
46     friend ::chip::DeviceLayer::SoftwareUpdateManager & SoftwareUpdateMgr();
47     friend SoftwareUpdateManagerImpl & SoftwareUpdateMgrImpl();
48
49     static SoftwareUpdateManagerImpl sInstance;
50
51 private:
52     // ===== Members that implement the SoftwareUpdateManager abstract interface.
53
54     CHIP_ERROR _Init();
55 };
56
57 /**
58  * Returns a reference to the public interface of the SoftwareUpdateManager singleton object.
59  *
60  * Internal components should use this to access features of the SoftwareUpdateManager object
61  * that are common to all platforms.
62  */
63 inline SoftwareUpdateManager & SoftwareUpdateMgr()
64 {
65     return SoftwareUpdateManagerImpl::sInstance;
66 }
67
68 /**
69  * Returns the platform-specific implementation of the SoftwareUpdateManager singleton object.
70  *
71  * Internal components can use this to gain access to features of the SoftwareUpdateManager
72  * that are specific to the nRF5 platform.
73  */
74 inline SoftwareUpdateManagerImpl & SoftwareUpdateMgrImpl()
75 {
76     return SoftwareUpdateManagerImpl::sInstance;
77 }
78
79 } // namespace DeviceLayer
80 } // namespace chip
81
82 #endif // CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER