當前位置: 首頁>>代碼示例>>Python>>正文


Python MobileDevice.MobileDevice類代碼示例

本文整理匯總了Python中MobileDevice.MobileDevice的典型用法代碼示例。如果您正苦於以下問題:Python MobileDevice類的具體用法?Python MobileDevice怎麽用?Python MobileDevice使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了MobileDevice類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: init_device

    def init_device(self) :
        ports = []
        devices =  self.hal_manager.GetAllDevices()

        device_udi = self.dev_props["info.udi"]
        
        for device in devices :
            device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
            try:
                props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
            except:
                return False

            device_tmp = props["info.udi"]
            
            if device_tmp.startswith(device_udi):
                if props.has_key("serial.device") :
                    ports.append(os.path.basename(props["serial.device"]))
            
        ports.sort()
        print ports
        
        if len(ports) >= 3 :
            self.set_property("data-device", "/dev/%s" % ports[0])
            self.set_property("conf-device", "/dev/%s" % ports[1])
            self.set_property("device-icon", "network-wireless")
            self.pretty_name = "Novatel"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        else:
            return False
開發者ID:guadalinex-archive,項目名稱:guadalinex-v5,代碼行數:34,代碼來源:MobileDeviceNovatel.py

示例2: init_device

    def init_device(self):
        print 0
        port = "/dev/rfcomm%s" % os.path.basename(self.dev_props["linux.sysfs_path"]).strip("hci")
        
        parent_dev_dbus_obj =  self.dbus.get_object("org.freedesktop.Hal", self.dev_props["info.parent"])
        try:
            parent_props = parent_dev_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
        except:
            print "init error in Bluetooth device"
            self.set_property("data-device", port)
            self.set_property("devices-autoconf", True)
            MobileDevice.init_device(self)
            return True

        if parent_props.has_key("info.subsystem") :
            if parent_props["info.subsystem"] == "usb_device" :
                if parent_props.has_key("info.product") :
                    self.pretty_name = parent_props["info.product"]
                    if self.pretty_name == "Bluetooth Host Controller Interface":
                        self.pretty_name = "Bluetooth"
                    
        
        self.set_property("data-device", port)
        self.set_property("devices-autoconf", True)
        self.set_property("device-icon", "bluetooth")

        MobileDevice.init_device(self)
        
        return True
開發者ID:oier,項目名稱:mobile-manager,代碼行數:29,代碼來源:MobileDeviceBluetooth.py

示例3: set_mode_domain

    def set_mode_domain(self, mode, domain):
        rmode = None
        rdomain = None
        
        if mode == CARD_TECH_SELECTION_GPRS :
            rmode = "1"
        elif mode == CARD_TECH_SELECTION_UMTS :
            rmode = "2"
        elif mode == CARD_TECH_SELECTION_GRPS_PREFERED :
            rmode = "1"
        elif mode == CARD_TECH_SELECTION_UMTS_PREFERED :
            rmode = "2"
        elif mode == CARD_TECH_SELECTION_AUTO :
            rmode = "0"
        else:
            rmode = "0"

        if domain == CARD_DOMAIN_CS:
            rdomain = "0"
        elif domain == CARD_DOMAIN_PS:
            rdomain = "1"
        elif domain == CARD_DOMAIN_CS_PS :
            rdomain = "2"
        elif domain == CARD_DOMAIN_ANY:
            rdomain = "2"
        else:
            rdomain = "2"

        res = self.send_at_command("AT$NWRAT=%s,%s" % (rmode, rdomain))
        self.dbg_msg ("SET DOMAIN : %s" % res)
        MobileDevice.set_mode_domain(self, mode, domain)
開發者ID:oier,項目名稱:mobile-manager,代碼行數:31,代碼來源:MobileDeviceNovatel.py

示例4: init_device

 def init_device(self) :
     ports = []
     devices =  self.hal_manager.GetAllDevices()
     for device in devices :
         device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
         try:
             props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
         except:
             return False
         
         if props.has_key("info.parent") and props["info.parent"] == self.dev_props["info.udi"]:
             if props.has_key("usb.linux.sysfs_path") :
                 files = os.listdir(props["usb.linux.sysfs_path"])
                 for f in files:
                     if f.startswith("ttyUSB") :
                         ports.append(f)
     ports.sort()
     print ports
     
     if len(ports) == 4 :
         self.set_property("data-device", "/dev/%s" % ports[0])
         self.set_property("conf-device", "/dev/%s" % ports[2])
         self.pretty_name = "Option"
         self.set_property("devices-autoconf", True)
         if not self.exists_conf :
             self.set_property("priority", "50")
         MobileDevice.init_device(self)
         return True
     else:
         return False
開發者ID:guadalinex-archive,項目名稱:guadalinex-v5,代碼行數:30,代碼來源:MobileDeviceOption.py

示例5: set_mode_domain

    def set_mode_domain(self, mode, domain):
        if mode == CARD_TECH_SELECTION_GPRS :
            res = self.send_at_command("AT!SELRAT=02")
        elif mode == CARD_TECH_SELECTION_UMTS :
            res = self.send_at_command("AT!SELRAT=01")
        elif mode == CARD_TECH_SELECTION_GRPS_PREFERED :
            res = self.send_at_command("AT!SELRAT=04")
        elif mode == CARD_TECH_SELECTION_UMTS_PREFERED :
            res = self.send_at_command("AT!SELRAT=03")
        elif mode == CARD_TECH_SELECTION_AUTO :
            res = self.send_at_command("AT!SELRAT=00")
        else:
            self.dbg_msg ("SET MODE DOMAIN : CRASH")
            return False

        self.dbg_msg ("SET MODE : %s" % res)

        if domain == CARD_DOMAIN_CS:
            real_domain = 00
        elif domain == CARD_DOMAIN_PS:
            real_domain = 01
        elif domain == CARD_DOMAIN_CS_PS :
            real_domain = 02
        elif domain == CARD_DOMAIN_ANY:
            real_domain = 02
        else:
            real_domain = 02

        res = self.send_at_command("AT!SELMODE=%s" % real_domain)
        self.dbg_msg ("SET DOMAIN : %s" % res)
        MobileDevice.set_mode_domain(self, mode, domain)
開發者ID:oier,項目名稱:mobile-manager,代碼行數:31,代碼來源:MobileDeviceSierra.py

示例6: __init__

 def __init__(self, mcontroller, dev_props):
     self.capabilities = [AT_COMM_CAPABILITY, X_ZONE_CAPABILITY]
     
     #Device list with tuplas representating the device (product_id, vendor_id)
     self.device_list = [(0xc, 0x1931)]
     
     MobileDevice.__init__(self, mcontroller, dev_props)
開發者ID:guadalinex-archive,項目名稱:guadalinex-v5,代碼行數:7,代碼來源:MobileDeviceNozomi.py

示例7: __init__

 def __init__(self, mcontroller, dev_props):
     self.capabilities = [AT_COMM_CAPABILITY, X_ZONE_CAPABILITY, SMS_CAPABILITY, ADDRESSBOOK_CAPABILITY]
     
     #Device list with tuplas representating the device (product_id, vendor_id)
     self.device_list = [(0x4400,0x1410),(0x7001, 0x1410)]
     
     MobileDevice.__init__(self, mcontroller, dev_props)
開發者ID:oier,項目名稱:mobile-manager,代碼行數:7,代碼來源:MobileDeviceNovatel.py

示例8: set_mode_domain

 def set_mode_domain(self, mode, domain):
     if domain == CARD_DOMAIN_CS:
         real_domain = 0
     elif domain == CARD_DOMAIN_PS:
         real_domain = 1
     elif domain == CARD_DOMAIN_CS_PS :
         real_domain = 2
     elif domain == CARD_DOMAIN_ANY:
         real_domain = 3
     else:
         real_domain = 2
     
     if mode == CARD_TECH_SELECTION_GPRS :
         res = self.send_at_command("AT^SYSCFG=13,0,3FFFFFFF,1,%s" % real_domain)
     elif mode == CARD_TECH_SELECTION_UMTS :
         res = self.send_at_command("AT^SYSCFG=14,0,3FFFFFFF,1,%s" % real_domain)
     elif mode == CARD_TECH_SELECTION_GRPS_PREFERED :
         res = self.send_at_command("AT^SYSCFG=2,1,3FFFFFFF,1,%s" % real_domain)
     elif mode == CARD_TECH_SELECTION_UMTS_PREFERED :
         res = self.send_at_command("AT^SYSCFG=2,2,3FFFFFFF,1,%s" % real_domain)
     elif mode == CARD_TECH_SELECTION_AUTO :
         res = self.send_at_command("AT^SYSCFG=2,0,3FFFFFFF,1,%s" % real_domain)
     else:
         self.dbg_msg ("SET MODE DOMAIN : CRASH")
         return False
     
     if res[2] == 'OK' :
         self.dbg_msg ("SET MODE DOMAIN : %s" % res)
         MobileDevice.set_mode_domain(self, mode, domain)
         return True
     else:
         self.dbg_msg ("SET MODE DOMAIN (CRASH) : %s" % res)
         return False
開發者ID:oier,項目名稱:mobile-manager,代碼行數:33,代碼來源:MobileDeviceHuawei.py

示例9: init_device

 def init_device(self) :
     ports = []
     devices =  self.hal_manager.GetAllDevices()
     for device in devices :
         device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
         try:
             props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
         except:
             return False
         
         if props.has_key("info.linux.driver") and props["info.linux.driver"] == "nozomi":
             if props.has_key("linux.sysfs_path") :
                 files = os.listdir(props["linux.sysfs_path"] + "/tty")
                 for f in files:
                     if f.startswith("noz"):
                         ports.append(f)
     ports.sort()
     print ports
     
     if len(ports) >= 3 :
         self.set_property("data-device", "/dev/%s" % ports[0])
         self.set_property("conf-device", "/dev/%s" % ports[2])
         self.set_property("device-icon", "network-wireless")
         self.pretty_name = "Option Nozomi"
         self.set_property("devices-autoconf", True)
         if not self.exists_conf :
             self.set_property("priority", "50")
         MobileDevice.init_device(self)
         return True
     else:
         return False
開發者ID:guadalinex-archive,項目名稱:guadalinex-v5,代碼行數:31,代碼來源:MobileDeviceNozomi.py

示例10: init_device

    def init_device(self) :
        ports = []
        devices =  self.hal_manager.GetAllDevices()

        device_udi = self.dev_props["info.udi"]
        
        for device in devices :
            device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
            try:
                props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
            except:
                return False

            device_tmp = props["info.udi"]
            
            if device_tmp.startswith(device_udi):
                if props.has_key("serial.device") :
                    ports.append(os.path.basename(props["serial.device"]))

        ports = dict(map(lambda i: (i,1),ports)).keys()
        ports.sort()
        print ports

        dev = (self.dev_props["usb_device.product_id"],
               self.dev_props["usb_device.vendor_id"])
        
        if len(ports) >= 3 :
            if dev == (0x7001, 0x1410) and len(ports) != 4 :
                return False
            
            if dev == (0x7001, 0x1410) :
                self.set_property("data-device", "/dev/%s" % ports[0])
                self.set_property("conf-device", "/dev/%s" % ports[1])
            else:
                self.set_property("data-device", "/dev/%s" % ports[0])
                self.set_property("conf-device", "/dev/%s" % ports[1])
                
            self.set_property("device-icon", "network-wireless")
            self.pretty_name = "Novatel"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        else:
            if dev == (0x7001, 0x1410) and len(ports) == 1 :            
                self.set_property("data-device", "/dev/%s" % ports[0])
                self.set_property("conf-device", "/dev/%s" % ports[0][:-1] + str(int(ports[0][-1]) + 1))
                print "data --> %s" % self.get_property("data-device")
                print "conf --> %s" % self.get_property("conf-device")
                self.set_property("device-icon", "network-wireless")
                self.pretty_name = "Novatel"
                self.set_property("devices-autoconf", True)
                if not self.exists_conf :
                    self.set_property("priority", "50")
                MobileDevice.init_device(self)
                return True
            
            return False
開發者ID:oier,項目名稱:mobile-manager,代碼行數:59,代碼來源:MobileDeviceNovatel.py

示例11: init_device

 def init_device(self):
     if self.device_port != None:
         self.set_property("data-device", self.device_port)
         self.set_property("devices-autoconf", True)
         MobileDevice.init_device(self)
         return True
     else:
         return False
開發者ID:guadalinex-archive,項目名稱:guadalinex-v5,代碼行數:8,代碼來源:MobileDeviceUSB.py

示例12: set_mode_domain

 def set_mode_domain(self, mode, domain):
     res = self.send_at_command("AT_OPSYS=%s,%s" % (mode,domain))
     if res[2] == 'OK' :
         self.dbg_msg ("SET MODE DOMAIN : %s" % res)
         MobileDevice.set_mode_domain(self, mode, domain)
         return True
     else:
         self.dbg_msg ("SET MODE DOMAIN (CRASH) : %s" % res)
         return False
開發者ID:oier,項目名稱:mobile-manager,代碼行數:9,代碼來源:MobileDeviceOption.py

示例13: init_device

    def init_device(self) :
        ports = []
        devices =  self.hal_manager.GetAllDevices()
        for device in devices :
            device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
            try:
                props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
            except:
                return False
            
            if props.has_key("info.parent") and props["info.parent"] == self.dev_props["info.udi"]:
                if props.has_key("usb.linux.sysfs_path") :
                    files = os.listdir(props["usb.linux.sysfs_path"])
                    for f in files:
                        if f.startswith("ttyUSB"):
                            ports.append(f)
        
        if len(ports) == 0 :
            device_udi = self.dev_props["info.udi"]
            for device in devices :
                device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
                try:
                    props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
                except:
                    return False
    
                device_tmp = props["info.udi"]
                
                if device_tmp.startswith(device_udi):
                    if props.has_key("serial.device") :
                        ports.append(os.path.basename(props["serial.device"]))

            ports = dict(map(lambda i: (i,1),ports)).keys()
        
        ports.sort()
        print "-------------> %s" % ports
        dev = (self.dev_props["usb_device.product_id"],
               self.dev_props["usb_device.vendor_id"])
        
        if len(ports) >= 3 :
            if dev == (0x7501, 0xaf0) :
                self.set_property("data-device", "/dev/%s" % ports[3])
                self.set_property("conf-device", "/dev/%s" % ports[2])
            else:
                self.set_property("data-device", "/dev/%s" % ports[0])
                self.set_property("conf-device", "/dev/%s" % ports[2])
                
            self.set_property("device-icon", "network-wireless")
            self.pretty_name = "Option"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        else:
            return False
開發者ID:oier,項目名稱:mobile-manager,代碼行數:56,代碼來源:MobileDeviceOption.py

示例14: open_device

    def open_device(self):
        MobileDevice.open_device(self)
        
        res = self.send_at_command("AT^PORTSEL=1")
        if res[2] != "OK" :
            print "error opening huawei device"

        res = self.send_at_command("AT+COPS=3,0")
        if res[2] != "OK" :
            print "error opening huawei device"
開發者ID:guadalinex-archive,項目名稱:guadalinex-v5,代碼行數:10,代碼來源:MobileDeviceHuawei.py

示例15: init_device

 def init_device(self):
     if self.device_port != None:
         self.set_property("data-device", self.dev_props["serial.device"] )
         self.pretty_name = "Serial Port (%s or %s for Win users)" % (os.path.basename( self.dev_props["serial.device"]),
                                                                      "COM%i" % (int( self.dev_props["serial.device"][-1])+1))
         self.set_property("devices-autoconf", True)
         MobileDevice.init_device(self)
         return True
     else:
         return False
開發者ID:oier,項目名稱:mobile-manager,代碼行數:10,代碼來源:MobileDeviceSerial.py


注:本文中的MobileDevice.MobileDevice類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。