def __init__(self): self.hid = None self.delimiter = "," devicesUsed = 0 for device in hid.find_all_hid_devices(): if device.product_name == 'EEG Signals': devicesUsed += 1 self.hid = device self.hid.open() self.serial_number = device.serial_number device.set_raw_data_handler(self.dataHandler) if devicesUsed == 0: raise RuntimeError('Устройство не найдено!') sn = self.serial_number # EPOC+ in 16-bit Mode. k = ['\0'] * 16 k = [ sn[-1], sn[-2], sn[-2], sn[-3], sn[-3], sn[-3], sn[-2], sn[-4], sn[-1], sn[-4], sn[-2], sn[-2], sn[-4], sn[-4], sn[-2], sn[-1] ] # # EPOC+ in 14-bit Mode. # k = [sn[-1],00,sn[-2],21,sn[-3],00,sn[-4],12,sn[-3],00,sn[-2],68,sn[-1],00,sn[-2],88] self.key = str(''.join(k)) self.cipher = AES.new(self.key.encode("utf8"), AES.MODE_ECB)
def __init__(self, eeg_queue, gyro_queue): super().__init__() self.hid = None self.delimiter = ", " self.eeg_queue = eeg_queue self.gyro_queue = gyro_queue devicesUsed = 0 for device in hid.find_all_hid_devices(): if device.product_name == 'EEG Signals': devicesUsed += 1 self.hid = device self.hid.open() self.serial_number = device.serial_number device.set_raw_data_handler(self.dataHandler) if devicesUsed == 0: os._exit(0) sn = self.serial_number # EPOC+ in 16-bit Mode. k = ['\0'] * 16 k = [ sn[-1], sn[-2], sn[-2], sn[-3], sn[-3], sn[-3], sn[-2], sn[-4], sn[-1], sn[-4], sn[-2], sn[-2], sn[-4], sn[-4], sn[-2], sn[-1] ] # EPOC+ in 14-bit Mode. #k = [sn[-1],00,sn[-2],21,sn[-3],00,sn[-4],12,sn[-3],00,sn[-2],68,sn[-1],00,sn[-2],88] self.key = str(''.join(k)) self.cipher = AES.new(self.key.encode("utf8"), AES.MODE_ECB)
def __init__(self): self.hid = None self.delimiter = ", " self.insight_1 = [ 0, 8, 14, 22, 28, 36, 42, 50, 56, 64, 70, 78, 84, 92, 98, 106, 112, 120, 126, 134, 140, 148, 154, 162, 168, 176, 182, 190, 196, 204, 210, 218, 224, 232, 238 ] devicesUsed = 0 for device in hid.find_all_hid_devices(): if device.product_name == 'EEG Signals': devicesUsed += 1 self.hid = device self.hid.open() self.serial_number = device.serial_number device.set_raw_data_handler(self.dataHandler) if devicesUsed == 0: os._exit(0) sn = bytearray() for i in range(0, len(self.serial_number)): sn += bytearray([ord(self.serial_number[i])]) # Insight Keymodel. k = ['\0'] * 16 k = [ sn[-1], 00, sn[-2], 21, sn[-3], 00, sn[-4], 12, sn[-3], 00, sn[-2], 68, sn[-1], 00, sn[-2], 88 ] self.key = bytes(bytearray(k)) self.cipher = AES.new(self.key, AES.MODE_ECB)