read values from the device
190122
def read_data(self, variable_instance):
        
        if self.inst is None:
            return
        if variable_instance.visavariable.device_property.upper() == 'PRESENT_VALUE':
            return self.parse_value(self.inst.query('?U6P0'))
        elif variable_instance.visavariable.device_property.upper() == 'PRESENT_VALUE_MANUAL_C_FREQ':
            freq = VariableProperty.objects.get_property(variable=variable_instance, name='VISA:FREQ')
            if freq is None:
                freq = 500
            return self.parse_value(self.inst.query('?MAM1SR9HT3ST2SM%dE'%freq))
        return None
1042431
def read(self):
        
        # Read value
        try:
            buf = os.read(self._fd, 2)
        except OSError as e:
            raise GPIOError(e.errno, "Reading GPIO: " + e.strerror)

        # Rewind
        try:
            os.lseek(self._fd, 0, os.SEEK_SET)
        except OSError as e:
            raise GPIOError(e.errno, "Rewinding GPIO: " + e.strerror)

        if buf[0] == b"0"[0]:
            return False
        elif buf[0] == b"1"[0]:
            return True

        raise GPIOError(None, "Unknown GPIO value: \"%s\"" % buf[0])
5843
def read_dev_prop(self, device_name):
        
        with open("{}.bin".format(device_name), "rb") as file:
            return pickle.load(file)["device"]
676835
def current_reading(self) -> Optional[Union[int, float]]:
        """"""
        return self._get_field_value(SpecialDevice.PROP_CURRENT_READING)
70662
def values(self, start=None, stop=None):
        """"""
        return (item[1] for item in self.items(start, stop))
471415
def read_value(self):
        
        while not self._valid():
            time.sleep((self._integration_time + 0.9)/1000.0)
        # Read each color register.
        r = self._readU16LE(TCS34725_RDATAL)
        g = self._readU16LE(TCS34725_GDATAL)
        b = self._readU16LE(TCS34725_BDATAL)
        c = self._readU16LE(TCS34725_CDATAL)
        # Delay for the integration time to allow for next reading immediately.

        red   = int(pow((int((r/c) * 256) / 255), 2.5) * 255)
        green = int(pow((int((g/c) * 256) / 255), 2.5) * 255)
        blue  = int(pow((int((b/c) * 256) / 255), 2.5) * 255)

        return [r, g, b]
230203
def getDevices(self, status=None):
        
        return [d for d in self.devices.values() if status is None or d.payload.get('status') == status]
180278
def match(self, device):
        """"""
        return all(match_value(getattr(device, k), v)
                   for k, v in self._match.items())
1214142
def read(self):
        
        val = self._fd.read()
        self._fd.seek(0)
        return int(val)
171632
def getDevice(self, id):
        
        return next(iter([d for d in self.devices.values() if d.deviceId == id]), None)
1015132
def _parse_device_information(device_info_string) -> dict:
    '''
    
    '''
    error_msg = 'Unexpected argument to _parse_device_information: {}'.format(
        device_info_string)
    if not device_info_string or \
            not isinstance(device_info_string, str):
        raise ParseError(error_msg)
    parsed_values = device_info_string.strip().split(' ')
    if len(parsed_values) < 3:
        log.error(error_msg)
        raise ParseError(error_msg)
    res = {
        _parse_key_from_substring(s): _parse_string_value_from_substring(s)
        for s in parsed_values[:3]
    }
    for key in ['model', 'version', 'serial']:
        if key not in res:
            raise ParseError(error_msg)
    return res
178780
def getViewportValues(self, view=None):
        
        values = {
            'width': 'device-width',
            'initial-scale': '1.0',
        }

        return ','.join('%s=%s' % (k, v) for k, v in values.items())
1137823
def read(self, device=None, offset=0, bs=None, count=1):
        
        volume = self.get_volume(device)
        block_size = bs or BLOCK_SIZE

        offset = int(offset) * block_size
        count = int(count)
        print("Offset: ", offset)

        total = 0
        with directio.open(volume['path'], buffered=block_size) as file:
            file.seek(offset)
            for i in range(0, count):
                total += os.write(sys.stdout.fileno(), file.read(block_size))
        os.write(sys.stdout.fileno(), "\nRead: %d Bytes\n" % total)
936953
protected void read() throws IOException {
        buffer.rewind();
        buffer.limit(buffer.capacity());
        device.read(offset, buffer);
        this.dirty = false;
    }
1271997
def readinto(self, b):
        """"""
        if self.connected is None:
            return None

        # Extract requested amount of data from the read buffer.
        b[:] = self._get_input(size)

        if len(b):
            return len(b)
        else:
            return None
1244831
def GPIO_read(self):
        ''
        self.bus.write_byte_data(self.address, 0xF5, 0x0f)
        status = self.bus.read_byte(self.address)
        bits_values = dict([('SS0',status & 0x01 == 0x01),('SS1',status & 0x02 == 0x02),('SS2',status & 0x04 == 0x04),('SS3',status & 0x08 == 0x08)])
        return bits_values
685061
def read_value(self, dtype='uint64', count=1, advance=True):
        
        data = np.frombuffer(self._blob, dtype=dtype, count=count, offset=self.pos)
        if advance:
            # probably the same thing as data.nbytes * 8
            self._pos += data.dtype.itemsize * data.size
        if count == 1:
            data = data[0]
        return data