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

Commit 2d54353

Browse files
authored
Merge pull request #463 from robszewczyk/bug/software-update-timer
Make the software update timer oblivious to service connectivity events
2 parents 56bcb34 + bc957cd commit 2d54353

File tree

4 files changed

+7
-39
lines changed

4 files changed

+7
-39
lines changed

src/adaptations/device-layer/include/Weave/DeviceLayer/SoftwareUpdateManager.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ class SoftwareUpdateManager
320320
template<class> friend class Internal::GenericPlatformManagerImpl;
321321

322322
WEAVE_ERROR Init(void);
323-
void OnPlatformEvent(const WeaveDeviceEvent * event);
324323

325324
protected:
326325

@@ -482,11 +481,6 @@ inline WEAVE_ERROR SoftwareUpdateManager::PrepareImageStorageComplete(WEAVE_ERRO
482481
return static_cast<ImplClass*>(this)->_PrepareImageStorageComplete(aError);
483482
}
484483

485-
inline void SoftwareUpdateManager::OnPlatformEvent(const WeaveDeviceEvent * event)
486-
{
487-
static_cast<ImplClass*>(this)->_OnPlatformEvent(event);
488-
}
489-
490484
inline SoftwareUpdateManager::State SoftwareUpdateManager::GetState(void)
491485
{
492486
return static_cast<ImplClass*>(this)->_GetState();

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,6 @@ void GenericPlatformManagerImpl<ImplClass>::DispatchEventToDeviceLayer(const Wea
421421
NetworkProvisioningSvr().OnPlatformEvent(event);
422422
FabricProvisioningSvr().OnPlatformEvent(event);
423423
ServiceProvisioningSvr().OnPlatformEvent(event);
424-
#if WEAVE_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER
425-
SoftwareUpdateMgr().OnPlatformEvent(event);
426-
#endif
427424
#if WEAVE_DEVICE_CONFIG_ENABLE_TRAIT_MANAGER
428425
TraitMgr().OnPlatformEvent(event);
429426
#endif // WEAVE_DEVICE_CONFIG_ENABLE_TRAIT_MANAGER

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class GenericSoftwareUpdateManagerImpl
5353
bool _IsInProgress(void);
5454
SoftwareUpdateManager::State _GetState(void);
5555

56-
void _OnPlatformEvent(const WeaveDeviceEvent * event);
5756
void _SetRetryPolicyCallback(const SoftwareUpdateManager::RetryPolicyCallback aRetryPolicyCallback);
5857

5958
static void _DefaultEventHandler(void *apAppState, SoftwareUpdateManager::EventType aEvent,
@@ -131,7 +130,6 @@ class GenericSoftwareUpdateManagerImpl
131130

132131
PacketBuffer * mImageQueryPacketBuffer;
133132

134-
bool mHaveServiceConnectivity;
135133
bool mScheduledCheckEnabled;
136134
bool mShouldRetry;
137135
bool mIgnorePartialImage;
@@ -161,4 +159,3 @@ extern template class Internal::GenericSoftwareUpdateManagerImpl<SoftwareUpdateM
161159

162160
// #endif // WEAVE_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER
163161
#endif // GENERIC_SOFTWARE_UPDATE_MANAGER_IMPL_H
164-

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

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ void GenericSoftwareUpdateManagerImpl<ImplClass>::DoInit()
6262
{
6363
mShouldRetry = false;
6464
mScheduledCheckEnabled = false;
65-
mHaveServiceConnectivity = false;
6665
mIgnorePartialImage = false;
6766

6867
mEventHandlerCallback = NULL;
@@ -122,6 +121,12 @@ void GenericSoftwareUpdateManagerImpl<ImplClass>::PrepareBinding(intptr_t arg)
122121

123122
self->Cleanup();
124123

124+
if (!ConnectivityMgr().HaveServiceConnectivity())
125+
{
126+
WeaveLogProgress(DeviceLayer, "Software Update Check: No service connectivity");
127+
ExitNow(err = WEAVE_ERROR_NOT_CONNECTED);
128+
}
129+
125130
self->mBinding = ExchangeMgr.NewBinding(HandleServiceBindingEvent, NULL);
126131
VerifyOrExit(self->mBinding != NULL, err = WEAVE_ERROR_NO_MEMORY);
127132

@@ -436,27 +441,6 @@ bool GenericSoftwareUpdateManagerImpl<ImplClass>::_IsInProgress(void)
436441
false : true );
437442
}
438443

439-
template<class ImplClass>
440-
void GenericSoftwareUpdateManagerImpl<ImplClass>::_OnPlatformEvent(const WeaveDeviceEvent * event)
441-
{
442-
GenericSoftwareUpdateManagerImpl<ImplClass> * self = &SoftwareUpdateMgrImpl();
443-
444-
if (event->Type == DeviceEventType::kServiceConnectivityChange)
445-
{
446-
if (event->ServiceConnectivityChange.Overall.Result == kConnectivity_Established)
447-
{
448-
self->mHaveServiceConnectivity = true;
449-
}
450-
else if (event->ServiceConnectivityChange.Overall.Result == kConnectivity_Lost)
451-
{
452-
self->mHaveServiceConnectivity = false;
453-
SystemLayer.CancelTimer(HandleHoldOffTimerExpired, NULL);
454-
}
455-
456-
self->DriveState(SoftwareUpdateManager::kState_Idle);
457-
}
458-
}
459-
460444
template<class ImplClass>
461445
void GenericSoftwareUpdateManagerImpl<ImplClass>::SendQuery(void)
462446
{
@@ -729,7 +713,7 @@ void GenericSoftwareUpdateManagerImpl<ImplClass>::DriveState(SoftwareUpdateManag
729713
* will trigger on expiration of the timer unless service connectivity was lost or
730714
* the application requested a manual software update check.
731715
*/
732-
if ((mScheduledCheckEnabled || mShouldRetry) && mHaveServiceConnectivity)
716+
if (mScheduledCheckEnabled || mShouldRetry)
733717
{
734718
uint32_t timeToNextQueryMS = GetNextWaitTimeInterval();
735719

@@ -740,10 +724,6 @@ void GenericSoftwareUpdateManagerImpl<ImplClass>::DriveState(SoftwareUpdateManag
740724
SystemLayer.StartTimer(timeToNextQueryMS, HandleHoldOffTimerExpired, NULL);
741725
}
742726
}
743-
else if (!mHaveServiceConnectivity)
744-
{
745-
WeaveLogProgress(DeviceLayer, "Software Update Check Suspended - no service connectivity");
746-
}
747727
}
748728
break;
749729

0 commit comments

Comments
 (0)