mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-29 17:52:28 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -63,17 +63,9 @@ namespace OpenWifi {
|
||||
std::lock_guard G(Mutex_);
|
||||
|
||||
Initialized_ = true;
|
||||
std::string DeviceTypes;
|
||||
if (AppServiceRegistry().Get("deviceTypes", DeviceTypes)) {
|
||||
Poco::JSON::Parser P;
|
||||
try {
|
||||
auto O = P.parse(DeviceTypes).extract<Poco::JSON::Array::Ptr>();
|
||||
for (const auto &i : *O) {
|
||||
DeviceTypes_.insert(i.toString());
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
std::vector<std::string> DeviceTypes;
|
||||
AppServiceRegistry().Get("deviceTypes", DeviceTypes);
|
||||
std::for_each(DeviceTypes.begin(),DeviceTypes.end(),[&](const std::string &s){ DeviceTypes_.insert(s);});
|
||||
}
|
||||
|
||||
inline bool UpdateDeviceTypes() {
|
||||
@@ -107,15 +99,9 @@ namespace OpenWifi {
|
||||
|
||||
inline void SaveCache() {
|
||||
std::lock_guard G(Mutex_);
|
||||
|
||||
Poco::JSON::Array Arr;
|
||||
for (auto const &i : DeviceTypes_)
|
||||
Arr.add(i);
|
||||
|
||||
std::stringstream OS;
|
||||
Arr.stringify(OS);
|
||||
|
||||
AppServiceRegistry().Set("deviceTypes", OS.str());
|
||||
std::vector<std::string> DeviceTypes;
|
||||
std::for_each(DeviceTypes_.begin(),DeviceTypes_.end(),[&](const std::string &s){DeviceTypes.emplace_back(s);});
|
||||
AppServiceRegistry().Set("deviceTypes", DeviceTypes);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenWifi {
|
||||
}
|
||||
|
||||
bool Get(const char *key, std::vector<std::string> &Value) {
|
||||
if(Registry_->has(key) && Registry_->isArray(key)) {
|
||||
if(Registry_->has(key) && !Registry_->isNull(key) && Registry_->isArray(key)) {
|
||||
auto Arr = Registry_->get(key);
|
||||
for(const auto &v:Arr) {
|
||||
Value.emplace_back(v);
|
||||
|
||||
Reference in New Issue
Block a user