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

Commit 1637e18

Browse files
committed
Continuation of Software Update Manager implementation
-- Add a concrete software update manager implementation for the ESP32 platform. Update Makefiles for the same -- Fix copyright header in GenericSoftwareUpdateManager_BDX.ipp -- Explicitly call AbortDownload when a BDX transfer fails.
1 parent c80a62b commit 1637e18

File tree

11 files changed

+181
-11
lines changed

11 files changed

+181
-11
lines changed

src/adaptations/device-layer/ESP32/ESP32Config.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ const ESP32Config::Key ESP32Config::kConfigKey_GroupKeyIndex = { kConf
5555
const ESP32Config::Key ESP32Config::kConfigKey_LastUsedEpochKeyId = { kConfigNamespace_WeaveConfig, "last-ek-id" };
5656
const ESP32Config::Key ESP32Config::kConfigKey_FailSafeArmed = { kConfigNamespace_WeaveConfig, "fail-safe-armed" };
5757
const ESP32Config::Key ESP32Config::kConfigKey_WiFiStationSecType = { kConfigNamespace_WeaveConfig, "sta-sec-type" };
58-
const ESP32Config::Key ESP32Config::kConfigKey_CertBodyId = { kConfigNamespace_WeaveConfig, "cert-body-id" };
5958

6059
// Prefix used for NVS keys that contain Weave group encryption keys.
6160
const char ESP32Config::kGroupKeyNamePrefix[] = "gk-";
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ 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 \
@@ -147,6 +148,7 @@ libDeviceLayer_a_SOURCES += \
147148
ESP32/LwIPCoreLock.cpp \
148149
ESP32/NetworkProvisioningServerImpl.cpp \
149150
ESP32/PlatformManagerImpl.cpp \
151+
ESP32/SoftwareUpdateManagerImpl.cpp \
150152
ESP32/SystemTimeSupport.cpp \
151153
LwIP/WarmSupport.cpp \
152154
$(NULL)

src/adaptations/device-layer/Makefile.in

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ target_triplet = @target@
126126
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ ESP32/LwIPCoreLock.cpp \
127127
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ ESP32/NetworkProvisioningServerImpl.cpp \
128128
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ ESP32/PlatformManagerImpl.cpp \
129+
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ ESP32/SoftwareUpdateManagerImpl.cpp \
129130
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ ESP32/SystemTimeSupport.cpp \
130131
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ LwIP/WarmSupport.cpp \
131132
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ $(NULL)
@@ -242,10 +243,11 @@ am__libDeviceLayer_a_SOURCES_DIST = CASEAuth.cpp \
242243
ESP32/ESP32Config.cpp ESP32/ESP32Utils.cpp \
243244
ESP32/GroupKeyStoreImpl.cpp ESP32/Logging.cpp \
244245
ESP32/LwIPCoreLock.cpp ESP32/NetworkProvisioningServerImpl.cpp \
245-
ESP32/PlatformManagerImpl.cpp ESP32/SystemTimeSupport.cpp \
246-
LwIP/WarmSupport.cpp nRF5/BLEManagerImpl.cpp \
247-
nRF5/ConfigurationManagerImpl.cpp nRF5/PlatformManagerImpl.cpp \
248-
nRF5/ConnectivityManagerImpl.cpp \
246+
ESP32/PlatformManagerImpl.cpp \
247+
ESP32/SoftwareUpdateManagerImpl.cpp \
248+
ESP32/SystemTimeSupport.cpp LwIP/WarmSupport.cpp \
249+
nRF5/BLEManagerImpl.cpp nRF5/ConfigurationManagerImpl.cpp \
250+
nRF5/PlatformManagerImpl.cpp nRF5/ConnectivityManagerImpl.cpp \
249251
nRF5/NetworkProvisioningServerImpl.cpp \
250252
nRF5/ThreadStackManagerImpl.cpp nRF5/GroupKeyStoreImpl.cpp \
251253
nRF5/nRF5Config.cpp nRF5/nRF5Utils.cpp nRF5/Entropy.cpp \
@@ -264,6 +266,7 @@ am__dirstamp = $(am__leading_dot)dirstamp
264266
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ ESP32/libDeviceLayer_a-LwIPCoreLock.$(OBJEXT) \
265267
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ ESP32/libDeviceLayer_a-NetworkProvisioningServerImpl.$(OBJEXT) \
266268
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ ESP32/libDeviceLayer_a-PlatformManagerImpl.$(OBJEXT) \
269+
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.$(OBJEXT) \
267270
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ ESP32/libDeviceLayer_a-SystemTimeSupport.$(OBJEXT) \
268271
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_ESP32_TRUE@ LwIP/libDeviceLayer_a-WarmSupport.$(OBJEXT)
269272
@CONFIG_DEVICE_LAYER_TRUE@@WEAVE_DEVICE_LAYER_TARGET_NRF5_TRUE@am__objects_2 = nRF5/libDeviceLayer_a-BLEManagerImpl.$(OBJEXT) \
@@ -662,6 +665,7 @@ noinst_HEADERS = \
662665
include/Weave/DeviceLayer/ESP32/BLEManagerImpl.h \
663666
include/Weave/DeviceLayer/ESP32/ConfigurationManagerImpl.h \
664667
include/Weave/DeviceLayer/ESP32/PlatformManagerImpl.h \
668+
include/Weave/DeviceLayer/ESP32/SoftwareUpdateManagerImpl.h \
665669
include/Weave/DeviceLayer/ESP32/WeaveDevicePlatformEvent.h \
666670
include/Weave/DeviceLayer/ESP32/NetworkProvisioningServerImpl.h \
667671
include/Weave/DeviceLayer/nRF5/ConfigurationManagerImpl.h \
@@ -870,6 +874,8 @@ ESP32/libDeviceLayer_a-NetworkProvisioningServerImpl.$(OBJEXT): \
870874
ESP32/$(am__dirstamp) ESP32/$(DEPDIR)/$(am__dirstamp)
871875
ESP32/libDeviceLayer_a-PlatformManagerImpl.$(OBJEXT): \
872876
ESP32/$(am__dirstamp) ESP32/$(DEPDIR)/$(am__dirstamp)
877+
ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.$(OBJEXT): \
878+
ESP32/$(am__dirstamp) ESP32/$(DEPDIR)/$(am__dirstamp)
873879
ESP32/libDeviceLayer_a-SystemTimeSupport.$(OBJEXT): \
874880
ESP32/$(am__dirstamp) ESP32/$(DEPDIR)/$(am__dirstamp)
875881
LwIP/$(am__dirstamp):
@@ -979,6 +985,7 @@ distclean-compile:
979985
@AMDEP_TRUE@@am__include@ @am__quote@ESP32/$(DEPDIR)/libDeviceLayer_a-LwIPCoreLock.Po@am__quote@
980986
@AMDEP_TRUE@@am__include@ @am__quote@ESP32/$(DEPDIR)/libDeviceLayer_a-NetworkProvisioningServerImpl.Po@am__quote@
981987
@AMDEP_TRUE@@am__include@ @am__quote@ESP32/$(DEPDIR)/libDeviceLayer_a-PlatformManagerImpl.Po@am__quote@
988+
@AMDEP_TRUE@@am__include@ @am__quote@ESP32/$(DEPDIR)/libDeviceLayer_a-SoftwareUpdateManagerImpl.Po@am__quote@
982989
@AMDEP_TRUE@@am__include@ @am__quote@ESP32/$(DEPDIR)/libDeviceLayer_a-SystemTimeSupport.Po@am__quote@
983990
@AMDEP_TRUE@@am__include@ @am__quote@FreeRTOS/$(DEPDIR)/libDeviceLayer_a-SystemTimeSupport.Po@am__quote@
984991
@AMDEP_TRUE@@am__include@ @am__quote@LwIP/$(DEPDIR)/libDeviceLayer_a-WarmSupport.Po@am__quote@
@@ -1543,6 +1550,20 @@ ESP32/libDeviceLayer_a-PlatformManagerImpl.obj: ESP32/PlatformManagerImpl.cpp
15431550
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
15441551
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libDeviceLayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ESP32/libDeviceLayer_a-PlatformManagerImpl.obj `if test -f 'ESP32/PlatformManagerImpl.cpp'; then $(CYGPATH_W) 'ESP32/PlatformManagerImpl.cpp'; else $(CYGPATH_W) '$(srcdir)/ESP32/PlatformManagerImpl.cpp'; fi`
15451552

1553+
ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.o: ESP32/SoftwareUpdateManagerImpl.cpp
1554+
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libDeviceLayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.o -MD -MP -MF ESP32/$(DEPDIR)/libDeviceLayer_a-SoftwareUpdateManagerImpl.Tpo -c -o ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.o `test -f 'ESP32/SoftwareUpdateManagerImpl.cpp' || echo '$(srcdir)/'`ESP32/SoftwareUpdateManagerImpl.cpp
1555+
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ESP32/$(DEPDIR)/libDeviceLayer_a-SoftwareUpdateManagerImpl.Tpo ESP32/$(DEPDIR)/libDeviceLayer_a-SoftwareUpdateManagerImpl.Po
1556+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ESP32/SoftwareUpdateManagerImpl.cpp' object='ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.o' libtool=no @AMDEPBACKSLASH@
1557+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1558+
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libDeviceLayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.o `test -f 'ESP32/SoftwareUpdateManagerImpl.cpp' || echo '$(srcdir)/'`ESP32/SoftwareUpdateManagerImpl.cpp
1559+
1560+
ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.obj: ESP32/SoftwareUpdateManagerImpl.cpp
1561+
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libDeviceLayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.obj -MD -MP -MF ESP32/$(DEPDIR)/libDeviceLayer_a-SoftwareUpdateManagerImpl.Tpo -c -o ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.obj `if test -f 'ESP32/SoftwareUpdateManagerImpl.cpp'; then $(CYGPATH_W) 'ESP32/SoftwareUpdateManagerImpl.cpp'; else $(CYGPATH_W) '$(srcdir)/ESP32/SoftwareUpdateManagerImpl.cpp'; fi`
1562+
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ESP32/$(DEPDIR)/libDeviceLayer_a-SoftwareUpdateManagerImpl.Tpo ESP32/$(DEPDIR)/libDeviceLayer_a-SoftwareUpdateManagerImpl.Po
1563+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ESP32/SoftwareUpdateManagerImpl.cpp' object='ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.obj' libtool=no @AMDEPBACKSLASH@
1564+
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1565+
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libDeviceLayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ESP32/libDeviceLayer_a-SoftwareUpdateManagerImpl.obj `if test -f 'ESP32/SoftwareUpdateManagerImpl.cpp'; then $(CYGPATH_W) 'ESP32/SoftwareUpdateManagerImpl.cpp'; else $(CYGPATH_W) '$(srcdir)/ESP32/SoftwareUpdateManagerImpl.cpp'; fi`
1566+
15461567
ESP32/libDeviceLayer_a-SystemTimeSupport.o: ESP32/SystemTimeSupport.cpp
15471568
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libDeviceLayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ESP32/libDeviceLayer_a-SystemTimeSupport.o -MD -MP -MF ESP32/$(DEPDIR)/libDeviceLayer_a-SystemTimeSupport.Tpo -c -o ESP32/libDeviceLayer_a-SystemTimeSupport.o `test -f 'ESP32/SystemTimeSupport.cpp' || echo '$(srcdir)/'`ESP32/SystemTimeSupport.cpp
15481569
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ESP32/$(DEPDIR)/libDeviceLayer_a-SystemTimeSupport.Tpo ESP32/$(DEPDIR)/libDeviceLayer_a-SystemTimeSupport.Po
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

src/adaptations/device-layer/include/Weave/DeviceLayer/internal/GenericSoftwareUpdateManagerImpl.ipp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ void GenericSoftwareUpdateManagerImpl<ImplClass>::HandleImageQueryResponse(Packe
473473
VerifyOrExit(imageQueryResponse.uri.theLength < WEAVE_DEVICE_CONFIG_SOFTWARE_UPDATE_URI_LEN, err = WEAVE_ERROR_BUFFER_TOO_SMALL);
474474
strncpy(mURI, imageQueryResponse.uri.theString, imageQueryResponse.uri.theLength);
475475

476-
VerifyOrExit(imageQueryResponse.versionSpec.theLength < ARRAY_SIZE(versionString), err = WEAVE_ERROR_BUFFER_TOO_SMALL);
476+
VerifyOrExit(imageQueryResponse.versionSpec.theLength < ArraySize(versionString), err = WEAVE_ERROR_BUFFER_TOO_SMALL);
477477
strncpy(versionString, imageQueryResponse.versionSpec.theString, imageQueryResponse.versionSpec.theLength);
478478

479479
mIntegritySpec = imageQueryResponse.integritySpec;
@@ -1026,7 +1026,7 @@ template<class ImplClass>
10261026
WEAVE_ERROR GenericSoftwareUpdateManagerImpl<ImplClass>::GetIntegrityTypeList(::nl::Weave::Profiles::SoftwareUpdate::IntegrityTypeList * aIntegrityTypeList)
10271027
{
10281028
uint8_t supportedTypes[] = { Profiles::SoftwareUpdate::kIntegrityType_SHA256 };
1029-
aIntegrityTypeList->init(ARRAY_SIZE(supportedTypes), supportedTypes);
1029+
aIntegrityTypeList->init(ArraySize(supportedTypes), supportedTypes);
10301030

10311031
return WEAVE_NO_ERROR;
10321032
}

src/adaptations/device-layer/include/Weave/DeviceLayer/internal/GenericSoftwareUpdateManagerImpl_BDX.ipp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2018 Nest Labs, Inc.
3+
* Copyright (c) 2019 Google LLC.
44
* All rights reserved.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -179,6 +179,8 @@ template<class ImplClass>
179179
void GenericSoftwareUpdateManagerImpl_BDX<ImplClass>::XferErroHandler(BDXTransfer * aXfer, StatusReport * aReport)
180180
{
181181
GenericSoftwareUpdateManagerImpl_BDX<ImplClass> * self = &SoftwareUpdateMgrImpl();
182+
183+
self->AbortDownload();
182184
self->Impl()->SoftwareUpdateFailed(WEAVE_ERROR_STATUS_REPORT_RECEIVED, aReport);
183185
}
184186

@@ -193,6 +195,8 @@ template<class ImplClass>
193195
void GenericSoftwareUpdateManagerImpl_BDX<ImplClass>::ErrorHandler(BDXTransfer * aXfer, WEAVE_ERROR aErrorCode)
194196
{
195197
GenericSoftwareUpdateManagerImpl_BDX<ImplClass> * self = &SoftwareUpdateMgrImpl();
198+
199+
self->AbortDownload();
196200
self->Impl()->SoftwareUpdateFailed(aErrorCode, NULL);
197201
}
198202

@@ -254,7 +258,7 @@ template<class ImplClass>
254258
WEAVE_ERROR GenericSoftwareUpdateManagerImpl_BDX<ImplClass>::GetUpdateSchemeList(::nl::Weave::Profiles::SoftwareUpdate::UpdateSchemeList * aUpdateSchemeList)
255259
{
256260
uint8_t supportedSchemes[] = { Profiles::SoftwareUpdate::kUpdateScheme_BDX };
257-
aUpdateSchemeList->init(ARRAY_SIZE(supportedSchemes), supportedSchemes);
261+
aUpdateSchemeList->init(ArraySize(supportedSchemes), supportedSchemes);
258262

259263
return WEAVE_NO_ERROR;
260264
}

src/adaptations/device-layer/include/Weave/DeviceLayer/nRF5/SoftwareUpdateManagerImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ inline SoftwareUpdateManager & SoftwareUpdateMgr(void)
8080
* Returns the platform-specific implementation of the SoftwareUpdateManager singleton object.
8181
*
8282
* Internal components can use this to gain access to features of the SoftwareUpdateManager
83-
* that are specific to the ESP32 platform.
83+
* that are specific to the nRF5 platform.
8484
*/
8585
inline SoftwareUpdateManagerImpl & SoftwareUpdateMgrImpl(void)
8686
{

src/adaptations/device-layer/include/Weave/DeviceLayer/nRF5/nRF5Config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class NRF5Config
9090
static constexpr Key kConfigKey_LastUsedEpochKeyId = NRF5ConfigKey(kFileId_WeaveConfig, 0x000C);
9191
static constexpr Key kConfigKey_FailSafeArmed = NRF5ConfigKey(kFileId_WeaveConfig, 0x000D);
9292
static constexpr Key kConfigKey_GroupKey = NRF5ConfigKey(kFileId_WeaveConfig, 0x000E);
93-
static constexpr Key kConfigKey_CertBodyId = NRF5ConfigKey(kFileId_WeaveConfig, 0x000F);
9493

9594
// Range of FDS record keys used to store Weave persisted counter values.
9695
static constexpr uint16_t kPersistedCounterRecordKeyBase = kFDSRecordKeyMin;

src/include/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,7 @@ $(nl_public_WeaveDeviceLayer_source_dirstem)/ESP32/GroupKeyStoreImpl.h
995995
$(nl_public_WeaveDeviceLayer_source_dirstem)/ESP32/InetPlatformConfig.h \
996996
$(nl_public_WeaveDeviceLayer_source_dirstem)/ESP32/NetworkProvisioningServerImpl.h \
997997
$(nl_public_WeaveDeviceLayer_source_dirstem)/ESP32/PlatformManagerImpl.h \
998+
$(nl_public_WeaveDeviceLayer_source_dirstem)/ESP32/SoftwareUpdateManagerImpl.h \
998999
$(nl_public_WeaveDeviceLayer_source_dirstem)/ESP32/SystemPlatformConfig.h \
9991000
$(nl_public_WeaveDeviceLayer_source_dirstem)/ESP32/WarmPlatformConfig.h \
10001001
$(nl_public_WeaveDeviceLayer_source_dirstem)/ESP32/WeaveDevicePlatformConfig.h \

0 commit comments

Comments
 (0)