commit
96af71b56f
@ -0,0 +1,5 @@
|
||||
all:
|
||||
#rm -f pepadaptop.h main
|
||||
/usr/bin/dbusxx-xml2cpp pep-introspect.xml --adaptor=pep-server-glue.h
|
||||
g++ -I/usr/include/dbus-c++-1 -I. -ldbus-c++-1 pep-server.cpp -o main
|
||||
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" ?>
|
||||
<node name="/security/pep/">
|
||||
<interface name="security.pep">
|
||||
<method name="hello" />
|
||||
</interface>
|
||||
</node>
|
@ -0,0 +1,85 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __dbusxx__pep_server_glue_h__ADAPTOR_MARSHAL_H
|
||||
#define __dbusxx__pep_server_glue_h__ADAPTOR_MARSHAL_H
|
||||
|
||||
#include <dbus-c++/dbus.h>
|
||||
#include <cassert>
|
||||
|
||||
namespace security {
|
||||
|
||||
class pep_adaptor
|
||||
: public ::DBus::InterfaceAdaptor
|
||||
{
|
||||
public:
|
||||
|
||||
pep_adaptor()
|
||||
: ::DBus::InterfaceAdaptor("security.pep")
|
||||
{
|
||||
register_method(pep_adaptor, Hello, _Hello_stub);
|
||||
}
|
||||
|
||||
::DBus::IntrospectedInterface *introspect() const
|
||||
{
|
||||
static ::DBus::IntrospectedArgument Hello_args[] =
|
||||
{
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
static ::DBus::IntrospectedMethod pep_adaptor_methods[] =
|
||||
{
|
||||
{ "Hello", Hello_args },
|
||||
{ 0, 0 }
|
||||
};
|
||||
static ::DBus::IntrospectedMethod pep_adaptor_signals[] =
|
||||
{
|
||||
{ 0, 0 }
|
||||
};
|
||||
static ::DBus::IntrospectedProperty pep_adaptor_properties[] =
|
||||
{
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
static ::DBus::IntrospectedInterface pep_adaptor_interface =
|
||||
{
|
||||
"security.pep",
|
||||
pep_adaptor_methods,
|
||||
pep_adaptor_signals,
|
||||
pep_adaptor_properties
|
||||
};
|
||||
return &pep_adaptor_interface;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/* properties exposed by this interface, use
|
||||
* property() and property(value) to get and set a particular property
|
||||
*/
|
||||
|
||||
public:
|
||||
|
||||
/* methods exported by this interface,
|
||||
* you will have to implement them in your ObjectAdaptor
|
||||
*/
|
||||
virtual void Hello() = 0;
|
||||
|
||||
public:
|
||||
|
||||
/* signal emitters for this interface
|
||||
*/
|
||||
|
||||
private:
|
||||
|
||||
/* unmarshalers (to unpack the DBus message before calling the actual interface method)
|
||||
*/
|
||||
::DBus::Message _Hello_stub(const ::DBus::CallMessage &call)
|
||||
{
|
||||
Hello();
|
||||
::DBus::ReturnMessage reply(call);
|
||||
return reply;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
#endif //__dbusxx__pep_server_glue_h__ADAPTOR_MARSHAL_H
|
@ -0,0 +1,49 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "pep-server.h"
|
||||
|
||||
#include "dbus-c++/error.h"
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
static const char *ASYNC_SERVER_NAME = "security.pep";
|
||||
static const char *ASYNC_SERVER_PATH = "/security/pep";
|
||||
|
||||
pEpServer::pEpServer(DBus::Connection &connection)
|
||||
: DBus::ObjectAdaptor(connection, ASYNC_SERVER_PATH)
|
||||
{
|
||||
}
|
||||
|
||||
void pEpServer::hello()
|
||||
{
|
||||
std::cout << "Hello World" << std::endl;
|
||||
}
|
||||
|
||||
DBus::BusDispatcher dispatcher;
|
||||
|
||||
void niam(int sig)
|
||||
{
|
||||
dispatcher.leave();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGTERM, niam);
|
||||
signal(SIGINT, niam);
|
||||
|
||||
DBus::default_dispatcher = &dispatcher;
|
||||
|
||||
DBus::Connection conn = DBus::Connection::SessionBus();
|
||||
conn.request_name(ASYNC_SERVER_NAME);
|
||||
|
||||
pEpServer server(conn);
|
||||
|
||||
dispatcher.enter();
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
#ifndef __DEMO_ASYNC_SERVER_H
|
||||
#define __DEMO_ASYNC_SERVER_H
|
||||
|
||||
#include <dbus-c++/dbus.h>
|
||||
#include "pep-server-glue.h"
|
||||
|
||||
class pEpServer
|
||||
: public security::pep_adaptor,
|
||||
public DBus::IntrospectableAdaptor,
|
||||
public DBus::ObjectAdaptor
|
||||
{
|
||||
public:
|
||||
pEpServer(DBus::Connection &connection);
|
||||
void hello();
|
||||
};
|
||||
|
||||
#endif//__DEMO_ASYNC_SERVER_H
|
Loading…
Reference in new issue