signals with adaptors and interfaces

Vitaly V. Ch vitaly.v.ch at gmail.com
Mon Nov 12 06:13:06 PST 2007


In other words if I need bidirectional signal-based communication
between two program I need write two dbus object Introspection in xml
and generate two adaptors and too proxy interfaces and each program
must use adaptor from one pair and proxy interface from other?

\\wbr Vitaly


On Nov 12, 2007 2:44 PM, Thiago Macieira <thiago at kde.org> wrote:
> Em Monday 12 November 2007 13:19:22 Vitaly V. Ch escreveu:
> > 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?
>
> Not exactly. The one is the inverse of the other.
>
> With an adaptor, you emit signals (Qt→D-Bus) and you receive method calls
> (D-Bus→Qt). With a proxy interface, you receive signal emissions (D-Bus→Qt)
> and you place method calls (Qt→D-Bus).
>
> > 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)));
> > }
>
> You're using wildcard connections, so the code above is syntactically correct.
> It just seems odd that you're connecting signals called get-something. Your
> signal design seems weird, to say the least.
>
> > > > 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?
>
> You're correct.
>
> --
>
>  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