Example #1
0
    def post(self):
        '''connect device'''
        global device, atx_settings
        serial = self.get_argument('serial').strip()

        # check if device is alive, should be in drivers?
        if device is not None:
            if hasattr(device, 'serial') and serial == device.serial:
                if device.serial.startswith('http://'):
                    self.write({'status': 'ok'})
                    return
                elif AdbClient().devices().get(serial) == 'device':
                    self.write({'status': 'ok'})
                    return

        # wrapping args, should be in drivers? identifier?
        atx_connect_url = atx_settings['device_url'] = serial.encode('utf-8') # used in set env-var SERIAL
        device = atx.connect(atx_connect_url)

        if device.platform == 'ios':
            info = device.status()
            setattr(device, 'serial', serial)
        else:
            info = device.info
        self.write({'status': 'ok', 'info': info})
Example #2
0
 def get(self):
     '''get device list'''
     global device
     if hasattr(device, 'serial'):
         self.write({'serial': device.serial})
         return
     try:
         d = AdbClient().devices().keys()
         print 'android device list:', d
     except EnvironmentError as e:
         print 'ERROR:', str(e)
         d = []
     self.write({'android': d, 'ios': []})  # device list
Example #3
0
 def get(self):
     '''get device list'''
     global device
     try:
         d = AdbClient().devices().keys()
         print 'android device list:', d
     except EnvironmentError as e:
         print 'ERROR:', str(e)
         d = []
     self.write({
         'android': d,
         'ios': [],
         'serial': 'todo'
     })  #device and device.serial})
Example #4
0
    def get(self):
        '''get device list'''
        global device
        try:
            d = AdbClient().devices().keys()
            if not isinstance(d, list):
                d = list(d)

        except EnvironmentError as e:
            print('ERROR:', str(e))
            d = []
        if hasattr(device, 'serial'):
            self.write({'android': d, 'ios': [], 'serial': device.serial})
        else:
            self.write({'android': d, 'ios': []})  # device list