Skip to content

Commit

Permalink
Merge pull request #336 from Telecominfraproject/master
Browse files Browse the repository at this point in the history
  • Loading branch information
stephb9959 authored Dec 15, 2023
2 parents 810e492 + 500688e commit 4684697
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
63
65
2 changes: 1 addition & 1 deletion src/AP_WS_Process_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace OpenWifi {
}

StateUtils::ComputeAssociations(StateObj, State_.Associations_2G,
State_.Associations_5G, State_.Associations_6G);
State_.Associations_5G, State_.Associations_6G, State_.uptime);

if (KafkaManager()->Enabled() && !AP_WS_Server()->KafkaDisableState()) {
KafkaManager()->PostMessage(KafkaTopics::STATE, SerialNumber_, *ParamsObj);
Expand Down
1 change: 1 addition & 0 deletions src/RESTObjects/RESTAPI_GWobjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ namespace OpenWifi::GWObjects {
field_to_json(Obj, "totalConnectionTime", Utils::Now() - started);
field_to_json(Obj, "certificateExpiryDate", certificateExpiryDate);
field_to_json(Obj, "connectReason", connectReason);
field_to_json(Obj, "uptime", uptime);

#ifdef TIP_GATEWAY_SERVICE
hasRADIUSSessions = RADIUSSessionTracker()->HasSessions(SerialNumber);
Expand Down
1 change: 1 addition & 0 deletions src/RESTObjects/RESTAPI_GWobjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace OpenWifi::GWObjects {
std::double_t load=0.0;
std::double_t temperature=0.0;
std::string connectReason;
std::uint64_t uptime=0;

void to_json(const std::string &SerialNumber, Poco::JSON::Object &Obj) ;
};
Expand Down
10 changes: 8 additions & 2 deletions src/StateUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace OpenWifi::StateUtils {
}

bool ComputeAssociations(const Poco::JSON::Object::Ptr RawObject, uint64_t &Radios_2G,
uint64_t &Radios_5G, uint64_t &Radios_6G) {
uint64_t &Radios_5G, uint64_t &Radios_6G, uint64_t &UpTime ) {
Radios_2G = 0;
Radios_5G = 0;
Radios_6G = 0;
Expand Down Expand Up @@ -90,9 +90,15 @@ namespace OpenWifi::StateUtils {
}
}
}
// std::cout << Radios_2G << " " << Radios_5G << " " << Radios_6G << std::endl;
return true;
}

if(RawObject->has("unit") && !RawObject->isNull("unit") && RawObject->isObject("unit")) {
auto unit = RawObject->getObject("unit");
if(unit->has("uptime")) {
UpTime = unit->get("uptime");
}
}
return false;
}
} // namespace OpenWifi::StateUtils
2 changes: 1 addition & 1 deletion src/StateUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

namespace OpenWifi::StateUtils {
bool ComputeAssociations(const Poco::JSON::Object::Ptr RawObject, uint64_t &Radios_2G,
uint64_t &Radios_5G, uint64_t &Radio_6G);
uint64_t &Radios_5G, uint64_t &Radio_6G, uint64_t &UpTime);
}
4 changes: 2 additions & 2 deletions src/storage/storage_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,9 @@ namespace OpenWifi {
}
}

uint64_t Associations_2G, Associations_5G, Associations_6G;
uint64_t Associations_2G, Associations_5G, Associations_6G, uptime;
StateUtils::ComputeAssociations(RawObject, Associations_2G, Associations_5G,
Associations_6G);
Associations_6G, uptime);
UpdateCountedMap(Dashboard.associations, "2G", Associations_2G);
UpdateCountedMap(Dashboard.associations, "5G", Associations_5G);
UpdateCountedMap(Dashboard.associations, "6G", Associations_6G);
Expand Down

0 comments on commit 4684697

Please sign in to comment.