Files
2026-09-22 09:38:26 +08:00

75 lines
2.1 KiB
C++

/*
* SPDX-License-Identifier: LicenseRef-Unisoc-General-1.0
* Copyright 2016-2023 Unisoc (Shanghai) Technologies Co., Ltd
* Licensed under the Unisoc General Software License, version 1.0 (the License);
* you may not use this file except in compliance with the License. You may obtain a copy of the License at
* https://www.unisoc.com/en_us/license/UNISOC_GENERAL_LICENSE_V1.0-EN_US
* Software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OF ANY KIND, either express or implied.
* See the Unisoc General Software License, version 1.0 for more details.
*/
#include <Introspection.h>
#include <Object.h>
#include <Message.h>
#include <dbus/dbus.h>
#include "Debug.h"
#include <sstream>
using namespace UDBus;
static const char* gIntrospectableName = "smartlink.netcon.UDBus.Introspectable";
IntrospectableAdaptor::IntrospectableAdaptor()
: UDbusInterfaceAdaptor(gIntrospectableName)
{
REGISTER_METHOD(IntrospectableAdaptor, Introspect, Introspect);
}
Message IntrospectableAdaptor::Introspect(const CallMessage &call)
{
ReturnMessage reply(call);
return reply;
}
IntrospectableProxy::IntrospectableProxy()
: InterfaceProxy(gIntrospectableName)
{}
std::string IntrospectableProxy::Introspect()
{
UDBus::CallMessage call;
call.SetMember("Introspect");
UDBus::Message message = InvokeMethod(call);
return message.Reader().GetString();
}
const UDbusIntrospectIface *IntrospectableAdaptor::Introspect() const
{
static UDbusIntrospectMethod introspectableSignals[] = {
{ 0, 0 }
};
static UDbusIntrospectArg introspectArgs[] = {
{ "data", "s", false },
{ 0, 0, 0 }
};
static UDbusIntrospectProp introspectableProperties[] = {
{ 0, 0, 0, 0 }
};
static UDbusIntrospectMethod introspectableMethods[] = {
{ "Introspect", introspectArgs },
{ 0, 0 }
};
static UDbusIntrospectIface introspectableIface = {
gIntrospectableName,
introspectableMethods,
introspectableSignals,
introspectableProperties
};
return &introspectableIface;
}