本文整理汇总了Python中MobileDevice.MobileDevice类的典型用法代码示例。如果您正苦于以下问题:Python MobileDevice类的具体用法?Python MobileDevice怎么用?Python MobileDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MobileDevice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: init_device
def init_device(self):
if self.device_port != None:
self.set_property("data-device", self.device_port)
self.set_property("conf-device", self.device_port)
self.set_property("devices-autoconf", True)
self.set_property("device-icon", "stock_cell-phone")
#self.set_property("priority", "50")
MobileDevice.init_device(self)
return True
else:
return False
开发者ID:oier,项目名称:mobile-manager,代码行数:11,代码来源:MobileDeviceUSB.py
示例17: 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 = list(set(ports))
ports.sort()
dev = (self.dev_props["usb_device.product_id"],
self.dev_props["usb_device.vendor_id"])
if len(ports) >= 3 :
if dev == (0x68a3,0x1199) and len(ports) >= 4 :
self.set_property("conf-device", "/dev/%s" % ports[2])
self.set_property("data-device", "/dev/%s" % ports[3])
elif dev == (0x6890,0x1199) and len(ports) >= 4 :
self.set_property("conf-device", "/dev/%s" % ports[3])
self.set_property("data-device", "/dev/%s" % ports[4])
else:
self.set_property("conf-device", "/dev/%s" % ports[2])
self.set_property("data-device", "/dev/%s" % ports[0])
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 = "Sierra"
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,代码行数:48,代码来源:MobileDeviceSierra.py
示例18: actions_on_open_port
def actions_on_open_port(self):
ret = MobileDevice.actions_on_open_port(self)
if ret == False :
return False
dev = (self.dev_props["usb_device.product_id"],
self.dev_props["usb_device.vendor_id"])
self.serial.write("AT+CPMS?\r")
self.dbg_msg ("Send : AT+CPMS?")
attempts = 5
res = self.serial.readline()
while attempts != 0 :
self.dbg_msg ("Recv : %s" % res)
if res == "OK" :
break
elif res == None :
attempts = attempts - 1
res = self.serial.readline()
if res != "OK" :
self.dbg_msg ("ACTIONS ON OPEN PORT END FAILED--------")
return False
开发者ID:oier,项目名称:mobile-manager,代码行数:25,代码来源:MobileDeviceZTE.py
示例19: get_net_info
def get_net_info(self):
tech_in_use, card_mode, card_domain, carrier, carrier_mode = MobileDevice.get_net_info(self)
if tech_in_use == CARD_TECH_UMTS :
res = self.send_at_command("AT^SYSINFO", accept_null_response=False)
self.dbg_msg ("SYSCFG (HSPA stuff) : %s" % res)
if res[2] == 'OK' :
tech = int(res[1][0][-1])
if tech >= 5 :
tech_in_use = CARD_TECH_HSPA
return tech_in_use, card_mode, card_domain, carrier, carrier_mode
开发者ID:guadalinex-archive,项目名称:guadalinex-v5,代码行数:11,代码来源:MobileDeviceHuawei.py
示例20: get_carrier
def get_carrier(self):
res = self.send_at_command("AT+COPS=3,2")
self.dbg_msg ("CHANGE TO NUMERIC FORMAT : %s" % res)
carrier = MobileDevice.get_carrier(self)
res = self.send_at_command("AT+COPS=3,0")
self.dbg_msg ("CHANGE TO STRING FORMAT : %s" % res)
if carrier == "21407" :
return "movistar"
else:
return carrier
开发者ID:oier,项目名称:mobile-manager,代码行数:13,代码来源:MobileDeviceOption.py
注:本文中的MobileDevice.MobileDevice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论