qlsdk2 0.4.0a1__tar.gz → 0.4.0a2__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 (47) hide show
  1. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/PKG-INFO +1 -1
  2. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/setup.py +1 -1
  3. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/device_manager.py +24 -3
  4. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/discover.py +1 -0
  5. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/entity.py +0 -1
  6. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/paradigm.py +5 -3
  7. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk2.egg-info/PKG-INFO +1 -1
  8. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/README.md +0 -0
  9. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/setup.cfg +0 -0
  10. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/__init__.py +0 -0
  11. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/ar4/__init__.py +0 -0
  12. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/ar4m/__init__.py +0 -0
  13. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/__init__.py +0 -0
  14. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/crc/__init__.py +0 -0
  15. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/crc/crctools.py +0 -0
  16. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/device.py +0 -0
  17. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/entity/__init__.py +0 -0
  18. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/exception.py +0 -0
  19. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/filter/__init__.py +0 -0
  20. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/filter/norch.py +0 -0
  21. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/local.py +0 -0
  22. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/message/__init__.py +0 -0
  23. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/message/command.py +0 -0
  24. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/message/tcp.py +0 -0
  25. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/message/udp.py +0 -0
  26. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/utils.py +0 -0
  27. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/persist/__init__.py +0 -0
  28. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/persist/edf.py +0 -0
  29. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/persist/rsc_edf.py +0 -0
  30. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/__init__.py +0 -0
  31. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/command/__init__.py +0 -0
  32. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/command/message.py +0 -0
  33. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/eegion.py +0 -0
  34. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/proxy.py +0 -0
  35. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/sdk/__init__.py +0 -0
  36. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/sdk/ar4sdk.py +0 -0
  37. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/sdk/hub.py +0 -0
  38. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/sdk/libs/libAr4SDK.dll +0 -0
  39. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/sdk/libs/libwinpthread-1.dll +0 -0
  40. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/x8/__init__.py +0 -0
  41. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/x8m/__init__.py +0 -0
  42. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk2.egg-info/SOURCES.txt +0 -0
  43. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk2.egg-info/dependency_links.txt +0 -0
  44. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk2.egg-info/requires.txt +0 -0
  45. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk2.egg-info/top_level.txt +0 -0
  46. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/test/test.py +0 -0
  47. {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/test/test_ar4m.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: qlsdk2
3
- Version: 0.4.0a1
3
+ Version: 0.4.0a2
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") as fh:
6
6
 
7
7
  setuptools.setup(
8
8
  name="qlsdk2",
9
- version="0.4.0a1",
9
+ version="0.4.0a2",
10
10
  author="hehuajun",
11
11
  author_email="hehuajun@eegion.com",
12
12
  description="SDK for quanlan device",
@@ -1,16 +1,18 @@
1
1
  import socket
2
+ from typing import Optional
2
3
  from loguru import logger
3
4
  from qlsdk.rsc.discover import UdpBroadcaster
4
5
  from threading import Thread
5
6
  from qlsdk.core import *
6
7
  from qlsdk.rsc.entity import QLDevice
7
8
  from qlsdk.rsc.proxy import DeviceProxy
9
+ import time
8
10
 
9
11
 
10
12
  class DeviceContainer(object):
11
- def __init__(self, proxy_enabled=False):
13
+ def __init__(self, proxy_enabled=False, tcp_port = 19216):
12
14
  self._devices = {}
13
- self._tcp_port = 19216
15
+ self._tcp_port = tcp_port
14
16
  self._proxy_enabled = proxy_enabled
15
17
 
16
18
  # 设备搜索广播器
@@ -21,6 +23,25 @@ class DeviceContainer(object):
21
23
  self._listening_thread = Thread(target=self._listening)
22
24
  self._listening_thread.daemon = True
23
25
  self._listening_thread.start()
26
+
27
+ @property
28
+ def devices(self)-> QLDevice:
29
+ return self._devices
30
+
31
+ '''
32
+ 等待设备连接
33
+ '''
34
+ def connect(self, device_id: str, timeout:int=30) -> Optional[QLDevice]:
35
+ logger.info(f"Searching for device: {device_id}")
36
+ self.add_search(device_id)
37
+ for _ in range(timeout):
38
+ device = self.get_device(device_id)
39
+ if device:
40
+ logger.success(f"Device {device_id} connected")
41
+ return device
42
+ time.sleep(1)
43
+ logger.error(f"Device {device_id} not found")
44
+ return None
24
45
 
25
46
  def _listening(self):
26
47
  tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -84,7 +105,7 @@ class DeviceContainer(object):
84
105
  logger.debug(f"add_device {device.device_name} then has broadcaster {self._broadcaster}")
85
106
 
86
107
  def get_device(self, device_id=None)->QLDevice:
87
- logger.debug(f"已连接设备数量:{len(self._devices)}")
108
+ logger.trace(f"已连接设备数量:{len(self._devices)}")
88
109
  if len(self._devices) == 0:
89
110
  return None
90
111
 
@@ -6,6 +6,7 @@ from loguru import logger
6
6
  from qlsdk.core.message import UDPMessage
7
7
 
8
8
  class UdpBroadcaster:
9
+ # 广播端口需要和ar4sdk做区分, 使用54366时不能和x8同时使用
9
10
  def __init__(self, port=54366):
10
11
  self.broadcast_port = port
11
12
  self.devices_to_broadcast = [] # 待广播的设备序列号列表
@@ -128,7 +128,6 @@ class QLDevice(BaseDevice):
128
128
  @property
129
129
  def signal_consumers(self):
130
130
  return self.__signal_consumer
131
- return self.__signal_consumer
132
131
 
133
132
  @property
134
133
  def impedance_consumers(self):
@@ -186,16 +186,18 @@ class PulseStimulation(StimulationChannel):
186
186
  channel_id: int, 通道编号,从0开始
187
187
  current: float, 电流值,单位为mA
188
188
  duration: float, 刺激时间,单位为秒
189
+ frequency: float, 频率,单位为Hz
190
+ pulse_width: int, 脉冲宽度,单位为ms
191
+ pulse_width_ratio: float, 脉冲宽度比,范围(0, 1)
189
192
  ramp_up: float, 上升时间,单位为秒
190
193
  ramp_down: float, 下降时间,单位为秒
191
- frequency: float, 频率,单位为Hz
192
- phase_position: int, 相位位置,单位为度
194
+ delay_time: float, 延迟启动时间,单位为秒(暂未启用)
193
195
  '''
194
196
  def __init__(self, channel_id: int, current: float, duration: float, frequency: float, pulse_width: int,
195
197
  pulse_width_ratio: float = 1, ramp_up: float = 0, ramp_down: float = 0, delay_time = 0):
196
198
  super().__init__(channel_id, WaveForm.PULSE.value, current, duration, ramp_up, ramp_down)
197
199
  self.frequency = frequency
198
- self.duration_delay = delay_time
200
+ self.delay_time = delay_time
199
201
  self.pulse_width = pulse_width
200
202
  self.pulse_width_ratio = pulse_width_ratio
201
203
  self.pulse_interval = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: qlsdk2
3
- Version: 0.4.0a1
3
+ Version: 0.4.0a2
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