02-05-2014 07:50 AM
I want to implement headless app concept in my project.
The basic concept of my project is, I want to send data usage log,text message count,gps location,call logs to server.
After each 30 sec. will check whether maximum limit is crossed for any data. Once this limit is cross we will send all data to server in xml format. Till now this all functionality is present in one project. Now I want to devide it in two parts like UI and headless part.
But I am not able to understand how to make two parts of the application.
Which part of the application I need to kept in headless part.
If I create two parts like all the screens are present in UI part and all bussiness logic in headless part then for each 30 sec how can I communicate between them.
Please correct me if I am wrong and offer some suggetions.
02-07-2014 08:29 AM
The best way to communicate between the two parts is to use InvokeRequest from the invocation framework.
02-07-2014 10:17 AM
Although I do not have full visibility to your usecase, I will try to recommend the best option here.
I dont think you need to communicate between the UI and the service every 30 seconds. You can have the UI to control some settings and whenever that changes you can invoke the headless part to refresh the settings..
The headless part would be solely responsible for collecting the data as well as sending the data to the server. Hence, I dont see a need for the headless and UI to communicate every 30 seconds in this case.
Re: communication channel between headless and UI, as Martin mentioned you can use the invocation framework. However, note that you can only invoke the headless from the UI and not the other way around. The other way to communicate is via local sockets OR you can share a file between the two.
02-12-2014 01:43 AM
Thanks for your reply..
I have some doubts related to headless application.
Basic structure of my project is like through the application we are sending current data usage, call logs, no of SMS to the server when any one of this exceeds the maximum limit which is previously set. So to check the maximum limit I am calling on function after 30 sec. First we have registration screen and then screens to show current send data usage n all..
So need of headless application in my project is we want to send data usage to server even if application is closed by user.
If I place UI part in one project and all business logic like sending data usage, checking registration in headless part, then how can I communicate between them...
e.g. If user want to register he will place user name and password then how to pass this values to headless application to call the web service and get the result?
Again according to result display a message to user. Blackberry provides invocation framework method. but how to use it for my concept?
Please help me to clear my doubts..
02-12-2014 12:07 PM
There are several ways to communicate between the UI and Headless process.
Invocation Framework: This is the easiest but it only allows you to invoke headless from UI but you cant invoke the UI from headless.
QSettings: Whenever there is a change, your headless or the UI process can write them to QSettings whcih essentially writes the data to a file. The process that needs to know about this change can create a QFileSystemWatcher to watch for changes. Please see
Local Sockets: This is probably the best but it is not the easiest to implement. Your headless can open a server socket that your UI connects to. Once the connection is made, both can communicate in real time. Please see
Hope this helps.