signals with adaptors and interfaces

Vitaly V. Ch vitaly.v.ch at gmail.com
Mon Nov 12 04:19:22 PST 2007


On Nov 12, 2007 1:46 PM, Thiago Macieira <thiago at kde.org> wrote:
> Em Monday 12 November 2007 12:32:01 Vitaly V. Ch escreveu:
> > is adaptors class usable for catching/sending signals over dbus?
>
> "Yes" and "you probably don't want it".
>
> Adaptors are useful for sending signals over D-Bus. For receiving them, you
> should connect to your own class's slots, not to slots in adaptors. There's
> nothing technically wrong with connecting signals (of any type) to slots in
> adaptors, but it seems wrong to do so.
>

As I understand adaptors and interfaces classes is gates from Qt to
dbus. But they seem unidirection.
It's right? Or i'm wrong?

for example at now I catch signals in following way:

MainClass::MainClass(const QDBusConnection & _connection_)
:   connection(_connection_)
{
    // add our D-Bus interface and connect to D-Bus
    new Sim300Adaptor(this);
    connection.registerObject("/", this);

    connection.connect(QString(), QString(), "com.i_zum.sim300",
"send_data",      this, SLOT(countersSlot(QByteArray)));
    connection.connect(QString(), QString(), "com.i_zum.sim300",
"get_money_atd",  this, SLOT(get_money_atd()));
    connection.connect(QString(), QString(), "com.i_zum.sim300",
"get_money_cusd", this, SLOT(get_money_cusd()));
    connection.connect(QString(), QString(), "com.i_zum.sim300",
"get_csq",        this, SLOT(get_csq()));
    connection.connect(QString(), QString(), "com.i_zum.sim300",
"get_opers_list", this, SLOT(get_opers_list()));
    connection.connect(QString(), QString(), "com.i_zum.sim300",
"set_oper",       this, SLOT(set_oper(QString)));
}

but at now I'm interesting in more transparent or more abstracted way

> > And is interface class usable for sending signal to dbus or only for
> > catching?
>
> You cannot emit signals for a proxy interface class. You can only emit signals
> from objects you have registered -- therefore, adaptors only.
>
> But you can connect to any proxy interface object's signals as if they were
> normal Qt signals.
>

Hm, May be I'm wrong than adaptors is for service and interfaces for
clients and both require both of them?

> --
>  Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>   PGP/GPG: 0x6EF45358; fingerprint:
>   E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>
>


More information about the dbus mailing list