You Are Here:

Community: Developer Discussion Boards

#1 Old Announce/RFC: Properties for PyS60 1.9.x - 2009-06-30, 01:59

Join Date: Jul 2007
Posts: 159
Location: Eindhoven, the Netherlands
hurenkam
Offline
Regular Contributor
Hi,

Having been unable to find an extension that implements an interface to get at the hwrmpowerstate items (at least the ChargerStatus), I decided it was time to dive into python extension writing myself.
The result is a generic interface to the RProperty class (which implements the Publish & Subscribe interface in Symbian C++). With this extension you can get at the KHWRMBatteryLevel, KHWRMBatteryStatus, and KHWRMChargingStatus keys of the KPSUidHWRMPowerState category.
(of course, since it is a generic interface, you can get at other categories & keys as well)

Now this code is not perfect yet, it crashes python when you exit the interpreter, and there may be some other issues, however, it works for me, I can get at the chargerstatus settings, and can even subscribe to changes.

Open Issues:
1) Exit code & Error handling is not properly done everywhere, causing an error upon exit of the interpreter
2) Access rights are set to their defaults upon creation. This may not allow you to share properties between processes.

Sources can be found here: http://code.google.com/p/tracker-py/...properties/src
Unsigned SIS can be found here: http://code.google.com/p/tracker-py/...properties.sis

Update: Zip package for Module Repository can be found here: http://code.google.com/p/tracker-py/...properties.zip

Currently, I have only support for 1.9.x releases of python.
A port to 1.4.5 is in the works, but for those eager to port it themselves, here are some tips from an earlier port:
http://discussion.forum.nokia.com/fo...d.php?t=169265


Regards,
Mark.
Last edited by hurenkam : 2009-06-30 at 22:00.
Reply With Quote

#2 Old Re: Announce/RFC: Properties for PyS60 1.9.x - 2009-06-30, 05:43

Join Date: Oct 2007
Posts: 114
ashwinurao
Offline
Regular Contributor
Quote:
Originally Posted by hurenkam View Post
Currently, I have only support for 1.9.x releases of python.
Great!

Quote:
Originally Posted by hurenkam View Post
Short story: Please please distribute it so that users will extract your extension to their module repository.

Long story: Instead of distributing your extension as unsigned sis, can you please distribute the PYD in some archive so that application developers who would need your extension would just extract it on their PC and directly import it in their application - and guess what - this is possible with Module Repository!

So, all you need to do is create a directory named "properties" under dev-modules directory(I'm guessing you have installed either the tar or setup.exe of 1.9.x) and place the kf_properties.pyd there. Now zip the directory "properties" and you should distribute _this_ archive. Now anyone who wants to use your extension just needs to extract this zip(any archive format can be used) into the dev-modules directory on their PC. They can then do "import properties" in their application and when they use PyS60 application packager to create a sis, the application packager will scan the dev-modules directory for properties and automatically package this PYD with their application. Another important thing to note is that it will modify the capabilities of the PYD to match that of the EXE thus eliminating the numerous KErrPermissionDenied errors which users see because of capability mismatches between PYDs(extension modules) and EXE(their application).


import antigravity
Reply With Quote

#3 Old Re: Announce/RFC: Properties for PyS60 1.9.x - 2009-06-30, 10:07

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hello Mark

thanks for developing this great extension

i will soon put my comments on this once i check the module.

Enjoy Pythoning
Gaba88


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#4 Old Re: Announce/RFC: Properties for PyS60 1.9.x - 2009-06-30, 10:58

Join Date: Jul 2007
Posts: 159
Location: Eindhoven, the Netherlands
hurenkam
Offline
Regular Contributor
Quote:
Originally Posted by ashwinurao View Post
Great!
Short story: Please please distribute it so that users will extract your extension to their module repository.
I thought I just did that... sources & sis file...

Quote:
Originally Posted by ashwinurao View Post
Long story: Instead of distributing your extension as unsigned sis, can you please distribute the PYD in some archive so that application developers who would need your extension would just extract it on their PC and directly import it in their application - and guess what - this is possible with Module Repository!
I'll make the pyd available as well then.

Quote:
Originally Posted by ashwinurao View Post
So, all you need to do is create a directory named "properties" under dev-modules directory(I'm guessing you have installed either the tar or setup.exe of 1.9.x) and place the kf_properties.pyd there. Now zip the directory "properties" and you should distribute _this_ archive. Now anyone who wants to use your extension just needs to extract this zip(any archive format can be used) into the dev-modules directory on their PC. They can then do "import properties" in their application and when they use PyS60 application packager to create a sis, the application packager will scan the dev-modules directory for properties and automatically package this PYD with their application. Another important thing to note is that it will modify the capabilities of the PYD to match that of the EXE thus eliminating the numerous KErrPermissionDenied errors which users see because of capability mismatches between PYDs(extension modules) and EXE(their application).
I haven't looked into the packager yet, since obviously it doesn't work on my Mac... I just have Windows
running in a VirtualBox, with Carbide C++, 3rdFp1 SDK and Python 1.9.5 SDK.
Connecting my N95 to the virtual machine is impossible, so I really can't use any fancy installers, I depend solely on sis packages to be installed from the phone filemanager.

When I have some time, I will see what I can do to prepare such a package.
It would help if there is a command available that I can run from the commandline which will just create it for me (just like I can run makesis properties.pkg to create a sis file).

Mark.
Reply With Quote

#5 Old Re: Announce/RFC: Properties for PyS60 1.9.x - 2009-06-30, 11:48

Join Date: Oct 2007
Posts: 114
ashwinurao
Offline
Regular Contributor
Quote:
Originally Posted by hurenkam View Post
I thought I just did that... sources & sis file...
Ah, what I meant was in a zip format so that users will extract it to their module repository.

Quote:
Originally Posted by hurenkam View Post
I haven't looked into the packager yet, since obviously it doesn't work on my Mac...
It works! Not the GUI version, but it works on the command line. Download the tar.gz package(https://garage.maemo.org/frs/downloa...0_1.9.5.tar.gz) and extract it. To package a script into sis run - "python ensymble.py py2sis my_script.py". Check "python ensymble.py py2sis --help" for more info.


Quote:
Originally Posted by hurenkam View Post
I just have Windows running in a VirtualBox, with Carbide C++, 3rdFp1 SDK and Python 1.9.5 SDK.
Connecting my N95 to the virtual machine is impossible, so I really can't use any fancy installers,
We release a tar.gz which can be used by Linux/Mac users. https://garage.maemo.org/frs/downloa...0_1.9.5.tar.gz
Although this is only useful for application developers and not extension developers since SDK and other stuff is not available.

Quote:
Originally Posted by hurenkam View Post
When I have some time, I will see what I can do to prepare such a package.
It would help if there is a command available that I can run from the commandline which will just create it for me (just like I can run makesis properties.pkg to create a sis file).
Mark.
Yes. We will try to prepare something like that. In the meantime you can read up on the "Module Repository" concept (Chapter 7 in S60 doc - PythonForS60/doc/s60/modulerepo.html if you have extracted the tar.gz).

To create a module repo compliant package all you need to do right now is -
1. Create directory named "properties".
2. Place kf_poperties.pyd in it.
3. Zip it.
4. Upload the zip and announce the link


import antigravity
Reply With Quote

#6 Old Re: Announce/RFC: Properties for PyS60 1.9.x - 2009-06-30, 21:56

Join Date: Jul 2007
Posts: 159
Location: Eindhoven, the Netherlands
hurenkam
Offline
Regular Contributor
Quote:
Originally Posted by ashwinurao View Post
It works! Not the GUI version, but it works on the command line. Download the tar.gz package(https://garage.maemo.org/frs/downloa...0_1.9.5.tar.gz) and extract it. To package a script into sis run - "python ensymble.py py2sis my_script.py". Check "python ensymble.py py2sis --help" for more info.
Will try it out when I get to it. I know ensymble, but was not aware that it could automagically package dependencies...

Quote:
Originally Posted by ashwinurao View Post
Yes. We will try to prepare something like that. In the meantime you can read up on the "Module Repository" concept (Chapter 7 in S60 doc - PythonForS60/doc/s60/modulerepo.html if you have extracted the tar.gz).

To create a module repo compliant package all you need to do right now is -
1. Create directory named "properties".
2. Place kf_poperties.pyd in it.
3. Zip it.
4. Upload the zip and announce the link
Ok, I did it the manual way on my Mac using zip, hope it is ok, you can find it here:
http://code.google.com/p/tracker-py/...properties.zip

Good luck!
Mark.
Reply With Quote

#7 Old Re: Announce/RFC: Properties for PyS60 1.9.x - 2009-07-01, 01:40

Join Date: Jul 2007
Posts: 159
Location: Eindhoven, the Netherlands
hurenkam
Offline
Regular Contributor
I just uploaded an update, v1.0.2 now also has a Cancel method that can be used to cancel a subscribe. When properly used (every subscribe is properly cancelled) this version exits without generating errors.

Will try tomorrow how this works with 1.9.6...
Reply With Quote

#8 Old Re: Announce/RFC: Properties for PyS60 1.9.x - 2009-07-04, 20:57

Join Date: Jul 2007
Posts: 159
Location: Eindhoven, the Netherlands
hurenkam
Offline
Regular Contributor
I did some more tweaking with the module, and posted another updated version 1.0.3:
http://code.google.com/p/tracker-py/downloads/list

Also I put up an initial wiki page describing the module:
http://code.google.com/p/tracker-py/wiki/Properties

Regards,
Mark.
Reply With Quote

#9 Old Re: Announce/RFC: Properties for PyS60 1.9.x - 2009-07-04, 22:02

Join Date: Mar 2003
Posts: 937
Location: Espoo, Finland
JOM's Avatar
JOM
Offline
Forum Nokia Champion
Hmph,

I think this might be something really interesting for me, too... but not sure, so got to ask: could you please give a reference where to find that "RProperty C++ class" documentation? I can't find it with S60 5th Edition SDK

One specific question, could I use it for this purpose:

Quote:
static IMPORT_C TInt SysUtil::GetLangVersion ( TDes & aValue ) [static]

Obtains the version of the currently installed language package.

Since:
S60 v2.0
Parameters:
aValue On return, contains the language package version string. The buffer should have space for KSysUtilVersionTextLength characters.

Returns:
KErrNone on success, or one of the Symbian error codes if reading the version string fails.
Curious,

--jouni
Reply With Quote

#10 Old Re: Announce/RFC: Properties for PyS60 1.9.x - 2009-07-06, 00:06

Join Date: Jul 2007
Posts: 159
Location: Eindhoven, the Netherlands
hurenkam
Offline
Regular Contributor
Quote:
Originally Posted by JOM View Post
could you please give a reference where to find that "RProperty C++ class" documentation? I can't find it with S60 5th Edition SDK
I don't know if the info is in 5th Edition SDK, but you can find it in the 3rd edition documentation:
http://library.forum.nokia.com/index...2DC40ADB0.html

And also on the wiki:
http://wiki.forum.nokia.com/index.ph...or_subscribing
http://wiki.forum.nokia.com/index.ph...for_publishing

Quote:
Originally Posted by JOM View Post
One specific question, could I use it for this purpose:

static IMPORT_C TInt SysUtil::GetLangVersion ( TDes & aValue ) [static]

Obtains the version of the currently installed language package.
This I really don't know. If the setting is published using a Uid/key combination, then yes you can. I have done a quick search, but couldn't find a reference to it in the system agent header file, and the sysutil header file does not contain such a Uid/key combination. My guess is you are out of luck...


Regards,
Mark.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
[Announce] pygame for S60 for PyS60 1.9.x GameDude Python 55 2009-10-15 08:30
Read Config / Properties/ XML File in J2ME sandeepkumar03 Mobile Java General 2 2009-01-21 12:19
Nokia-specific Java system properties sgerogia Mobile Java General 6 2005-05-03 14:17
Browser Properties with WML vvsnaresh Mobile Java General 0 2005-01-18 15:51
Nokia-specific Java system properties sgerogia Mobile Java General 0 2002-11-22 10:32

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia