def receive(self, ser: BluetoothSerial) -> any: rlen = ser.read_response(EXG_REGS_RESPONSE, arg_format='B') if not rlen == self._rlen: raise ValueError( 'Response does not contain required amount of bytes') reg_data = ser.read(rlen) return ExGRegister(reg_data)
def receive(self, ser: BluetoothSerial) -> any: sr_val, _, n_ch, buf_size = ser.read_response(INQUIRY_RESPONSE, arg_format='<HIBB') channel_conf = ser.read(n_ch) sr = dr2sr(sr_val) ctypes = self.decode_channel_types(channel_conf) return sr, buf_size, ctypes
def receive(self, ser: BluetoothSerial) -> None: """Receive and decode a data packet :param ser: The serial device from which to read the data """ ser.read_response(DATA_PACKET) for channel_type, channel_dtype in self._types: data_bin = ser.read(channel_dtype.size) self._values[channel_type] = channel_dtype.decode(data_bin)
def receive(self, ser: BluetoothSerial) -> None: ser.read_response(DATA_PACKET) for channel_type, channel_dtype in self._types: data_bin = ser.read(channel_dtype.size) self._values[channel_type] = channel_dtype.decode(data_bin)