You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1002 B
34 lines
1002 B
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
|
|
//
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
#include "dp4service.h"
|
|
|
|
#include <QDBusConnection>
|
|
#include <QDebug>
|
|
|
|
#include <unistd.h>
|
|
|
|
static dp4::service::Dp4Service *serviceObject = nullptr;
|
|
|
|
extern "C" int DSMRegister(const char *name, void *data)
|
|
{
|
|
QDBusConnection::RegisterOptions opts = QDBusConnection::ExportAllSlots
|
|
| QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllProperties;
|
|
|
|
QString path = name;
|
|
path = QString("/%1").arg(path.replace(".", "/"));
|
|
auto connection = reinterpret_cast<QDBusConnection *>(data);
|
|
serviceObject = new dp4::service::Dp4Service;
|
|
connection->registerObject(path, serviceObject, opts);
|
|
return 0;
|
|
}
|
|
|
|
// 该函数用于资源释放
|
|
// 非常驻插件必须实现该函数,以防内存泄漏
|
|
extern "C" int DSMUnRegister(const char *name, void *data)
|
|
{
|
|
(void)name;
|
|
(void)data;
|
|
serviceObject->deleteLater();
|
|
return 0;
|
|
}
|
|
|