mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-01 19:27:59 +00:00
Framework update
This commit is contained in:
@@ -146,6 +146,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj,"custom", Custom);
|
field_to_json(Obj,"custom", Custom);
|
||||||
field_to_json(Obj,"waitingForFile", WaitingForFile);
|
field_to_json(Obj,"waitingForFile", WaitingForFile);
|
||||||
field_to_json(Obj,"attachFile", AttachDate);
|
field_to_json(Obj,"attachFile", AttachDate);
|
||||||
|
field_to_json(Obj,"executionTime", executionTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefaultConfiguration::from_json(Poco::JSON::Object::Ptr &Obj) {
|
bool DefaultConfiguration::from_json(Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ namespace OpenWifi::GWObjects {
|
|||||||
std::string Firmware;
|
std::string Firmware;
|
||||||
std::string Compatible;
|
std::string Compatible;
|
||||||
std::string FWUpdatePolicy;
|
std::string FWUpdatePolicy;
|
||||||
uint64_t UUID;
|
uint64_t UUID = 0 ;
|
||||||
uint64_t CreationTimestamp;
|
uint64_t CreationTimestamp = 0 ;
|
||||||
uint64_t LastConfigurationChange;
|
uint64_t LastConfigurationChange = 0 ;
|
||||||
uint64_t LastConfigurationDownload;
|
uint64_t LastConfigurationDownload = 0 ;
|
||||||
uint64_t LastFWUpdate;
|
uint64_t LastFWUpdate = 0 ;
|
||||||
std::string Venue;
|
std::string Venue;
|
||||||
std::string DevicePassword;
|
std::string DevicePassword;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
@@ -64,25 +64,25 @@ namespace OpenWifi::GWObjects {
|
|||||||
|
|
||||||
struct Statistics {
|
struct Statistics {
|
||||||
std::string SerialNumber;
|
std::string SerialNumber;
|
||||||
uint64_t UUID;
|
uint64_t UUID = 0 ;
|
||||||
std::string Data;
|
std::string Data;
|
||||||
uint64_t Recorded;
|
uint64_t Recorded = 0;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HealthCheck {
|
struct HealthCheck {
|
||||||
std::string SerialNumber;
|
std::string SerialNumber;
|
||||||
uint64_t UUID;
|
uint64_t UUID = 0 ;
|
||||||
std::string Data;
|
std::string Data;
|
||||||
uint64_t Recorded;
|
uint64_t Recorded = 0 ;
|
||||||
uint64_t Sanity;
|
uint64_t Sanity = 0 ;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Capabilities {
|
struct Capabilities {
|
||||||
std::string Capabilities;
|
std::string Capabilities;
|
||||||
uint64_t FirstUpdate;
|
uint64_t FirstUpdate = 0 ;
|
||||||
uint64_t LastUpdate;
|
uint64_t LastUpdate = 0 ;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -100,10 +100,10 @@ namespace OpenWifi::GWObjects {
|
|||||||
std::string SerialNumber;
|
std::string SerialNumber;
|
||||||
std::string Log;
|
std::string Log;
|
||||||
std::string Data;
|
std::string Data;
|
||||||
uint64_t Severity;
|
uint64_t Severity = 0 ;
|
||||||
uint64_t Recorded;
|
uint64_t Recorded = 0 ;
|
||||||
uint64_t LogType;
|
uint64_t LogType = 0 ;
|
||||||
uint64_t UUID;
|
uint64_t UUID = 0 ;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -137,6 +137,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
uint64_t AttachDate = 0 ;
|
uint64_t AttachDate = 0 ;
|
||||||
uint64_t AttachSize = 0 ;
|
uint64_t AttachSize = 0 ;
|
||||||
std::string AttachType;
|
std::string AttachType;
|
||||||
|
double executionTime = 0.0;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -152,20 +153,20 @@ namespace OpenWifi::GWObjects {
|
|||||||
struct RttySessionDetails {
|
struct RttySessionDetails {
|
||||||
std::string SerialNumber;
|
std::string SerialNumber;
|
||||||
std::string Server;
|
std::string Server;
|
||||||
uint64_t Port;
|
uint64_t Port = 0 ;
|
||||||
std::string Token;
|
std::string Token;
|
||||||
uint64_t TimeOut;
|
uint64_t TimeOut = 0 ;
|
||||||
std::string ConnectionId;
|
std::string ConnectionId;
|
||||||
uint64_t Started;
|
uint64_t Started = 0 ;
|
||||||
std::string CommandUUID;
|
std::string CommandUUID;
|
||||||
uint64_t ViewPort;
|
uint64_t ViewPort = 0 ;
|
||||||
std::string DevicePassword;
|
std::string DevicePassword;
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Dashboard {
|
struct Dashboard {
|
||||||
uint64_t snapshot;
|
uint64_t snapshot = 0 ;
|
||||||
uint64_t numberOfDevices;
|
uint64_t numberOfDevices = 0 ;
|
||||||
Types::CountedMap commands;
|
Types::CountedMap commands;
|
||||||
Types::CountedMap upTimes;
|
Types::CountedMap upTimes;
|
||||||
Types::CountedMap memoryUsed;
|
Types::CountedMap memoryUsed;
|
||||||
|
|||||||
@@ -181,7 +181,15 @@ namespace OpenWifi::RESTAPI_utils {
|
|||||||
Obj.set(Field,V);
|
Obj.set(Field,V);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, const std::string & S) {
|
inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, double V) {
|
||||||
|
Obj.set(Field,V);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, float V) {
|
||||||
|
Obj.set(Field,V);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, const std::string & S) {
|
||||||
Obj.set(Field,S);
|
Obj.set(Field,S);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1036,7 +1044,39 @@ namespace OpenWifi {
|
|||||||
static const std::string uSERVICE_SUBCRIBER{ "owsub"};
|
static const std::string uSERVICE_SUBCRIBER{ "owsub"};
|
||||||
static const std::string uSERVICE_INSTALLER{ "owinst"};
|
static const std::string uSERVICE_INSTALLER{ "owinst"};
|
||||||
|
|
||||||
template <class Record, typename KeyType = std::string, int Size=256, int Expiry=60000> class RecordCache {
|
class ConfigurationEntry {
|
||||||
|
public:
|
||||||
|
template <typename T> explicit ConfigurationEntry(T def) :
|
||||||
|
Default_(def),
|
||||||
|
Current_(def){
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> explicit ConfigurationEntry(T def, T cur, const std::string &Hint="") :
|
||||||
|
Default_(def),
|
||||||
|
Current_(cur),
|
||||||
|
Hint_(Hint){
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ConfigurationEntry()=default;
|
||||||
|
inline ~ConfigurationEntry()=default;
|
||||||
|
|
||||||
|
template <typename T> explicit operator T () const { return std::get<T>(Current_); }
|
||||||
|
inline ConfigurationEntry & operator=(const char *v) { Current_ = std::string(v); return *this;}
|
||||||
|
template <typename T> ConfigurationEntry & operator=(T v) { Current_ = (T) v; return *this;}
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
Current_ = Default_;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::variant<bool,uint64_t,std::string> Default_, Current_;
|
||||||
|
std::string Hint_;
|
||||||
|
};
|
||||||
|
inline std::string to_string(const ConfigurationEntry &v) { return (std::string) v; }
|
||||||
|
|
||||||
|
typedef std::map<std::string,ConfigurationEntry> ConfigurationMap_t;
|
||||||
|
|
||||||
|
template <class Record, typename KeyType = std::string, int Size=256, int Expiry=60000> class RecordCache {
|
||||||
public:
|
public:
|
||||||
explicit RecordCache( KeyType Record::* Q) :
|
explicit RecordCache( KeyType Record::* Q) :
|
||||||
MemberOffset(Q){
|
MemberOffset(Q){
|
||||||
|
|||||||
Reference in New Issue
Block a user