RE: Noob question re Qt Application structure

2010-05-09 Thread Scifi Guy

Chitti Babu said:
 
Hi Sudheer,

Yes, I had a similar use-case and faced the same problem. 
I ensured that my daemon was properly osso-initialised to ensure that its 
triggered properly by gui-app via dbus-daemon successfully. 
 
But, in your use-case, you seem to use QT. I am not aware of the fix.

Regards,
Chitti

Hello Chitti,

Thanks for your response. Yes, I am  using Qt4.6 to build the application.
I thought about using osso_initialize() but I couldn't find any 
examples/tutorial regarding 
using OSSO functions in Qt. All the existing ones are based on GTK or Python. 

Then I read somewhere that using osso initialize and de-initialize are not 
necessary if you are 
registering and un-registering the custom DBUS service through code. I am 
registering the DBUS service through code.
In any case, I will try OSSO sometime again in future.
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: Noob question re Qt Application structure

2010-05-08 Thread Scifi Guy

 Twas brillig at 10:05:38 07.05.2010 UTC-07 when scifi@hotmail.com
 did gyre and gimble:
 
  SG Could you please elaborate what you mean by upon first access?
 
 There is elaborate documentation.
 
 http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-starting-services
 
 -- 
   http://fossarchy.blogspot.com/

Thank you :) 

I will create the service for the daemon and post back the results. Probably 
tonight (at work now). 

Thank you all for taking time to read and respond to my post.

~Sudheer
  
I am back with my questions again. Not sure If I need to start a new thread but 
let me ask anyway.

I have split my functionality into two apps, one running as a daemon and 
another as a GUI app. Now, I am trying send dbus signals to daemon. Till now I 
am not successful. Could you guys tell me what am I doing wrong here?

Here is my  /usr/share/dbus-1/services/org.maemo.vicar.service file content

# Service description file
[D-BUS Service]
Name=org.maemo.vicar
Exec=/home/user/vicar-daemon

# Code from the cpp file
if (!connection.registerService(org.maemo.vicar)) {
qDebug()  dbusUtility.getErrorMessage();
exit(1);
}

if (!connection.registerObject(/org/maemo/vicar, this,
QDBusConnection::ExportScriptableSlots)) {
qDebug()  dbusUtility.getErrorMessage();
exit(2);
}

1) If I reboot the device, the service does not get activated automatically. I 
verified this by running the method call  org.freedesktop.DBus.ListNames (on 
System Bus). But If I run the executable manually, the service is registered 
successfully to system bus and I can see the name listed with the method call 
org.freedesktop.DBus.ListNames. Why is the daemon not launched automatically?

2) The daemon app connects to a custom signal on launch. 
   
  QDBusConnection connection = QDBusConnection::systemBus();

bool success = connection.connect(QString(),
   QString(),
   QString(org.maemo.vicar),
   QString(startOutgoingCallMonitor),this,
   SLOT(startOutgoingCallMonitor()));

I am receiving the boolean value as successful. With the app running, I tried 
to send the Dbus signal from terminal. I am not successful so far. Could you 
tell me what is wrong here?

~ $ dbus-send --system --print-reply --type=signal --dest=org.maemo.vicar 
org/maemo/vicar org.maemo.vicar.startOutgoingCallMonitor
process 1686: arguments to dbus_message_new_signal() were incorrect, assertion 
_dbus_check_is_valid_path (path) failed in file dbus-message.c line 1165.
This is normally a bug in some application using the D-Bus library.
Couldn't allocate D-Bus message

  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccountocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Noob question re Qt Application structure

2010-05-07 Thread Ram Kurvakat
just my 2 pence worth.

you should perhaps try to make 2 different apps for it.
1 which runs as a daemon and invoked on startup using an upstart  
http://upstart.ubuntu.com/getting-started.html script.
and the other a GUI based app , that can interact with your daemon, via files, 
sockets, any which way.

cheers
Ram


- Original Message -
From: Scifi Guy
Sent: 05/07/10 03:26 PM
To: maemo-developers@maemo.org
Subject: Noob question re Qt Application structure

 Hi All,

I am developing a Qt4.6 based application that monitors outgoing international 
calls (by connecting to relevant DBUS signals) and routes
them via a calling card number. I have developed a configuration UI widget 
(QWidget subclass) to enable/disable such routing. 
The problem is that the UI widget code and DBUS slots code are all in the same 
class. If I launch the application, the UI widget is shown.

This is the code in my main.cpp.


#include QtGui/QApplication
#include eventmonitor.h
#include QDebug

int main(int argc, char *argv[])
{

 QApplication a(argc, argv); 
 EventMonitor w;
 w.show();
 return a.exec();
}


EventMonitor is a QWidget subclass which also has functions to connect to DBUS 
signals. My aim is to separate the functionality into two different classes. 
The class with DBus slots should be running as a daemon which is invoked on 
startup.
The class with QWidget (config screen) should be invoked when user launches the 
app from the applications menu. Think on the lines of AutoDisconnect. 

What is the best way to achieve this? Let me know if you want me to post more 
code.


Thanks  Regards,
Sudheer 
-
The New Busy is not the old busy. Search, chat and e-mail from your inbox. Get 
started. 
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Noob question re Qt Application structure

2010-05-07 Thread ianaré sévi
I second that opinion. Subclassing by functionality is definitely good
for a single app, but if you need to have the two parts running at
different times a daemon app and a GUI app is the way to go.

Another option you could use to interact with your two apps is through
dbus itself, ince you will already be using that kind of code.

- ianaré sévi



2010/5/7 Ram Kurvakat rkma...@gmx.com:
 just my 2 pence worth.

 you should perhaps try to make 2 different apps for it.

 1 which runs as a daemon and invoked on startup using an upstart script.

 and the other a GUI based app , that can interact with your daemon, via
 files, sockets, any which way.

 cheers

 Ram

 - Original Message -

 From: Scifi Guy

 Sent: 05/07/10 03:26 PM

 To: maemo-developers@maemo.org

 Subject: Noob question re Qt Application structure

 Hi All,

 I am developing a Qt4.6 based application that monitors outgoing
 international calls (by connecting to relevant DBUS signals) and routes
 them via a calling card number. I have developed a configuration UI widget
 (QWidget subclass) to enable/disable such routing.
 The problem is that the UI widget code and DBUS slots code are all in the
 same class. If I launch the application, the UI widget is shown.

 This is the code in my main.cpp.


 #include QtGui/QApplication
 #include eventmonitor.h
 #include QDebug

 int main(int argc, char *argv[])
 {

     QApplication a(argc, argv);
     EventMonitor w;
     w.show();
     return a.exec();
 }


 EventMonitor is a QWidget subclass which also has functions to connect to
 DBUS signals. My aim is to separate the functionality into two different
 classes. The class with DBus slots should be running as a daemon which is
 invoked on startup.
 The class with QWidget (config screen) should be invoked when user launches
 the app from the applications menu. Think on the lines of AutoDisconnect.

 What is the best way to achieve this? Let me know if you want me to post
 more code.


 Thanks  Regards,
 Sudheer
 
 The New Busy is not the old busy. Search, chat and e-mail from your inbox.
 Get started.





 ___
 maemo-developers mailing list
 maemo-developers@maemo.org
 https://lists.maemo.org/mailman/listinfo/maemo-developers


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: Noob question re Qt Application structure

2010-05-07 Thread Scifi Guy

Hi Ram  ianaré,

Thank you for the response. Creating two apps makes sense. I was trying to 
avoid user having to install two apps for one feature. But it is not a big deal 
i guess (If i set the dependencies properly).

Here is another question though. How I do launch/kill the daemon app from the 
GUI app? This is required when user chooses enable/disable application from GUI 
app. I can exit the daemon by receiving a custom DBUS signal but how do I 
launch it?

Thanks  Regards,
Sudheer

P.S: Sometimes 2 cents is worth more than a million :)

 Date: Fri, 7 May 2010 10:54:15 -0400
 Subject: Re: Noob question re Qt Application structure
 From: ian...@gmail.com
 To: rkma...@gmx.com
 CC: scifi@hotmail.com; maemo-developers@maemo.org
 
 I second that opinion. Subclassing by functionality is definitely good
 for a single app, but if you need to have the two parts running at
 different times a daemon app and a GUI app is the way to go.
 
 Another option you could use to interact with your two apps is through
 dbus itself, ince you will already be using that kind of code.
 
 - ianaré sévi
 
 
 
 2010/5/7 Ram Kurvakat rkma...@gmx.com:
  just my 2 pence worth.
 
  you should perhaps try to make 2 different apps for it.
 
  1 which runs as a daemon and invoked on startup using an upstart script.
 
  and the other a GUI based app , that can interact with your daemon, via
  files, sockets, any which way.
 
  cheers
 
  Ram
 
  - Original Message -
 
  From: Scifi Guy
 
  Sent: 05/07/10 03:26 PM
 
  To: maemo-developers@maemo.org
 
  Subject: Noob question re Qt Application structure
 
  Hi All,
 
  I am developing a Qt4.6 based application that monitors outgoing
  international calls (by connecting to relevant DBUS signals) and routes
  them via a calling card number. I have developed a configuration UI widget
  (QWidget subclass) to enable/disable such routing.
  The problem is that the UI widget code and DBUS slots code are all in the
  same class. If I launch the application, the UI widget is shown.
 
  This is the code in my main.cpp.
 
 
  #include QtGui/QApplication
  #include eventmonitor.h
  #include QDebug
 
  int main(int argc, char *argv[])
  {
 
  QApplication a(argc, argv);
  EventMonitor w;
  w.show();
  return a.exec();
  }
 
 
  EventMonitor is a QWidget subclass which also has functions to connect to
  DBUS signals. My aim is to separate the functionality into two different
  classes. The class with DBus slots should be running as a daemon which is
  invoked on startup.
  The class with QWidget (config screen) should be invoked when user launches
  the app from the applications menu. Think on the lines of AutoDisconnect.
 
  What is the best way to achieve this? Let me know if you want me to post
  more code.
 
 
  Thanks  Regards,
  Sudheer
  
  The New Busy is not the old busy. Search, chat and e-mail from your inbox.
  Get started.
 
 
 
 
 
  ___
  maemo-developers mailing list
  maemo-developers@maemo.org
  https://lists.maemo.org/mailman/listinfo/maemo-developers
 
 
  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: Noob question re Qt Application structure

2010-05-07 Thread Ram Kurvakat
assuming you have the communication between the GUI and daemon in place.

you could always launch a daemon ( this is not running ) using QProcess 
http://doc.trolltech.com/4.6/qprocess.html  and shutdown by listening to a 
custom DBUS message or similar 
communication.

-Ram


- Original Message -
From: Scifi Guy
Sent: 05/07/10 04:24 PM
To: ian...@gmail.com, rkma...@gmx.com
Subject: RE: Noob question re Qt Application structure

 Hi Ram  ianaré,

Thank you for the response. Creating two apps makes sense. I was trying to 
avoid user having to install two apps for one feature. But it is not a big deal 
i guess (If i set the dependencies properly).

Here is another question though. How I do launch/kill the daemon app from the 
GUI app? This is required when user chooses enable/disable application from GUI 
app. I can exit the daemon by receiving a custom DBUS signal but how do I 
launch it?

Thanks  Regards,
Sudheer

P.S: Sometimes 2 cents is worth more than a million :)

 Date: Fri, 7 May 2010 10:54:15 -0400
 Subject: Re: Noob question re Qt Application structure
 From: ian...@gmail.com
 To: rkma...@gmx.com
 CC: scifi@hotmail.com; maemo-developers@maemo.org
 
 I second that opinion. Subclassing by functionality is definitely good
 for a single app, but if you need to have the two parts running at
 different times a daemon app and a GUI app is the way to go.
 
 Another option you could use to interact with your two apps is through
 dbus itself, ince you will already be using that kind of code.
 
 - ianaré sévi
 
 
 
 2010/5/7 Ram Kurvakat rkma...@gmx.com:
  just my 2 pence worth.
 
  you should perhaps try to make 2 different apps for it.
 
  1 which runs as a daemon and invoked on startup using an upstart script.
 
  and the other a GUI based app , that can interact with your daemon, via
  files, sockets, any which way.
 
  cheers
 
  Ram
 
  - Original Message -
 
  From: Scifi Guy
 
  Sent: 05/07/10 03:26 PM
 
  To: maemo-developers@maemo.org
 
  Subject: Noob question re Qt Application structure
 
  Hi All,
 
  I am developing a Qt4.6 based application that monitors outgoing
  international calls (by connecting to relevant DBUS signals) and routes
  them via a calling card number. I have developed a configuration UI widget
  (QWidget subclass) to enable/disable such routing.
  The problem is that the UI widget code and DBUS slots code are all in the
  same class. If I launch the application, the UI widget is shown.
 
  This is the code in my main.cpp.
 
 
  #include QtGui/QApplication
  #include eventmonitor.h
  #include QDebug
 
  int main(int argc, char *argv[])
  {
 
  QApplication a(argc, argv);
  EventMonitor w;
  w.show();
  return a.exec();
  }
 
 
  EventMonitor is a QWidget subclass which also has functions to connect to
  DBUS signals. My aim is to separate the functionality into two different
  classes. The class with DBus slots should be running as a daemon which is
  invoked on startup.
  The class with QWidget (config screen) should be invoked when user launches
  the app from the applications menu. Think on the lines of AutoDisconnect.
 
  What is the best way to achieve this? Let me know if you want me to post
  more code.
 
 
  Thanks  Regards,
  Sudheer
  
  The New Busy is not the old busy. Search, chat and e-mail from your inbox.
  Get started.
 
 
 
 
 
  ___
  maemo-developers mailing list
  maemo-developers@maemo.org
  https://lists.maemo.org/mailman/listinfo/maemo-developers 
  https://lists.maemo.org/mailman/listinfo/maemo-developers 
 
 

-
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox. See how. 
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Noob question re Qt Application structure

2010-05-07 Thread ianare
Right, one way is to have two separate deb packages, making the GUI depend on 
the daemon. This is expecially useful if you envision the daemon to be accessed 
by other apps or does not need the GUI in all cases.
Another way is to package both apps (executables) in the same deb package.

- ianaré

- Original message -

 Hi Ram  ianaré,

 Thank you for the response. Creating two apps makes sense. I was trying to 
 avoid
 user having to install two apps for one feature. But it is not a big deal i
 guess (If i set the dependencies properly).

 Here is another question though. How I do launch/kill the daemon app from the
 GUI app? This is required when user chooses enable/disable application from 
 GUI
 app. I can exit the daemon by receiving a custom DBUS signal but how do I 
 launch
 it?

 Thanks  Regards,
 Sudheer

 P.S: Sometimes 2 cents is worth more than a million :)

  Date: Fri, 7 May 2010 10:54:15 -0400
  Subject: Re: Noob question re Qt Application structure
  From: ian...@gmail.com
  To: rkma...@gmx.com
  CC: scifi@hotmail.com; maemo-developers@maemo.org
 
  I second that opinion. Subclassing by functionality is definitely good
  for a single app, but if you need to have the two parts running at
  different times a daemon app and a GUI app is the way to go.
 
  Another option you could use to interact with your two apps is through
  dbus itself, ince you will already be using that kind of code.
 
  - ianaré sévi
 
 
 
  2010/5/7 Ram Kurvakat rkma...@gmx.com:
   just my 2 pence worth.
  
   you should perhaps try to make 2 different apps for it.
  
   1 which runs as a daemon and invoked on startup using an upstart script.
  
   and the other a GUI based app , that can interact with your daemon, via
   files, sockets, any which way.
  
   cheers
  
   Ram
  
   - Original Message -
  
   From: Scifi Guy
  
   Sent: 05/07/10 03:26 PM
  
   To: maemo-developers@maemo.org
  
   Subject: Noob question re Qt Application structure
  
   Hi All,
  
   I am developing a Qt4.6 based application that monitors outgoing
   international calls (by connecting to relevant DBUS signals) and routes
   them via a calling card number. I have developed a configuration UI widget
   (QWidget subclass) to enable/disable such routing.
   The problem is that the UI widget code and DBUS slots code are all in the
   same class. If I launch the application, the UI widget is shown.
  
   This is the code in my main.cpp.
  
  
   #include QtGui/QApplication
   #include eventmonitor.h
   #include QDebug
  
   int main(int argc, char *argv[])
   {
  
          QApplication a(argc, argv);
          EventMonitor w;
          w.show();
          return a.exec();
   }
  
  
   EventMonitor is a QWidget subclass which also has functions to connect to
   DBUS signals. My aim is to separate the functionality into two different
   classes. The class with DBus slots should be running as a daemon which is
   invoked on startup.
   The class with QWidget (config screen) should be invoked when user 
   launches
   the app from the applications menu. Think on the lines of AutoDisconnect.
  
   What is the best way to achieve this? Let me know if you want me to post
   more code.
  
  
   Thanks  Regards,
   Sudheer
   
   The New Busy is not the old busy. Search, chat and e-mail from your inbox.
   Get started.
  
  
  
  
  
   ___
   maemo-developers mailing list
   maemo-developers@maemo.org
   https://lists.maemo.org/mailman/listinfo/maemo-developers
  
  
                           
 _
 Hotmail is redefining busy with tools for the New Busy. Get more from your 
 inbox.
 http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Noob question re Qt Application structure

2010-05-07 Thread Mikhail Gusarov

Twas brillig at 08:24:06 07.05.2010 UTC-07 when scifi@hotmail.com
did gyre and gimble:

 SG I can exit the daemon by receiving a custom DBUS signal but how do
 SG I launch it?

Register it as a D-Bus service and daemon will be started by D-Bus upon
first access.

-- 
  http://fossarchy.blogspot.com/


pgpRfnhVJcCP4.pgp
Description: PGP signature
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: Noob question re Qt Application structure

2010-05-07 Thread Scifi Guy


 From: dotted...@dottedmag.net
 To: scifi@hotmail.com
 CC: ian...@gmail.com; rkma...@gmx.com; maemo-developers@maemo.org
 Subject: Re: Noob question re Qt Application structure
 Date: Fri, 7 May 2010 23:26:50 +0700
 
 
 Twas brillig at 08:24:06 07.05.2010 UTC-07 when scifi@hotmail.com
 did gyre and gimble:
 
  SG I can exit the daemon by receiving a custom DBUS signal but how do
  SG I launch it?
 
 Register it as a D-Bus service and daemon will be started by D-Bus upon
 first access.
 
 -- 
   http://fossarchy.blogspot.com/



Hi Mikhail,

Could you please elaborate what you mean by upon first access? This is the 
typical scenario I am assuming.

A custom D-Bus service for the daemon will be registered when user enables the 
application from the GUI app. This ideally happens only once. After enabling 
the application, user can reboot the device any number of times. Will D-Bus 
automatically start the daemon after each reboot?  Or do I need to register the 
service each time using an upstart script?

Regards,
Sudheer
  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: Noob question re Qt Application structure

2010-05-07 Thread Scifi Guy

ianaré 
wrote:
 

Right, one way is to have two separate deb packages, making the GUI depend on 
the daemon. This is expecially useful if you envision the daemon to be 
accessed by other apps or does not need the GUI in all cases.

Another way is to package both apps (executables) in the same deb package.



- ianaré 


ianaré - I'll go with two executables in same deb package then. The daemon is 
too specific for this app that there is no use creating a new deb for that 
alone. 



Thanks  Regards,
Sudheer

  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Noob question re Qt Application structure

2010-05-07 Thread Mikhail Gusarov

Twas brillig at 10:05:38 07.05.2010 UTC-07 when scifi@hotmail.com
did gyre and gimble:

 SG Could you please elaborate what you mean by upon first access?

There is elaborate documentation.

http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-starting-services

-- 
  http://fossarchy.blogspot.com/


pgpVJb22sKPlX.pgp
Description: PGP signature
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: Noob question re Qt Application structure

2010-05-07 Thread Scifi Guy


 From: dotted...@dottedmag.net
 To: scifi@hotmail.com
 CC: ian...@gmail.com; rkma...@gmx.com; maemo-developers@maemo.org
 Subject: Re: Noob question re Qt Application structure
 Date: Sat, 8 May 2010 00:19:03 +0700
 
 
 Twas brillig at 10:05:38 07.05.2010 UTC-07 when scifi@hotmail.com
 did gyre and gimble:
 
  SG Could you please elaborate what you mean by upon first access?
 
 There is elaborate documentation.
 
 http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-starting-services
 
 -- 
   http://fossarchy.blogspot.com/

Thank you :) 

I will create the service for the daemon and post back the results. Probably 
tonight (at work now). 

Thank you all for taking time to read and respond to my post.

~Sudheer
  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers