Exemplo n.º 1
0
}

ERICSSON_CONN_DICT = {
    consts.MM_NETWORK_MODE_ANY: 1,
    consts.MM_NETWORK_MODE_2G_ONLY: 5,
    consts.MM_NETWORK_MODE_3G_ONLY: 6,
}

ERINFO_2G_GPRS, ERINFO_2G_EGPRS = 1, 2
ERINFO_3G_UMTS, ERINFO_3G_HSDPA = 1, 2

E2NAP_DISCONNECTED, E2NAP_CONNECTED, E2NAP_CONNECTING = 0, 1, 2

ERICSSON_CMD_DICT = get_cmd_dict_copy()

ERICSSON_CMD_DICT['get_card_model'] = build_cmd_dict('\s*(?P<model>\S*)\r\n')

# +CIND: 5,5,0,0,1,0,1,0,1,1,0,0
ERICSSON_CMD_DICT['get_signal_quality'] = build_cmd_dict(
                '\s*\+CIND:\s+[0-9]*,(?P<sig>[0-9]*),.*')

ERICSSON_CMD_DICT['get_network_info'] = build_cmd_dict(re.compile(r"""
                \r\n
                \+COPS:\s+
                (
                (?P<error>\d) |
                \d,\d,             # or followed by num,num,str,num
                "(?P<netname>[^"]*)",
                (?P<status>\d)
                )                  # end of group
                \s*\r\n
Exemplo n.º 2
0
    consts.MM_NETWORK_MODE_2G_PREFERRED: '04',
}

SIERRA_BAND_DICT = {
    consts.MM_NETWORK_BAND_EGSM: '03',   # EGSM (900MHz)
    consts.MM_NETWORK_BAND_DCS: '03',    # DCS (1800MHz)
    consts.MM_NETWORK_BAND_PCS: '04',    # PCS (1900MHz)
    consts.MM_NETWORK_BAND_G850: '04',   # GSM (850 MHz)
    consts.MM_NETWORK_BAND_U2100: '02',  # WCDMA 2100Mhz         (Class I)
    consts.MM_NETWORK_BAND_U800: '02',   # WCDMA 3GPP UMTS800   (Class VI)
    consts.MM_NETWORK_BAND_ANY: '00',    # any band
}

SIERRA_CMD_DICT = get_cmd_dict_copy()

SIERRA_CMD_DICT['get_band'] = build_cmd_dict(re.compile(
                    "\r\n\!BAND:\s?(?P<band>\d+)"))

SIERRA_CMD_DICT['get_network_mode'] = build_cmd_dict(re.compile(
                    "\r\n\!SELRAT:\s?(?P<mode>\d+)"))


class SierraWrapper(WCDMAWrapper):
    """Wrapper for all Sierra cards"""

    def get_band(self):
        """Returns the current used band"""

        def get_band_cb(resp):
            band = resp[0].group('band')
            return revert_dict(self.custom.band_dict)[band]
Exemplo n.º 3
0
    consts.MM_ALLOWED_MODE_ANY: None,
    consts.MM_ALLOWED_MODE_2G_ONLY: None,
}

ZTEK2525_CONN_DICT = {
    consts.MM_NETWORK_MODE_ANY: None,
    consts.MM_NETWORK_MODE_2G_ONLY: None,
}

ZTEK2525_CMD_DICT = ZTE_CMD_DICT.copy()

ZTEK2525_CMD_DICT['get_network_info'] = build_cmd_dict(re.compile(r"""
                             \r\n
                             \+COPS:\s+
                             (
                             (?P<error>\d) |
                             \d,\d, # or followed by num,num,str (fixed bearer)
                             "(?P<netname>[\w\S ]*)"
                             )      # end of group
                             \r\n
                             """, re.VERBOSE))

ZTEK2525_CMD_DICT['get_network_mode'] = build_cmd_dict(re.compile(r"""
                             \r\n
                             \+ZSNT=
                             (?P<only>\d+),
                             (?P<netsel>\d+),
                             (?P<order>\d+)
                             \r\n
                             """, re.VERBOSE))

ZTEK2525_CMD_DICT['get_network_names'] = build_cmd_dict(re.compile(r"""
Exemplo n.º 4
0
Arquivo: zte.py Projeto: achiang/wader
    (consts.MM_NETWORK_BAND_U850 |
     consts.MM_NETWORK_BAND_U1900 |
     consts.MM_NETWORK_BAND_G850 |
     consts.MM_NETWORK_BAND_PCS): 4,
}
# AT+ZBANDI=0 : Automatic (Auto) - Default
# AT+ZBANDI=1 : UMTS 850 + GSM 900/1800
# AT+ZBANDI=2 : UMTS 2100 + GSM 900/1800 (Europe)
# AT+ZBANDI=3 : UMTS 850/2100 + GSM 900/1800
# AT+ZBANDI=4 : UMTS 850/1900 + GSM 850/1900

ZTE_CMD_DICT = get_cmd_dict_copy()

ZTE_CMD_DICT['get_band'] = build_cmd_dict(re.compile(r"""
                                            \r\n
                                            \+ZBANDI:\s?
                                            (?P<band>\d)
                                            \r\n
                                            """, re.VERBOSE))

ZTE_CMD_DICT['get_network_mode'] = build_cmd_dict(re.compile(r"""
                                            \r\n
                                            \+ZSNT:\s
                                            (?P<only>\d+),
                                            (?P<netsel>\d+),
                                            (?P<order>\d+)
                                            \r\n
                                            """, re.VERBOSE))


def zte_new_conn_mode(what, device):
    zpasr = re.search(r'"(?P<mode>.*?)"(?:,"(?P<domain>.*?)")?', what)
Exemplo n.º 5
0
    consts.MM_NETWORK_MODE_2G_ONLY: 0,
    consts.MM_NETWORK_MODE_3G_ONLY: 1,
    consts.MM_NETWORK_MODE_2G_PREFERRED: 2,
    consts.MM_NETWORK_MODE_3G_PREFERRED: 3,
}

ICERA_BAND_DICT = {
}

ICERA_CMD_DICT = get_cmd_dict_copy()

# \r\n+CPBR: (1-200),80,14,0,0,0\r\n\r\nOK\r\n
ICERA_CMD_DICT['get_phonebook_size'] = build_cmd_dict(
    re.compile(r"""
        \r\n
        \+CPBR:\s
        \(\d+-(?P<size>\d+)\).*
        \r\n
    """, re.VERBOSE))

# \r\n+CMGL: 1,1,"616E64726577",23\r\n
# 0791447758100650040C9144977162470100009011503195310004D436390C\r\n
ICERA_CMD_DICT['list_sms'] = build_cmd_dict(
    re.compile(r"""
        \r\n
        \+CMGL:\s*
        (?P<id>\d+),
        (?P<where>\d),
        (?P<alpha>"\w*?")?,
        \d+
        \r\n(?P<pdu>\w+)
Exemplo n.º 6
0
    'U800': consts.MM_NETWORK_BAND_U850,
    'U900': consts.MM_NETWORK_BAND_U900,
    'U17IX': consts.MM_NETWORK_BAND_U17IX,
}

OPTION_CONN_DICT = {
    consts.MM_NETWORK_MODE_2G_ONLY: 0,
    consts.MM_NETWORK_MODE_3G_ONLY: 1,
    consts.MM_NETWORK_MODE_2G_PREFERRED: 2,
    consts.MM_NETWORK_MODE_3G_PREFERRED: 3,
    consts.MM_NETWORK_MODE_ANY: 5,
}

# Option devices like to append its serial number after the IMEI, ignore it
OPTION_CMD_DICT = get_cmd_dict_copy()
OPTION_CMD_DICT['get_imei'] = build_cmd_dict(re.compile(
                                    "\r\n(?P<imei>\d+),\S+\r\n", re.VERBOSE))

OPTION_CMD_DICT['get_sim_status'] = build_cmd_dict(re.compile(r"""
                                             _OBLS:\s(?P<sim>\d),
                                             (?P<contacts>\d),
                                             (?P<sms>\d)
                                             """, re.VERBOSE))

OPTION_CMD_DICT['get_band'] = build_cmd_dict(re.compile(r"""
                                             \r\n(?P<name>.*):\s+(?P<active>\d)
                                             """, re.VERBOSE))

OPTION_CMD_DICT['get_network_mode'] = build_cmd_dict(re.compile(r"""
                                             _OPSYS:\s
                                             (?P<mode>\d),
                                             (?P<domain>\d)
Exemplo n.º 7
0
        '5,6': consts.MM_NETWORK_MODE_HSUPA,
        '5,7': consts.MM_NETWORK_MODE_HSPA,
        '5,9': consts.MM_NETWORK_MODE_HSPA,  # doc says HSPA+
    }
    try:
        return mode_args_dict[args]
    except KeyError:
        return consts.MM_NETWORK_MODE_UNKNOWN


HUAWEI_CMD_DICT = get_cmd_dict_copy()
HUAWEI_CMD_DICT['get_syscfg'] = build_cmd_dict(re.compile(r"""
                                     \r\n
                                     \^SYSCFG:
                                     (?P<modea>\d+),
                                     (?P<modeb>\d+),
                                     (?P<theband>[0-9A-F]*),
                                     (?P<roam>\d),
                                     (?P<srv>\d)
                                     \r\n
                                     """, re.VERBOSE))

HUAWEI_CMD_DICT['get_radio_status'] = build_cmd_dict(
                       end=re.compile('\r\n\+CFUN:\s?\d\r\n'),
                       extract=re.compile('\r\n\+CFUN:\s?(?P<status>\d)\r\n'))

HUAWEI_CMD_DICT['check_pin'] = build_cmd_dict(re.compile(r"""
                        \r\n
                        \+CPIN:\s*
                        (?P<resp>
                        READY      |
                        SIM\sPIN2? |
Exemplo n.º 8
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import re

from wader.common.hardware.huawei import (HuaweiWCDMADevicePlugin,
                                          HuaweiWCDMACustomizer)
from wader.common.command import build_cmd_dict

E620_CMD_DICT = HuaweiWCDMACustomizer.cmd_dict.copy()
E620_CMD_DICT['get_roaming_ids'] = build_cmd_dict(re.compile(
                                    """
                                    \r\n
                                    \+CPOL:\s(?P<index>\d+),"(?P<netid>\d+)"
                                    """, re.VERBOSE))


class HuaweiE620Customizer(HuaweiWCDMACustomizer):
    cmd_dict = E620_CMD_DICT


class HuaweiE620(HuaweiWCDMADevicePlugin):
    """:class:`~wader.common.plugin.DevicePlugin` for Huawei's E620"""
    name = "Huawei E620"
    version = "0.1"
    author = u"Pablo Martí"
    custom = HuaweiE620Customizer()