2020-05-06 23:23:46 +03:00
|
|
|
#include "defaultservice.h"
|
|
|
|
|
2020-05-07 16:08:56 +03:00
|
|
|
char* arg[] = {
|
|
|
|
const_cast<char*>("/"),
|
|
|
|
const_cast<char*>("-e")
|
2020-05-06 23:23:46 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
DefaultService::DefaultService():
|
2020-05-07 16:08:56 +03:00
|
|
|
Patronum::Service<QCoreApplication>(2, arg, "TestPatronum") {
|
2020-05-06 23:23:46 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void DefaultService::start() {
|
|
|
|
QuasarAppUtils::Params::log("Server started!", QuasarAppUtils::Info);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DefaultService::handleReceive(const QList<Patronum::Feature> &data) {
|
|
|
|
|
|
|
|
QList<Patronum::Feature> notSupportedList;
|
|
|
|
for (const auto& i : data) {
|
|
|
|
if (i.cmd() == "ping") {
|
2020-05-07 16:08:56 +03:00
|
|
|
sendResuylt("pong");
|
2020-05-06 23:23:46 +03:00
|
|
|
} else {
|
|
|
|
notSupportedList += i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Patronum::Service<QCoreApplication>::handleReceive(notSupportedList);
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<Patronum::Feature> DefaultService::supportedFeatures() {
|
|
|
|
QList<Patronum::Feature> res;
|
|
|
|
res += Patronum::Feature("ping", {}, "test ping", "ping");
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|