sensor-sdk 0.1.9__tar.gz → 0.2.0__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.
- {sensor_sdk-0.1.9/sensor_sdk.egg-info → sensor_sdk-0.2.0}/PKG-INFO +1 -1
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/bleak_process.py +41 -6
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/sensor_data_context.py +6 -2
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0/sensor_sdk.egg-info}/PKG-INFO +1 -1
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/setup.py +1 -1
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/LICENSE.txt +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/README.md +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/__init__.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/bleak_host.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/bleak_no_ack_patch.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/fb/DataType.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/fb/Sample.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/fb/SensorData.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/fb/__init__.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/gforce.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/sdk_log.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/sensor_controller.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/sensor_data.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/sensor_data_pool.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/sensor_device.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/sensor_profile.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/sensor_utils.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor/winrt_high_throughput.py +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor_sdk.egg-info/SOURCES.txt +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor_sdk.egg-info/dependency_links.txt +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor_sdk.egg-info/requires.txt +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor_sdk.egg-info/top_level.txt +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/sensor_sdk.egg-info/zip-safe +0 -0
- {sensor_sdk-0.1.9 → sensor_sdk-0.2.0}/setup.cfg +0 -0
|
@@ -1111,6 +1111,12 @@ class BleakProcess(multiprocessing.Process):
|
|
|
1111
1111
|
sorted_keys = sorted(ctx.notify_map.keys())
|
|
1112
1112
|
result = "|".join(f"{k}|{ctx.notify_map[k]}" for k in sorted_keys)
|
|
1113
1113
|
|
|
1114
|
+
if key == "NTF_IMU":
|
|
1115
|
+
imu_sub_keys = ["NTF_GFORCE_ACC", "NTF_GFORCE_GYRO", "NTF_GFORCE_QUAT", "NTF_GFORCE_EULER"]
|
|
1116
|
+
result = "ON" if all(ctx.notify_map.get(k) == "ON" for k in imu_sub_keys) else "OFF"
|
|
1117
|
+
elif key in ctx.notify_map:
|
|
1118
|
+
result = ctx.notify_map[key]
|
|
1119
|
+
|
|
1114
1120
|
if key == "DEBUG_LOG_PATH":
|
|
1115
1121
|
result = SdkLog.get_log_path() or ""
|
|
1116
1122
|
|
|
@@ -1168,6 +1174,12 @@ class BleakProcess(multiprocessing.Process):
|
|
|
1168
1174
|
if key == "NTF_PPG_RAW":
|
|
1169
1175
|
map_key = "NTF_PPG"
|
|
1170
1176
|
|
|
1177
|
+
# IMU 总开关同时控制 ACC/GYRO/QUAT/EULER
|
|
1178
|
+
imu_sub_keys = ["NTF_GFORCE_ACC", "NTF_GFORCE_GYRO", "NTF_GFORCE_QUAT", "NTF_GFORCE_EULER"]
|
|
1179
|
+
if map_key == "NTF_IMU":
|
|
1180
|
+
for sub in imu_sub_keys:
|
|
1181
|
+
ctx.notify_map[sub] = value
|
|
1182
|
+
|
|
1171
1183
|
# 老版本 EMG 设备上 Gesture 与 EMG 互斥,自动切换
|
|
1172
1184
|
if not ctx.isNewEMG:
|
|
1173
1185
|
if map_key == "NTF_GEST" and value == "ON" and ctx.notify_map.get("NTF_EMG") == "ON":
|
|
@@ -1182,17 +1194,40 @@ class BleakProcess(multiprocessing.Process):
|
|
|
1182
1194
|
ctx.notify_map[map_key] = value
|
|
1183
1195
|
result = "OK"
|
|
1184
1196
|
else:
|
|
1197
|
+
# 新 EMG:Gesture 依赖 EMG 数据,关闭 EMG 时同步关闭 Gesture;打开 Gesture 时自动打开 EMG
|
|
1198
|
+
if map_key == "NTF_EMG" and value == "OFF":
|
|
1199
|
+
ctx.notify_map["NTF_GEST"] = "OFF"
|
|
1200
|
+
elif map_key == "NTF_GEST" and value == "ON" and ctx.notify_map.get("NTF_EMG") != "ON":
|
|
1201
|
+
ctx.notify_map["NTF_EMG"] = "ON"
|
|
1185
1202
|
ctx.notify_map[map_key] = value
|
|
1186
1203
|
result = "OK"
|
|
1187
|
-
|
|
1204
|
+
|
|
1205
|
+
# 单个 IMU 子开关变化时,同步更新 NTF_IMU 总开关的聚合状态
|
|
1206
|
+
if map_key in imu_sub_keys:
|
|
1207
|
+
ctx.notify_map["NTF_IMU"] = "ON" if all(ctx.notify_map.get(k) == "ON" for k in imu_sub_keys) else "OFF"
|
|
1208
|
+
|
|
1209
|
+
if result == "OK" and ctx.hasInit():
|
|
1188
1210
|
ctx._buildNotifyDataFlag()
|
|
1189
|
-
|
|
1190
|
-
|
|
1211
|
+
|
|
1212
|
+
# 新 EMG 设备通过 function switch 控制 EMG/Gesture 输出,bit0=gesture, bit1=emg
|
|
1213
|
+
if ctx.isNewEMG and map_key in ("NTF_EMG", "NTF_GEST"):
|
|
1214
|
+
emg_bit = 1 if ctx.notify_map.get("NTF_EMG") == "ON" else 0
|
|
1215
|
+
gest_bit = 1 if (emg_bit and ctx.notify_map.get("NTF_GEST") == "ON") else 0
|
|
1216
|
+
func_switch = (emg_bit << 1) | gest_bit
|
|
1191
1217
|
try:
|
|
1192
|
-
await ctx.gForce.
|
|
1218
|
+
await ctx.gForce.set_function_switch(func_switch)
|
|
1219
|
+
await asyncio.sleep(0.5)
|
|
1193
1220
|
except Exception as e:
|
|
1194
|
-
SdkLog.exception(_TAG, f"_do_set_param
|
|
1195
|
-
result = "ERROR:
|
|
1221
|
+
SdkLog.exception(_TAG, f"_do_set_param set_function_switch failed: {device_mac}")
|
|
1222
|
+
result = "ERROR: set_function_switch fail: " + str(e)
|
|
1223
|
+
elif ctx.isDataTransfering:
|
|
1224
|
+
needs_restart = True
|
|
1225
|
+
if ctx.getChipType() == BLEChipType.OYM:
|
|
1226
|
+
try:
|
|
1227
|
+
await ctx.gForce.set_subscription(ctx.notifyDataFlag)
|
|
1228
|
+
except Exception as e:
|
|
1229
|
+
SdkLog.exception(_TAG, f"_do_set_param set_subscription failed: {device_mac}")
|
|
1230
|
+
result = "ERROR: set_subscription fail: " + str(e)
|
|
1196
1231
|
|
|
1197
1232
|
if key in ["FILTER_50HZ", "FILTER_60HZ", "FILTER_HPF", "FILTER_LPF"]:
|
|
1198
1233
|
if value in ["ON", "OFF"]:
|
|
@@ -390,8 +390,12 @@ class SensorProfileDataCtx:
|
|
|
390
390
|
config.batch_len = 128
|
|
391
391
|
|
|
392
392
|
if isNewEMG:
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
# 新版 EMG:bit0=gesture,bit1=emg;Gesture 依赖 EMG,EMG 关闭时 Gesture 同步关闭
|
|
394
|
+
emg_bit = 1 if self.notify_map.get("NTF_EMG") == "ON" else 0
|
|
395
|
+
gest_bit = 1 if (emg_bit and self.notify_map.get("NTF_GEST") == "ON") else 0
|
|
396
|
+
await self.gForce.set_function_switch((emg_bit << 1) | gest_bit)
|
|
397
|
+
await asyncio.sleep(0.5)
|
|
398
|
+
|
|
395
399
|
await self.gForce.set_emg_raw_data_config(config)
|
|
396
400
|
await self.gForce.set_package_id(True)
|
|
397
401
|
|
|
@@ -8,7 +8,7 @@ with open(os.path.join(this_directory, "README.md"), "r", encoding="utf-8") as f
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="sensor-sdk",
|
|
11
|
-
version="0.
|
|
11
|
+
version="0.2.0",
|
|
12
12
|
description="Python sdk for Synchroni",
|
|
13
13
|
long_description=long_description,
|
|
14
14
|
long_description_content_type="text/markdown",
|
|
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
|