qlsdk2 0.6.0a7__tar.gz → 0.6.0a9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/PKG-INFO +1 -1
  2. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/setup.py +1 -1
  3. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/persist/ars_edf.py +8 -4
  4. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/device/arskindling.py +0 -15
  5. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/device/base.py +17 -6
  6. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/parser/base.py +9 -4
  7. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk2.egg-info/PKG-INFO +1 -1
  8. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/README.md +0 -0
  9. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/setup.cfg +0 -0
  10. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/__init__.py +0 -0
  11. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/ar4/__init__.py +0 -0
  12. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/ar4m/__init__.py +0 -0
  13. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/__init__.py +0 -0
  14. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/crc/__init__.py +0 -0
  15. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/crc/crctools.py +0 -0
  16. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/device.py +0 -0
  17. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/entity/__init__.py +0 -0
  18. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/exception.py +0 -0
  19. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/filter/__init__.py +0 -0
  20. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/filter/norch.py +0 -0
  21. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/local.py +0 -0
  22. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/message/__init__.py +0 -0
  23. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/message/command.py +0 -0
  24. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/message/tcp.py +0 -0
  25. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/message/udp.py +0 -0
  26. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/network/__init__.py +0 -0
  27. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/network/monitor.py +0 -0
  28. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/core/utils.py +0 -0
  29. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/entity/__init__.py +0 -0
  30. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/entity/message.py +0 -0
  31. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/entity/signal.py +0 -0
  32. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/interface/__init__.py +0 -0
  33. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/interface/analyzer.py +0 -0
  34. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/interface/collector.py +0 -0
  35. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/interface/device.py +0 -0
  36. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/interface/parser.py +0 -0
  37. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/interface/stimulator.py +0 -0
  38. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/interface/store.py +0 -0
  39. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/persist/__init__.py +0 -0
  40. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/persist/edf.py +0 -0
  41. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/persist/rsc_edf.py +0 -0
  42. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/persist/stream.py +0 -0
  43. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/__init__.py +0 -0
  44. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/command/__init__.py +0 -0
  45. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/device/__init__.py +0 -0
  46. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/device/c16_rs.py +0 -0
  47. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/device/c256_rs.py +0 -0
  48. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/device/c64_rs.py +0 -0
  49. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/device/c64s1.py +0 -0
  50. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/device/device_factory.py +0 -0
  51. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/eegion.py +0 -0
  52. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/entity.py +0 -0
  53. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/interface/__init__.py +0 -0
  54. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/interface/command.py +0 -0
  55. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/interface/device.py +0 -0
  56. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/interface/handler.py +0 -0
  57. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/interface/parser.py +0 -0
  58. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/manager/__init__.py +0 -0
  59. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/manager/container.py +0 -0
  60. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/manager/search.py +0 -0
  61. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/network/__init__.py +0 -0
  62. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/network/discover.py +0 -0
  63. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/paradigm.py +0 -0
  64. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/parser/__init__.py +0 -0
  65. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/parser/base-new.py +0 -0
  66. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/parser/rsc.py +0 -0
  67. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/rsc/proxy.py +0 -0
  68. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/sdk/__init__.py +0 -0
  69. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/sdk/ar4sdk.py +0 -0
  70. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/sdk/hub.py +0 -0
  71. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/sdk/libs/libAr4SDK.dll +0 -0
  72. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/sdk/libs/libwinpthread-1.dll +0 -0
  73. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/x8/__init__.py +0 -0
  74. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk/x8m/__init__.py +0 -0
  75. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk2.egg-info/SOURCES.txt +0 -0
  76. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk2.egg-info/dependency_links.txt +0 -0
  77. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk2.egg-info/requires.txt +0 -0
  78. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/src/qlsdk2.egg-info/top_level.txt +0 -0
  79. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/test/test.222.py +0 -0
  80. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/test/test.py +0 -0
  81. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/test/test_ar4m.py +0 -0
  82. {qlsdk2-0.6.0a7 → qlsdk2-0.6.0a9}/test/test_bdf.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qlsdk2
3
- Version: 0.6.0a7
3
+ Version: 0.6.0a9
4
4
  Summary: SDK for quanlan device
5
5
  Home-page: https://github.com/hehuajun/qlsdk
6
6
  Author: hehuajun
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding='utf-8' ) as fh:
6
6
 
7
7
  setuptools.setup(
8
8
  name="qlsdk2",
9
- version="0.6.0a7",
9
+ version="0.6.0a9",
10
10
  author="hehuajun",
11
11
  author_email="hehuajun@eegion.com",
12
12
  description="SDK for quanlan device",
@@ -213,12 +213,12 @@ class ARSKindlingEDFHandler(object):
213
213
  channel_pos = intersection_positions(packet.channels, channel_filter)
214
214
 
215
215
  if channel_pos is None or len(channel_pos) == 0 :
216
- logger.debug(f"没有指定分区{name}的通道,跳过")
217
- pass
216
+ logger.trace(f"没有指定分区{name}的通道,跳过")
217
+ return
218
218
 
219
219
  # 分区数据包写入
220
220
  if name not in self._edf_handler.keys():
221
- edf_handler = RscEDFHandler(self.sample_rate, self.digital_max , self.digital_min, self.resolution)
221
+ edf_handler = RscEDFHandler(self.sample_rate, self.physical_max , self.physical_min, self.resolution)
222
222
  edf_handler.set_device_type(self._device_type)
223
223
  edf_handler.set_device_no(self._device_no)
224
224
  edf_handler.set_storage_path(self._storage_path)
@@ -234,7 +234,8 @@ class ARSKindlingEDFHandler(object):
234
234
  data = RscPacket()
235
235
  data.time_stamp = packet.time_stamp
236
236
  data.pkg_id = packet.pkg_id
237
- data.channels = channels
237
+ # data.channels = channels
238
+ data.channels = self.channel_display(channels)
238
239
  data.origin_sample_rate = packet.origin_sample_rate
239
240
  data.sample_rate = packet.sample_rate
240
241
  data.sample_num = packet.sample_num
@@ -251,3 +252,6 @@ class ARSKindlingEDFHandler(object):
251
252
  # trigger现在(20250702)多个分区共享, 分发到所有分区文件中标记
252
253
  for k in self._edf_handler.keys():
253
254
  self._edf_handler[k].trigger(desc, cur_time)
255
+
256
+ def channel_display(self, channel):
257
+ return [self._channel_mapping.get(channel_id, []) for channel_id in channel]
@@ -77,19 +77,4 @@ class ARSKindling(QLBaseDevice):
77
77
 
78
78
  return body
79
79
 
80
- def __str__(self):
81
- return f'''
82
- Device:
83
- Name: {self.device_no},
84
- Type: {hex(self.device_type) if self.device_type else None},
85
- ID: {self.device_id if self.device_id else None},
86
- Software: {self.software_version},
87
- Hardware: {self.hardware_version},
88
- Connect Time: {self.connect_time},
89
- Current Time: {self.current_time},
90
- Voltage: {str(self.voltage) + "mV" if self.voltage else None},
91
- Battery Remain: {str(self.battery_remain)+ "%" if self.battery_remain else None},
92
- Battery Total: {str(self.battery_total) + "%" if self.battery_total else None}
93
- '''
94
-
95
80
 
@@ -144,14 +144,14 @@ class QLBaseDevice(IDevice):
144
144
  def _produce_signal(self, body: bytes):
145
145
 
146
146
  # 处理信号数据
147
- data = self._signal_wrapper(body)
147
+ data = self._signal_wrapper(body)
148
148
  # logger.debug("pkg_id: {}, eeg len: {}".format(data.pkg_id, len(data.eeg)))
149
149
  #
150
150
  trigger_positions = [index for index, value in enumerate(data.trigger) if value != 0]
151
151
  if len(trigger_positions) > 0:
152
152
  # logger.debug(f"Trigger触发点位置: {trigger_positions}, 触发点时间戳: {[data.time_stamp + int(pos * 1000 / data.sample_rate) for pos in trigger_positions]}")
153
153
  for pos in trigger_positions:
154
- self.trigger(data.trigger[pos])
154
+ self.trigger(trigger_info(data.trigger[pos]))
155
155
  # 存储
156
156
  if self.storage_enable:
157
157
  # 确保记录线程启动
@@ -402,8 +402,8 @@ class QLBaseDevice(IDevice):
402
402
  msg = StartStimulationCommand.build(self).pack()
403
403
  logger.trace(f"start_stimulation message is {msg.hex()}")
404
404
  self.socket.sendall(msg)
405
- t = Thread(target=self._stop_stimulation_trigger, args=(self.stim_paradigm.duration,), daemon=True)
406
- t.start()
405
+ # t = Thread(target=self._stop_stimulation_trigger, args=(self.stim_paradigm.duration,), daemon=True)
406
+ # t.start()
407
407
 
408
408
  def get_stim_param(self) -> bytes:
409
409
  return self.stim_paradigm.to_bytes()
@@ -421,7 +421,7 @@ class QLBaseDevice(IDevice):
421
421
 
422
422
  def stop_stimulation(self):
423
423
  logger.info(f"[设备-{self.device_no}]停止电刺激")
424
- msg = StopStimulationCommand.pack()
424
+ msg = StopStimulationCommand.build(self).pack()
425
425
  logger.trace(f"stop_stimulation message is {msg.hex()}")
426
426
  self.socket.sendall(msg)
427
427
 
@@ -537,4 +537,15 @@ class QLBaseDevice(IDevice):
537
537
  return self.device_type == other.device_type and self.device_no == other.device_no
538
538
 
539
539
  def __hash__(self):
540
- return hash((self.device_type, self.device_no))
540
+ return hash((self.device_type, self.device_no))
541
+
542
+ __TRIGGER_MAPPING = {
543
+ 0x3E8: "Start of stimulation",
544
+ 0x3E9: "End of stimulation",
545
+ 0x3EA: "Ascending end of stimulation",
546
+ 0x3EB: "Descending start of stimulation ",
547
+ 0x3EC: "刺激参数有误",
548
+ 0x3ED: "End of stimulation (by force)",
549
+ }
550
+ def trigger_info(code: int) -> str:
551
+ return __TRIGGER_MAPPING.get(code, "未知触发事件")
@@ -131,10 +131,15 @@ class TcpMessageParser(IParser):
131
131
 
132
132
  def unpack(self, packet):
133
133
  # 提取指令码
134
- cmd_code = int.from_bytes(packet[self.cmd_pos : self.cmd_pos + 2], 'little')
135
- cmd_class = CommandFactory.create_command(cmd_code)
136
- instance = cmd_class(self.device)
137
- instance.parse_body(packet[self.header_len:-2])
134
+ cmd_code = None
135
+ try:
136
+ cmd_code = int.from_bytes(packet[self.cmd_pos : self.cmd_pos + 2], 'little')
137
+ cmd_class = CommandFactory.create_command(cmd_code)
138
+ instance = cmd_class(self.device)
139
+ instance.parse_body(packet[self.header_len:-2])
140
+ except Exception as e:
141
+ logger.error(f"指令[{cmd_code}]数据包[len={len(packet)}]解析异常: {e}")
142
+
138
143
  return instance
139
144
 
140
145
  def start(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qlsdk2
3
- Version: 0.6.0a7
3
+ Version: 0.6.0a9
4
4
  Summary: SDK for quanlan device
5
5
  Home-page: https://github.com/hehuajun/qlsdk
6
6
  Author: hehuajun
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes