×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    8

    Multi-tasking using the S60

    Hi,
    I'm trying to develop a program that does a bit of multi-tasking.
    For the app, I'm using the AXYZ module by Cyke64. The problem is, that as soon as I connect the motion sensor (axyz.connect() for those of you familiar with the module), I lose the ability to do other things, like play an mp3. Usually, the result is that Python crashes, sometimes the phone just gets stuck all together.

    So I guess my question is - has anybody had similar experience with the module ? Any ideas ?

    Does anyone know anything about multi-threading using Python for the S60 ?

    Thanks for your help,
    Gilly.

  2. #2
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    147

    Re: Multi-tasking using the S60

    Threading is fairly limited in pys60 and it is very common for the interpreter to crash if you do things that are not "allowed". For instance try passing a file reference to s separate thread :-)

    It is definitely doable you just have to be extra careful. If you can post your pseudo code maybe we can spot something obvious...

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

    Re: Multi-tasking using the S60

    Quote Originally Posted by gillyd View Post
    as soon as I connect the motion sensor (axyz.connect() for those of you familiar with the module), I lose the ability to do other things, like play an mp3.
    Just wondering, why don't you use the Sensor API? Does AXYZ module offer something extra, which is not available in Sensor API?

    Cheers,

    --jouni

  4. #4
    Registered User
    Join Date
    Jan 2008
    Posts
    8

    Re: Multi-tasking using the S60

    I honestly was never able to find any good documentation on the sensor API. If you have any, I'd love to see it.
    The axyz module is packaged and simple to use.
    I guess that's the main +.

  5. #5
    (Retired) Nokia Developer Admin.
    Join Date
    Jan 2006
    Location
    Michigan
    Posts
    4,664

    Re: Multi-tasking using the S60

    Check the Forum Nokia Wiki for help with the S60 Sensors there is quite a library of knowledge there.

    Ron

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

    Re: Multi-tasking using the S60

    Here is a article on Forum Nokia Wiki on Sensor API

    http://wiki.forum.nokia.com/index.php/Sensor_API

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

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

    Re: Multi-tasking using the S60

    Quote Originally Posted by gillyd View Post
    I honestly was never able to find any good documentation on the sensor API. If you have any, I'd love to see it.
    I know what you mean, that's why I wrote a sample myself

    http://jouni.miettunen.googlepages.com/sensorsample

    I just updated the code for you, it's now version 1.1. It should work ok, but I have NOT tested on any real device... and Sensor API cannot be used with emulator. Should work, because previous version did and this is just a code clean-up with pylint.

    Cheers,

    --jouni

  8. #8
    Registered User
    Join Date
    Jan 2008
    Posts
    8

    Re: Multi-tasking using the S60

    As far as I can tell, using just the Sensor API gives you directional information. As in - turn over and flip.
    The AXYZ module gives number feedback of the x,y,z coordinates.

    Am I wrong ?

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

    Re: Multi-tasking using the S60

    Quote Originally Posted by gillyd View Post
    As far as I can tell, using just the Sensor API gives you directional information. As in - turn over and flip.
    The AXYZ module gives number feedback of the x,y,z coordinates.
    I don't think so, but I really don't know. I'm guessing that if you remove this line, you might get coordinate info:
    Code:
            sensor_acc.set_event_filter(sensor.OrientationEventFilter())
    As far as I know, that line makes the Sensor API to tell nothing but turning info. Since I don't have sensor device, I cannot test But when I get such a device, I'll expand the sample

    --jouni

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

    Re: Multi-tasking using the S60

    I ordered a sensor device last week (it was almost my birthday ) and received it yesterday. After some initial experiments last night I can now CONFIRM that removing that OrientationFilter will give your callback routine three numbers and a sensor id.

    Currently I have no idea what those values mean, but here's one example (a_data is my own variable, the values were filled by Sensor API). The device was about flat on it's back and I had just pressed select key:

    {'a_data': {'data_3': -287, 'data_2': -10, 'data_1': 10, 'sensor_id': 271003684}}
    Btw in my case the callback was called about 30-40 times a SECOND. Something to think about... Furthermore I believe it's "only" 30-40 a sec due to heavy debugging code I ran at the same time.

    Cheers,

    --jouni

  11. #11
    Regular Contributor
    Join Date
    Sep 2005
    Location
    Finland, Helsinki
    Posts
    323

    Sensors API

    Quote Originally Posted by JOM View Post
    - - I can now CONFIRM that removing that OrientationFilter will give your callback routine three numbers and a sensor id.

    Currently I have no idea what those values mean - -
    You have already probably tried verlet.py ?
    http://discussion.forum.nokia.com/fo...55&postcount=1

    I made slight modifications and now it prints to the screen current x/y/z values when screen is updated:
    http://plok.in/tmp/acceleration_detect.py
    (Copy to the E:\Python etc., you know...)

    Perhaps value sqrt(x^2+y^2+z^2) = 300 = 1 g = 9.81 m/s^2 ?

    Some kind of G-force meter and logger would be nice (e.g. for amusement park use).

    And a new nokiagame: how many seconds you can keep your phone floating in the air (-> throwing up, detected by gravity ~ zero). Points are calculated by mupliplying seconds and the max gravity in the end...

    Is there more detailed documentation of Sensor-API somewhere?

    --
    Aapo

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

    Re: Sensors API

    Quote Originally Posted by aaaaapo View Post
    You have already probably tried verlet.py ?
    http://discussion.forum.nokia.com/fo...55&postcount=1
    Never seen before, but thanx for the link! I'll have to search for already existing sample code and apps, thanx for pointing that out

    Quote Originally Posted by aaaaapo View Post
    I made slight modifications and now it prints to the screen current x/y/z values when screen is updated:
    http://plok.in/tmp/acceleration_detect.py
    (Copy to the E:\Python etc., you know...)
    Great! I don't still understand the values, so continued with my own version. If I manage to get it run once more before I fall asleep, I'll put it online. Still don't get those values, need to study some more background info... Completely new area for me, wonderful!

    Quote Originally Posted by aaaaapo View Post
    Is there more detailed documentation of Sensor-API somewhere?
    Me, too! Maybe something in S60 C++ docs, if such exist?

    Cheers,

    --jouni

Similar Threads

  1. Mimicing EikStart::RunApplication() on S60 2nd
    By ruslan.zalata in forum Symbian
    Replies: 2
    Last Post: 2007-11-14, 04:52
  2. Is it possible to debug a project on multi instance of emulators on SDK2 FP2 (S60)?
    By rzmadadi in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2007-07-10, 11:48
  3. Mail Sync for S60 / S60 3rd Devices
    By bmenke in forum PC Suite API and PC Connectivity SDK
    Replies: 4
    Last Post: 2006-09-17, 06:24
  4. Almost all tools (S60 MIDP SDK B0.1, Nokia S60 SDK Symbian OS v0.3) Crashes
    By alexandershalamov in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2002-07-03, 13:44

Posting Permissions

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