Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-13268
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Jan 5, 2024
1 parent e430c52 commit 52123f7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/AP_WS_LookForUpgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace OpenWifi {
std::cout << __LINE__ << ": " << SerialNumber_ << " INT:" << SerialNumberInt_ << " GoodConfig: " << GoodConfig << " UUID:" << UUID << " Pending:" << State_.PendingUUID << std::endl;
if (GoodConfig && (GoodConfig == UUID || GoodConfig == State_.PendingUUID)) {
UpgradedUUID = UUID;
State_.PendingUUID = 0;
return false;
}

Expand All @@ -23,6 +24,8 @@ namespace OpenWifi {
return false;
}



std::cout << "D.pendingUUID: " << D.pendingUUID << " UUID: " << D.UUID << " SerialNumber: " << D.SerialNumber << std::endl;
if(State_.PendingUUID!=0 && UUID==State_.PendingUUID) {
std::cout << __LINE__ << ": " << SerialNumber_ << " GoodConfig: " << GoodConfig << " UUID:" << UUID << " Pending:" << State_.PendingUUID << std::endl;
Expand All @@ -34,19 +37,15 @@ namespace OpenWifi {
}
std::cout << __LINE__ << ": " << SerialNumber_ << " GoodConfig: " << GoodConfig << " UUID:" << UUID << " Pending:" << State_.PendingUUID << " Device:" << D.UUID << std::endl;

// This is the case where the cache is empty after a restart. So GoodConfig will 0. If
// the device already has the right UUID, we just return.
if (D.UUID == UUID) {
UpgradedUUID = UUID;
SetCurrentConfigurationID(SerialNumberInt_, UUID);
std::cout << __LINE__ << ": " << SerialNumber_ << " Set GoodConfig" << std::endl;
return false;
}

Config::Config Cfg(D.Configuration);
// if this is a broken device (UUID==0) just fix it
auto StoredConfigurationUUID = Cfg.UUID();
if(D.UUID==0 && UUID == StoredConfigurationUUID) {
if(D.UUID==0) {
D.UUID = StoredConfigurationUUID;
}


if (D.UUID == UUID) {
D.UUID = UpgradedUUID = UUID;
State_.PendingUUID = D.pendingUUID = 0;
D.pendingConfiguration.clear();
Expand All @@ -67,7 +66,8 @@ namespace OpenWifi {

Cfg.SetUUID(D.UUID);
D.Configuration = Cfg.get();
State_.PendingUUID = UpgradedUUID = D.UUID;
D.pendingUUID = State_.PendingUUID = UpgradedUUID = D.UUID;
StorageService()->UpdateDevice(Session, D);

GWObjects::CommandDetails Cmd;
Cmd.SerialNumber = SerialNumber_;
Expand Down

0 comments on commit 52123f7

Please sign in to comment.