qlsdk2 0.1.5__tar.gz → 0.1.6__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.1.5 → qlsdk2-0.1.6}/PKG-INFO +1 -1
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/setup.py +1 -1
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/src/qlsdk/ar4m/__init__.py +7 -5
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/src/qlsdk/ar4m/ar4sdk.py +33 -9
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/src/qlsdk2.egg-info/PKG-INFO +1 -1
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/README.md +0 -0
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/setup.cfg +0 -0
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/src/qlsdk/__init__.py +0 -0
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/src/qlsdk/ar4m/libs/libAr4SDK.dll +0 -0
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/src/qlsdk/ar4m/libs/libwinpthread-1.dll +0 -0
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/src/qlsdk2.egg-info/SOURCES.txt +0 -0
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/src/qlsdk2.egg-info/dependency_links.txt +0 -0
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/src/qlsdk2.egg-info/requires.txt +0 -0
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/src/qlsdk2.egg-info/top_level.txt +0 -0
- {qlsdk2-0.1.5 → qlsdk2-0.1.6}/test/test_ar4m.py +0 -0
|
@@ -33,15 +33,17 @@ class AR4M(object):
|
|
|
33
33
|
def _search_ar4(self):
|
|
34
34
|
try:
|
|
35
35
|
devices = AR4SDK.enum_devices()
|
|
36
|
-
logger.debug(f"_search_ar4 devices size: {len(devices)}")
|
|
36
|
+
# logger.debug(f"_search_ar4 devices size: {len(devices)}")
|
|
37
37
|
for dev in devices:
|
|
38
|
-
logger.debug(f"slot: {dev.slot}, mac: {dev.mac}-{hex(dev.mac)}, hub_name: {dev.hub_name.str}")
|
|
38
|
+
# logger.debug(f"slot: {dev.slot}, mac: {dev.mac}-{hex(dev.mac)}, hub_name: {dev.hub_name.str}")
|
|
39
39
|
if dev.mac in list(self._devices.keys()):
|
|
40
40
|
ar4 = self._devices[dev.mac]
|
|
41
41
|
ar4.update_info()
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
else:
|
|
43
|
+
ar4 = AR4(hex(dev.mac), dev.slot, dev.hub_name.str.decode("utf-8"))
|
|
44
|
+
if ar4.init():
|
|
45
|
+
self._devices[dev.mac] = ar4
|
|
46
|
+
logger.info(f"add device mac: {ar4.box_mac} slot: {ar4.slot} hub_name: {ar4.hub_name}")
|
|
45
47
|
except Exception as e:
|
|
46
48
|
logger.error(f"_search_ar4 异常: {str(e)}")
|
|
47
49
|
finally:
|
|
@@ -108,13 +108,19 @@ class AR4SDK:
|
|
|
108
108
|
"""枚举可用设备"""
|
|
109
109
|
devices = []
|
|
110
110
|
ptr = _dll.ar4_sdk_enum_device()
|
|
111
|
+
if not ptr:
|
|
112
|
+
logger.info("没有找到ar4设备")
|
|
113
|
+
return devices
|
|
111
114
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if
|
|
116
|
-
logger.debug(f"enum_devices break with {ptr}")
|
|
115
|
+
index = 0
|
|
116
|
+
while True:
|
|
117
|
+
device = ptr[index]
|
|
118
|
+
if not device or device.mac == 0:
|
|
117
119
|
break
|
|
120
|
+
# logger.debug(f"get device: {device.slot}, mac: {hex(device.mac)}, hub_name: {device.hub_name.str}")
|
|
121
|
+
devices.append(device)
|
|
122
|
+
index += 1
|
|
123
|
+
|
|
118
124
|
return devices
|
|
119
125
|
|
|
120
126
|
@classmethod
|
|
@@ -159,6 +165,8 @@ class AR4(object):
|
|
|
159
165
|
self._connected = False
|
|
160
166
|
self._conn_time = None
|
|
161
167
|
self._last_time = None
|
|
168
|
+
|
|
169
|
+
self._acq_info = {}
|
|
162
170
|
# 回调函数
|
|
163
171
|
self._data_callback = FuncAr4DataNotify(self._wrap_data_accept())
|
|
164
172
|
self._trigger_callback = FuncAr4TriggerNotify(self._trigger_accept)
|
|
@@ -169,7 +177,14 @@ class AR4(object):
|
|
|
169
177
|
@property
|
|
170
178
|
def box_mac(self):
|
|
171
179
|
return self._box_mac
|
|
180
|
+
@property
|
|
181
|
+
def slot(self):
|
|
182
|
+
return self._slot
|
|
183
|
+
@property
|
|
184
|
+
def hub_name(self):
|
|
185
|
+
return self._hub_name
|
|
172
186
|
def init(self):
|
|
187
|
+
# logger.info(f"init ar4 {self.box_mac}")
|
|
173
188
|
if not self._handle:
|
|
174
189
|
self._connected = self.connect()
|
|
175
190
|
if self._connected:
|
|
@@ -226,6 +241,8 @@ class AR4(object):
|
|
|
226
241
|
logger.info(f"ar4 {self._box_mac} 启动数据采集...")
|
|
227
242
|
"""启动数据采集"""
|
|
228
243
|
|
|
244
|
+
self._acq_info["start_time"] = _get_time()
|
|
245
|
+
|
|
229
246
|
if self._handle:
|
|
230
247
|
# 设置信号数据回调
|
|
231
248
|
try:
|
|
@@ -234,10 +251,10 @@ class AR4(object):
|
|
|
234
251
|
logger.error(f"ar4 {self._box_mac} 停止采集异常: {str(e)}")
|
|
235
252
|
|
|
236
253
|
# 设置trigger数据回调
|
|
237
|
-
try:
|
|
238
|
-
|
|
239
|
-
except Exception as e:
|
|
240
|
-
|
|
254
|
+
# try:
|
|
255
|
+
# _dll.ar4_sdk_register_trigger_notify(self._handle, self._trigger_callback)
|
|
256
|
+
# except Exception as e:
|
|
257
|
+
# logger.error(f"ar4 {self._box_mac} 停止采集异常: {str(e)}")
|
|
241
258
|
# 启动采集
|
|
242
259
|
try:
|
|
243
260
|
logger.debug(f"ar4 {self._box_mac} 启动采集: {self._handle}")
|
|
@@ -254,6 +271,10 @@ class AR4(object):
|
|
|
254
271
|
def stop_acquisition(self):
|
|
255
272
|
"""停止采集"""
|
|
256
273
|
if self._handle:
|
|
274
|
+
try:
|
|
275
|
+
self.get_acq_start_time()
|
|
276
|
+
except Exception as e:
|
|
277
|
+
logger.error(f"ar4 {self._box_mac} 获取开始采集时间异常: {str(e)}")
|
|
257
278
|
try:
|
|
258
279
|
return _dll.ar4_sdk_stop_acq(self._handle) == 0
|
|
259
280
|
except Exception as e:
|
|
@@ -276,6 +297,9 @@ class AR4(object):
|
|
|
276
297
|
def get_acq_start_time(self):
|
|
277
298
|
try:
|
|
278
299
|
ret = _dll.ar4_sdk_get_acq_start_time(self._handle)
|
|
300
|
+
# 更新采样开始时间
|
|
301
|
+
if ret:
|
|
302
|
+
self._acq_info["start_time"] = ret
|
|
279
303
|
logger.debug(f"ar4 {self._box_mac} 获取采样开始时间: {ret}")
|
|
280
304
|
except Exception as e:
|
|
281
305
|
logger.error(f"ar4 {self._box_mac} 获取采样开始时间异常: {str(e)}")
|
|
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
|