/
breton75
/
modus2
Обзор
Документация
Войти
/
breton75
/
modus2
Код
Запросы
0
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
framework/dbus/sv_dbus.cpp
64 строки
2 KB
breton75
Update sv_dbus.cpp, auth.cpp, and 9 more files...
02 июл 2025, 17:37
02 июл 2025, 17:37
30a6c8c
Код
Авторство
О чём код?
#include "sv_dbus.h" //QMutex sv::SvDBus::mutex; modus::DBus::DBus(const sv::log::Options options, const QString &branch, QObject *parent): sv::SvAbstractLogger(options, parent), m_current_token(modus::Token(modus::eMain, 0)) { m_branch = branch; } void modus::DBus::init(const QString& branch) { m_branch = branch; QDBusConnection::sessionBus().registerObject(m_branch, DBUS_SERVER_NAME, this); new DBusModusInterface(DBUS_SERVER_NAME, m_branch, QDBusConnection::sessionBus(), this); // ModusDBusAdaptor *mdba = new ModusDBusAdaptor(this); } modus::DBus& modus::DBus::setToken(const modus::Token& token) { m_current_token = token; return *this; } void modus::DBus::log(sv::log::Level level, sv::log::MessageTypes type, const QString text, modus::Token token, bool newline) { m_current_token = token; log(level, type, text, newline); } void modus::DBus::log(sv::log::Level level, sv::log::MessageTypes type, const QString text, bool newline) { if(!p_options.enable || (level > p_options.level)) { resetCurrentData(); return; } QMutexLocker locker(&p_mutex); QDBusMessage msg = QDBusMessage::createSignal(QString("/%1").arg(modus::EntityCode.key(m_current_token.entity, P_MAIN)), DBUS_SERVER_NAME, "message"); msg << int(m_current_token.entity) << m_current_token.uid << int(type) << QDateTime::currentMSecsSinceEpoch() //DateTime().toString("ddMMyy-hh:mm:ss:zzz") << text; QDBusConnection::sessionBus().send(msg); if(newline) p_current_line_num++; if(m_debug_mode) qDebug() << text; resetCurrentData(); }