Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Maemo: Developers

profile functions ran on emulator does not ran on device!

 

 

Maemo developers RSS feed   Index | Next | Previous | View Threaded


mohamed.ismael at asgatech

Nov 17, 2009, 1:44 AM

Post #1 of 2 (278 views)
Permalink
profile functions ran on emulator does not ran on device!

Dear Sir;

I am trying to create a simple Application to change the current phone
profile to silent.
I installed the libprofile-dev package from nokia binaries repository,
found the documentation in the file : /<scratchbox
target>/usr/include/profiled/libprofile.h (both targets : X86 and ARMEL)

/** \brief Get name of the current profile
*
* Get name of the currently active profile.
*
* @returns profile name, NULL on error
*/
char *profile_get_profile (void);

/** \brief Set the active profile
*
* Set currently active profil.
*
* @param profile profile name
*
* @returns 0 on success, -1 on error
*/
int profile_set_profile (const char *profile);

So, I used them to write the following application:

#include <hildon/hildon.h>
#include <libprofile.h>
int main(int argc, char *argv[]) {
char * profile = profile_get_profile();
if(profile)
printf(profile);
else
printf("profile does not exist");

int state =profile_set_profile("silent");
if(state == 0)
printf("profile set successfully");
else
printf("there is an error");
return 0;
}

the application ran perfectly on the Emulator (it viewed the current
profile and changed it to silent), But when creating a debian package
out of it (using ESBOX : 'Build debian package' command) and trying the
package on the phone; I found the following:

the application works but it can't get the current profile neither
change it to silent.
it prints : "profile does not exist" and then "there is an error".


Although I installed the libprofile-dev package ON the phone - from the
nokia binaries repository- and made sure that the libprofile.so file
exists inside the phone's '/usr/lib/' dierctory. But nothing seems to work

where is the problem?? Can you help me to find the solution?

thanks
_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


daniel.wilms at nokia

Nov 17, 2009, 3:33 AM

Post #2 of 2 (253 views)
Permalink
Re: profile functions ran on emulator does not ran on device! [In reply to]

Hi,

It sounds that you are running the program on device as root? That won't
work. If so, try to run it as "user" and see if it works. You could as
well always use the DBus-service (on device) directly to test, like:

dbus-send --session --type=method_call --dest="com.nokia.profiled"
--print-reply /com/nokia/profiled com.nokia.profiled.get_profile

You can now find as well further documentation about the profile daemon
[1], the DBus-service [2] and the library [3] in the API references.

1. http://maemo.org/api_refs/5.0/5.0-final/libprofile/index.html
2. http://maemo.org/api_refs/5.0/5.0-final/libprofile/profile__dbus_8h.html
3. http://maemo.org/api_refs/5.0/5.0-final/libprofile/libprofile_8h.html

Cheers Daniel

ext mohamed ismael wrote:
> Dear Sir;
>
> I am trying to create a simple Application to change the current phone
> profile to silent.
> I installed the libprofile-dev package from nokia binaries repository,
> found the documentation in the file : /<scratchbox
> target>/usr/include/profiled/libprofile.h (both targets : X86 and ARMEL)
>
> /** \brief Get name of the current profile
> *
> * Get name of the currently active profile.
> *
> * @returns profile name, NULL on error
> */
> char *profile_get_profile (void);
>
> /** \brief Set the active profile
> *
> * Set currently active profil.
> *
> * @param profile profile name
> *
> * @returns 0 on success, -1 on error
> */
> int profile_set_profile (const char *profile);
>
> So, I used them to write the following application:
>
> #include <hildon/hildon.h>
> #include <libprofile.h>
> int main(int argc, char *argv[]) {
> char * profile = profile_get_profile();
> if(profile)
> printf(profile);
> else
> printf("profile does not exist");
>
> int state =profile_set_profile("silent");
> if(state == 0)
> printf("profile set successfully");
> else
> printf("there is an error");
> return 0;
> }
>
> the application ran perfectly on the Emulator (it viewed the current
> profile and changed it to silent), But when creating a debian package
> out of it (using ESBOX : 'Build debian package' command) and trying the
> package on the phone; I found the following:
>
> the application works but it can't get the current profile neither
> change it to silent.
> it prints : "profile does not exist" and then "there is an error".
>
>
> Although I installed the libprofile-dev package ON the phone - from the
> nokia binaries repository- and made sure that the libprofile.so file
> exists inside the phone's '/usr/lib/' dierctory. But nothing seems to work
>
> where is the problem?? Can you help me to find the solution?
>
> thanks
> _______________________________________________
> maemo-developers mailing list
> maemo-developers [at] maemo
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers

Maemo developers RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.