×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    47

    positioning.position??

    Hello.
    I was looking on internet how to use the method positioning.position() because i need to use it and i cannot understand how to use it. On the Python Library reference i didn't manage to find it.
    Does anybody knows how to use it?
    Here is my code:

    CODE:
    def init():
    try:
    positioning.set_requestors([{"type":"service", "format":"application", "data":"test_app"}])
    positioning.position(course=1,satellites=1, callback=cb, interval=500000, partial=0)

    except:
    return 0
    return 1

    Thank you!

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: positioning.position??

    It would help if you told us what you want to do. And please use the CODE quotations when posting code so indentation is kept and the code is easier to read.

    From the PyS60 documentation:

    6.6 positioning - Simplified interface to the position information

    The positioning module provides basic access to the S60 position information. The module can be
    e.g. used to access position information provided by external Bluetooth GPS-devices and by built-in
    GPS-receivers from S60 2nd Edition FP 2 onwards.
    The module offers a large amount of information (cost of service, device power consumption etc.) about
    accessible positioning devices (like GPS-modules), position, course, accuracy and satellite information
    (depending on the position device used) and much more. This module can also be used to obtain
    device/vendor specific extended information.

    Note: The module position requires Location capability to work fully in S60 3rd Edition devices.

    The following data items are available in positioning:

    POSITION_INTERVAL
    The time interval (in microseconds) between the position function callback invocation. The
    default value set is 1 000 000 microseconds (= 1 second)
    The positioning module has the following functions (for examples of the values returned, see Section
    6.6.1):
    modules()
    Get information about available positioning modules.
    default_module()
    Get default module id.
    module_info(module id)
    Get detailed information about the specied module.
    select_module(module id)
    Select a module.
    set_requestors(requestors)
    Set the requestors of the service (at least one must be set).
    position(course=0,satellites=0,callback=None, interval=positioning.POSITION_INTERVAL, partial=0)
    By default, returns the position information in a dictionary. With course and/or satellites set to
    1, information about course and satellites is also returned (if available).
    With no callback provided, this call blocks until the position information is available.
    The call returns immediately if a valid callback function is given. This callback function is then
    invoked with the specied time interval (in microseconds) in between the invocations. The callback
    function is called with the the current position information as parameter.
    If partial update is set to 1, the function might return e.g. information about satellites before the
    nal location x has been calculated.
    For an example of the dictionary returned and the detailed keys, see Section 6.6.1.
    stop_position()
    Stops an ongoing position request.

    6.6.1 Example
    The following example (invoked in a Nokia N95 device) demonstrates how to use the Python positioning
    module to obtain information about the positioning technologies in the device:
    >>> positioning.modules()
    [{'available': 0, 'id': 270526873, 'name': u'Bluetooth GPS'}, {'available': 1, '
    id': 270526858, 'name': u'Integrated GPS'}, {'available': 1, 'id': 270559509, 'n
    ame': u'Network based'}]
    >>> positioning.default_module()
    270526858
    >>> positioning.module_info(270526858)
    {'available': 1, 'status': {'data_quality': 3, 'device_status': 7}, 'version': u
    '1.00(0)', 'name': u'Integrated GPS', 'position_quality': {'vertical_accuracy':
    10.0, 'time_to_first_fix': 1000000L, 'cost': 1, 'time_to_next_fix': 1000000L, 'h
    orizontal_accuracy': 10.0, 'power_consumption': 3}, 'technology': 1, 'id': 27052
    6858, 'capabilities': 127, 'location': 1}
    >>>

    The following example demonstrates how to use the Python positioning module.
    # information about available positioning modules
    print "***available modules***"
    print positioning.modules()
    print ""
    # id of the default positioning module
    print "***default module***"
    print positioning.default_module()
    print ""
    # detailed information about the default positioning module
    print "***detailed module info***"
    print positioning.module_info(positioning.default_module())
    print ""
    # select a module (in practise, selecting default module has no
    # relevance.).
    positioning.select_module(positioning.default_module())
    # set requestors.
    # at least one requestor must be set before requesting the position.
    # the last requestor must always be service requestor
    # (whether or not there are other requestors).
    positioning.set_requestors([{"type":"service",
    "format":"application",
    "data":"test_app"}])

    # Example 1. Blocking call
    # get the position.
    # note that the first position()-call may take a long time
    # (because of gps technology).
    print "***position info***"
    print positioning.position()
    print ""
    # re-get the position.
    # this call should be much quicker.
    # ask also course and satellite information.
    print "***course and satellites***"
    print positioning.position(course=1,satellites=1)
    58 Chapter 6. Audio and Communication Services
    print ""

    # Example 2. Non-blocking call
    def cb(event):
    print "---"
    print event
    print "---"
    print "***starts the position feed***"
    print positioning.position(course=1,satellites=1,
    callback=cb, interval=500000,
    partial=0)

    An example dictionary returned/printed from the above example script could be as follows:
    {'satellites': {'horizontal_dop': 2.34999990463257, 'used_satellites': 5, 'verti
    cal_dop': 2.29999995231628, 'time': 1187167353.0, 'satellites': 11, 'time_dop':
    1.26999998092651}, 'position': {'latitude': 60.217033666473, 'altitude': 42.0, '
    vertical_accuracy': 58.0, 'longitude': 24.878942093007, 'horizontal_accuracy': 4
    7.531005859375}, 'course': {'speed': 0.0500000007450581, 'heading': 68.959999084
    4727, 'heading_accuracy': 359.989990234375, 'speed_accuracy': NaN}}

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    47

    Re: positioning.position??

    Quote Originally Posted by bogdan.galiceanu View Post
    It would help if you told us what you want to do. And please use the CODE quotations when posting code so indentation is kept and the code is easier to read.

    From the PyS60 documentation:
    I too am trying to access the built in GPS on my N95 8G using PyS60. I’ve tried the examples in the PyS60 documentation 6.6.1
    But I get this error message ‘SymbianError: [Errno -46] KErrPermissionDenied’ when calling
    Code:
    positioning.modules()
    Also
    Code:
    positioning.position()
    always returns nothing but NaN values.

    Any ideas on what I need to do to get the 6.6.1 examples to work?
    Many thanks

    FYI: Installed versions are PythonForS60_1_4_2_3rdEd.SIS and PythonScriptShell_1_4_2_3rdEd.SIS from sourceforge.net

  4. #4
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: positioning.position??

    Quote Originally Posted by ianw View Post
    I too am trying to access the built in GPS on my N95 8G using PyS60. I’ve tried the examples in the PyS60 documentation 6.6.1
    But I get this error message ‘SymbianError: [Errno -46] KErrPermissionDenied’ when calling
    Code:
    positioning.modules()
    Also
    Code:
    positioning.position()
    always returns nothing but NaN values.

    Any ideas on what I need to do to get the 6.6.1 examples to work?
    Many thanks

    FYI: Installed versions are PythonForS60_1_4_2_3rdEd.SIS and PythonScriptShell_1_4_2_3rdEd.SIS from sourceforge.net
    Nokia's Python Script Shell is not signed with Locationing capability. DLL inherits permissions from exe (Python Script Shell). You need to resign Python Script Shell with a developer certificate.
    Mikko Ohtamaa

    http://mfabrik.com
    http://blog.mfabrik.com

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    47

    Re: positioning.position??

    Quote Originally Posted by miohtama View Post
    Nokia's Python Script Shell is not signed with Locationing capability. DLL inherits permissions from exe (Python Script Shell). You need to resign Python Script Shell with a developer certificate.
    Thanks for the info. Sorry if this is a dumb newbie question but how do I ‘resign Python Script Shell with a developer certificate’ ?

  6. #6
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: positioning.position??

    Quote Originally Posted by ianw View Post
    Thanks for the info. Sorry if this is a dumb newbie question but how do I ‘resign Python Script Shell with a developer certificate’ ?
    1. You need a get developer certificate from symbiansigned.com (currently hefty 200e)

    2. Use ensymble tool to replace the certificate in SIS file (see threads in this forum)
    Mikko Ohtamaa

    http://mfabrik.com
    http://blog.mfabrik.com

  7. #7
    Registered User
    Join Date
    Apr 2008
    Posts
    47

    Re: positioning.position??

    Quote Originally Posted by miohtama View Post
    1. You need a get developer certificate from symbiansigned.com (currently hefty 200e)

    2. Use ensymble tool to replace the certificate in SIS file (see threads in this forum)
    Just read your article on symbiansigned.com. Wish me luck!

    Thanks

  8. #8
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,796

    Re: positioning.position??

    Quote Originally Posted by ianw View Post
    Just read your article on symbiansigned.com. Wish me luck!

    Thanks
    Well, Ianw, you could get your Python Script Shell at symbiansigned.com too using opensigned online if you donot have a dev cert

    And Best of Luck!

    Best Regards
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  9. #9
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: positioning.position??

    Quote Originally Posted by croozeus View Post
    Well, Ianw, you could get your Python Script Shell at symbiansigned.com too using opensigned online if you donot have a dev cert
    But you still need to rip off the existing certificate and change UIDs to non-protected range.
    Mikko Ohtamaa

    http://mfabrik.com
    http://blog.mfabrik.com

  10. #10
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,796

    Re: positioning.position??

    Quote Originally Posted by miohtama View Post
    But you still need to rip off the existing certificate and change UIDs to non-protected range.
    Here is a Pythonscript shell in the non protective UID range, ready to be opensigned online at symbiansigned.com

    Best regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  11. #11
    Registered User
    Join Date
    Apr 2008
    Posts
    47

    Re: positioning.position??

    Quote Originally Posted by croozeus View Post
    Here is a Pythonscript shell in the non protective UID range, ready to be opensigned online at symbiansigned.com

    Best regards,
    Croozeus
    Is this 3rdEd version?
    Thanks

  12. #12
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,796

    Re: positioning.position??

    Quote Originally Posted by ianw View Post
    Is this 3rdEd version?
    Thanks
    Yes. It is
    Sign it with your IMEI using OpenSigned online at symbiansigned.com

    Best Regards
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  13. #13
    Registered User
    Join Date
    Mar 2008
    Posts
    25

    Re: positioning.position??

    Quote Originally Posted by croozeus View Post
    Yes. It is
    Sign it with your IMEI using OpenSigned online at symbiansigned.com

    Best Regards
    Croozeus

    This is a great idea.

    Has anyone had success installing this script shell??
    i get update error after i have signed it online

  14. #14
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: positioning.position??

    Quote Originally Posted by ComplexT View Post
    This is a great idea.

    Has anyone had success installing this script shell??
    i get update error after i have signed it online
    Update errors are most likely due to a UID conflict. Possible solutions:
    -make sure any previous versions of the program are uninstalled before trying to install it (maybe even restart the phone before trying to install it)
    -make sure there isn't another application installed that uses the same UID

  15. #15
    Registered User
    Join Date
    Mar 2008
    Posts
    25

    Re: positioning.position??

    it installs now.. but its not in the same location as the python for s60 i have installed. i also cannot see the shell anymore it has gone. which obviously means its not in the right place.. but if i install an unsigned shell it worls fine. So, because its signed it wont show up the shell..?

    disaster..!
    Last edited by ComplexT; 2008-04-17 at 22:43.

Similar Threads

  1. positioning.position() doesn't work
    By Chiara81000 in forum Symbian
    Replies: 5
    Last Post: 2007-10-31, 18:49

Posting Permissions

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