import e32
import _elocation

def gsm_location():
    if (e32.s60_version_info >= (3, 0)):
        ret = _elocation.gsm_location()
        if (ret[4] == 1):
            return (int(ret[0]),
             int(ret[1]),
             ret[2],
             ret[3])
        else:
            return None
    else:
        return _elocation.gsm_location()

def extended_gsm_location():
    if (e32.s60_version_info >= (3, 0)):
        ret = _elocation.extended_gsm_location()
        if (ret.get('AreaKnown', False) or ret.get('CdmaSID', False)):
            return ret
        else:
            return {}
    else:
        return _elocation.extended_gsm_location()

def get_registration_status():
    return _elocation.get_registration_status()

def get_imsi():
    return _elocation.get_imsi()