Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 66f6b62

Browse files
author
Jay Logue
authored
Merge pull request #302 from openweave/feature/softwareupdatemanager
Software Update Manager Implementation
2 parents 2bf2e95 + a3c42b2 commit 66f6b62

17 files changed

+2634
-53
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
*
3+
* Copyright (c) 2019 Google LLC.
4+
* All rights reserved.
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+
20+
#include <Weave/DeviceLayer/internal/WeaveDeviceLayerInternal.h>
21+
22+
#if WEAVE_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER
23+
24+
#include <Weave/Profiles/WeaveProfiles.h>
25+
#include <Weave/Profiles/common/CommonProfile.h>
26+
27+
#include <Weave/DeviceLayer/internal/GenericSoftwareUpdateManagerImpl_BDX.ipp>
28+
#include <Weave/DeviceLayer/internal/GenericSoftwareUpdateManagerImpl.ipp>
29+
30+
namespace nl {
31+
namespace Weave {
32+
namespace DeviceLayer {
33+
34+
SoftwareUpdateManagerImpl SoftwareUpdateManagerImpl::sInstance;
35+
36+
WEAVE_ERROR SoftwareUpdateManagerImpl::_Init(void)
37+
{
38+
Internal::GenericSoftwareUpdateManagerImpl_BDX<SoftwareUpdateManagerImpl>::DoInit();
39+
Internal::GenericSoftwareUpdateManagerImpl<SoftwareUpdateManagerImpl>::DoInit();
40+
41+
return WEAVE_NO_ERROR;
42+
}
43+
44+
} // namespace DeviceLayer
45+
} // namespace Weave
46+
} // namespace nl
47+
48+
#endif // WEAVE_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER

src/adaptations/device-layer/Makefile.am

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,21 @@ noinst_HEADERS = \
4444
include/Weave/DeviceLayer/ESP32/BLEManagerImpl.h \
4545
include/Weave/DeviceLayer/ESP32/ConfigurationManagerImpl.h \
4646
include/Weave/DeviceLayer/ESP32/PlatformManagerImpl.h \
47+
include/Weave/DeviceLayer/ESP32/SoftwareUpdateManagerImpl.h \
4748
include/Weave/DeviceLayer/ESP32/WeaveDevicePlatformEvent.h \
4849
include/Weave/DeviceLayer/ESP32/NetworkProvisioningServerImpl.h \
4950
include/Weave/DeviceLayer/nRF5/ConfigurationManagerImpl.h \
5051
include/Weave/DeviceLayer/nRF5/PlatformManagerImpl.h \
5152
include/Weave/DeviceLayer/nRF5/nRF5Config.h \
53+
include/Weave/DeviceLayer/nRF5/SoftwareUpdateManagerImpl.h \
5254
include/Weave/DeviceLayer/nRF5/WeaveDevicePlatformConfig.h \
5355
include/Weave/DeviceLayer/nRF5/WeaveDevicePlatformEvent.h \
5456
include/Weave/DeviceLayer/FreeRTOS/GenericPlatformManagerImpl_FreeRTOS.h \
5557
include/Weave/DeviceLayer/FreeRTOS/GenericPlatformManagerImpl_FreeRTOS.ipp \
5658
include/Weave/DeviceLayer/GeneralUtils.h \
5759
include/Weave/DeviceLayer/NetworkTelemetryManager.h \
5860
include/Weave/DeviceLayer/PlatformManager.h \
61+
include/Weave/DeviceLayer/SoftwareUpdateManager.h \
5962
include/Weave/DeviceLayer/TimeSyncManager.h \
6063
include/Weave/DeviceLayer/TraitManager.h \
6164
include/Weave/DeviceLayer/WeaveDeviceConfig.h \
@@ -76,6 +79,10 @@ noinst_HEADERS = \
7679
include/Weave/DeviceLayer/internal/GenericNetworkProvisioningServerImpl.ipp \
7780
include/Weave/DeviceLayer/internal/GenericPlatformManagerImpl.h \
7881
include/Weave/DeviceLayer/internal/GenericPlatformManagerImpl.ipp \
82+
include/Weave/DeviceLayer/internal/GenericSoftwareUpdateManagerImpl.h \
83+
include/Weave/DeviceLayer/internal/GenericSoftwareUpdateManagerImpl.ipp \
84+
include/Weave/DeviceLayer/internal/GenericSoftwareUpdateManagerImpl_BDX.h \
85+
include/Weave/DeviceLayer/internal/GenericSoftwareUpdateManagerImpl_BDX.ipp \
7986
include/Weave/DeviceLayer/internal/NetworkProvisioningServer.h \
8087
include/Weave/DeviceLayer/internal/ServiceDirectoryManager.h \
8188
include/Weave/DeviceLayer/internal/ServiceProvisioningServer.h \
@@ -141,6 +148,7 @@ libDeviceLayer_a_SOURCES += \
141148
ESP32/LwIPCoreLock.cpp \
142149
ESP32/NetworkProvisioningServerImpl.cpp \
143150
ESP32/PlatformManagerImpl.cpp \
151+
ESP32/SoftwareUpdateManagerImpl.cpp \
144152
ESP32/SystemTimeSupport.cpp \
145153
LwIP/WarmSupport.cpp \
146154
$(NULL)
@@ -161,6 +169,7 @@ libDeviceLayer_a_SOURCES += \
161169
nRF5/nRF5Utils.cpp \
162170
nRF5/Entropy.cpp \
163171
nRF5/Logging.cpp \
172+
nRF5/SoftwareUpdateManagerImpl.cpp \
164173
FreeRTOS/SystemTimeSupport.cpp \
165174
OpenThread/OpenThreadUtils.cpp \
166175
LwIP/WarmSupport.cpp \

src/adaptations/device-layer/Makefile.in

Lines changed: 73 additions & 14 deletions
Large diffs are not rendered by default.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
*
3+
* Copyright (c) 2019 Google LLC.
4+
* All rights reserved.
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+
#ifndef SOFTWARE_UPDATE_MANAGER_IMPL_H
20+
#define SOFTWARE_UPDATE_MANAGER_IMPL_H
21+
22+
#if WEAVE_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER
23+
24+
#include <Weave/DeviceLayer/internal/GenericSoftwareUpdateManagerImpl.h>
25+
#include <Weave/DeviceLayer/internal/GenericSoftwareUpdateManagerImpl_BDX.h>
26+
27+
namespace nl {
28+
namespace Weave {
29+
namespace DeviceLayer {
30+
31+
/**
32+
* Concrete implementation of the SoftwareUpdateManager singleton object for the
33+
* ESP32 platforms.
34+
*/
35+
class SoftwareUpdateManagerImpl final
36+
: public SoftwareUpdateManager,
37+
public Internal::GenericSoftwareUpdateManagerImpl<SoftwareUpdateManagerImpl>,
38+
public Internal::GenericSoftwareUpdateManagerImpl_BDX<SoftwareUpdateManagerImpl>
39+
{
40+
// Allow the SoftwareUpdateManager interface class to delegate method calls to
41+
// the implementation methods provided by this class.
42+
friend class SoftwareUpdateManager;
43+
44+
// Allow the GenericSoftwareUpdateManagerImpl base class to access helper methods
45+
// and types defined on this class.
46+
friend class Internal::GenericSoftwareUpdateManagerImpl<SoftwareUpdateManagerImpl>;
47+
48+
// Allow the GenericSoftwareUpdateManagerImpl_BDX base class to access helper methods
49+
// and types defined on this class.
50+
friend class Internal::GenericSoftwareUpdateManagerImpl_BDX<SoftwareUpdateManagerImpl>;
51+
52+
public:
53+
54+
// ===== Members for internal use by the following friends.
55+
56+
friend ::nl::Weave::DeviceLayer::SoftwareUpdateManager & SoftwareUpdateMgr(void);
57+
friend SoftwareUpdateManagerImpl & SoftwareUpdateMgrImpl(void);
58+
59+
static SoftwareUpdateManagerImpl sInstance;
60+
61+
private:
62+
// ===== Members that implement the SoftwareUpdateManager abstract interface.
63+
64+
WEAVE_ERROR _Init(void);
65+
66+
};
67+
68+
/**
69+
* Returns a reference to the public interface of the SoftwareUpdateManager singleton object.
70+
*
71+
* Internal components should use this to access features of the SoftwareUpdateManager object
72+
* that are common to all platforms.
73+
*/
74+
inline SoftwareUpdateManager & SoftwareUpdateMgr(void)
75+
{
76+
return SoftwareUpdateManagerImpl::sInstance;
77+
}
78+
79+
/**
80+
* Returns the platform-specific implementation of the SoftwareUpdateManager singleton object.
81+
*
82+
* Internal components can use this to gain access to features of the SoftwareUpdateManager
83+
* that are specific to the ESP32 platform.
84+
*/
85+
inline SoftwareUpdateManagerImpl & SoftwareUpdateMgrImpl(void)
86+
{
87+
return SoftwareUpdateManagerImpl::sInstance;
88+
}
89+
90+
} // namespace DeviceLayer
91+
} // namespace Weave
92+
} // namespace nl
93+
94+
#endif // WEAVE_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER
95+
#endif // SOFTWARE_UPDATE_MANAGER_IMPL_H

0 commit comments

Comments
 (0)