Gsm location in python

I have this script file in python running on S60:

import location def current_location(): gsm_loc = location.gsm_location() print gsm_loc current_location() 

instead of printing a tuple of mcc, mnc, lac and cellId, it prints None.

on top of my python shell, I see the location between enabled features.

what could be the problem?

Situation development:

I thought, maybe, nevertheless, my problem is the lack of opportunities. So I went to sign the PythonScriptShell file. I used the OPDA website - I know that they sign all the features, but three - which I do not use. I installed the signed PythonScriptShell file on my phone (N95). At the top, the list of features has not changed. tried again to run the script: the same result - prints No.

If someone can help me, this is really important.

thanks.

+4
source share
2 answers

I think now I can answer one part of the problem:

the reason for printing None is because it needs other features: ReadDeviceData, which was not included in the list of features on top of the python shell.

Remaining another part of the problem, why was this feature not included when I signed the PythonScriptShell file? This is not one of three limited options.

+2
source

I have the same problem with all the necessary scriptshell features: "PowerMgmnt", " ReadDeviceData strong>", "WriteDeviceData", "TrustedUI", "ProtServ", "SwEvent", "Network Services", LocalServices', 'ReadUserData' , 'WriteUserData', ' Location ', 'SurroundingsDD', 'UserEnviroment'.

Let's take a look at the source code from PythonForS60/module-repo/dev-modules/location.py :

 import e32 import _location def gsm_location(): if e32.s60_version_info>=(3,0): ret = _location.gsm_location() if ret[4]==1: # relevant information ? return (int(ret[0]),int(ret[1]),ret[2],ret[3]) else: return None # information returned by _location.gsm_location() not relevant else: return _location.gsm_location() 

On my Nokia E71 e32.s60_version_info == (3,1) , and I get the value None .

I really don't know what β€œnot relevant” means, but a direct call

 >>> import _location >>> _location.gsm_location() (u'257', u'01', 555, 11, 0) 

returns something close to my objective reality.

0
source

All Articles