mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-30 18:18:03 +00:00
Merge pull request #33 from Telecominfraproject/main
Fix: https://telecominfraproject.atlassian.net/browse/WIFI-10004
This commit is contained in:
@@ -26,6 +26,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
void AutoDiscovery::run() {
|
void AutoDiscovery::run() {
|
||||||
Poco::AutoPtr<Poco::Notification> Note(Queue_.waitDequeueNotification());
|
Poco::AutoPtr<Poco::Notification> Note(Queue_.waitDequeueNotification());
|
||||||
|
Utils::SetThreadName("auto-discovery");
|
||||||
while(Note && Running_) {
|
while(Note && Running_) {
|
||||||
auto Msg = dynamic_cast<DiscoveryMessage *>(Note.get());
|
auto Msg = dynamic_cast<DiscoveryMessage *>(Note.get());
|
||||||
if(Msg!= nullptr) {
|
if(Msg!= nullptr) {
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ namespace OpenWifi {
|
|||||||
{"https://ucentral.io/ucentral.schema.pretty.json", "ucentral.schema.pretty.json" }
|
{"https://ucentral.io/ucentral.schema.pretty.json", "ucentral.schema.pretty.json" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Utils::SetThreadName("file-dmnldr");
|
||||||
|
|
||||||
for(const auto &[url,filename]:Files) {
|
for(const auto &[url,filename]:Files) {
|
||||||
try {
|
try {
|
||||||
std::string FileContent;
|
std::string FileContent;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
void JobController::run() {
|
void JobController::run() {
|
||||||
Running_ = true ;
|
Running_ = true ;
|
||||||
|
Utils::SetThreadName("job-controller");
|
||||||
while(Running_) {
|
while(Running_) {
|
||||||
Poco::Thread::trySleep(2000);
|
Poco::Thread::trySleep(2000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
void Signup::run() {
|
void Signup::run() {
|
||||||
Running_ = true;
|
Running_ = true;
|
||||||
|
Utils::SetThreadName("signup-mgr");
|
||||||
while(Running_) {
|
while(Running_) {
|
||||||
Poco::Thread::trySleep(5000);
|
Poco::Thread::trySleep(5000);
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Storage::onTimer([[maybe_unused]] Poco::Timer &timer) {
|
void Storage::onTimer([[maybe_unused]] Poco::Timer &timer) {
|
||||||
|
Utils::SetThreadName("strg-janitor");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Storage::Stop() {
|
void Storage::Stop() {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TagServer::run() {
|
void TagServer::run() {
|
||||||
|
Utils::SetThreadName("tag-server");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,7 @@ namespace OpenWifi {
|
|||||||
void run() final {
|
void run() final {
|
||||||
ProvObjects::InventoryTag Device;
|
ProvObjects::InventoryTag Device;
|
||||||
started_=true;
|
started_=true;
|
||||||
|
Utils::SetThreadName("venue-cfg");
|
||||||
if(StorageService()->InventoryDB().GetRecord("id",uuid_,Device)) {
|
if(StorageService()->InventoryDB().GetRecord("id",uuid_,Device)) {
|
||||||
SerialNumber = Device.serialNumber;
|
SerialNumber = Device.serialNumber;
|
||||||
// std::cout << "Starting push for " << Device.serialNumber << std::endl;
|
// std::cout << "Starting push for " << Device.serialNumber << std::endl;
|
||||||
@@ -66,6 +67,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
done_ = true;
|
done_ = true;
|
||||||
// std::cout << "Done push for " << Device.serialNumber << std::endl;
|
// std::cout << "Done push for " << Device.serialNumber << std::endl;
|
||||||
|
Utils::SetThreadName("free");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t updated_=0, failed_=0, bad_config_=0;
|
uint64_t updated_=0, failed_=0, bad_config_=0;
|
||||||
@@ -110,6 +112,8 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void run() final {
|
inline void run() final {
|
||||||
|
|
||||||
|
Utils::SetThreadName("venue-update");
|
||||||
|
|
||||||
if(When_ && When_>OpenWifi::Now())
|
if(When_ && When_>OpenWifi::Now())
|
||||||
Poco::Thread::trySleep( (long) (When_ - OpenWifi::Now()) * 1000 );
|
Poco::Thread::trySleep( (long) (When_ - OpenWifi::Now()) * 1000 );
|
||||||
|
|
||||||
@@ -206,6 +210,8 @@ namespace OpenWifi {
|
|||||||
WebSocketClientNotificationVenueUpdateJobCompletionToUser(UI_.email, N);
|
WebSocketClientNotificationVenueUpdateJobCompletionToUser(UI_.email, N);
|
||||||
Logger().information(fmt::format("Job {} Completed: {} updated, {} failed to update , {} bad configurations.",
|
Logger().information(fmt::format("Job {} Completed: {} updated, {} failed to update , {} bad configurations.",
|
||||||
JobId_, Updated ,Failed, BadConfigs));
|
JobId_, Updated ,Failed, BadConfigs));
|
||||||
|
Utils::SetThreadName("free");
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void run() final {
|
inline void run() final {
|
||||||
|
|
||||||
|
Utils::SetThreadName("venue-reboot");
|
||||||
|
|
||||||
if(When_ && When_>OpenWifi::Now())
|
if(When_ && When_>OpenWifi::Now())
|
||||||
Poco::Thread::trySleep( (long) (When_ - OpenWifi::Now()) * 1000 );
|
Poco::Thread::trySleep( (long) (When_ - OpenWifi::Now()) * 1000 );
|
||||||
|
|
||||||
@@ -170,6 +172,9 @@ namespace OpenWifi {
|
|||||||
WebSocketClientNotificationVenueRebootCompletionToUser(UI_.email,N);
|
WebSocketClientNotificationVenueRebootCompletionToUser(UI_.email,N);
|
||||||
Logger().information(fmt::format("Job {} Completed: {} rebooted, {} failed to reboot.",
|
Logger().information(fmt::format("Job {} Completed: {} rebooted, {} failed to reboot.",
|
||||||
JobId_, rebooted_ ,failed_));
|
JobId_, rebooted_ ,failed_));
|
||||||
|
|
||||||
|
Utils::SetThreadName("free");
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void run() final {
|
inline void run() final {
|
||||||
|
|
||||||
|
Utils::SetThreadName("venue-upgr");
|
||||||
|
|
||||||
if(When_ && When_>OpenWifi::Now())
|
if(When_ && When_>OpenWifi::Now())
|
||||||
Poco::Thread::trySleep( (long) (When_ - OpenWifi::Now()) * 1000 );
|
Poco::Thread::trySleep( (long) (When_ - OpenWifi::Now()) * 1000 );
|
||||||
|
|
||||||
@@ -194,6 +196,8 @@ namespace OpenWifi {
|
|||||||
WebSocketClientNotificationVenueRebootCompletionToUser(UI_.email,N);
|
WebSocketClientNotificationVenueRebootCompletionToUser(UI_.email,N);
|
||||||
Logger().information(fmt::format("Job {} Completed: {} upgraded, {} failed to upgrade.",
|
Logger().information(fmt::format("Job {} Completed: {} upgraded, {} failed to upgrade.",
|
||||||
JobId_, upgraded_ ,failed_));
|
JobId_, upgraded_ ,failed_));
|
||||||
|
Utils::SetThreadName("free");
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -643,6 +643,27 @@ namespace OpenWifi::RESTAPI_utils {
|
|||||||
|
|
||||||
namespace OpenWifi::Utils {
|
namespace OpenWifi::Utils {
|
||||||
|
|
||||||
|
inline void SetThreadName(const char *name) {
|
||||||
|
#ifdef __linux__
|
||||||
|
Poco::Thread::current()->setName(name);
|
||||||
|
pthread_setname_np(pthread_self(), name);
|
||||||
|
#endif
|
||||||
|
#ifdef __APPLE__
|
||||||
|
Poco::Thread::current()->setName(name);
|
||||||
|
pthread_setname_np(name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SetThreadName(Poco::Thread &thr, const char *name) {
|
||||||
|
#ifdef __linux__
|
||||||
|
thr.setName(name);
|
||||||
|
pthread_setname_np(thr.tid(), name);
|
||||||
|
#endif
|
||||||
|
#ifdef __APPLE__
|
||||||
|
thr.setName(name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
enum MediaTypeEncodings {
|
enum MediaTypeEncodings {
|
||||||
PLAIN,
|
PLAIN,
|
||||||
BINARY,
|
BINARY,
|
||||||
@@ -1316,7 +1337,7 @@ namespace OpenWifi {
|
|||||||
inline void Start();
|
inline void Start();
|
||||||
inline void Stop();
|
inline void Stop();
|
||||||
private:
|
private:
|
||||||
std::atomic_bool Running_ = false;
|
mutable std::atomic_bool Running_ = false;
|
||||||
Poco::Thread Thread_;
|
Poco::Thread Thread_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1847,7 +1868,8 @@ namespace OpenWifi {
|
|||||||
Request = &RequestIn;
|
Request = &RequestIn;
|
||||||
Response = &ResponseIn;
|
Response = &ResponseIn;
|
||||||
|
|
||||||
Poco::Thread::current()->setName("WebServerThread_" + std::to_string(TransactionId_));
|
std::string th_name = "restsvr_" + std::to_string(TransactionId_);
|
||||||
|
Utils::SetThreadName(th_name.c_str());
|
||||||
|
|
||||||
if(Request->getContentLength()>0) {
|
if(Request->getContentLength()>0) {
|
||||||
if(Request->getContentType().find("application/json")!=std::string::npos) {
|
if(Request->getContentType().find("application/json")!=std::string::npos) {
|
||||||
@@ -2579,7 +2601,7 @@ namespace OpenWifi {
|
|||||||
private:
|
private:
|
||||||
std::recursive_mutex Mutex_;
|
std::recursive_mutex Mutex_;
|
||||||
Poco::Thread Worker_;
|
Poco::Thread Worker_;
|
||||||
std::atomic_bool Running_=false;
|
mutable std::atomic_bool Running_=false;
|
||||||
Poco::NotificationQueue Queue_;
|
Poco::NotificationQueue Queue_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2605,7 +2627,7 @@ namespace OpenWifi {
|
|||||||
private:
|
private:
|
||||||
std::recursive_mutex Mutex_;
|
std::recursive_mutex Mutex_;
|
||||||
Poco::Thread Worker_;
|
Poco::Thread Worker_;
|
||||||
std::atomic_bool Running_=false;
|
mutable std::atomic_bool Running_=false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KafkaDispatcher : public Poco::Runnable {
|
class KafkaDispatcher : public Poco::Runnable {
|
||||||
@@ -2662,6 +2684,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void run() override {
|
inline void run() override {
|
||||||
Poco::AutoPtr<Poco::Notification> Note(Queue_.waitDequeueNotification());
|
Poco::AutoPtr<Poco::Notification> Note(Queue_.waitDequeueNotification());
|
||||||
|
Utils::SetThreadName("kafka-dispatch");
|
||||||
while(Note && Running_) {
|
while(Note && Running_) {
|
||||||
auto Msg = dynamic_cast<KafkaMessage*>(Note.get());
|
auto Msg = dynamic_cast<KafkaMessage*>(Note.get());
|
||||||
if(Msg!= nullptr) {
|
if(Msg!= nullptr) {
|
||||||
@@ -2687,7 +2710,7 @@ namespace OpenWifi {
|
|||||||
std::recursive_mutex Mutex_;
|
std::recursive_mutex Mutex_;
|
||||||
Types::NotifyTable Notifiers_;
|
Types::NotifyTable Notifiers_;
|
||||||
Poco::Thread Worker_;
|
Poco::Thread Worker_;
|
||||||
std::atomic_bool Running_=false;
|
mutable std::atomic_bool Running_=false;
|
||||||
uint64_t FunctionId_=1;
|
uint64_t FunctionId_=1;
|
||||||
Poco::NotificationQueue Queue_;
|
Poco::NotificationQueue Queue_;
|
||||||
};
|
};
|
||||||
@@ -2882,6 +2905,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
void handleRequest(Poco::Net::HTTPServerRequest& Request, Poco::Net::HTTPServerResponse& Response) override
|
void handleRequest(Poco::Net::HTTPServerRequest& Request, Poco::Net::HTTPServerResponse& Response) override
|
||||||
{
|
{
|
||||||
|
Utils::SetThreadName("alb-request");
|
||||||
try {
|
try {
|
||||||
if((id_ % 100) == 0) {
|
if((id_ % 100) == 0) {
|
||||||
Logger_.debug(fmt::format("ALB-REQUEST({}): ALB Request {}.",
|
Logger_.debug(fmt::format("ALB-REQUEST({}): ALB Request {}.",
|
||||||
@@ -2950,7 +2974,7 @@ namespace OpenWifi {
|
|||||||
std::unique_ptr<Poco::Net::HTTPServer> Server_;
|
std::unique_ptr<Poco::Net::HTTPServer> Server_;
|
||||||
std::unique_ptr<Poco::Net::ServerSocket> Socket_;
|
std::unique_ptr<Poco::Net::ServerSocket> Socket_;
|
||||||
int Port_ = 0;
|
int Port_ = 0;
|
||||||
std::atomic_bool Running_=false;
|
mutable std::atomic_bool Running_=false;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline auto ALBHealthCheckServer() { return ALBHealthCheckServer::instance(); }
|
inline auto ALBHealthCheckServer() { return ALBHealthCheckServer::instance(); }
|
||||||
@@ -2982,7 +3006,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
||||||
RESTAPIHandler::BindingMap Bindings;
|
RESTAPIHandler::BindingMap Bindings;
|
||||||
Poco::Thread::current()->setName(fmt::format("RESTAPI_ExtServer_{}",Id));
|
Utils::SetThreadName(fmt::format("rest_ext_{}",Id).c_str());
|
||||||
return RESTAPI_ExtRouter(Path, Bindings, Logger(), Server_, Id);
|
return RESTAPI_ExtRouter(Path, Bindings, Logger(), Server_, Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3006,7 +3030,7 @@ namespace OpenWifi {
|
|||||||
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &Request) override {
|
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &Request) override {
|
||||||
try {
|
try {
|
||||||
Poco::URI uri(Request.getURI());
|
Poco::URI uri(Request.getURI());
|
||||||
Poco::Thread::current()->setName(fmt::format("ExtWebServer_{}",TransactionId_));
|
Utils::SetThreadName(fmt::format("rest_ext_{}",TransactionId_).c_str());
|
||||||
return RESTAPI_ExtServer()->CallServer(uri.getPath(), TransactionId_++);
|
return RESTAPI_ExtServer()->CallServer(uri.getPath(), TransactionId_++);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|
||||||
@@ -3115,7 +3139,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
||||||
RESTAPIHandler::BindingMap Bindings;
|
RESTAPIHandler::BindingMap Bindings;
|
||||||
Poco::Thread::current()->setName(fmt::format("RESTAPI_IntServer_{}",Id));
|
Utils::SetThreadName(fmt::format("rest_int_{}",Id).c_str());
|
||||||
return RESTAPI_IntRouter(Path, Bindings, Logger(), Server_, Id);
|
return RESTAPI_IntRouter(Path, Bindings, Logger(), Server_, Id);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
@@ -3524,6 +3548,8 @@ namespace OpenWifi {
|
|||||||
void DaemonPostInitialization(Poco::Util::Application &self);
|
void DaemonPostInitialization(Poco::Util::Application &self);
|
||||||
|
|
||||||
inline void MicroService::initialize(Poco::Util::Application &self) {
|
inline void MicroService::initialize(Poco::Util::Application &self) {
|
||||||
|
// Utils::SetThreadName("microservice");
|
||||||
|
|
||||||
// add the default services
|
// add the default services
|
||||||
LoadConfigurationFile();
|
LoadConfigurationFile();
|
||||||
InitializeLoggingSystem();
|
InitializeLoggingSystem();
|
||||||
@@ -3919,6 +3945,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline int MicroService::main([[maybe_unused]] const ArgVec &args) {
|
inline int MicroService::main([[maybe_unused]] const ArgVec &args) {
|
||||||
|
|
||||||
|
// Utils::SetThreadName("main");
|
||||||
MyErrorHandler ErrorHandler(*this);
|
MyErrorHandler ErrorHandler(*this);
|
||||||
Poco::ErrorHandler::set(&ErrorHandler);
|
Poco::ErrorHandler::set(&ErrorHandler);
|
||||||
|
|
||||||
@@ -4034,6 +4061,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void BusEventManager::run() {
|
inline void BusEventManager::run() {
|
||||||
Running_ = true;
|
Running_ = true;
|
||||||
|
Utils::SetThreadName("BusEventManager");
|
||||||
auto Msg = MicroService::instance().MakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_JOIN);
|
auto Msg = MicroService::instance().MakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_JOIN);
|
||||||
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS,MicroService::instance().PrivateEndPoint(),Msg, false);
|
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS,MicroService::instance().PrivateEndPoint(),Msg, false);
|
||||||
while(Running_) {
|
while(Running_) {
|
||||||
@@ -4119,6 +4147,8 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void KafkaProducer::run() {
|
inline void KafkaProducer::run() {
|
||||||
|
|
||||||
|
Utils::SetThreadName("KafkaProducer");
|
||||||
cppkafka::Configuration Config({
|
cppkafka::Configuration Config({
|
||||||
{ "client.id", MicroService::instance().ConfigGetString("openwifi.kafka.client.id") },
|
{ "client.id", MicroService::instance().ConfigGetString("openwifi.kafka.client.id") },
|
||||||
{ "metadata.broker.list", MicroService::instance().ConfigGetString("openwifi.kafka.brokerlist") }
|
{ "metadata.broker.list", MicroService::instance().ConfigGetString("openwifi.kafka.brokerlist") }
|
||||||
@@ -4157,6 +4187,8 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void KafkaConsumer::run() {
|
inline void KafkaConsumer::run() {
|
||||||
|
Utils::SetThreadName("KafkaConsumer");
|
||||||
|
|
||||||
cppkafka::Configuration Config({
|
cppkafka::Configuration Config({
|
||||||
{ "client.id", MicroService::instance().ConfigGetString("openwifi.kafka.client.id") },
|
{ "client.id", MicroService::instance().ConfigGetString("openwifi.kafka.client.id") },
|
||||||
{ "metadata.broker.list", MicroService::instance().ConfigGetString("openwifi.kafka.brokerlist") },
|
{ "metadata.broker.list", MicroService::instance().ConfigGetString("openwifi.kafka.brokerlist") },
|
||||||
@@ -4815,7 +4847,7 @@ namespace OpenWifi {
|
|||||||
[[nodiscard]] bool SendToUser(const std::string &userName, const std::string &Payload);
|
[[nodiscard]] bool SendToUser(const std::string &userName, const std::string &Payload);
|
||||||
void SendToAll(const std::string &Payload);
|
void SendToAll(const std::string &Payload);
|
||||||
private:
|
private:
|
||||||
std::atomic_bool Running_ = false;
|
mutable std::atomic_bool Running_ = false;
|
||||||
Poco::Thread Thr_;
|
Poco::Thread Thr_;
|
||||||
// std::unique_ptr<MyParallelSocketReactor> ReactorPool_;
|
// std::unique_ptr<MyParallelSocketReactor> ReactorPool_;
|
||||||
Poco::Net::SocketReactor Reactor_;
|
Poco::Net::SocketReactor Reactor_;
|
||||||
@@ -4912,6 +4944,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void WebSocketClientServer::run() {
|
inline void WebSocketClientServer::run() {
|
||||||
Running_ = true ;
|
Running_ = true ;
|
||||||
|
Utils::SetThreadName("ws:clnt-svr");
|
||||||
while(Running_) {
|
while(Running_) {
|
||||||
Poco::Thread::trySleep(2000);
|
Poco::Thread::trySleep(2000);
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ namespace OpenWifi {
|
|||||||
void EntityDB::AddVenues(Poco::JSON::Object &Tree, const std::string & Node) {
|
void EntityDB::AddVenues(Poco::JSON::Object &Tree, const std::string & Node) {
|
||||||
ProvObjects::Venue E;
|
ProvObjects::Venue E;
|
||||||
// std::cout << "Adding venue:" << Node << std::endl;
|
// std::cout << "Adding venue:" << Node << std::endl;
|
||||||
StorageService()->VenueDB().GetRecord("id",Node,E);
|
if(StorageService()->VenueDB().GetRecord("id",Node,E)) {
|
||||||
Poco::JSON::Array Venues;
|
Poco::JSON::Array Venues;
|
||||||
for (const auto &i: E.children) {
|
for (const auto &i: E.children) {
|
||||||
Poco::JSON::Object Venue;
|
Poco::JSON::Object Venue;
|
||||||
@@ -108,11 +108,12 @@ namespace OpenWifi {
|
|||||||
Tree.set("uuid", E.info.id);
|
Tree.set("uuid", E.info.id);
|
||||||
Tree.set("children", Venues);
|
Tree.set("children", Venues);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EntityDB::BuildTree(Poco::JSON::Object &Tree, const std::string & Node) {
|
void EntityDB::BuildTree(Poco::JSON::Object &Tree, const std::string & Node) {
|
||||||
ProvObjects::Entity E;
|
ProvObjects::Entity E;
|
||||||
// std::cout << "Adding node:" << Node << std::endl;
|
// std::cout << "Adding node:" << Node << std::endl;
|
||||||
StorageService()->EntityDB().GetRecord("id",Node,E);
|
if(StorageService()->EntityDB().GetRecord("id",Node,E)) {
|
||||||
Poco::JSON::Array Children;
|
Poco::JSON::Array Children;
|
||||||
for (const auto &i: E.children) {
|
for (const auto &i: E.children) {
|
||||||
Poco::JSON::Object Child;
|
Poco::JSON::Object Child;
|
||||||
@@ -131,6 +132,7 @@ namespace OpenWifi {
|
|||||||
Tree.set("children", Children);
|
Tree.set("children", Children);
|
||||||
Tree.set("venues", Venues);
|
Tree.set("venues", Venues);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EntityDB::ImportVenues(const Poco::JSON::Object::Ptr &O, const std::string &Parent) {
|
void EntityDB::ImportVenues(const Poco::JSON::Object::Ptr &O, const std::string &Parent) {
|
||||||
std::string Type, Name, UUID;
|
std::string Type, Name, UUID;
|
||||||
|
|||||||
Reference in New Issue
Block a user