mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralfms.git
synced 2026-01-27 10:23:12 +00:00
Finishing FMS dash board
This commit is contained in:
@@ -219,6 +219,10 @@ components:
|
||||
$ref: '#/components/schemas/TagIntPairList'
|
||||
endPoints:
|
||||
$ref: '#/components/schemas/TagIntPairList'
|
||||
unknownFirmwares:
|
||||
$ref: '#/components/schemas/TagIntPairList'
|
||||
usingLatest:
|
||||
$ref: '#/components/schemas/TagIntPairList'
|
||||
|
||||
#########################################################################################
|
||||
##
|
||||
|
||||
@@ -48,6 +48,18 @@ namespace uCentral {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LatestFirmwareCache::IsLatest(const std::string &DeviceType, const std::string &Revision) {
|
||||
SubMutexGuard G(Mutex_);
|
||||
|
||||
std::string Result;
|
||||
auto E=FirmwareCache_.find(DeviceType);
|
||||
if(E!=FirmwareCache_.end()) {
|
||||
return E->second.Revision == Revision;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void LatestFirmwareCache::DumpCache() {
|
||||
SubMutexGuard G(Mutex_);
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace uCentral {
|
||||
void DumpCache();
|
||||
inline Types::StringSet GetRevisions() { SubMutexGuard G(Mutex_); return RevisionSet_; };
|
||||
inline Types::StringSet GetDevices() { SubMutexGuard G(Mutex_); return DeviceSet_; };
|
||||
bool IsLatest(const std::string &DeviceType, const std::string &Revision);
|
||||
|
||||
private:
|
||||
static LatestFirmwareCache *instance_;
|
||||
|
||||
@@ -214,6 +214,8 @@ namespace uCentral::FMSObjects {
|
||||
field_to_json(Obj, "deviceTypes", DeviceTypes_);
|
||||
field_to_json(Obj, "status", Status_);
|
||||
field_to_json(Obj,"endPoints", EndPoints_);
|
||||
field_to_json(Obj, "usingLatest", UsingLatest_);
|
||||
field_to_json(Obj, "unknownFirmwares", UnknownFirmwares_);
|
||||
}
|
||||
|
||||
bool DeviceReport::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||
|
||||
@@ -117,6 +117,8 @@ namespace uCentral::FMSObjects {
|
||||
Types::CountedMap DeviceTypes_;
|
||||
Types::CountedMap Status_;
|
||||
Types::CountedMap EndPoints_;
|
||||
Types::CountedMap UsingLatest_;
|
||||
Types::CountedMap UnknownFirmwares_;
|
||||
|
||||
void to_json(Poco::JSON::Object &Obj) const;
|
||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "StorageService.h"
|
||||
#include "Utils.h"
|
||||
#include "Poco/Data/RecordSet.h"
|
||||
#include "LatestFirmwareCache.h"
|
||||
|
||||
/*
|
||||
"serialNumber=?, "
|
||||
@@ -213,6 +214,14 @@ namespace uCentral {
|
||||
Types::UpdateCountedMap(Report.Status_, Status);
|
||||
Types::UpdateCountedMap(Report.EndPoints_, EndPoint);
|
||||
Types::UpdateCountedMap(Report.OUI_, SerialNumber.substr(0,6));
|
||||
FMSObjects::FirmwareAgeDetails Age;
|
||||
if(ComputeFirmwareAge(DeviceType, Revision, Age)) {
|
||||
if(Age.age==0) {
|
||||
Types::UpdateCountedMap(Report.UnknownFirmwares_, Revision);
|
||||
}
|
||||
}
|
||||
if(LatestFirmwareCache()->IsLatest(DeviceType, Revision))
|
||||
Types::UpdateCountedMap(Report.UsingLatest_,Revision);
|
||||
More = RSet.moveNext();
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user