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.
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/PKG-INFO +1 -1
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/setup.py +1 -1
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/device_manager.py +24 -3
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/discover.py +1 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/entity.py +0 -1
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/paradigm.py +5 -3
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk2.egg-info/PKG-INFO +1 -1
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/README.md +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/setup.cfg +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/ar4/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/ar4m/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/crc/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/crc/crctools.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/device.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/entity/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/exception.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/filter/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/filter/norch.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/local.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/message/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/message/command.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/message/tcp.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/message/udp.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/core/utils.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/persist/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/persist/edf.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/persist/rsc_edf.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/command/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/command/message.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/eegion.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/rsc/proxy.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/sdk/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/sdk/ar4sdk.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/sdk/hub.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/sdk/libs/libAr4SDK.dll +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/sdk/libs/libwinpthread-1.dll +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/x8/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk/x8m/__init__.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk2.egg-info/SOURCES.txt +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk2.egg-info/dependency_links.txt +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk2.egg-info/requires.txt +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/src/qlsdk2.egg-info/top_level.txt +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/test/test.py +0 -0
- {qlsdk2-0.4.0a1 → qlsdk2-0.4.0a2}/test/test_ar4m.py +0 -0
|
@@ -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 =
|
|
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.
|
|
108
|
+
logger.trace(f"已连接设备数量:{len(self._devices)}")
|
|
88
109
|
if len(self._devices) == 0:
|
|
89
110
|
return None
|
|
90
111
|
|
|
@@ -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
|
-
|
|
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.
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|