Ejemplo n.º 1
0
def show_operator(modem):
    out = atc._common_run(modem, '+COPS?', prefixed=False)[0]
    data = atc._enlist_data(out.split(': '))
    try:
        return data[1][2] # operator
    except IndexError:
        return ''
Ejemplo n.º 2
0
def show_operator(modem):
    out = atc._common_run(modem, '+COPS?', prefixed=False)[0]
    data = atc._enlist_data(out.split(': '))
    try:
        return data[1][2]  # operator
    except IndexError:
        return ''
Ejemplo n.º 3
0
def system_info(modem):
    """
    Voice (CS, circuit switched): equivalent to dialup data,
        dial a number and the data flows like in a voice call
    Packet (PS, packet switched): packets of data transmitted
        by GPRS or 3G
    """
    key = [
        ('Service', {
            0: 'No service',
            1: 'Restricted service',
            2: 'Valid service',
            3: 'Restricted regional service',
            4: 'Power-saving and deep sleep state'
        }),
        ('Type', {
            0: 'No service',
            1: 'Voice service only',
            2: 'Packet service only',
            3: 'Packet+Voice service',
            4: 'Voice and packet service not registered, searching'
        }),
        ('Roaming', {
            0: 'Not now',
            1: 'Enabled'
        }),
        (
            'Mode',
            {
                0: 'No service',
                1: 'AMPS',  # currently
                2: 'CDMA',  # not in use 
                3: 'GSM/GPRS',
                4: 'HDR',
                5: 'WCDMA',
                6: 'GPS'
            }),
        ('SIM card state', {
            0: 'Invalid / pin code locked',
            1: 'Valid',
            2: 'Invalid for voice service',
            3: 'Invalid for packet service',
            4: 'Invalid for voice and packet service',
            255: 'SIM card is not existent'
        })
    ]

    info = atc._common_run(modem, '^SYSINFO', prefixed=False)[0]
    info = info.replace('^SYSINFO:', '').split(',')
    keys = [x for x, y in key]
    out = {}
    for k, v in zip(keys, info):
        out[k] = dict(key)[k][int(v)]
    return out
Ejemplo n.º 4
0
def system_info(modem):
    """
    Voice (CS, circuit switched): equivalent to dialup data,
        dial a number and the data flows like in a voice call
    Packet (PS, packet switched): packets of data transmitted
        by GPRS or 3G
    """
    key = [
    ('Service', {
        0: 'No service',
        1: 'Restricted service',
        2: 'Valid service',
        3: 'Restricted regional service',
        4: 'Power-saving and deep sleep state'
        }),
    ('Type', {
        0: 'No service',
        1: 'Voice service only',
        2: 'Packet service only',
        3: 'Packet+Voice service',
        4: 'Voice and packet service not registered, searching'
        }),
    ('Roaming', {
        0: 'Not now',
        1: 'Enabled'
        }),
    ('Mode', {
        0: 'No service',
        1: 'AMPS', # currently
        2: 'CDMA', # not in use 
        3: 'GSM/GPRS',
        4: 'HDR',
        5: 'WCDMA',
        6: 'GPS'
        }),
    ('SIM card state', {
        0: 'Invalid / pin code locked',
        1: 'Valid',
        2: 'Invalid for voice service',
        3: 'Invalid for packet service',
        4: 'Invalid for voice and packet service',
        255: 'SIM card is not existent'
        })
    ]
    
    info = atc._common_run(modem, '^SYSINFO', prefixed=False)[0]
    info = info.replace('^SYSINFO:','').split(',')
    keys = [x for x, y in key]
    out = {}
    for k,v in zip(keys, info):
        out[k] = dict(key)[k][int(v)]
    return out
Ejemplo n.º 5
0
def show_phone_no(modem):
    out = atc._common_run(modem, '+CNUM', prefixed=True)
    try:
        return out[0].replace('"', '').split(',')[1]
    except IndexError:
        return ''
Ejemplo n.º 6
0
def show_imsi(modem):
    '''Show IMSI (SIM) number.'''
    return atc._common_run(modem, '+CIMI', prefixed=False)[0]
Ejemplo n.º 7
0
def show_phone_no(modem):
    out = atc._common_run(modem, '+CNUM', prefixed=True)
    try:
        return out[0].replace('"','').split(',')[1]
    except IndexError:
        return ''
Ejemplo n.º 8
0
def show_imsi(modem):
    '''Show IMSI (SIM) number.'''
    return atc._common_run(modem, '+CIMI', prefixed=False)[0]