×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Eindhoven, the Netherlands
    Posts
    187

    Announce/RFC: Properties for PyS60 1.9.x

    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 21:00.

  2. #2
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    114

    Re: Announce/RFC: Properties for PyS60 1.9.x

    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

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Announce/RFC: Properties for PyS60 1.9.x

    hello Mark

    thanks for developing this great extension

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

    Enjoy Pythoning
    Gaba88

  4. #4
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Eindhoven, the Netherlands
    Posts
    187

    Re: Announce/RFC: Properties for PyS60 1.9.x

    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.

  5. #5
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    114

    Re: Announce/RFC: Properties for PyS60 1.9.x

    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

  6. #6
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Eindhoven, the Netherlands
    Posts
    187

    Re: Announce/RFC: Properties for PyS60 1.9.x

    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.

  7. #7
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Eindhoven, the Netherlands
    Posts
    187

    Re: Announce/RFC: Properties for PyS60 1.9.x

    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...

  8. #8
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Eindhoven, the Netherlands
    Posts
    187

    Re: Announce/RFC: Properties for PyS60 1.9.x

    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.

  9. #9
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Announce/RFC: Properties for PyS60 1.9.x

    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:

    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

  10. #10
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Eindhoven, the Netherlands
    Posts
    187

    Re: Announce/RFC: Properties for PyS60 1.9.x

    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.

  11. #11
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Re: Announce/RFC: Properties for PyS60 1.9.x

    Hello,

    I'm desperately looking for a method to check the charger status for a blackout safetey system for my lab. I'm using S60v3 and Python 1.9.4. I was able to install the properties version 1.0.3 via the sis file and to import the properties package but I get an error when I use the GetInt function. It is not known.

    >>> GetInt(KPSUidHWRMPowerState,KHWRMChargingStatus)
    Traceback (most recent call last):
    File "<console>", line 1, in <module>
    NameError: name 'GetInt' is not defined

    I would really apreaciate your help!

    Alex

Similar Threads

  1. [Announce] pygame for S60 for PyS60 1.9.x
    By GameDude in forum Symbian
    Replies: 57
    Last Post: 2011-02-21, 23:18
  2. Read Config / Properties/ XML File in J2ME
    By sandeepkumar03 in forum Mobile Java General
    Replies: 2
    Last Post: 2009-01-21, 11:19
  3. Nokia-specific Java system properties
    By sgerogia in forum Mobile Java General
    Replies: 6
    Last Post: 2005-05-03, 13:17
  4. Browser Properties with WML
    By vvsnaresh in forum Mobile Java General
    Replies: 0
    Last Post: 2005-01-18, 14:51
  5. Nokia-specific Java system properties
    By sgerogia in forum Mobile Java General
    Replies: 0
    Last Post: 2002-11-22, 09:32

Posting Permissions

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