dbus

Aashish Raina aashish_raina at persistent.co.in
Fri Oct 26 23:53:09 PDT 2007


Hi All Of You

      please  correct me if i am wrong

                      I want to broadcast a signal on to the bus,
so that if  any interested application wants it.

So that means
1:I need to have  a server application which broadcasts a signal.
2:cliesnt will listen to it and receives it.

Right now in my server code
  a: I have connected to the system bus.
  b: as we know to in dbus every kind of communication  happens through 
objects:
      So now i will create a object from which i can send the signal and in 
future send method calls

     but in my code
                                        dbus_bus_acquire_service (conn, 
"org.pirate.parrot",
                                                                             
                                   0, &error2);

                                        which is used for accuring a service 
fails .
                                        It is printing the error message 
thatorg.freedesktop.DBus.Error.Disconnected: Disconnected prior to receiving 
a reply

                                 one more thing this org/pirate/  is this 
path choosen by our choise (i mean if we have 5 objects then 5 diff paths)


//server

 main()
{
  DBusError error,error2;
  DBusConnection *conn;

  //dbus_uint32_t serial = 0; // unique number to associate replies with 
requests
  DBusMessage* msg;
  DBusMessageIter args;

  dbus_error_init (&error);
 conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error);

 if (!conn)
   {
     fprintf (stderr, "%s: %s\n",
              error.name, error.message);
     return 1;
   }
 else
   printf("%p",conn);

 //now sending a message but from a well known address :lets accuire a 
service

 //Connecting to the system bus is a nice first step, but we want to be able 
to send messages from a well-known address. Let's acquire a service:


 dbus_bus_acquire_service (conn, "org.pirate.parrot",
                           0, &error2);
 if (dbus_error_is_set (&error2))
   {
     fprintf (stderr, "%s: %s\n",
              error2.name, error2.message);

     //dbus_connection_disconnect (conn);
     //return;
   }




DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.


More information about the dbus mailing list