Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50b3741b1a |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -25,12 +25,6 @@ vite.config.ts.timestamp-*
|
|||||||
/src-tauri/target/
|
/src-tauri/target/
|
||||||
/src-tauri/target-codex-check*/
|
/src-tauri/target-codex-check*/
|
||||||
/src-tauri/gen/schemas/
|
/src-tauri/gen/schemas/
|
||||||
/src-tauri/gen/android/app/build/
|
|
||||||
/src-tauri/gen/android/buildSrc/build/
|
|
||||||
/src-tauri/gen/android/.gradle/
|
|
||||||
/src-tauri/gen/android/app/.gradle/
|
|
||||||
/src-tauri/gen/android/buildSrc/.gradle/
|
|
||||||
/src-tauri/gen/android/build/reports/
|
|
||||||
|
|
||||||
/src-tauri/program.log*
|
/src-tauri/program.log*
|
||||||
/src-tauri/recording_replay_debug_*.csv
|
/src-tauri/recording_replay_debug_*.csv
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "eskin-finger-sdk"]
|
|
||||||
path = eskin-finger-sdk
|
|
||||||
url = https://gitea.e-skin.top/yanjie/eskin-finger-sdk.git
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,423 +0,0 @@
|
|||||||
('D:\\Workspace\\je-skin-customer-demo\\devkit\\dist\\je-skin-devkit-server.exe',
|
|
||||||
True,
|
|
||||||
False,
|
|
||||||
False,
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico',
|
|
||||||
None,
|
|
||||||
False,
|
|
||||||
False,
|
|
||||||
b'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<assembly xmlns='
|
|
||||||
b'"urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">\n <trustInfo x'
|
|
||||||
b'mlns="urn:schemas-microsoft-com:asm.v3">\n <security>\n <requested'
|
|
||||||
b'Privileges>\n <requestedExecutionLevel level="asInvoker" uiAccess='
|
|
||||||
b'"false"/>\n </requestedPrivileges>\n </security>\n </trustInfo>\n '
|
|
||||||
b'<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">\n <'
|
|
||||||
b'application>\n <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f'
|
|
||||||
b'0}"/>\n <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>\n '
|
|
||||||
b' <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>\n <s'
|
|
||||||
b'upportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>\n <supporte'
|
|
||||||
b'dOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>\n </application>\n <'
|
|
||||||
b'/compatibility>\n <application xmlns="urn:schemas-microsoft-com:asm.v3">'
|
|
||||||
b'\n <windowsSettings>\n <longPathAware xmlns="http://schemas.micros'
|
|
||||||
b'oft.com/SMI/2016/WindowsSettings">true</longPathAware>\n </windowsSett'
|
|
||||||
b'ings>\n </application>\n <dependency>\n <dependentAssembly>\n <ass'
|
|
||||||
b'emblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version='
|
|
||||||
b'"6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" langua'
|
|
||||||
b'ge="*"/>\n </dependentAssembly>\n </dependency>\n</assembly>',
|
|
||||||
True,
|
|
||||||
False,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\je-skin-devkit-server.pkg',
|
|
||||||
[('pyi-contents-directory _internal', '', 'OPTION'),
|
|
||||||
('PYZ-00.pyz',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\PYZ-00.pyz',
|
|
||||||
'PYZ'),
|
|
||||||
('struct',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\localpycs\\struct.pyc',
|
|
||||||
'PYMODULE'),
|
|
||||||
('pyimod01_archive',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\localpycs\\pyimod01_archive.pyc',
|
|
||||||
'PYMODULE'),
|
|
||||||
('pyimod02_importers',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\localpycs\\pyimod02_importers.pyc',
|
|
||||||
'PYMODULE'),
|
|
||||||
('pyimod03_ctypes',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\localpycs\\pyimod03_ctypes.pyc',
|
|
||||||
'PYMODULE'),
|
|
||||||
('pyimod04_pywin32',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\localpycs\\pyimod04_pywin32.pyc',
|
|
||||||
'PYMODULE'),
|
|
||||||
('pyiboot01_bootstrap',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\PyInstaller\\loader\\pyiboot01_bootstrap.py',
|
|
||||||
'PYSOURCE'),
|
|
||||||
('pyi_rth_inspect',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py',
|
|
||||||
'PYSOURCE'),
|
|
||||||
('pyi_rth_pkgutil',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py',
|
|
||||||
'PYSOURCE'),
|
|
||||||
('pyi_rth_multiprocessing',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py',
|
|
||||||
'PYSOURCE'),
|
|
||||||
('sensor_server',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\sensor_server.py',
|
|
||||||
'PYSOURCE'),
|
|
||||||
('python313.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\python313.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('numpy.libs\\libscipy_openblas64_-63c857e738469261263c764a36be9436.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy.libs\\libscipy_openblas64_-63c857e738469261263c764a36be9436.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('numpy.libs\\msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy.libs\\msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('select.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\select.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_multiprocessing.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_multiprocessing.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('pyexpat.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\pyexpat.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_ssl.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_ssl.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_hashlib.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_hashlib.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('unicodedata.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\unicodedata.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_decimal.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_decimal.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_socket.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_socket.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_lzma.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_lzma.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_bz2.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_bz2.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_ctypes.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_ctypes.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_queue.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_queue.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\_core\\_multiarray_tests.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\_core\\_multiarray_tests.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\_core\\_multiarray_umath.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\_core\\_multiarray_umath.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_overlapped.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_overlapped.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_asyncio.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_asyncio.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_wmi.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_wmi.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\linalg\\_umath_linalg.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\linalg\\_umath_linalg.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\mtrand.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\mtrand.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\bit_generator.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\bit_generator.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_sfc64.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_sfc64.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_philox.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_philox.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_pcg64.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_pcg64.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_mt19937.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_mt19937.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_generator.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_generator.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_common.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_common.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_bounded_integers.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_bounded_integers.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\fft\\_pocketfft_umath.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\fft\\_pocketfft_umath.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_elementtree.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_elementtree.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('grpc\\_cython\\cygrpc.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\grpc\\_cython\\cygrpc.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('google\\_upb\\_message.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\google\\_upb\\_message.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('grpc_tools\\_protoc_compiler.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\grpc_tools\\_protoc_compiler.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('api-ms-win-crt-process-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-process-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-time-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-time-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-runtime-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-runtime-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-locale-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-locale-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-heap-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-heap-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('zlib.dll', 'C:\\Users\\Administrator\\miniconda3\\zlib.dll', 'BINARY'),
|
|
||||||
('api-ms-win-crt-string-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-string-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-filesystem-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-filesystem-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-environment-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-environment-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-convert-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-convert-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-stdio-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-stdio-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-conio-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-conio-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('VCRUNTIME140.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\VCRUNTIME140.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-math-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-math-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-private-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-private-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-utility-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-utility-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('VCRUNTIME140_1.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\VCRUNTIME140_1.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('libexpat.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\libexpat.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('libssl-3-x64.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\libssl-3-x64.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('libcrypto-3-x64.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\libcrypto-3-x64.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('libmpdec-4.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\libmpdec-4.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('liblzma.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\liblzma.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('LIBBZ2.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\LIBBZ2.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('ffi.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\ffi.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('python3.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\python3.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('ucrtbase.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\ucrtbase.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-synch-l1-2-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-synch-l1-2-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-errorhandling-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-errorhandling-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-console-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-console-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-processthreads-l1-1-1.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-processthreads-l1-1-1.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-debug-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-debug-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-string-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-string-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-profile-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-profile-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-localization-l1-2-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-localization-l1-2-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-file-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-file-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-timezone-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-timezone-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-processenvironment-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-processenvironment-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-sysinfo-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-sysinfo-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-rtlsupport-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-rtlsupport-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-heap-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-heap-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-memory-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-memory-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-file-l1-2-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-file-l1-2-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-interlocked-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-interlocked-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-util-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-util-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-libraryloader-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-libraryloader-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-handle-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-handle-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-synch-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-synch-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-fibers-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-fibers-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-processthreads-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-processthreads-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-datetime-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-datetime-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-namedpipe-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-namedpipe-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-file-l2-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-file-l2-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('sensor_stream_pb2.py',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\sensor_stream_pb2.py',
|
|
||||||
'DATA'),
|
|
||||||
('sensor_stream_pb2_grpc.py',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\sensor_stream_pb2_grpc.py',
|
|
||||||
'DATA'),
|
|
||||||
('grpc\\_cython\\_cygrpc\\private_key_signing\\private_key_signer_py_wrapper.cc',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\grpc\\_cython\\_cygrpc\\private_key_signing\\private_key_signer_py_wrapper.cc',
|
|
||||||
'DATA'),
|
|
||||||
('grpc\\_cython\\_cygrpc\\private_key_signing\\private_key_signer_py_wrapper.h',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\grpc\\_cython\\_cygrpc\\private_key_signing\\private_key_signer_py_wrapper.h',
|
|
||||||
'DATA'),
|
|
||||||
('grpc\\_cython\\_credentials\\roots.pem',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\grpc\\_cython\\_credentials\\roots.pem',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\WHEEL',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\WHEEL',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\distributions\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\distributions\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\REQUESTED',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\REQUESTED',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\mt19937\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\mt19937\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\sfc64\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\sfc64\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\linalg\\lapack_lite\\LICENSE.txt',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\linalg\\lapack_lite\\LICENSE.txt',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\INSTALLER',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\INSTALLER',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\multiarray\\dragon4_LICENSE.txt',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\multiarray\\dragon4_LICENSE.txt',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\fft\\pocketfft\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\fft\\pocketfft\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\ma\\LICENSE',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\ma\\LICENSE',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\entry_points.txt',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\entry_points.txt',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\common\\pythoncapi-compat\\COPYING',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\common\\pythoncapi-compat\\COPYING',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\LICENSE.txt',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\LICENSE.txt',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\splitmix64\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\splitmix64\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\umath\\svml\\LICENSE',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\umath\\svml\\LICENSE',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\include\\numpy\\libdivide\\LICENSE.txt',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\include\\numpy\\libdivide\\LICENSE.txt',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\DELVEWHEEL',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\DELVEWHEEL',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\npysort\\x86-simd-sort\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\npysort\\x86-simd-sort\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\METADATA',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\METADATA',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\philox\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\philox\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\RECORD',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\RECORD',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\highway\\LICENSE',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\highway\\LICENSE',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\pcg64\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\pcg64\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('base_library.zip',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\base_library.zip',
|
|
||||||
'DATA')],
|
|
||||||
[],
|
|
||||||
False,
|
|
||||||
False,
|
|
||||||
1780277624,
|
|
||||||
[('run.exe',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\run.exe',
|
|
||||||
'EXECUTABLE')],
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\python313.dll')
|
|
||||||
@@ -1,401 +0,0 @@
|
|||||||
('D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\je-skin-devkit-server.pkg',
|
|
||||||
{'BINARY': True,
|
|
||||||
'DATA': True,
|
|
||||||
'EXECUTABLE': True,
|
|
||||||
'EXTENSION': True,
|
|
||||||
'PYMODULE': True,
|
|
||||||
'PYSOURCE': True,
|
|
||||||
'PYZ': False,
|
|
||||||
'SPLASH': True,
|
|
||||||
'SYMLINK': False},
|
|
||||||
[('pyi-contents-directory _internal', '', 'OPTION'),
|
|
||||||
('PYZ-00.pyz',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\PYZ-00.pyz',
|
|
||||||
'PYZ'),
|
|
||||||
('struct',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\localpycs\\struct.pyc',
|
|
||||||
'PYMODULE'),
|
|
||||||
('pyimod01_archive',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\localpycs\\pyimod01_archive.pyc',
|
|
||||||
'PYMODULE'),
|
|
||||||
('pyimod02_importers',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\localpycs\\pyimod02_importers.pyc',
|
|
||||||
'PYMODULE'),
|
|
||||||
('pyimod03_ctypes',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\localpycs\\pyimod03_ctypes.pyc',
|
|
||||||
'PYMODULE'),
|
|
||||||
('pyimod04_pywin32',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\localpycs\\pyimod04_pywin32.pyc',
|
|
||||||
'PYMODULE'),
|
|
||||||
('pyiboot01_bootstrap',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\PyInstaller\\loader\\pyiboot01_bootstrap.py',
|
|
||||||
'PYSOURCE'),
|
|
||||||
('pyi_rth_inspect',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py',
|
|
||||||
'PYSOURCE'),
|
|
||||||
('pyi_rth_pkgutil',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py',
|
|
||||||
'PYSOURCE'),
|
|
||||||
('pyi_rth_multiprocessing',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py',
|
|
||||||
'PYSOURCE'),
|
|
||||||
('sensor_server',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\sensor_server.py',
|
|
||||||
'PYSOURCE'),
|
|
||||||
('python313.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\python313.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('numpy.libs\\libscipy_openblas64_-63c857e738469261263c764a36be9436.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy.libs\\libscipy_openblas64_-63c857e738469261263c764a36be9436.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('numpy.libs\\msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy.libs\\msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('select.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\select.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_multiprocessing.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_multiprocessing.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('pyexpat.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\pyexpat.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_ssl.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_ssl.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_hashlib.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_hashlib.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('unicodedata.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\unicodedata.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_decimal.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_decimal.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_socket.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_socket.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_lzma.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_lzma.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_bz2.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_bz2.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_ctypes.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_ctypes.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_queue.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_queue.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\_core\\_multiarray_tests.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\_core\\_multiarray_tests.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\_core\\_multiarray_umath.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\_core\\_multiarray_umath.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_overlapped.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_overlapped.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_asyncio.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_asyncio.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_wmi.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_wmi.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\linalg\\_umath_linalg.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\linalg\\_umath_linalg.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\mtrand.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\mtrand.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\bit_generator.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\bit_generator.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_sfc64.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_sfc64.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_philox.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_philox.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_pcg64.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_pcg64.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_mt19937.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_mt19937.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_generator.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_generator.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_common.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_common.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\random\\_bounded_integers.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\random\\_bounded_integers.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('numpy\\fft\\_pocketfft_umath.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy\\fft\\_pocketfft_umath.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('_elementtree.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\DLLs\\_elementtree.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('grpc\\_cython\\cygrpc.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\grpc\\_cython\\cygrpc.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('google\\_upb\\_message.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\google\\_upb\\_message.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('grpc_tools\\_protoc_compiler.cp313-win_amd64.pyd',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\grpc_tools\\_protoc_compiler.cp313-win_amd64.pyd',
|
|
||||||
'EXTENSION'),
|
|
||||||
('api-ms-win-crt-process-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-process-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-time-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-time-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-runtime-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-runtime-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-locale-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-locale-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-heap-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-heap-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('zlib.dll', 'C:\\Users\\Administrator\\miniconda3\\zlib.dll', 'BINARY'),
|
|
||||||
('api-ms-win-crt-string-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-string-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-filesystem-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-filesystem-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-environment-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-environment-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-convert-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-convert-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-stdio-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-stdio-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-conio-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-conio-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('VCRUNTIME140.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\VCRUNTIME140.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-math-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-math-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-private-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-private-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-crt-utility-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-crt-utility-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('VCRUNTIME140_1.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\VCRUNTIME140_1.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('libexpat.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\libexpat.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('libssl-3-x64.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\libssl-3-x64.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('libcrypto-3-x64.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\libcrypto-3-x64.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('libmpdec-4.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\libmpdec-4.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('liblzma.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\liblzma.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('LIBBZ2.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\LIBBZ2.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('ffi.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Library\\bin\\ffi.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('python3.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\python3.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('ucrtbase.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\ucrtbase.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-synch-l1-2-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-synch-l1-2-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-errorhandling-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-errorhandling-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-console-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-console-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-processthreads-l1-1-1.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-processthreads-l1-1-1.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-debug-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-debug-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-string-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-string-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-profile-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-profile-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-localization-l1-2-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-localization-l1-2-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-file-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-file-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-timezone-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-timezone-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-processenvironment-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-processenvironment-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-sysinfo-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-sysinfo-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-rtlsupport-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-rtlsupport-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-heap-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-heap-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-memory-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-memory-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-file-l1-2-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-file-l1-2-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-interlocked-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-interlocked-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-util-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-util-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-libraryloader-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-libraryloader-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-handle-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-handle-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-synch-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-synch-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-fibers-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-fibers-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-processthreads-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-processthreads-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-datetime-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-datetime-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-namedpipe-l1-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-namedpipe-l1-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('api-ms-win-core-file-l2-1-0.dll',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\api-ms-win-core-file-l2-1-0.dll',
|
|
||||||
'BINARY'),
|
|
||||||
('sensor_stream_pb2.py',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\sensor_stream_pb2.py',
|
|
||||||
'DATA'),
|
|
||||||
('sensor_stream_pb2_grpc.py',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\sensor_stream_pb2_grpc.py',
|
|
||||||
'DATA'),
|
|
||||||
('grpc\\_cython\\_cygrpc\\private_key_signing\\private_key_signer_py_wrapper.cc',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\grpc\\_cython\\_cygrpc\\private_key_signing\\private_key_signer_py_wrapper.cc',
|
|
||||||
'DATA'),
|
|
||||||
('grpc\\_cython\\_cygrpc\\private_key_signing\\private_key_signer_py_wrapper.h',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\grpc\\_cython\\_cygrpc\\private_key_signing\\private_key_signer_py_wrapper.h',
|
|
||||||
'DATA'),
|
|
||||||
('grpc\\_cython\\_credentials\\roots.pem',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\grpc\\_cython\\_credentials\\roots.pem',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\WHEEL',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\WHEEL',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\distributions\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\distributions\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\REQUESTED',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\REQUESTED',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\mt19937\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\mt19937\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\sfc64\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\sfc64\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\linalg\\lapack_lite\\LICENSE.txt',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\linalg\\lapack_lite\\LICENSE.txt',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\INSTALLER',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\INSTALLER',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\multiarray\\dragon4_LICENSE.txt',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\multiarray\\dragon4_LICENSE.txt',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\fft\\pocketfft\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\fft\\pocketfft\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\ma\\LICENSE',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\ma\\LICENSE',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\entry_points.txt',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\entry_points.txt',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\common\\pythoncapi-compat\\COPYING',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\common\\pythoncapi-compat\\COPYING',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\LICENSE.txt',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\LICENSE.txt',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\splitmix64\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\splitmix64\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\umath\\svml\\LICENSE',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\umath\\svml\\LICENSE',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\include\\numpy\\libdivide\\LICENSE.txt',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\include\\numpy\\libdivide\\LICENSE.txt',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\DELVEWHEEL',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\DELVEWHEEL',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\npysort\\x86-simd-sort\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\npysort\\x86-simd-sort\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\METADATA',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\METADATA',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\philox\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\philox\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\RECORD',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\RECORD',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\highway\\LICENSE',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\_core\\src\\highway\\LICENSE',
|
|
||||||
'DATA'),
|
|
||||||
('numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\pcg64\\LICENSE.md',
|
|
||||||
'C:\\Users\\Administrator\\miniconda3\\Lib\\site-packages\\numpy-2.4.6.dist-info\\licenses\\numpy\\random\\src\\pcg64\\LICENSE.md',
|
|
||||||
'DATA'),
|
|
||||||
('base_library.zip',
|
|
||||||
'D:\\Workspace\\je-skin-customer-demo\\devkit\\build\\je-skin-devkit-server\\base_library.zip',
|
|
||||||
'DATA')],
|
|
||||||
'python313.dll',
|
|
||||||
False,
|
|
||||||
False,
|
|
||||||
False,
|
|
||||||
[],
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None)
|
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,246 +0,0 @@
|
|||||||
|
|
||||||
This file lists modules PyInstaller was not able to find. This does not
|
|
||||||
necessarily mean these modules are required for running your program. Both
|
|
||||||
Python's standard library and 3rd-party Python packages often conditionally
|
|
||||||
import optional modules, some of which may be available only on certain
|
|
||||||
platforms.
|
|
||||||
|
|
||||||
Types of import:
|
|
||||||
* top-level: imported at the top-level - look at these first
|
|
||||||
* conditional: imported within an if-statement
|
|
||||||
* delayed: imported within a function
|
|
||||||
* optional: imported within a try-except-statement
|
|
||||||
|
|
||||||
IMPORTANT: Do NOT post this list to the issue-tracker. Use it as a basis for
|
|
||||||
tracking down the missing module yourself. Thanks!
|
|
||||||
|
|
||||||
missing module named pwd - imported by posixpath (delayed, conditional, optional), shutil (delayed, optional), tarfile (optional), pathlib._local (optional), subprocess (delayed, conditional, optional), http.server (delayed, optional), netrc (delayed, optional), getpass (delayed, optional)
|
|
||||||
missing module named grp - imported by shutil (delayed, optional), tarfile (optional), pathlib._local (optional), subprocess (delayed, conditional, optional)
|
|
||||||
missing module named 'collections.abc' - imported by traceback (top-level), typing (top-level), inspect (top-level), logging (top-level), importlib.resources.readers (top-level), selectors (top-level), tracemalloc (top-level), http.client (top-level), typing_extensions (top-level), asyncio.base_events (top-level), asyncio.coroutines (top-level), grpc.aio._metadata (top-level), google.protobuf.internal.containers (top-level), google.protobuf.internal.well_known_types (top-level), numpy._typing._array_like (top-level), numpy._typing._nested_sequence (conditional), numpy._typing._shape (top-level), numpy._typing._dtype_like (top-level), numpy.lib._function_base_impl (top-level), numpy.lib._npyio_impl (top-level), numpy.random._common (top-level), numpy.random._generator (top-level), numpy.random.bit_generator (top-level), numpy.random.mtrand (top-level), numpy.polynomial._polybase (top-level), xml.etree.ElementTree (top-level)
|
|
||||||
missing module named _posixsubprocess - imported by subprocess (conditional), multiprocessing.util (delayed)
|
|
||||||
missing module named fcntl - imported by subprocess (optional)
|
|
||||||
missing module named _posixshmem - imported by multiprocessing.resource_tracker (conditional), multiprocessing.shared_memory (conditional)
|
|
||||||
missing module named _scproxy - imported by urllib.request (conditional)
|
|
||||||
missing module named termios - imported by tty (top-level), _pyrepl.pager (delayed, optional), getpass (optional)
|
|
||||||
missing module named multiprocessing.BufferTooShort - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
|
|
||||||
missing module named multiprocessing.AuthenticationError - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
|
|
||||||
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (top-level)
|
|
||||||
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), zipimport (top-level)
|
|
||||||
missing module named posix - imported by os (conditional, optional), posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional)
|
|
||||||
missing module named resource - imported by posix (top-level)
|
|
||||||
missing module named multiprocessing.get_context - imported by multiprocessing (top-level), multiprocessing.pool (top-level), multiprocessing.managers (top-level), multiprocessing.sharedctypes (top-level)
|
|
||||||
missing module named multiprocessing.TimeoutError - imported by multiprocessing (top-level), multiprocessing.pool (top-level)
|
|
||||||
missing module named multiprocessing.set_start_method - imported by multiprocessing (top-level), multiprocessing.spawn (top-level)
|
|
||||||
missing module named multiprocessing.get_start_method - imported by multiprocessing (top-level), multiprocessing.spawn (top-level)
|
|
||||||
missing module named pyimod02_importers - imported by C:\Users\Administrator\miniconda3\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py (delayed)
|
|
||||||
missing module named _dummy_thread - imported by numpy._core.arrayprint (optional)
|
|
||||||
missing module named asyncio.DefaultEventLoopPolicy - imported by asyncio (delayed, conditional), asyncio.events (delayed, conditional)
|
|
||||||
missing module named annotationlib - imported by typing_extensions (conditional)
|
|
||||||
missing module named 'numpy_distutils.cpuinfo' - imported by numpy.f2py.diagnose (delayed, conditional, optional)
|
|
||||||
missing module named 'numpy_distutils.fcompiler' - imported by numpy.f2py.diagnose (delayed, conditional, optional)
|
|
||||||
missing module named 'numpy_distutils.command' - imported by numpy.f2py.diagnose (delayed, conditional, optional)
|
|
||||||
missing module named numpy_distutils - imported by numpy.f2py.diagnose (delayed, optional)
|
|
||||||
missing module named vms_lib - imported by platform (delayed, optional)
|
|
||||||
missing module named 'java.lang' - imported by platform (delayed, optional)
|
|
||||||
missing module named java - imported by platform (delayed)
|
|
||||||
missing module named psutil - imported by numpy.testing._private.utils (delayed, optional)
|
|
||||||
missing module named readline - imported by cmd (delayed, conditional, optional), code (delayed, conditional, optional), pdb (delayed, conditional, optional), rlcompleter (optional)
|
|
||||||
missing module named win32pdh - imported by numpy.testing._private.utils (delayed, conditional)
|
|
||||||
missing module named _typeshed - imported by numpy.random.bit_generator (top-level)
|
|
||||||
missing module named numpy.random.RandomState - imported by numpy.random (top-level), numpy.random._generator (top-level)
|
|
||||||
missing module named threadpoolctl - imported by numpy.lib._utils_impl (delayed, optional)
|
|
||||||
missing module named numpy._core.zeros - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.vstack - imported by numpy._core (top-level), numpy.lib._shape_base_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.void - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.vecmat - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.vecdot - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.ushort - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.unsignedinteger - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.ulonglong - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.ulong - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.uintp - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.uintc - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.uint64 - imported by numpy._core (conditional), numpy (conditional), numpy._array_api_info (top-level)
|
|
||||||
missing module named numpy._core.uint32 - imported by numpy._core (conditional), numpy (conditional), numpy._array_api_info (top-level)
|
|
||||||
missing module named numpy._core.uint16 - imported by numpy._core (conditional), numpy (conditional), numpy._array_api_info (top-level)
|
|
||||||
missing module named numpy._core.uint - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.ubyte - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.trunc - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.true_divide - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.transpose - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.lib._function_base_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.trace - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.timedelta64 - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.tensordot - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.tanh - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.tan - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.swapaxes - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.sum - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.subtract - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.str_ - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.square - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.sqrt - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional), numpy.fft._pocketfft (top-level)
|
|
||||||
missing module named numpy._core.spacing - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.sort - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.sinh - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.single - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.signedinteger - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.signbit - imported by numpy._core (delayed), numpy.testing._private.utils (delayed), numpy (conditional)
|
|
||||||
missing module named numpy._core.sign - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.short - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.rint - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.right_shift - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.result_type - imported by numpy._core (delayed), numpy.testing._private.utils (delayed), numpy (conditional), numpy.fft._pocketfft (top-level)
|
|
||||||
missing module named numpy._core.remainder - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.reciprocal - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional), numpy.fft._pocketfft (top-level)
|
|
||||||
missing module named numpy._core.radians - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.rad2deg - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.prod - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.power - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.positive - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.pi - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.outer - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.ones - imported by numpy._core (top-level), numpy.lib._polynomial_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.object_ - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.testing._private.utils (delayed), numpy (conditional)
|
|
||||||
missing module named numpy._core.number - imported by numpy._core (delayed), numpy.testing._private.utils (delayed), numpy (conditional)
|
|
||||||
missing module named numpy._core.not_equal - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.nextafter - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.newaxis - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.negative - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.ndarray - imported by numpy._core (top-level), numpy.testing._private.utils (top-level), numpy.lib._utils_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.multiply - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.moveaxis - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.modf - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.mod - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.minimum - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.maximum - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.max - imported by numpy._core (delayed), numpy.testing._private.utils (delayed), numpy (conditional)
|
|
||||||
missing module named numpy._core.matvec - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.matrix_transpose - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.matmul - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.longlong - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.longdouble - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.long - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.logical_xor - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.logical_or - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.logical_not - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.logical_and - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.logaddexp2 - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.logaddexp - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.log10 - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.log2 - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.log1p - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.log - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.linspace - imported by numpy._core (top-level), numpy.lib._index_tricks_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.less_equal - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.less - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.left_shift - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.ldexp - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.lcm - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.isscalar - imported by numpy._core (delayed), numpy.testing._private.utils (delayed), numpy.lib._polynomial_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.isnat - imported by numpy._core (top-level), numpy.testing._private.utils (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.isnan - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.testing._private.utils (delayed), numpy (conditional)
|
|
||||||
missing module named numpy._core.isfinite - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.intp - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.testing._private.utils (top-level), numpy (conditional), numpy._array_api_info (top-level)
|
|
||||||
missing module named numpy._core.integer - imported by numpy._core (conditional), numpy (conditional), numpy.fft._helper (top-level)
|
|
||||||
missing module named numpy._core.intc - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.int64 - imported by numpy._core (conditional), numpy (conditional), numpy._array_api_info (top-level)
|
|
||||||
missing module named numpy._core.int32 - imported by numpy._core (conditional), numpy (conditional), numpy._array_api_info (top-level)
|
|
||||||
missing module named numpy._core.int16 - imported by numpy._core (conditional), numpy (conditional), numpy._array_api_info (top-level)
|
|
||||||
missing module named numpy._core.int8 - imported by numpy._core (conditional), numpy (conditional), numpy._array_api_info (top-level)
|
|
||||||
missing module named numpy._core.inf - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.testing._private.utils (delayed), numpy (conditional)
|
|
||||||
missing module named numpy._core.inexact - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.iinfo - imported by numpy._core (top-level), numpy.lib._twodim_base_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.hypot - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.hstack - imported by numpy._core (top-level), numpy.lib._polynomial_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.heaviside - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.half - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.greater_equal - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.greater - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.gcd - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.frompyfunc - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.frexp - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.fmod - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.fmin - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.fmax - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.floor_divide - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.floor - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.floating - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.float_power - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.float32 - imported by numpy._core (top-level), numpy.testing._private.utils (top-level), numpy (conditional), numpy._array_api_info (top-level)
|
|
||||||
missing module named numpy._core.float16 - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.finfo - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.lib._polynomial_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.fabs - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.expm1 - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.exp2 - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.exp - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.euler_gamma - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.errstate - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.testing._private.utils (delayed), numpy (conditional)
|
|
||||||
missing module named numpy._core.equal - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.empty_like - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional), numpy.fft._pocketfft (top-level)
|
|
||||||
missing module named numpy._core.empty - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.testing._private.utils (top-level), numpy (conditional), numpy.fft._helper (top-level)
|
|
||||||
missing module named numpy._core.e - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.double - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.dot - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.lib._polynomial_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.divmod - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.divide - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.diagonal - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.degrees - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.deg2rad - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.datetime64 - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.csingle - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.cross - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.count_nonzero - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.cosh - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.cos - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.copysign - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.conjugate - imported by numpy._core (conditional), numpy (conditional), numpy.fft._pocketfft (top-level)
|
|
||||||
missing module named numpy._core.conj - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.complexfloating - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.complex64 - imported by numpy._core (conditional), numpy (conditional), numpy._array_api_info (top-level)
|
|
||||||
missing module named numpy._core.clongdouble - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.character - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.ceil - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.cdouble - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.cbrt - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.bytes_ - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.byte - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.bool_ - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.bitwise_xor - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.bitwise_or - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.bitwise_count - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.bitwise_and - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.atleast_3d - imported by numpy._core (top-level), numpy.lib._shape_base_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.atleast_2d - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.atleast_1d - imported by numpy._core (top-level), numpy.lib._polynomial_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.asarray - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.lib._array_utils_impl (top-level), numpy (conditional), numpy.fft._helper (top-level), numpy.fft._pocketfft (top-level)
|
|
||||||
missing module named numpy._core.asanyarray - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.array_repr - imported by numpy._core (top-level), numpy.testing._private.utils (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.array2string - imported by numpy._core (delayed), numpy.testing._private.utils (delayed), numpy (conditional)
|
|
||||||
missing module named numpy._core.array - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.testing._private.utils (top-level), numpy.lib._polynomial_impl (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.argsort - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.arctanh - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.arctan2 - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.arctan - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.arcsinh - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.arcsin - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.arccosh - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.arccos - imported by numpy._core (conditional), numpy (conditional)
|
|
||||||
missing module named numpy._core.arange - imported by numpy._core (top-level), numpy.testing._private.utils (top-level), numpy (conditional), numpy.fft._helper (top-level)
|
|
||||||
missing module named numpy._core.amin - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.amax - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named numpy._core.all - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy.testing._private.utils (delayed), numpy (conditional)
|
|
||||||
missing module named numpy._core.add - imported by numpy._core (top-level), numpy.linalg._linalg (top-level), numpy (conditional)
|
|
||||||
missing module named yaml - imported by numpy.__config__ (delayed)
|
|
||||||
missing module named numpy._distributor_init_local - imported by numpy (optional), numpy._distributor_init (optional)
|
|
||||||
missing module named defusedxml - imported by openpyxl.xml (delayed, optional)
|
|
||||||
missing module named lxml - imported by openpyxl.xml (delayed, optional)
|
|
||||||
missing module named 'defusedxml.ElementTree' - imported by openpyxl.xml.functions (conditional)
|
|
||||||
missing module named 'lxml.etree' - imported by openpyxl.xml.functions (conditional)
|
|
||||||
missing module named PIL - imported by openpyxl.drawing.image (optional)
|
|
||||||
missing module named openpyxl.tests - imported by openpyxl.reader.excel (optional)
|
|
||||||
missing module named google.protobuf.pyext._message - imported by google.protobuf.pyext (conditional, optional), google.protobuf.internal.api_implementation (conditional, optional), google.protobuf.descriptor (conditional), google.protobuf.pyext.cpp_message (conditional)
|
|
||||||
missing module named google.protobuf.enable_deterministic_proto_serialization - imported by google.protobuf (optional), google.protobuf.internal.api_implementation (optional)
|
|
||||||
missing module named google.protobuf.internal._api_implementation - imported by google.protobuf.internal (optional), google.protobuf.internal.api_implementation (optional)
|
|
||||||
missing module named grpc_reflection - imported by grpc (optional)
|
|
||||||
missing module named grpc_health - imported by grpc (optional)
|
|
||||||
missing module named pkg_resources - imported by grpc_tools.protoc (conditional)
|
|
||||||
File diff suppressed because it is too large
Load Diff
BIN
devkit/dist/je-skin-devkit-server.exe
vendored
BIN
devkit/dist/je-skin-devkit-server.exe
vendored
Binary file not shown.
@@ -5,8 +5,8 @@ a = Analysis(
|
|||||||
['sensor_server.py'],
|
['sensor_server.py'],
|
||||||
pathex=[],
|
pathex=[],
|
||||||
binaries=[],
|
binaries=[],
|
||||||
datas=[('sensor_stream_pb2*.py', '.')],
|
datas=[('sensor_stream_pb2.py', '.'), ('sensor_stream_pb2_grpc.py', '.')],
|
||||||
hiddenimports=['grpc', 'openpyxl'],
|
hiddenimports=['grpc', 'openpyxl', 'numpy'],
|
||||||
hookspath=[],
|
hookspath=[],
|
||||||
hooksconfig={},
|
hooksconfig={},
|
||||||
runtime_hooks=[],
|
runtime_hooks=[],
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,7 @@ _sym_db = _symbol_database.Default()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13sensor_stream.proto\x12\rsensor_stream\"\x85\x01\n\x0bSensorFrame\x12\x0b\n\x03seq\x18\x01 \x01(\x04\x12\x14\n\x0ctimestamp_ms\x18\x02 \x01(\x04\x12\x0c\n\x04rows\x18\x03 \x01(\r\x12\x0c\n\x04\x63ols\x18\x04 \x01(\r\x12\x0e\n\x06matrix\x18\x05 \x03(\r\x12\x17\n\x0fresultant_force\x18\x06 \x01(\x01\x12\x0e\n\x06\x64ts_ms\x18\x07 \x01(\r\"\xf9\x01\n\x10PztAngleResponse\x12\x0b\n\x03seq\x18\x01 \x01(\x04\x12\x14\n\x0ctimestamp_ms\x18\x02 \x01(\x04\x12\r\n\x05\x61ngle\x18\x03 \x01(\x02\x12\x0e\n\x06\x64ts_ms\x18\x04 \x01(\r\x12\n\n\x02ok\x18\x05 \x01(\x08\x12\x0f\n\x07message\x18\x06 \x01(\t\x12\x11\n\tmagnitude\x18\x07 \x01(\x02\x12\r\n\x05state\x18\x08 \x01(\x05\x12\r\n\x05\x63op_x\x18\t \x01(\x02\x12\r\n\x05\x63op_y\x18\n \x01(\x02\x12\x0e\n\x06\x62\x61se_x\x18\x0b \x01(\x02\x12\x0e\n\x06\x62\x61se_y\x18\x0c \x01(\x02\x12\x13\n\x0btotal_press\x18\r \x01(\x02\x12\x11\n\tthreshold\x18\x0e \x01(\x02\"8\n\x0eProcessRequest\x12\x10\n\x08\x63sv_path\x18\x01 \x01(\t\x12\x14\n\x0csave_as_xlsx\x18\x02 \x01(\x08\"\xa6\x01\n\x0fProcessResponse\x12\n\n\x02ok\x18\x01 \x01(\x08\x12\x13\n\x0boutput_path\x18\x02 \x01(\t\x12\x13\n\x0bgroups_used\x18\x03 \x01(\r\x12\x12\n\nmean_value\x18\x04 \x01(\x01\x12\x11\n\tthreshold\x18\x05 \x01(\x01\x12\x12\n\nrows_total\x18\x06 \x01(\r\x12\x11\n\trows_kept\x18\x07 \x01(\r\x12\x0f\n\x07message\x18\x08 \x01(\t2W\n\nSensorPush\x12I\n\x06Upload\x12\x1a.sensor_stream.SensorFrame\x1a\x1f.sensor_stream.PztAngleResponse(\x01\x30\x01\x32_\n\x0f\x45xportProcessor\x12L\n\x0bProcessFile\x12\x1d.sensor_stream.ProcessRequest\x1a\x1e.sensor_stream.ProcessResponseb\x06proto3')
|
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13sensor_stream.proto\x12\rsensor_stream\"\x85\x01\n\x0bSensorFrame\x12\x0b\n\x03seq\x18\x01 \x01(\x04\x12\x14\n\x0ctimestamp_ms\x18\x02 \x01(\x04\x12\x0c\n\x04rows\x18\x03 \x01(\r\x12\x0c\n\x04\x63ols\x18\x04 \x01(\r\x12\x0e\n\x06matrix\x18\x05 \x03(\r\x12\x17\n\x0fresultant_force\x18\x06 \x01(\x01\x12\x0e\n\x06\x64ts_ms\x18\x07 \x01(\r\"q\n\x10PztAngleResponse\x12\x0b\n\x03seq\x18\x01 \x01(\x04\x12\x14\n\x0ctimestamp_ms\x18\x02 \x01(\x04\x12\r\n\x05\x61ngle\x18\x03 \x01(\x02\x12\x0e\n\x06\x64ts_ms\x18\x04 \x01(\r\x12\n\n\x02ok\x18\x05 \x01(\x08\x12\x0f\n\x07message\x18\x06 \x01(\t\"8\n\x0eProcessRequest\x12\x10\n\x08\x63sv_path\x18\x01 \x01(\t\x12\x14\n\x0csave_as_xlsx\x18\x02 \x01(\x08\"\xa6\x01\n\x0fProcessResponse\x12\n\n\x02ok\x18\x01 \x01(\x08\x12\x13\n\x0boutput_path\x18\x02 \x01(\t\x12\x13\n\x0bgroups_used\x18\x03 \x01(\r\x12\x12\n\nmean_value\x18\x04 \x01(\x01\x12\x11\n\tthreshold\x18\x05 \x01(\x01\x12\x12\n\nrows_total\x18\x06 \x01(\r\x12\x11\n\trows_kept\x18\x07 \x01(\r\x12\x0f\n\x07message\x18\x08 \x01(\t2W\n\nSensorPush\x12I\n\x06Upload\x12\x1a.sensor_stream.SensorFrame\x1a\x1f.sensor_stream.PztAngleResponse(\x01\x30\x01\x32_\n\x0f\x45xportProcessor\x12L\n\x0bProcessFile\x12\x1d.sensor_stream.ProcessRequest\x1a\x1e.sensor_stream.ProcessResponseb\x06proto3')
|
||||||
|
|
||||||
_globals = globals()
|
_globals = globals()
|
||||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||||
@@ -33,14 +33,14 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|||||||
DESCRIPTOR._loaded_options = None
|
DESCRIPTOR._loaded_options = None
|
||||||
_globals['_SENSORFRAME']._serialized_start=39
|
_globals['_SENSORFRAME']._serialized_start=39
|
||||||
_globals['_SENSORFRAME']._serialized_end=172
|
_globals['_SENSORFRAME']._serialized_end=172
|
||||||
_globals['_PZTANGLERESPONSE']._serialized_start=175
|
_globals['_PZTANGLERESPONSE']._serialized_start=174
|
||||||
_globals['_PZTANGLERESPONSE']._serialized_end=424
|
_globals['_PZTANGLERESPONSE']._serialized_end=287
|
||||||
_globals['_PROCESSREQUEST']._serialized_start=426
|
_globals['_PROCESSREQUEST']._serialized_start=289
|
||||||
_globals['_PROCESSREQUEST']._serialized_end=482
|
_globals['_PROCESSREQUEST']._serialized_end=345
|
||||||
_globals['_PROCESSRESPONSE']._serialized_start=485
|
_globals['_PROCESSRESPONSE']._serialized_start=348
|
||||||
_globals['_PROCESSRESPONSE']._serialized_end=651
|
_globals['_PROCESSRESPONSE']._serialized_end=514
|
||||||
_globals['_SENSORPUSH']._serialized_start=653
|
_globals['_SENSORPUSH']._serialized_start=516
|
||||||
_globals['_SENSORPUSH']._serialized_end=740
|
_globals['_SENSORPUSH']._serialized_end=603
|
||||||
_globals['_EXPORTPROCESSOR']._serialized_start=742
|
_globals['_EXPORTPROCESSOR']._serialized_start=605
|
||||||
_globals['_EXPORTPROCESSOR']._serialized_end=837
|
_globals['_EXPORTPROCESSOR']._serialized_end=700
|
||||||
# @@protoc_insertion_point(module_scope)
|
# @@protoc_insertion_point(module_scope)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,32 +0,0 @@
|
|||||||
# 更新日志
|
|
||||||
|
|
||||||
## 2026-06-09 - 送样分支
|
|
||||||
|
|
||||||
分支:`sample-delivery`
|
|
||||||
|
|
||||||
提交:`160ff54 Prepare sample delivery UI`
|
|
||||||
|
|
||||||
### 显示与交互
|
|
||||||
|
|
||||||
- 合力曲线改为 Canvas 渲染,保留原有 HUD 风格。
|
|
||||||
- 合力曲线 panel 宽度调整为与三维力 panel 一致。
|
|
||||||
- 卸力后合力曲线继续接收并渲染后端 0 值数据,panel 延迟 5 秒消失。
|
|
||||||
- 5 秒内重新施力会取消合力曲线的消失计时。
|
|
||||||
- 三维力 panel 改为卸力后延迟 5 秒消失。
|
|
||||||
- 三维力箭头仍然实时跟随后端数据,卸力后箭头立即消失,不冻结最后方向。
|
|
||||||
|
|
||||||
### 后端数据
|
|
||||||
|
|
||||||
|
|
||||||
- 合力低于显示阈值时,后端不再清空 summary 数组,而是持续写入 `0.0`。
|
|
||||||
- 压力矩阵在低于显示阈值时仍然清零。
|
|
||||||
- 前端可以通过 summary 数组是否存在和最新值大小来判断释放状态。
|
|
||||||
|
|
||||||
### 显示范围
|
|
||||||
|
|
||||||
- 合力与压力数值显示增加最大显示值处理:超过 `25.6` 时显示为 `25.6+`。
|
|
||||||
|
|
||||||
### 验证
|
|
||||||
|
|
||||||
- `npm.cmd run check` 通过,0 errors,保留 13 个既有 warnings。
|
|
||||||
- `cargo check` 通过。
|
|
||||||
104
package-lock.json
generated
104
package-lock.json
generated
@@ -9,7 +9,7 @@
|
|||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.11.0",
|
"@tauri-apps/api": "^2",
|
||||||
"@tauri-apps/plugin-opener": "^2",
|
"@tauri-apps/plugin-opener": "^2",
|
||||||
"@tauri-apps/plugin-process": "^2.3.1",
|
"@tauri-apps/plugin-process": "^2.3.1",
|
||||||
"@tauri-apps/plugin-updater": "^2.10.1",
|
"@tauri-apps/plugin-updater": "^2.10.1",
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"@sveltejs/adapter-static": "^3.0.6",
|
"@sveltejs/adapter-static": "^3.0.6",
|
||||||
"@sveltejs/kit": "^2.9.0",
|
"@sveltejs/kit": "^2.9.0",
|
||||||
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
||||||
"@tauri-apps/cli": "^2.11.2",
|
"@tauri-apps/cli": "^2",
|
||||||
"@types/three": "^0.183.1",
|
"@types/three": "^0.183.1",
|
||||||
"svelte": "^5.0.0",
|
"svelte": "^5.0.0",
|
||||||
"svelte-check": "^4.0.0",
|
"svelte-check": "^4.0.0",
|
||||||
@@ -1032,9 +1032,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/api": {
|
"node_modules/@tauri-apps/api": {
|
||||||
"version": "2.11.0",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.10.1.tgz",
|
||||||
"integrity": "sha512-7CinYODhky9lmO23xHnUFv0Xt43fbtWMyxZcLcRBlFkcgXKuEirBvHpmtJ89YMhyeGcq20Wuc47Fa4XjyniywA==",
|
"integrity": "sha512-hKL/jWf293UDSUN09rR69hrToyIXBb8CjGaWC7gfinvnQrBVvnLr08FeFi38gxtugAVyVcTa5/FD/Xnkb1siBw==",
|
||||||
"license": "Apache-2.0 OR MIT",
|
"license": "Apache-2.0 OR MIT",
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
@@ -1042,9 +1042,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli": {
|
"node_modules/@tauri-apps/cli": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.10.1.tgz",
|
||||||
"integrity": "sha512-bk3HemqvGRoy+5D/dVMUQHKMYLglD0jVnMm/0iGMH6ufZ+p8r14m6BpIixwij3PBvZdvORUp1YifTD8QxVZ1Nw==",
|
"integrity": "sha512-jQNGF/5quwORdZSSLtTluyKQ+o6SMa/AUICfhf4egCGFdMHqWssApVgYSbg+jmrZoc8e1DscNvjTnXtlHLS11g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0 OR MIT",
|
"license": "Apache-2.0 OR MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -1058,23 +1058,23 @@
|
|||||||
"url": "https://opencollective.com/tauri"
|
"url": "https://opencollective.com/tauri"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@tauri-apps/cli-darwin-arm64": "2.11.2",
|
"@tauri-apps/cli-darwin-arm64": "2.10.1",
|
||||||
"@tauri-apps/cli-darwin-x64": "2.11.2",
|
"@tauri-apps/cli-darwin-x64": "2.10.1",
|
||||||
"@tauri-apps/cli-linux-arm-gnueabihf": "2.11.2",
|
"@tauri-apps/cli-linux-arm-gnueabihf": "2.10.1",
|
||||||
"@tauri-apps/cli-linux-arm64-gnu": "2.11.2",
|
"@tauri-apps/cli-linux-arm64-gnu": "2.10.1",
|
||||||
"@tauri-apps/cli-linux-arm64-musl": "2.11.2",
|
"@tauri-apps/cli-linux-arm64-musl": "2.10.1",
|
||||||
"@tauri-apps/cli-linux-riscv64-gnu": "2.11.2",
|
"@tauri-apps/cli-linux-riscv64-gnu": "2.10.1",
|
||||||
"@tauri-apps/cli-linux-x64-gnu": "2.11.2",
|
"@tauri-apps/cli-linux-x64-gnu": "2.10.1",
|
||||||
"@tauri-apps/cli-linux-x64-musl": "2.11.2",
|
"@tauri-apps/cli-linux-x64-musl": "2.10.1",
|
||||||
"@tauri-apps/cli-win32-arm64-msvc": "2.11.2",
|
"@tauri-apps/cli-win32-arm64-msvc": "2.10.1",
|
||||||
"@tauri-apps/cli-win32-ia32-msvc": "2.11.2",
|
"@tauri-apps/cli-win32-ia32-msvc": "2.10.1",
|
||||||
"@tauri-apps/cli-win32-x64-msvc": "2.11.2"
|
"@tauri-apps/cli-win32-x64-msvc": "2.10.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-darwin-arm64": {
|
"node_modules/@tauri-apps/cli-darwin-arm64": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.10.1.tgz",
|
||||||
"integrity": "sha512-+4UZzLt+eOAEQCwgd+TqKgyUJMrvx+BgdXLLaqJYmPqzP+nE6YZr/hY6CWLYGQb8jFn99jEkmC6uA3tNvamA1w==",
|
"integrity": "sha512-Z2OjCXiZ+fbYZy7PmP3WRnOpM9+Fy+oonKDEmUE6MwN4IGaYqgceTjwHucc/kEEYZos5GICve35f7ZiizgqEnQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1089,9 +1089,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-darwin-x64": {
|
"node_modules/@tauri-apps/cli-darwin-x64": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.10.1.tgz",
|
||||||
"integrity": "sha512-VjYYtZUPqDMLutSfJEyxFE3Bz+DPi7c8wC3imckgvciLDZLq4qwKJxBicg0BXGhXjJsl8vKWgWRFNMPELQ+Xyg==",
|
"integrity": "sha512-V/irQVvjPMGOTQqNj55PnQPVuH4VJP8vZCN7ajnj+ZS8Kom1tEM2hR3qbbIRoS3dBKs5mbG8yg1WC+97dq17Pw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -1106,9 +1106,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-linux-arm-gnueabihf": {
|
"node_modules/@tauri-apps/cli-linux-arm-gnueabihf": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.10.1.tgz",
|
||||||
"integrity": "sha512-yMemD6f4i95AQriS8EazyOFzbE34yjnP16i3IOzpHGQvBoy2DjypFMFBq0NtPuITURv/cOGguRtHR5d79/9CSA==",
|
"integrity": "sha512-Hyzwsb4VnCWKGfTw+wSt15Z2pLw2f0JdFBfq2vHBOBhvg7oi6uhKiF87hmbXOBXUZaGkyRDkCHsdzJcIfoJC2w==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
@@ -1123,9 +1123,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-linux-arm64-gnu": {
|
"node_modules/@tauri-apps/cli-linux-arm64-gnu": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.10.1.tgz",
|
||||||
"integrity": "sha512-cgI91D2wL8GSgoWwZXDqt+DwnuZCP2/bz03QAE4TrhgAKIsrB4hX26W/H1EONPUUNkqrsgeCD0wU6pcNjV/5kw==",
|
"integrity": "sha512-OyOYs2t5GkBIvyWjA1+h4CZxTcdz1OZPCWAPz5DYEfB0cnWHERTnQ/SLayQzncrT0kwRoSfSz9KxenkyJoTelA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1143,9 +1143,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-linux-arm64-musl": {
|
"node_modules/@tauri-apps/cli-linux-arm64-musl": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.10.1.tgz",
|
||||||
"integrity": "sha512-X1rm0BERqAAggtYTESSgXrS3sz4Sb/OiPiz54UqISlXW+GkR3vNIGnsy/lejNmoXGVqri3Q53BCfQiclOIyRPw==",
|
"integrity": "sha512-MIj78PDDGjkg3NqGptDOGgfXks7SYJwhiMh8SBoZS+vfdz7yP5jN18bNaLnDhsVIPARcAhE1TlsZe/8Yxo2zqg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1163,9 +1163,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-linux-riscv64-gnu": {
|
"node_modules/@tauri-apps/cli-linux-riscv64-gnu": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-riscv64-gnu/-/cli-linux-riscv64-gnu-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-riscv64-gnu/-/cli-linux-riscv64-gnu-2.10.1.tgz",
|
||||||
"integrity": "sha512-usbMLJbT3KtkOrBMDVeGYNM35aTHXx38SJSzTMSqqjeUIOQ+iVPjb2yAGNAE+KqmBbAx4FOFIyMeKXx2M/JKGQ==",
|
"integrity": "sha512-X0lvOVUg8PCVaoEtEAnpxmnkwlE1gcMDTqfhbefICKDnOTJ5Est3qL0SrWxizDackIOKBcvtpejrSiVpuJI1kw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
@@ -1183,9 +1183,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-linux-x64-gnu": {
|
"node_modules/@tauri-apps/cli-linux-x64-gnu": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.10.1.tgz",
|
||||||
"integrity": "sha512-Ru4gwJKPG0ctVGchRGpRup4Y4lW2SSfFnrbQcyHhCliKy4g8Qz97TrUgCur4CbWyAgKxvGh3SjrkA0LDYzDGiw==",
|
"integrity": "sha512-2/12bEzsJS9fAKybxgicCDFxYD1WEI9kO+tlDwX5znWG2GwMBaiWcmhGlZ8fi+DMe9CXlcVarMTYc0L3REIRxw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -1203,9 +1203,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-linux-x64-musl": {
|
"node_modules/@tauri-apps/cli-linux-x64-musl": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.10.1.tgz",
|
||||||
"integrity": "sha512-eUm7T6clN1MMmNSRQ9gaWsQdyehQx2Gmn5hht/QUlqZQI/qcP2OJK5dnaxqwFzCr2HdsEo9ydxaqcS1oJzMvUw==",
|
"integrity": "sha512-Y8J0ZzswPz50UcGOFuXGEMrxbjwKSPgXftx5qnkuMs2rmwQB5ssvLb6tn54wDSYxe7S6vlLob9vt0VKuNOaCIQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -1223,9 +1223,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-win32-arm64-msvc": {
|
"node_modules/@tauri-apps/cli-win32-arm64-msvc": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.10.1.tgz",
|
||||||
"integrity": "sha512-HeeZW80jU+gVTOEX4X/hC6NVSAdDVXajwP5fxIZ/3z9WvUC7qrudX2GMTilYq6Dg0e0sk0XgsAJD1hZ5wPBXUA==",
|
"integrity": "sha512-iSt5B86jHYAPJa/IlYw++SXtFPGnWtFJriHn7X0NFBVunF6zu9+/zOn8OgqIWSl8RgzhLGXQEEtGBdR4wzpVgg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1240,9 +1240,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-win32-ia32-msvc": {
|
"node_modules/@tauri-apps/cli-win32-ia32-msvc": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.10.1.tgz",
|
||||||
"integrity": "sha512-YhjQNZcXfbkCLyazSv1nPnJ9iRFE1wm6kc51FDbU10/Dk09io+6PAGMLjkxnX2GdM0qMnDmTjstY8mTDVvtKeA==",
|
"integrity": "sha512-gXyxgEzsFegmnWywYU5pEBURkcFN/Oo45EAwvZrHMh+zUSEAvO5E8TXsgPADYm31d1u7OQU3O3HsYfVBf2moHw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
@@ -1257,9 +1257,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tauri-apps/cli-win32-x64-msvc": {
|
"node_modules/@tauri-apps/cli-win32-x64-msvc": {
|
||||||
"version": "2.11.2",
|
"version": "2.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.10.1.tgz",
|
||||||
"integrity": "sha512-d2JchlFIpZevZVReyqhQOekJmb1UH3rhZ5VX6sH3ty9ETE0TKQavpihvoScUXfKKpW6HZC0MrFGRU0ZtD+w3gA==",
|
"integrity": "sha512-6Cn7YpPFwzChy0ERz6djKEmUehWrYlM+xTaNzGPgZocw3BD7OfwfWHKVWxXzdjEW2KfKkHddfdxK1XXTYqBRLg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.11.0",
|
"@tauri-apps/api": "^2",
|
||||||
"@tauri-apps/plugin-opener": "^2",
|
"@tauri-apps/plugin-opener": "^2",
|
||||||
"@tauri-apps/plugin-process": "^2.3.1",
|
"@tauri-apps/plugin-process": "^2.3.1",
|
||||||
"@tauri-apps/plugin-updater": "^2.10.1",
|
"@tauri-apps/plugin-updater": "^2.10.1",
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"@sveltejs/adapter-static": "^3.0.6",
|
"@sveltejs/adapter-static": "^3.0.6",
|
||||||
"@sveltejs/kit": "^2.9.0",
|
"@sveltejs/kit": "^2.9.0",
|
||||||
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
||||||
"@tauri-apps/cli": "^2.11.2",
|
"@tauri-apps/cli": "^2",
|
||||||
"@types/three": "^0.183.1",
|
"@types/three": "^0.183.1",
|
||||||
"svelte": "^5.0.0",
|
"svelte": "^5.0.0",
|
||||||
"svelte-check": "^4.0.0",
|
"svelte-check": "^4.0.0",
|
||||||
|
|||||||
1384
src-tauri/Cargo.lock
generated
1384
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -15,10 +15,8 @@ name = "tauri_demo_lib"
|
|||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["multi-dim"]
|
default = []
|
||||||
debug = []
|
|
||||||
devkit = ["dep:tonic", "dep:prost", "dep:prost-types", "dep:async-stream", "dep:dirs"]
|
devkit = ["dep:tonic", "dep:prost", "dep:prost-types", "dep:async-stream", "dep:dirs"]
|
||||||
multi-dim = ["dep:ndarray"]
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "2", features = [] }
|
tauri-build = { version = "2", features = [] }
|
||||||
@@ -38,22 +36,19 @@ async-stream = { version = "0.3", optional = true }
|
|||||||
dirs = { version = "6", optional = true }
|
dirs = { version = "6", optional = true }
|
||||||
tokio-serial = { version = "5.4.5" }
|
tokio-serial = { version = "5.4.5" }
|
||||||
tokio = { version = "1.50.0", features = ["full"] }
|
tokio = { version = "1.50.0", features = ["full"] }
|
||||||
async-trait = "0.1.89"
|
|
||||||
tokio-util = "0.7.18"
|
tokio-util = "0.7.18"
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
fern = { version = "0.7.1", features = ["colored", "date-based"] }
|
fern = { version = "0.7.1", features = ["colored", "date-based"] }
|
||||||
log = "0.4.29"
|
log = "0.4.29"
|
||||||
humantime = "2.3.0"
|
humantime = "2.3.0"
|
||||||
csv = "1.4.0"
|
csv = "1.4.0"
|
||||||
chrono = "0.4.44"
|
|
||||||
crc = "3.4.0"
|
|
||||||
axum = { version = "0.8", features = ["ws"] }
|
axum = { version = "0.8", features = ["ws"] }
|
||||||
tower-http = { version = "0.6", features = ["cors"] }
|
tower-http = { version = "0.6", features = ["cors"] }
|
||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
uuid = { version = "1", features = ["v4", "serde"] }
|
uuid = { version = "1", features = ["v4", "serde"] }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
|
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
|
||||||
ndarray = { version = "0.15", optional = true }
|
eskin-finger-sdk = { path = "../eskin-finger-sdk" }
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||||
tauri-plugin-updater = "2"
|
tauri-plugin-updater = "2"
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
|
|
||||||
-keep class com.lenn.tauri_serial.TauriActivity {
|
|
||||||
public app.tauri.plugin.PluginManager getPluginManager();
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"$schema":"https://schema.tauri.app/config/2","productName":"JE-Skin","version":"0.4.0","identifier":"com.lenn.tauri-serial","app":{"windows":[{"label":"main","create":true,"url":"index.html","dragDropEnabled":true,"center":false,"width":1366.0,"height":860.0,"resizable":true,"maximizable":true,"minimizable":true,"closable":true,"title":"JE-Skin","fullscreen":false,"focus":true,"focusable":true,"transparent":false,"maximized":false,"visible":true,"decorations":false,"alwaysOnBottom":false,"alwaysOnTop":false,"visibleOnAllWorkspaces":false,"contentProtected":false,"skipTaskbar":false,"titleBarStyle":"Visible","hiddenTitle":false,"acceptFirstMouse":false,"shadow":true,"incognito":false,"zoomHotkeysEnabled":false,"browserExtensionsEnabled":false,"useHttpsScheme":false,"javascriptDisabled":false,"allowLinkPreview":true,"disableInputAccessoryView":false,"scrollBarStyle":"default"}],"security":{"freezePrototype":false,"dangerousDisableAssetCspModification":false,"assetProtocol":{"scope":[],"enable":false},"pattern":{"use":"brownfield"},"capabilities":[]},"macOSPrivateApi":false,"withGlobalTauri":false,"enableGTKAppId":false},"build":{"devUrl":"http://localhost:1420/","frontendDist":"../build","beforeDevCommand":"npm run dev","beforeBuildCommand":"npm run build","removeUnusedCommands":false,"additionalWatchFolders":[]},"bundle":{"active":true,"targets":"all","createUpdaterArtifacts":true,"icon":["icons/32x32.png","icons/128x128.png","icons/128x128@2x.png","icons/icon.icns","icons/icon.ico"],"resources":["resources/je-skin-devkit-server.exe"],"useLocalToolsDir":false,"windows":{"digestAlgorithm":null,"certificateThumbprint":null,"timestampUrl":null,"tsp":false,"webviewInstallMode":{"type":"downloadBootstrapper","silent":true},"allowDowngrades":true,"wix":null,"nsis":{"template":"nsis/installer.nsi","headerImage":null,"sidebarImage":null,"installerIcon":"icons/icon.ico","installMode":"both","languages":null,"customLanguageFiles":null,"displayLanguageSelector":false,"compression":"lzma","startMenuFolder":null,"installerHooks":null,"minimumWebview2Version":null},"signCommand":null},"linux":{"appimage":{"bundleMediaFramework":false,"files":{}},"deb":{"files":{}},"rpm":{"release":"1","epoch":0,"files":{}}},"macOS":{"files":{},"minimumSystemVersion":"10.13","hardenedRuntime":true,"dmg":{"windowSize":{"width":660,"height":400},"appPosition":{"x":180,"y":170},"applicationFolderPosition":{"x":480,"y":170}}},"iOS":{"minimumSystemVersion":"14.0"},"android":{"minSdkVersion":24,"autoIncrementVersionCode":false}},"plugins":{}}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
@file:Suppress("unused")
|
|
||||||
|
|
||||||
package com.lenn.tauri_serial
|
|
||||||
|
|
||||||
import android.webkit.*
|
|
||||||
|
|
||||||
class Ipc(val webViewClient: RustWebViewClient) {
|
|
||||||
@JavascriptInterface
|
|
||||||
fun postMessage(message: String?) {
|
|
||||||
message?.let {m ->
|
|
||||||
// we're not using WebView::getUrl() here because it needs to be executed on the main thread
|
|
||||||
// and it would slow down the Ipc
|
|
||||||
// so instead we track the current URL on the webview client
|
|
||||||
this.ipc(webViewClient.currentUrl, m)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
init {
|
|
||||||
System.loadLibrary("tauri_demo_lib")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private external fun ipc(url: String, message: String)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate")
|
|
||||||
|
|
||||||
package com.lenn.tauri_serial
|
|
||||||
|
|
||||||
// taken from https://github.com/ionic-team/capacitor/blob/6658bca41e78239347e458175b14ca8bd5c1d6e8/android/capacitor/src/main/java/com/getcapacitor/Logger.java
|
|
||||||
|
|
||||||
import android.text.TextUtils
|
|
||||||
import android.util.Log
|
|
||||||
|
|
||||||
class Logger {
|
|
||||||
companion object {
|
|
||||||
private const val LOG_TAG_CORE = "Tauri"
|
|
||||||
|
|
||||||
fun tags(vararg subtags: String): String {
|
|
||||||
return if (subtags.isNotEmpty()) {
|
|
||||||
LOG_TAG_CORE + "/" + TextUtils.join("/", subtags)
|
|
||||||
} else LOG_TAG_CORE
|
|
||||||
}
|
|
||||||
|
|
||||||
fun verbose(message: String) {
|
|
||||||
verbose(LOG_TAG_CORE, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun verbose(tag: String, message: String) {
|
|
||||||
if (!shouldLog()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Log.v(tag, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun debug(message: String) {
|
|
||||||
debug(LOG_TAG_CORE, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun debug(tag: String, message: String) {
|
|
||||||
if (!shouldLog()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Log.d(tag, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun info(message: String) {
|
|
||||||
info(LOG_TAG_CORE, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun info(tag: String, message: String) {
|
|
||||||
if (!shouldLog()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Log.i(tag, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun warn(message: String) {
|
|
||||||
warn(LOG_TAG_CORE, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun warn(tag: String, message: String) {
|
|
||||||
if (!shouldLog()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Log.w(tag, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun error(message: String) {
|
|
||||||
error(LOG_TAG_CORE, message, null)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun error(message: String, e: Throwable?) {
|
|
||||||
error(LOG_TAG_CORE, message, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun error(tag: String, message: String, e: Throwable?) {
|
|
||||||
if (!shouldLog()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Log.e(tag, message, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun shouldLog(): Boolean {
|
|
||||||
return BuildConfig.DEBUG
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
package com.lenn.tauri_serial
|
|
||||||
|
|
||||||
// taken from https://github.com/ionic-team/capacitor/blob/6658bca41e78239347e458175b14ca8bd5c1d6e8/android/capacitor/src/main/java/com/getcapacitor/PermissionHelper.java
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.os.Build
|
|
||||||
import androidx.core.app.ActivityCompat
|
|
||||||
import java.util.ArrayList
|
|
||||||
|
|
||||||
object PermissionHelper {
|
|
||||||
/**
|
|
||||||
* Checks if a list of given permissions are all granted by the user
|
|
||||||
*
|
|
||||||
* @param permissions Permissions to check.
|
|
||||||
* @return True if all permissions are granted, false if at least one is not.
|
|
||||||
*/
|
|
||||||
fun hasPermissions(context: Context?, permissions: Array<String>): Boolean {
|
|
||||||
for (perm in permissions) {
|
|
||||||
if (ActivityCompat.checkSelfPermission(
|
|
||||||
context!!,
|
|
||||||
perm
|
|
||||||
) != PackageManager.PERMISSION_GRANTED
|
|
||||||
) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether the given permission has been defined in the AndroidManifest.xml
|
|
||||||
*
|
|
||||||
* @param permission A permission to check.
|
|
||||||
* @return True if the permission has been defined in the Manifest, false if not.
|
|
||||||
*/
|
|
||||||
fun hasDefinedPermission(context: Context, permission: String): Boolean {
|
|
||||||
var hasPermission = false
|
|
||||||
val requestedPermissions = getManifestPermissions(context)
|
|
||||||
if (!requestedPermissions.isNullOrEmpty()) {
|
|
||||||
val requestedPermissionsList = listOf(*requestedPermissions)
|
|
||||||
val requestedPermissionsArrayList = ArrayList(requestedPermissionsList)
|
|
||||||
if (requestedPermissionsArrayList.contains(permission)) {
|
|
||||||
hasPermission = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hasPermission
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether all of the given permissions have been defined in the AndroidManifest.xml
|
|
||||||
* @param context the app context
|
|
||||||
* @param permissions a list of permissions
|
|
||||||
* @return true only if all permissions are defined in the AndroidManifest.xml
|
|
||||||
*/
|
|
||||||
fun hasDefinedPermissions(context: Context, permissions: Array<String>): Boolean {
|
|
||||||
for (permission in permissions) {
|
|
||||||
if (!hasDefinedPermission(context, permission)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the permissions defined in AndroidManifest.xml
|
|
||||||
*
|
|
||||||
* @return The permissions defined in AndroidManifest.xml
|
|
||||||
*/
|
|
||||||
private fun getManifestPermissions(context: Context): Array<String>? {
|
|
||||||
var requestedPermissions: Array<String>? = null
|
|
||||||
try {
|
|
||||||
val pm = context.packageManager
|
|
||||||
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
pm.getPackageInfo(context.packageName, PackageManager.PackageInfoFlags.of(PackageManager.GET_PERMISSIONS.toLong()))
|
|
||||||
} else {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
pm.getPackageInfo(context.packageName, PackageManager.GET_PERMISSIONS)
|
|
||||||
}
|
|
||||||
if (packageInfo != null) {
|
|
||||||
requestedPermissions = packageInfo.requestedPermissions
|
|
||||||
}
|
|
||||||
} catch (_: Exception) {
|
|
||||||
}
|
|
||||||
return requestedPermissions
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Given a list of permissions, return a new list with the ones not present in AndroidManifest.xml
|
|
||||||
*
|
|
||||||
* @param neededPermissions The permissions needed.
|
|
||||||
* @return The permissions not present in AndroidManifest.xml
|
|
||||||
*/
|
|
||||||
fun getUndefinedPermissions(context: Context, neededPermissions: Array<String?>): Array<String?> {
|
|
||||||
val undefinedPermissions = ArrayList<String?>()
|
|
||||||
val requestedPermissions = getManifestPermissions(context)
|
|
||||||
if (!requestedPermissions.isNullOrEmpty()) {
|
|
||||||
val requestedPermissionsList = listOf(*requestedPermissions)
|
|
||||||
val requestedPermissionsArrayList = ArrayList(requestedPermissionsList)
|
|
||||||
for (permission in neededPermissions) {
|
|
||||||
if (!requestedPermissionsArrayList.contains(permission)) {
|
|
||||||
undefinedPermissions.add(permission)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var undefinedPermissionArray = arrayOfNulls<String>(undefinedPermissions.size)
|
|
||||||
undefinedPermissionArray = undefinedPermissions.toArray(undefinedPermissionArray)
|
|
||||||
return undefinedPermissionArray
|
|
||||||
}
|
|
||||||
return neededPermissions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,495 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
@file:Suppress("ObsoleteSdkInt", "RedundantOverride", "QueryPermissionsNeeded", "SimpleDateFormat")
|
|
||||||
|
|
||||||
package com.lenn.tauri_serial
|
|
||||||
|
|
||||||
// taken from https://github.com/ionic-team/capacitor/blob/6658bca41e78239347e458175b14ca8bd5c1d6e8/android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java
|
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.app.Activity
|
|
||||||
import android.app.AlertDialog
|
|
||||||
import android.content.ActivityNotFoundException
|
|
||||||
import android.content.DialogInterface
|
|
||||||
import android.content.Intent
|
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Environment
|
|
||||||
import android.provider.MediaStore
|
|
||||||
import android.view.View
|
|
||||||
import android.webkit.*
|
|
||||||
import android.widget.EditText
|
|
||||||
import androidx.activity.result.ActivityResult
|
|
||||||
import androidx.activity.result.ActivityResultCallback
|
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
|
||||||
import androidx.core.content.FileProvider
|
|
||||||
import java.io.File
|
|
||||||
import java.io.IOException
|
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class RustWebChromeClient(appActivity: WryActivity) : WebChromeClient() {
|
|
||||||
private interface PermissionListener {
|
|
||||||
fun onPermissionSelect(isGranted: Boolean?)
|
|
||||||
}
|
|
||||||
|
|
||||||
private interface ActivityResultListener {
|
|
||||||
fun onActivityResult(result: ActivityResult?)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val activity: WryActivity
|
|
||||||
private var permissionLauncher: ActivityResultLauncher<Array<String>>
|
|
||||||
private var activityLauncher: ActivityResultLauncher<Intent>
|
|
||||||
private var permissionListener: PermissionListener? = null
|
|
||||||
private var activityListener: ActivityResultListener? = null
|
|
||||||
|
|
||||||
init {
|
|
||||||
activity = appActivity
|
|
||||||
val permissionCallback =
|
|
||||||
ActivityResultCallback { isGranted: Map<String, Boolean> ->
|
|
||||||
if (permissionListener != null) {
|
|
||||||
var granted = true
|
|
||||||
for ((_, value) in isGranted) {
|
|
||||||
if (!value) granted = false
|
|
||||||
}
|
|
||||||
permissionListener!!.onPermissionSelect(granted)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
permissionLauncher =
|
|
||||||
activity.registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions(), permissionCallback)
|
|
||||||
activityLauncher = activity.registerForActivityResult(
|
|
||||||
ActivityResultContracts.StartActivityForResult()
|
|
||||||
) { result ->
|
|
||||||
if (activityListener != null) {
|
|
||||||
activityListener!!.onActivityResult(result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render web content in `view`.
|
|
||||||
*
|
|
||||||
* Both this method and [.onHideCustomView] are required for
|
|
||||||
* rendering web content in full screen.
|
|
||||||
*
|
|
||||||
* @see [](https://developer.android.com/reference/android/webkit/WebChromeClient.onShowCustomView
|
|
||||||
) */
|
|
||||||
override fun onShowCustomView(view: View, callback: CustomViewCallback) {
|
|
||||||
callback.onCustomViewHidden()
|
|
||||||
super.onShowCustomView(view, callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render web content in the original Web View again.
|
|
||||||
*
|
|
||||||
* Do not remove this method--@see #onShowCustomView(View, CustomViewCallback).
|
|
||||||
*/
|
|
||||||
override fun onHideCustomView() {
|
|
||||||
super.onHideCustomView()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPermissionRequest(request: PermissionRequest) {
|
|
||||||
val isRequestPermissionRequired = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
|
||||||
val permissionList: MutableList<String> = ArrayList()
|
|
||||||
if (listOf(*request.resources).contains("android.webkit.resource.VIDEO_CAPTURE")) {
|
|
||||||
permissionList.add(Manifest.permission.CAMERA)
|
|
||||||
}
|
|
||||||
if (listOf(*request.resources).contains("android.webkit.resource.AUDIO_CAPTURE")) {
|
|
||||||
permissionList.add(Manifest.permission.MODIFY_AUDIO_SETTINGS)
|
|
||||||
permissionList.add(Manifest.permission.RECORD_AUDIO)
|
|
||||||
}
|
|
||||||
if (permissionList.isNotEmpty() && isRequestPermissionRequired) {
|
|
||||||
val permissions = permissionList.toTypedArray()
|
|
||||||
permissionListener = object : PermissionListener {
|
|
||||||
override fun onPermissionSelect(isGranted: Boolean?) {
|
|
||||||
if (isGranted == true) {
|
|
||||||
request.grant(request.resources)
|
|
||||||
} else {
|
|
||||||
request.deny()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
permissionLauncher.launch(permissions)
|
|
||||||
} else {
|
|
||||||
request.grant(request.resources)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the browser alert modal
|
|
||||||
* @param view
|
|
||||||
* @param url
|
|
||||||
* @param message
|
|
||||||
* @param result
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
override fun onJsAlert(view: WebView, url: String, message: String, result: JsResult): Boolean {
|
|
||||||
if (activity.isFinishing) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
val builder = AlertDialog.Builder(view.context)
|
|
||||||
builder
|
|
||||||
.setMessage(message)
|
|
||||||
.setPositiveButton(
|
|
||||||
"OK"
|
|
||||||
) { dialog: DialogInterface, _: Int ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.confirm()
|
|
||||||
}
|
|
||||||
.setOnCancelListener { dialog: DialogInterface ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.cancel()
|
|
||||||
}
|
|
||||||
val dialog = builder.create()
|
|
||||||
dialog.show()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the browser confirm modal
|
|
||||||
* @param view
|
|
||||||
* @param url
|
|
||||||
* @param message
|
|
||||||
* @param result
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
override fun onJsConfirm(view: WebView, url: String, message: String, result: JsResult): Boolean {
|
|
||||||
if (activity.isFinishing) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
val builder = AlertDialog.Builder(view.context)
|
|
||||||
builder
|
|
||||||
.setMessage(message)
|
|
||||||
.setPositiveButton(
|
|
||||||
"OK"
|
|
||||||
) { dialog: DialogInterface, _: Int ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.confirm()
|
|
||||||
}
|
|
||||||
.setNegativeButton(
|
|
||||||
"Cancel"
|
|
||||||
) { dialog: DialogInterface, _: Int ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.cancel()
|
|
||||||
}
|
|
||||||
.setOnCancelListener { dialog: DialogInterface ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.cancel()
|
|
||||||
}
|
|
||||||
val dialog = builder.create()
|
|
||||||
dialog.show()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the browser prompt modal
|
|
||||||
* @param view
|
|
||||||
* @param url
|
|
||||||
* @param message
|
|
||||||
* @param defaultValue
|
|
||||||
* @param result
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
override fun onJsPrompt(
|
|
||||||
view: WebView,
|
|
||||||
url: String,
|
|
||||||
message: String,
|
|
||||||
defaultValue: String,
|
|
||||||
result: JsPromptResult
|
|
||||||
): Boolean {
|
|
||||||
if (activity.isFinishing) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
val builder = AlertDialog.Builder(view.context)
|
|
||||||
val input = EditText(view.context)
|
|
||||||
builder
|
|
||||||
.setMessage(message)
|
|
||||||
.setView(input)
|
|
||||||
.setPositiveButton(
|
|
||||||
"OK"
|
|
||||||
) { dialog: DialogInterface, _: Int ->
|
|
||||||
dialog.dismiss()
|
|
||||||
val inputText1 = input.text.toString().trim { it <= ' ' }
|
|
||||||
result.confirm(inputText1)
|
|
||||||
}
|
|
||||||
.setNegativeButton(
|
|
||||||
"Cancel"
|
|
||||||
) { dialog: DialogInterface, _: Int ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.cancel()
|
|
||||||
}
|
|
||||||
.setOnCancelListener { dialog: DialogInterface ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.cancel()
|
|
||||||
}
|
|
||||||
val dialog = builder.create()
|
|
||||||
dialog.show()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the browser geolocation permission prompt
|
|
||||||
* @param origin
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
override fun onGeolocationPermissionsShowPrompt(
|
|
||||||
origin: String,
|
|
||||||
callback: GeolocationPermissions.Callback
|
|
||||||
) {
|
|
||||||
super.onGeolocationPermissionsShowPrompt(origin, callback)
|
|
||||||
Logger.debug("onGeolocationPermissionsShowPrompt: DOING IT HERE FOR ORIGIN: $origin")
|
|
||||||
val geoPermissions =
|
|
||||||
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION)
|
|
||||||
if (!PermissionHelper.hasPermissions(activity, geoPermissions)) {
|
|
||||||
permissionListener = object : PermissionListener {
|
|
||||||
override fun onPermissionSelect(isGranted: Boolean?) {
|
|
||||||
if (isGranted == true) {
|
|
||||||
callback.invoke(origin, true, false)
|
|
||||||
} else {
|
|
||||||
val coarsePermission =
|
|
||||||
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION)
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
|
|
||||||
PermissionHelper.hasPermissions(activity, coarsePermission)
|
|
||||||
) {
|
|
||||||
callback.invoke(origin, true, false)
|
|
||||||
} else {
|
|
||||||
callback.invoke(origin, false, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
permissionLauncher.launch(geoPermissions)
|
|
||||||
} else {
|
|
||||||
// permission is already granted
|
|
||||||
callback.invoke(origin, true, false)
|
|
||||||
Logger.debug("onGeolocationPermissionsShowPrompt: has required permission")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onShowFileChooser(
|
|
||||||
webView: WebView,
|
|
||||||
filePathCallback: ValueCallback<Array<Uri?>?>,
|
|
||||||
fileChooserParams: FileChooserParams
|
|
||||||
): Boolean {
|
|
||||||
val acceptTypes = listOf(*fileChooserParams.acceptTypes)
|
|
||||||
val captureEnabled = fileChooserParams.isCaptureEnabled
|
|
||||||
val capturePhoto = captureEnabled && acceptTypes.contains("image/*")
|
|
||||||
val captureVideo = captureEnabled && acceptTypes.contains("video/*")
|
|
||||||
if (capturePhoto || captureVideo) {
|
|
||||||
if (isMediaCaptureSupported) {
|
|
||||||
showMediaCaptureOrFilePicker(filePathCallback, fileChooserParams, captureVideo)
|
|
||||||
} else {
|
|
||||||
permissionListener = object : PermissionListener {
|
|
||||||
override fun onPermissionSelect(isGranted: Boolean?) {
|
|
||||||
if (isGranted == true) {
|
|
||||||
showMediaCaptureOrFilePicker(filePathCallback, fileChooserParams, captureVideo)
|
|
||||||
} else {
|
|
||||||
Logger.warn(Logger.tags("FileChooser"), "Camera permission not granted")
|
|
||||||
filePathCallback.onReceiveValue(null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val camPermission = arrayOf(Manifest.permission.CAMERA)
|
|
||||||
permissionLauncher.launch(camPermission)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
showFilePicker(filePathCallback, fileChooserParams)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private val isMediaCaptureSupported: Boolean
|
|
||||||
get() {
|
|
||||||
val permissions = arrayOf(Manifest.permission.CAMERA)
|
|
||||||
return PermissionHelper.hasPermissions(activity, permissions) ||
|
|
||||||
!PermissionHelper.hasDefinedPermission(activity, Manifest.permission.CAMERA)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showMediaCaptureOrFilePicker(
|
|
||||||
filePathCallback: ValueCallback<Array<Uri?>?>,
|
|
||||||
fileChooserParams: FileChooserParams,
|
|
||||||
isVideo: Boolean
|
|
||||||
) {
|
|
||||||
val isVideoCaptureSupported = true
|
|
||||||
val shown = if (isVideo && isVideoCaptureSupported) {
|
|
||||||
showVideoCapturePicker(filePathCallback)
|
|
||||||
} else {
|
|
||||||
showImageCapturePicker(filePathCallback)
|
|
||||||
}
|
|
||||||
if (!shown) {
|
|
||||||
Logger.warn(
|
|
||||||
Logger.tags("FileChooser"),
|
|
||||||
"Media capture intent could not be launched. Falling back to default file picker."
|
|
||||||
)
|
|
||||||
showFilePicker(filePathCallback, fileChooserParams)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showImageCapturePicker(filePathCallback: ValueCallback<Array<Uri?>?>): Boolean {
|
|
||||||
val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
|
|
||||||
if (takePictureIntent.resolveActivity(activity.packageManager) == null) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
val imageFileUri: Uri = try {
|
|
||||||
createImageFileUri()
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
Logger.error("Unable to create temporary media capture file: " + ex.message)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageFileUri)
|
|
||||||
activityListener = object : ActivityResultListener {
|
|
||||||
override fun onActivityResult(result: ActivityResult?) {
|
|
||||||
var res: Array<Uri?>? = null
|
|
||||||
if (result?.resultCode == Activity.RESULT_OK) {
|
|
||||||
res = arrayOf(imageFileUri)
|
|
||||||
}
|
|
||||||
filePathCallback.onReceiveValue(res)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
activityLauncher.launch(takePictureIntent)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showVideoCapturePicker(filePathCallback: ValueCallback<Array<Uri?>?>): Boolean {
|
|
||||||
val takeVideoIntent = Intent(MediaStore.ACTION_VIDEO_CAPTURE)
|
|
||||||
if (takeVideoIntent.resolveActivity(activity.packageManager) == null) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
activityListener = object : ActivityResultListener {
|
|
||||||
override fun onActivityResult(result: ActivityResult?) {
|
|
||||||
var res: Array<Uri?>? = null
|
|
||||||
if (result?.resultCode == Activity.RESULT_OK) {
|
|
||||||
res = arrayOf(result.data!!.data)
|
|
||||||
}
|
|
||||||
filePathCallback.onReceiveValue(res)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
activityLauncher.launch(takeVideoIntent)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showFilePicker(
|
|
||||||
filePathCallback: ValueCallback<Array<Uri?>?>,
|
|
||||||
fileChooserParams: FileChooserParams
|
|
||||||
) {
|
|
||||||
val intent = fileChooserParams.createIntent()
|
|
||||||
if (fileChooserParams.mode == FileChooserParams.MODE_OPEN_MULTIPLE) {
|
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
|
|
||||||
}
|
|
||||||
if (fileChooserParams.acceptTypes.size > 1 || intent.type!!.startsWith(".")) {
|
|
||||||
val validTypes = getValidTypes(fileChooserParams.acceptTypes)
|
|
||||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, validTypes)
|
|
||||||
if (intent.type!!.startsWith(".")) {
|
|
||||||
intent.type = validTypes[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
activityListener = object : ActivityResultListener {
|
|
||||||
override fun onActivityResult(result: ActivityResult?) {
|
|
||||||
val res: Array<Uri?>?
|
|
||||||
val resultIntent = result?.data
|
|
||||||
if (result?.resultCode == Activity.RESULT_OK && resultIntent!!.clipData != null) {
|
|
||||||
val numFiles = resultIntent.clipData!!.itemCount
|
|
||||||
res = arrayOfNulls(numFiles)
|
|
||||||
for (i in 0 until numFiles) {
|
|
||||||
res[i] = resultIntent.clipData!!.getItemAt(i).uri
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
res = FileChooserParams.parseResult(
|
|
||||||
result?.resultCode ?: 0,
|
|
||||||
resultIntent
|
|
||||||
)
|
|
||||||
}
|
|
||||||
filePathCallback.onReceiveValue(res)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
activityLauncher.launch(intent)
|
|
||||||
} catch (e: ActivityNotFoundException) {
|
|
||||||
filePathCallback.onReceiveValue(null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getValidTypes(currentTypes: Array<String>): Array<String> {
|
|
||||||
val validTypes: MutableList<String> = ArrayList()
|
|
||||||
val mtm = MimeTypeMap.getSingleton()
|
|
||||||
for (mime in currentTypes) {
|
|
||||||
if (mime.startsWith(".")) {
|
|
||||||
val extension = mime.substring(1)
|
|
||||||
val extensionMime = mtm.getMimeTypeFromExtension(extension)
|
|
||||||
if (extensionMime != null && !validTypes.contains(extensionMime)) {
|
|
||||||
validTypes.add(extensionMime)
|
|
||||||
}
|
|
||||||
} else if (!validTypes.contains(mime)) {
|
|
||||||
validTypes.add(mime)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val validObj: Array<Any> = validTypes.toTypedArray()
|
|
||||||
return Arrays.copyOf(
|
|
||||||
validObj, validObj.size,
|
|
||||||
Array<String>::class.java
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onConsoleMessage(consoleMessage: ConsoleMessage): Boolean {
|
|
||||||
val tag: String = Logger.tags("Console")
|
|
||||||
if (consoleMessage.message() != null && isValidMsg(consoleMessage.message())) {
|
|
||||||
val msg = String.format(
|
|
||||||
"File: %s - Line %d - Msg: %s",
|
|
||||||
consoleMessage.sourceId(),
|
|
||||||
consoleMessage.lineNumber(),
|
|
||||||
consoleMessage.message()
|
|
||||||
)
|
|
||||||
val level = consoleMessage.messageLevel().name
|
|
||||||
if ("ERROR".equals(level, ignoreCase = true)) {
|
|
||||||
Logger.error(tag, msg, null)
|
|
||||||
} else if ("WARNING".equals(level, ignoreCase = true)) {
|
|
||||||
Logger.warn(tag, msg)
|
|
||||||
} else if ("TIP".equals(level, ignoreCase = true)) {
|
|
||||||
Logger.debug(tag, msg)
|
|
||||||
} else {
|
|
||||||
Logger.info(tag, msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isValidMsg(msg: String): Boolean {
|
|
||||||
return !(msg.contains("%cresult %c") ||
|
|
||||||
msg.contains("%cnative %c") ||
|
|
||||||
msg.equals("[object Object]", ignoreCase = true) ||
|
|
||||||
msg.equals("console.groupEnd", ignoreCase = true))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Throws(IOException::class)
|
|
||||||
private fun createImageFileUri(): Uri {
|
|
||||||
val photoFile = createImageFile(activity)
|
|
||||||
return FileProvider.getUriForFile(
|
|
||||||
activity,
|
|
||||||
activity.packageName.toString() + ".fileprovider",
|
|
||||||
photoFile
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Throws(IOException::class)
|
|
||||||
private fun createImageFile(activity: Activity): File {
|
|
||||||
// Create an image file name
|
|
||||||
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
|
|
||||||
val imageFileName = "JPEG_" + timeStamp + "_"
|
|
||||||
val storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES)
|
|
||||||
return File.createTempFile(imageFileName, ".jpg", storageDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onReceivedTitle(
|
|
||||||
view: WebView,
|
|
||||||
title: String
|
|
||||||
) {
|
|
||||||
handleReceivedTitle(view, title)
|
|
||||||
}
|
|
||||||
|
|
||||||
private external fun handleReceivedTitle(webview: WebView, title: String)
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
@file:Suppress("unused", "SetJavaScriptEnabled")
|
|
||||||
|
|
||||||
package com.lenn.tauri_serial
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.webkit.*
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.webkit.WebViewCompat
|
|
||||||
import androidx.webkit.WebViewFeature
|
|
||||||
import kotlin.collections.Map
|
|
||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
|
||||||
class RustWebView(context: Context, val initScripts: Array<String>, val id: String): WebView(context) {
|
|
||||||
val isDocumentStartScriptEnabled: Boolean
|
|
||||||
|
|
||||||
init {
|
|
||||||
settings.javaScriptEnabled = true
|
|
||||||
settings.domStorageEnabled = true
|
|
||||||
settings.setGeolocationEnabled(true)
|
|
||||||
settings.databaseEnabled = true
|
|
||||||
settings.mediaPlaybackRequiresUserGesture = false
|
|
||||||
settings.javaScriptCanOpenWindowsAutomatically = true
|
|
||||||
|
|
||||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) {
|
|
||||||
isDocumentStartScriptEnabled = true
|
|
||||||
for (script in initScripts) {
|
|
||||||
WebViewCompat.addDocumentStartJavaScript(this, script, setOf("*"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
isDocumentStartScriptEnabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadUrlMainThread(url: String) {
|
|
||||||
post {
|
|
||||||
loadUrl(url)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadUrlMainThread(url: String, additionalHttpHeaders: Map<String, String>) {
|
|
||||||
post {
|
|
||||||
loadUrl(url, additionalHttpHeaders)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun loadUrl(url: String) {
|
|
||||||
if (!shouldOverride(url)) {
|
|
||||||
super.loadUrl(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun loadUrl(url: String, additionalHttpHeaders: Map<String, String>) {
|
|
||||||
if (!shouldOverride(url)) {
|
|
||||||
super.loadUrl(url, additionalHttpHeaders);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadHTMLMainThread(html: String) {
|
|
||||||
post {
|
|
||||||
super.loadData(html, "text/html", null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun evalScript(id: Int, script: String) {
|
|
||||||
post {
|
|
||||||
super.evaluateJavascript(script) { result ->
|
|
||||||
onEval(id, result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun clearAllBrowsingData() {
|
|
||||||
try {
|
|
||||||
super.getContext().deleteDatabase("webviewCache.db")
|
|
||||||
super.getContext().deleteDatabase("webview.db")
|
|
||||||
super.clearCache(true)
|
|
||||||
super.clearHistory()
|
|
||||||
super.clearFormData()
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
Logger.error("Unable to create temporary media capture file: " + ex.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getCookies(url: String): String {
|
|
||||||
val cookieManager = CookieManager.getInstance()
|
|
||||||
return cookieManager.getCookie(url)
|
|
||||||
}
|
|
||||||
|
|
||||||
private external fun shouldOverride(url: String): Boolean
|
|
||||||
private external fun onEval(id: Int, result: String)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
package com.lenn.tauri_serial
|
|
||||||
|
|
||||||
import android.net.Uri
|
|
||||||
import android.webkit.*
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.os.Handler
|
|
||||||
import android.os.Looper
|
|
||||||
import androidx.webkit.WebViewAssetLoader
|
|
||||||
|
|
||||||
class RustWebViewClient(context: Context): WebViewClient() {
|
|
||||||
private val interceptedState = mutableMapOf<String, Boolean>()
|
|
||||||
var currentUrl: String = "about:blank"
|
|
||||||
private var lastInterceptedUrl: Uri? = null
|
|
||||||
private var pendingUrlRedirect: String? = null
|
|
||||||
|
|
||||||
private val assetLoader = WebViewAssetLoader.Builder()
|
|
||||||
.setDomain(assetLoaderDomain())
|
|
||||||
.addPathHandler("/", WebViewAssetLoader.AssetsPathHandler(context))
|
|
||||||
.build()
|
|
||||||
|
|
||||||
override fun shouldInterceptRequest(
|
|
||||||
view: WebView,
|
|
||||||
request: WebResourceRequest
|
|
||||||
): WebResourceResponse? {
|
|
||||||
pendingUrlRedirect?.let {
|
|
||||||
Handler(Looper.getMainLooper()).post {
|
|
||||||
view.loadUrl(it)
|
|
||||||
}
|
|
||||||
pendingUrlRedirect = null
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
lastInterceptedUrl = request.url
|
|
||||||
return if (withAssetLoader()) {
|
|
||||||
assetLoader.shouldInterceptRequest(request.url)
|
|
||||||
} else {
|
|
||||||
val rustWebview = view as RustWebView;
|
|
||||||
val response = handleRequest(rustWebview.id, request, rustWebview.isDocumentStartScriptEnabled)
|
|
||||||
interceptedState[request.url.toString()] = response != null
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun shouldOverrideUrlLoading(
|
|
||||||
view: WebView,
|
|
||||||
request: WebResourceRequest
|
|
||||||
): Boolean {
|
|
||||||
return shouldOverride(request.url.toString())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageStarted(view: WebView, url: String, favicon: Bitmap?) {
|
|
||||||
currentUrl = url
|
|
||||||
if (interceptedState[url] == false) {
|
|
||||||
val webView = view as RustWebView
|
|
||||||
for (script in webView.initScripts) {
|
|
||||||
view.evaluateJavascript(script, null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return onPageLoading(url)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageFinished(view: WebView, url: String) {
|
|
||||||
onPageLoaded(url)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onReceivedError(
|
|
||||||
view: WebView,
|
|
||||||
request: WebResourceRequest,
|
|
||||||
error: WebResourceError
|
|
||||||
) {
|
|
||||||
// we get a net::ERR_CONNECTION_REFUSED when an external URL redirects to a custom protocol
|
|
||||||
// e.g. oauth flow, because shouldInterceptRequest is not called on redirects
|
|
||||||
// so we must force retry here with loadUrl() to get a chance of the custom protocol to kick in
|
|
||||||
if (error.errorCode == ERROR_CONNECT && request.isForMainFrame && request.url != lastInterceptedUrl) {
|
|
||||||
// prevent the default error page from showing
|
|
||||||
view.stopLoading()
|
|
||||||
// without this initial loadUrl the app is stuck
|
|
||||||
view.loadUrl(request.url.toString())
|
|
||||||
// ensure the URL is actually loaded - for some reason there's a race condition and we need to call loadUrl() again later
|
|
||||||
pendingUrlRedirect = request.url.toString()
|
|
||||||
} else {
|
|
||||||
super.onReceivedError(view, request, error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
init {
|
|
||||||
System.loadLibrary("tauri_demo_lib")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private external fun assetLoaderDomain(): String
|
|
||||||
private external fun withAssetLoader(): Boolean
|
|
||||||
private external fun handleRequest(webviewId: String, request: WebResourceRequest, isDocumentStartScriptEnabled: Boolean): WebResourceResponse?
|
|
||||||
private external fun shouldOverride(url: String): Boolean
|
|
||||||
private external fun onPageLoading(url: String)
|
|
||||||
private external fun onPageLoaded(url: String)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
package com.lenn.tauri_serial
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.res.Configuration
|
|
||||||
import app.tauri.plugin.PluginManager
|
|
||||||
|
|
||||||
abstract class TauriActivity : WryActivity() {
|
|
||||||
var pluginManager: PluginManager = PluginManager(this)
|
|
||||||
override val handleBackNavigation: Boolean = false
|
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent) {
|
|
||||||
super.onNewIntent(intent)
|
|
||||||
pluginManager.onNewIntent(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
pluginManager.onResume()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
super.onPause()
|
|
||||||
pluginManager.onPause()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRestart() {
|
|
||||||
super.onRestart()
|
|
||||||
pluginManager.onRestart()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStop() {
|
|
||||||
super.onStop()
|
|
||||||
pluginManager.onStop()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
pluginManager.onDestroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
|
||||||
super.onConfigurationChanged(newConfig)
|
|
||||||
pluginManager.onConfigurationChanged(newConfig)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
package com.lenn.tauri_serial
|
|
||||||
|
|
||||||
import com.lenn.tauri_serial.RustWebView
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.webkit.WebView
|
|
||||||
import android.view.KeyEvent
|
|
||||||
import androidx.activity.OnBackPressedCallback
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
|
|
||||||
abstract class WryActivity : AppCompatActivity() {
|
|
||||||
private lateinit var mWebView: RustWebView
|
|
||||||
open val handleBackNavigation: Boolean = true
|
|
||||||
|
|
||||||
open fun onWebViewCreate(webView: WebView) { }
|
|
||||||
|
|
||||||
fun setWebView(webView: RustWebView) {
|
|
||||||
mWebView = webView
|
|
||||||
|
|
||||||
if (handleBackNavigation) {
|
|
||||||
val callback = object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
if (this@WryActivity.mWebView.canGoBack()) {
|
|
||||||
this@WryActivity.mWebView.goBack()
|
|
||||||
} else {
|
|
||||||
this.isEnabled = false
|
|
||||||
this@WryActivity.onBackPressed()
|
|
||||||
this.isEnabled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onBackPressedDispatcher.addCallback(this, callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
onWebViewCreate(webView)
|
|
||||||
}
|
|
||||||
|
|
||||||
val version: String
|
|
||||||
@SuppressLint("WebViewApiAvailability", "ObsoleteSdkInt")
|
|
||||||
get() {
|
|
||||||
// Check getCurrentWebViewPackage() directly if above Android 8
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
return WebView.getCurrentWebViewPackage()?.versionName ?: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise manually check WebView versions
|
|
||||||
var webViewPackage = "com.google.android.webview"
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
||||||
webViewPackage = "com.android.chrome"
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
val info = packageManager.getPackageInfo(webViewPackage, 0)
|
|
||||||
return info.versionName.toString()
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
Logger.warn("Unable to get package info for '$webViewPackage'$ex")
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
val info = packageManager.getPackageInfo("com.android.webview", 0)
|
|
||||||
return info.versionName.toString()
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
Logger.warn("Unable to get package info for 'com.android.webview'$ex")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Could not detect any webview, return empty string
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
create(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
super.onStart()
|
|
||||||
start()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
resume()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
super.onPause()
|
|
||||||
pause()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStop() {
|
|
||||||
super.onStop()
|
|
||||||
stop()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
|
||||||
super.onWindowFocusChanged(hasFocus)
|
|
||||||
focus(hasFocus)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
|
||||||
super.onSaveInstanceState(outState)
|
|
||||||
save()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
destroy()
|
|
||||||
onActivityDestroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLowMemory() {
|
|
||||||
super.onLowMemory()
|
|
||||||
memory()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getAppClass(name: String): Class<*> {
|
|
||||||
return Class.forName(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
init {
|
|
||||||
System.loadLibrary("tauri_demo_lib")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private external fun create(activity: WryActivity)
|
|
||||||
private external fun start()
|
|
||||||
private external fun resume()
|
|
||||||
private external fun pause()
|
|
||||||
private external fun stop()
|
|
||||||
private external fun save()
|
|
||||||
private external fun destroy()
|
|
||||||
private external fun onActivityDestroy()
|
|
||||||
private external fun memory()
|
|
||||||
private external fun focus(focus: Boolean)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
# THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!!
|
|
||||||
|
|
||||||
# Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
-keep class com.lenn.tauri_serial.* {
|
|
||||||
native <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
-keep class com.lenn.tauri_serial.WryActivity {
|
|
||||||
public <init>(...);
|
|
||||||
|
|
||||||
void setWebView(com.lenn.tauri_serial.RustWebView);
|
|
||||||
java.lang.Class getAppClass(...);
|
|
||||||
java.lang.String getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
-keep class com.lenn.tauri_serial.Ipc {
|
|
||||||
public <init>(...);
|
|
||||||
|
|
||||||
@android.webkit.JavascriptInterface public <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
-keep class com.lenn.tauri_serial.RustWebView {
|
|
||||||
public <init>(...);
|
|
||||||
|
|
||||||
void loadUrlMainThread(...);
|
|
||||||
void loadHTMLMainThread(...);
|
|
||||||
void evalScript(...);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keep class com.lenn.tauri_serial.RustWebChromeClient,com.lenn.tauri_serial.RustWebViewClient {
|
|
||||||
public <init>(...);
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/home/lenn/Workspace/JE-Skin/src-tauri/target/aarch64-linux-android/release/libtauri_demo_lib.so
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/home/lenn/Workspace/JE-Skin/src-tauri/target/armv7-linux-androideabi/release/libtauri_demo_lib.so
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/home/lenn/Workspace/JE-Skin/src-tauri/target/i686-linux-android/release/libtauri_demo_lib.so
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/home/lenn/Workspace/JE-Skin/src-tauri/target/x86_64-linux-android/release/libtauri_demo_lib.so
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
val implementation by configurations
|
|
||||||
dependencies {
|
|
||||||
implementation(project(":tauri-android"))
|
|
||||||
implementation(project(":tauri-plugin-opener"))
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
tauri.android.versionName=0.4.0
|
|
||||||
tauri.android.versionCode=4000
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
include ':tauri-android'
|
|
||||||
project(':tauri-android').projectDir = new File("/home/lenn/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-2.10.3/mobile/android")
|
|
||||||
include ':tauri-plugin-opener'
|
|
||||||
project(':tauri-plugin-opener').projectDir = new File("/home/lenn/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tauri-plugin-opener-2.5.3/android")
|
|
||||||
@@ -27,14 +27,6 @@ message PztAngleResponse {
|
|||||||
uint32 dts_ms = 4;
|
uint32 dts_ms = 4;
|
||||||
bool ok = 5;
|
bool ok = 5;
|
||||||
string message = 6;
|
string message = 6;
|
||||||
float magnitude = 7;
|
|
||||||
int32 state = 8;
|
|
||||||
float cop_x = 9;
|
|
||||||
float cop_y = 10;
|
|
||||||
float base_x = 11;
|
|
||||||
float base_y = 12;
|
|
||||||
float total_press = 13;
|
|
||||||
float threshold = 14;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ProcessRequest {
|
message ProcessRequest {
|
||||||
|
|||||||
Binary file not shown.
@@ -2,26 +2,11 @@
|
|||||||
//!
|
//!
|
||||||
//! 仅在 `devkit` feature 启用时编译。
|
//! 仅在 `devkit` feature 启用时编译。
|
||||||
|
|
||||||
use serde::Serialize;
|
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
|
||||||
use tauri::State;
|
use tauri::State;
|
||||||
#[cfg(feature = "devkit")]
|
#[cfg(feature = "devkit")]
|
||||||
use tauri::AppHandle;
|
use tauri::AppHandle;
|
||||||
|
|
||||||
use crate::devkit::{
|
use crate::devkit::{DevKitConfig, DevKitState, DevKitStatusSnapshot, ExportProcessResult};
|
||||||
proto::SensorFrame, DevKitConfig, DevKitState, DevKitStatusSnapshot, ExportProcessResult,
|
|
||||||
};
|
|
||||||
|
|
||||||
static REPLAY_SEQ_COUNTER: AtomicU64 = AtomicU64::new(0);
|
|
||||||
|
|
||||||
#[derive(Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct DevKitReplayFramePushResult {
|
|
||||||
pub seq: u64,
|
|
||||||
pub timestamp_ms: u64,
|
|
||||||
pub dts_ms: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn devkit_status(state: State<'_, DevKitState>) -> DevKitStatusSnapshot {
|
pub fn devkit_status(state: State<'_, DevKitState>) -> DevKitStatusSnapshot {
|
||||||
@@ -66,55 +51,3 @@ pub async fn devkit_process_export(
|
|||||||
let use_xlsx = save_as_xlsx.unwrap_or(config.save_as_xlsx);
|
let use_xlsx = save_as_xlsx.unwrap_or(config.save_as_xlsx);
|
||||||
state.process_export(&csv_path, use_xlsx).await
|
state.process_export(&csv_path, use_xlsx).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub fn devkit_push_replay_frame(
|
|
||||||
state: State<'_, DevKitState>,
|
|
||||||
values: Vec<i32>,
|
|
||||||
dts_ms: u32,
|
|
||||||
seq: Option<u64>,
|
|
||||||
) -> Result<DevKitReplayFramePushResult, String> {
|
|
||||||
if values.len() != 84 {
|
|
||||||
return Err(format!("InvalidReplayMatrixLength: {}", values.len()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if !state.running.load(Ordering::Relaxed) {
|
|
||||||
return Err("NotRunning".to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
let timestamp_ms = now_millis();
|
|
||||||
let seq = seq.unwrap_or_else(|| build_replay_seq(timestamp_ms));
|
|
||||||
let resultant_force = values.iter().copied().sum::<i32>().max(0) as f64;
|
|
||||||
let matrix = values
|
|
||||||
.into_iter()
|
|
||||||
.map(|value| value.max(0) as u32)
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
state.push_frame(SensorFrame {
|
|
||||||
seq,
|
|
||||||
timestamp_ms,
|
|
||||||
rows: 12,
|
|
||||||
cols: 7,
|
|
||||||
matrix,
|
|
||||||
resultant_force,
|
|
||||||
dts_ms,
|
|
||||||
});
|
|
||||||
|
|
||||||
Ok(DevKitReplayFramePushResult {
|
|
||||||
seq,
|
|
||||||
timestamp_ms,
|
|
||||||
dts_ms,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn now_millis() -> u64 {
|
|
||||||
SystemTime::now()
|
|
||||||
.duration_since(UNIX_EPOCH)
|
|
||||||
.map(|duration| duration.as_millis() as u64)
|
|
||||||
.unwrap_or_default()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build_replay_seq(timestamp_ms: u64) -> u64 {
|
|
||||||
let counter = REPLAY_SEQ_COUNTER.fetch_add(1, Ordering::Relaxed) % 1000;
|
|
||||||
timestamp_ms.saturating_mul(1000).saturating_add(counter)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,30 +1,18 @@
|
|||||||
use crate::serial_core::codecs::tactile_a::{
|
|
||||||
export_recording_csv, TactileACodec, TactileACsvImporter, TactileADataPacket, TactileAHandler,
|
|
||||||
};
|
|
||||||
use crate::serial_core::error::SerialError;
|
use crate::serial_core::error::SerialError;
|
||||||
use crate::serial_core::model::HudSpatialForce;
|
use crate::serial_core::record::{self, FingerRecording};
|
||||||
#[cfg(feature = "multi-dim")]
|
use crate::serial_core::serial;
|
||||||
use crate::serial_core::multi_dim_force::PztProcessor;
|
use eskin_finger_sdk::device::EskinDevice;
|
||||||
use crate::serial_core::record::CsvImporter;
|
|
||||||
use crate::serial_core::serial::{PollMode, TactileAPollRequester};
|
|
||||||
use crate::serial_core::{serial, TactileARecording};
|
|
||||||
use log::info;
|
use log::info;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::fs::File;
|
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
use tauri::{async_runtime::JoinHandle, AppHandle, Manager, State};
|
use tauri::{async_runtime::JoinHandle, AppHandle, Manager, State};
|
||||||
use tokio_serial::{available_ports, SerialPortBuilderExt};
|
use tokio_serial::available_ports;
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
|
|
||||||
const DEFAULT_TACTILE_COLS: usize = 7;
|
type SharedRecording = Arc<Mutex<FingerRecording>>;
|
||||||
const DEFAULT_TACTILE_ROWS: usize = 12;
|
|
||||||
const DEFAULT_TACTILE_POLL_INTERVAL_MS: u64 = 10;
|
|
||||||
const DEFAULT_TACTILE_REPLY_TIMEOUT_MS: u64 = 140;
|
|
||||||
|
|
||||||
type SharedTactileRecording = Arc<Mutex<TactileARecording>>;
|
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
@@ -47,7 +35,6 @@ pub struct SerialExportResponse {
|
|||||||
pub struct SerialImportFrame {
|
pub struct SerialImportFrame {
|
||||||
pub data: Vec<i32>,
|
pub data: Vec<i32>,
|
||||||
pub dts_ms: u64,
|
pub dts_ms: u64,
|
||||||
pub spatial_force: Option<HudSpatialForce>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
@@ -71,18 +58,18 @@ struct SerialSession {
|
|||||||
port: String,
|
port: String,
|
||||||
cancel: CancellationToken,
|
cancel: CancellationToken,
|
||||||
task: JoinHandle<()>,
|
task: JoinHandle<()>,
|
||||||
current_record: SharedTactileRecording,
|
current_record: SharedRecording,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct SerialConnectionState {
|
pub struct SerialConnectionState {
|
||||||
session: Mutex<Option<SerialSession>>,
|
session: Mutex<Option<SerialSession>>,
|
||||||
last_record: Mutex<Option<SharedTactileRecording>>,
|
last_record: Mutex<Option<SharedRecording>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn shutdown_active_session(
|
pub async fn shutdown_active_session(
|
||||||
state: &SerialConnectionState,
|
state: &SerialConnectionState,
|
||||||
) -> Result<Option<(String, SharedTactileRecording)>, SerialError> {
|
) -> Result<Option<(String, SharedRecording)>, SerialError> {
|
||||||
let session = {
|
let session = {
|
||||||
let mut guard = state.session.lock().map_err(|_| SerialError::StateError)?;
|
let mut guard = state.session.lock().map_err(|_| SerialError::StateError)?;
|
||||||
guard.take()
|
guard.take()
|
||||||
@@ -122,7 +109,8 @@ pub fn serial_enum() -> Result<Vec<String>, SerialError> {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|p| {
|
.filter_map(|p| {
|
||||||
let name = p.port_name;
|
let name = p.port_name;
|
||||||
if !should_include_serial_port(&name) {
|
#[cfg(unix)]
|
||||||
|
if !name.contains("USB") {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
Some(name)
|
Some(name)
|
||||||
@@ -132,21 +120,6 @@ pub fn serial_enum() -> Result<Vec<String>, SerialError> {
|
|||||||
Ok(ports)
|
Ok(ports)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
fn should_include_serial_port(name: &str) -> bool {
|
|
||||||
name.to_ascii_lowercase().contains("usb")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(all(unix, not(target_os = "macos")))]
|
|
||||||
fn should_include_serial_port(name: &str) -> bool {
|
|
||||||
name.contains("USB")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
|
||||||
fn should_include_serial_port(_name: &str) -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn serial_connect(
|
pub async fn serial_connect(
|
||||||
app: AppHandle,
|
app: AppHandle,
|
||||||
@@ -166,62 +139,41 @@ pub async fn serial_connect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cancel = CancellationToken::new();
|
let cancel = CancellationToken::new();
|
||||||
let current_record = Arc::new(Mutex::new(TactileARecording::new()));
|
let current_record = Arc::new(Mutex::new(FingerRecording::new()));
|
||||||
let task_record = current_record.clone();
|
let task_record = current_record.clone();
|
||||||
let task_cancel = cancel.clone();
|
let task_cancel = cancel.clone();
|
||||||
let task_app = app.clone();
|
let task_app = app.clone();
|
||||||
let task_port_name = port_name.clone();
|
let task_port_name = port_name.clone();
|
||||||
|
|
||||||
let port = tokio_serial::new(&port_name, 921600)
|
|
||||||
.open_native_async()
|
|
||||||
.map_err(|_| SerialError::OpenError)?;
|
|
||||||
let session_started_at = Instant::now();
|
|
||||||
|
|
||||||
let task = tauri::async_runtime::spawn(async move {
|
let task = tauri::async_runtime::spawn(async move {
|
||||||
let codec = TactileACodec::new(DEFAULT_TACTILE_COLS, DEFAULT_TACTILE_ROWS);
|
// Open device using SDK
|
||||||
let handler = TactileAHandler;
|
let session = match serial::open_device(&task_port_name) {
|
||||||
let poll_mode = PollMode::Enabled(Box::new(TactileAPollRequester::new(
|
Ok(s) => s,
|
||||||
Duration::from_millis(DEFAULT_TACTILE_POLL_INTERVAL_MS),
|
Err(e) => {
|
||||||
DEFAULT_TACTILE_COLS,
|
eprintln!("Failed to open device: {e}");
|
||||||
DEFAULT_TACTILE_ROWS,
|
cleanup_session(&task_app, &task_port_name, task_record).await;
|
||||||
Duration::from_millis(DEFAULT_TACTILE_REPLY_TIMEOUT_MS),
|
return;
|
||||||
)));
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if let Err(error) = serial::run_serial_with_poll(
|
let mut device = session.device;
|
||||||
|
|
||||||
|
// Run stream with recording
|
||||||
|
if let Err(error) = serial::run_stream_with_record(
|
||||||
task_app.clone(),
|
task_app.clone(),
|
||||||
port,
|
&mut device,
|
||||||
codec,
|
|
||||||
handler,
|
|
||||||
session_started_at,
|
|
||||||
task_record.clone(),
|
|
||||||
task_cancel,
|
task_cancel,
|
||||||
poll_mode,
|
task_record.clone(),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
log::error!("serial task exited with error: {error}");
|
eprintln!("serial task exited with error: {error}");
|
||||||
}
|
}
|
||||||
|
|
||||||
let manager = task_app.state::<SerialConnectionState>();
|
// Close device
|
||||||
if let Ok(mut last_record) = manager.last_record.lock() {
|
let _ = device.close();
|
||||||
*last_record = Some(task_record);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut session = match manager.session.lock() {
|
cleanup_session(&task_app, &task_port_name, task_record).await;
|
||||||
Ok(session) => session,
|
|
||||||
Err(_) => return,
|
|
||||||
};
|
|
||||||
|
|
||||||
{
|
|
||||||
let should_clear = session
|
|
||||||
.as_ref()
|
|
||||||
.map(|current| current.port.as_str() == task_port_name.as_str())
|
|
||||||
.unwrap_or(false);
|
|
||||||
|
|
||||||
if should_clear {
|
|
||||||
session.take();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut session = state.session.lock().map_err(|_| SerialError::StateError)?;
|
let mut session = state.session.lock().map_err(|_| SerialError::StateError)?;
|
||||||
@@ -245,6 +197,31 @@ pub async fn serial_connect(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn cleanup_session(
|
||||||
|
app: &AppHandle,
|
||||||
|
port_name: &str,
|
||||||
|
record: SharedRecording,
|
||||||
|
) {
|
||||||
|
let manager = app.state::<SerialConnectionState>();
|
||||||
|
if let Ok(mut last_record) = manager.last_record.lock() {
|
||||||
|
*last_record = Some(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut session = match manager.session.lock() {
|
||||||
|
Ok(session) => session,
|
||||||
|
Err(_) => return,
|
||||||
|
};
|
||||||
|
|
||||||
|
let should_clear = session
|
||||||
|
.as_ref()
|
||||||
|
.map(|current| current.port.as_str() == port_name)
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
|
if should_clear {
|
||||||
|
session.take();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn serial_disconnect(
|
pub async fn serial_disconnect(
|
||||||
state: State<'_, SerialConnectionState>,
|
state: State<'_, SerialConnectionState>,
|
||||||
@@ -311,8 +288,8 @@ pub fn serial_export_csv_to_path(
|
|||||||
state: State<'_, SerialConnectionState>,
|
state: State<'_, SerialConnectionState>,
|
||||||
) -> Result<SerialExportResponse, SerialError> {
|
) -> Result<SerialExportResponse, SerialError> {
|
||||||
let output_path = resolve_export_path(file_path)?;
|
let output_path = resolve_export_path(file_path)?;
|
||||||
let record = resolve_record_for_export(&state)?;
|
let rec = resolve_record_for_export(&state)?;
|
||||||
let frame_count = write_record_to_csv(record, &output_path)?;
|
let frame_count = write_record_to_csv(rec, &output_path)?;
|
||||||
let path = output_path.display().to_string();
|
let path = output_path.display().to_string();
|
||||||
|
|
||||||
info!("csv exported to {path}, frame_count={frame_count}");
|
info!("csv exported to {path}, frame_count={frame_count}");
|
||||||
@@ -329,18 +306,22 @@ pub fn serial_import_csv(
|
|||||||
file_name: String,
|
file_name: String,
|
||||||
csv_content: String,
|
csv_content: String,
|
||||||
) -> Result<SerialImportResponse, SerialError> {
|
) -> Result<SerialImportResponse, SerialError> {
|
||||||
let mut importer = TactileACsvImporter::new(file_name.as_str());
|
let packets = record::import_csv(Cursor::new(csv_content.into_bytes()))
|
||||||
let packets = importer
|
|
||||||
.load(Cursor::new(csv_content.into_bytes()))
|
|
||||||
.map_err(|_| SerialError::ImportError)?;
|
.map_err(|_| SerialError::ImportError)?;
|
||||||
|
|
||||||
if packets.is_empty() {
|
if packets.is_empty() {
|
||||||
return Err(SerialError::NoRecordedData);
|
return Err(SerialError::NoRecordedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
let channel_count = packets.first().map(|item| item.data.len()).unwrap_or(0);
|
let channel_count = 1; // fz is a single value per sample
|
||||||
let frame_count = packets.len();
|
let frame_count = packets.len();
|
||||||
let frames = build_import_frames(packets);
|
let frames = packets
|
||||||
|
.into_iter()
|
||||||
|
.map(|packet| SerialImportFrame {
|
||||||
|
data: vec![packet.fz as i32],
|
||||||
|
dts_ms: packet.timestamp_us / 1000,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
Ok(SerialImportResponse {
|
Ok(SerialImportResponse {
|
||||||
file_name,
|
file_name,
|
||||||
@@ -365,47 +346,9 @@ pub fn serial_import_csv_from_path(file_path: String) -> Result<SerialImportResp
|
|||||||
serial_import_csv(file_name, csv_content)
|
serial_import_csv(file_name, csv_content)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_import_frames(packets: Vec<TactileADataPacket>) -> Vec<SerialImportFrame> {
|
|
||||||
#[cfg(feature = "multi-dim")]
|
|
||||||
let mut pzt_processor = PztProcessor::new();
|
|
||||||
|
|
||||||
packets
|
|
||||||
.into_iter()
|
|
||||||
.map(|packet| {
|
|
||||||
#[cfg(feature = "multi-dim")]
|
|
||||||
let spatial_force = replay_spatial_force(&mut pzt_processor, &packet.data);
|
|
||||||
|
|
||||||
#[cfg(not(feature = "multi-dim"))]
|
|
||||||
let spatial_force = None;
|
|
||||||
|
|
||||||
SerialImportFrame {
|
|
||||||
data: packet.data,
|
|
||||||
dts_ms: packet.dts_ms,
|
|
||||||
spatial_force,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "multi-dim")]
|
|
||||||
fn replay_spatial_force(processor: &mut PztProcessor, values: &[i32]) -> Option<HudSpatialForce> {
|
|
||||||
let pzt_values = values.iter().map(|value| *value as f32).collect::<Vec<f32>>();
|
|
||||||
let analysis = processor.get_pzt_analysis(&pzt_values).ok()?;
|
|
||||||
|
|
||||||
if !PztProcessor::should_report(&analysis) {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(HudSpatialForce {
|
|
||||||
angle_deg: analysis.angle_deg,
|
|
||||||
magnitude: analysis.magnitude,
|
|
||||||
confidence: analysis.confidence,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn resolve_record_for_export(
|
fn resolve_record_for_export(
|
||||||
state: &State<'_, SerialConnectionState>,
|
state: &State<'_, SerialConnectionState>,
|
||||||
) -> Result<SharedTactileRecording, SerialError> {
|
) -> Result<SharedRecording, SerialError> {
|
||||||
let current_record = {
|
let current_record = {
|
||||||
let session = state.session.lock().map_err(|_| SerialError::StateError)?;
|
let session = state.session.lock().map_err(|_| SerialError::StateError)?;
|
||||||
session
|
session
|
||||||
@@ -456,7 +399,7 @@ fn snapshot_record_frame_count(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn write_record_to_csv(
|
fn write_record_to_csv(
|
||||||
record: SharedTactileRecording,
|
record: SharedRecording,
|
||||||
output_path: &Path,
|
output_path: &Path,
|
||||||
) -> Result<usize, SerialError> {
|
) -> Result<usize, SerialError> {
|
||||||
if let Some(parent) = output_path.parent() {
|
if let Some(parent) = output_path.parent() {
|
||||||
@@ -465,14 +408,14 @@ fn write_record_to_csv(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut file = File::create(output_path).map_err(|_| SerialError::ExportError)?;
|
let file = std::fs::File::create(output_path).map_err(|_| SerialError::ExportError)?;
|
||||||
let frame_count = {
|
let frame_count = {
|
||||||
let recording = record.lock().map_err(|_| SerialError::StateError)?;
|
let recording = record.lock().map_err(|_| SerialError::StateError)?;
|
||||||
if recording.frames.is_empty() {
|
if recording.frames.is_empty() {
|
||||||
return Err(SerialError::NoRecordedData);
|
return Err(SerialError::NoRecordedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
export_recording_csv(&recording, &mut file).map_err(|_| SerialError::ExportError)?;
|
record::export_recording_csv(&recording, file).map_err(|_| SerialError::ExportError)?;
|
||||||
recording.frames.len()
|
recording.frames.len()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ pub async fn win_close(
|
|||||||
.await
|
.await
|
||||||
.map_err(|error| error.to_string())?;
|
.map_err(|error| error.to_string())?;
|
||||||
|
|
||||||
main_window(&app)?.close().map_err(|error| error.to_string())
|
app.exit(0);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,14 +24,6 @@ struct DevKitPztAngleEvent {
|
|||||||
timestamp_ms: u64,
|
timestamp_ms: u64,
|
||||||
dts_ms: u32,
|
dts_ms: u32,
|
||||||
angle: f32,
|
angle: f32,
|
||||||
magnitude: f32,
|
|
||||||
state: i32,
|
|
||||||
cop_x: f32,
|
|
||||||
cop_y: f32,
|
|
||||||
base_x: f32,
|
|
||||||
base_y: f32,
|
|
||||||
total_press: f32,
|
|
||||||
threshold: f32,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── DevKit 配置 ────────────────────────────────────────────────────
|
// ── DevKit 配置 ────────────────────────────────────────────────────
|
||||||
@@ -284,28 +276,12 @@ async fn run_grpc_upload(
|
|||||||
timestamp_ms: message.timestamp_ms,
|
timestamp_ms: message.timestamp_ms,
|
||||||
dts_ms: message.dts_ms,
|
dts_ms: message.dts_ms,
|
||||||
angle: message.angle,
|
angle: message.angle,
|
||||||
magnitude: message.magnitude,
|
|
||||||
state: message.state,
|
|
||||||
cop_x: message.cop_x,
|
|
||||||
cop_y: message.cop_y,
|
|
||||||
base_x: message.base_x,
|
|
||||||
base_y: message.base_y,
|
|
||||||
total_press: message.total_press,
|
|
||||||
threshold: message.threshold,
|
|
||||||
};
|
};
|
||||||
::log::debug!(
|
::log::debug!(
|
||||||
"python pzt angle: seq={} dts_ms={} angle={:.2} magnitude={:.2} state={} cop=({:.2},{:.2}) base=({:.2},{:.2}) total_press={:.2} threshold={:.2}",
|
"python pzt angle: seq={} dts_ms={} angle={:.2}",
|
||||||
message.seq,
|
message.seq,
|
||||||
message.dts_ms,
|
message.dts_ms,
|
||||||
message.angle,
|
message.angle
|
||||||
message.magnitude,
|
|
||||||
message.state,
|
|
||||||
message.cop_x,
|
|
||||||
message.cop_y,
|
|
||||||
message.base_x,
|
|
||||||
message.base_y,
|
|
||||||
message.total_press,
|
|
||||||
message.threshold
|
|
||||||
);
|
);
|
||||||
app.emit("devkit_pzt_angle", payload)?;
|
app.emit("devkit_pzt_angle", payload)?;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -154,8 +154,7 @@ pub fn run() {
|
|||||||
commands::devkit::devkit_stop,
|
commands::devkit::devkit_stop,
|
||||||
commands::devkit::devkit_get_config,
|
commands::devkit::devkit_get_config,
|
||||||
commands::devkit::devkit_set_config,
|
commands::devkit::devkit_set_config,
|
||||||
commands::devkit::devkit_process_export,
|
commands::devkit::devkit_process_export
|
||||||
commands::devkit::devkit_push_replay_frame
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
#[cfg(not(feature = "devkit"))]
|
#[cfg(not(feature = "devkit"))]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use fern::{
|
|||||||
Dispatch,
|
Dispatch,
|
||||||
};
|
};
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use std::{path::PathBuf, time::SystemTime};
|
use std::{path::{Path, PathBuf}, time::SystemTime};
|
||||||
|
|
||||||
fn log_directory() -> PathBuf {
|
fn log_directory() -> PathBuf {
|
||||||
let base_dir = std::env::var_os("LOCALAPPDATA")
|
let base_dir = std::env::var_os("LOCALAPPDATA")
|
||||||
@@ -67,7 +67,6 @@ pub fn setup_logger() {
|
|||||||
|
|
||||||
Dispatch::new()
|
Dispatch::new()
|
||||||
.level(log::LevelFilter::Debug)
|
.level(log::LevelFilter::Debug)
|
||||||
.level_for("h2", log::LevelFilter::Info)
|
|
||||||
.chain(console_config)
|
.chain(console_config)
|
||||||
.chain(file_config)
|
.chain(file_config)
|
||||||
.apply()
|
.apply()
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
use crate::serial_core::error::CodecError;
|
|
||||||
use std::time::Instant;
|
|
||||||
pub trait Codec<F> {
|
|
||||||
fn decode(&mut self, input: &[u8], session_started_at: Instant) -> Result<Vec<F>, CodecError>;
|
|
||||||
fn encode(&self, frame: &F) -> Result<Vec<u8>, CodecError>;
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
use crate::serial_core::{frame::TestFrame, record::Recording};
|
|
||||||
|
|
||||||
pub mod test;
|
|
||||||
pub mod tactile_a;
|
|
||||||
pub type TestRecording = Recording<TestFrame>;
|
|
||||||
@@ -1,382 +0,0 @@
|
|||||||
use crate::serial_core::error::CodecError;
|
|
||||||
use crate::serial_core::frame::{
|
|
||||||
FrameHandler, TactileAFrameMetaData, TactileARepFrame, TactileAReqFrame,
|
|
||||||
};
|
|
||||||
use crate::serial_core::record::{write_csv, CsvExporter, CsvImporter, RecordedFrame, Recording};
|
|
||||||
use crate::serial_core::utils::{calc_crc8_itu, elapsed_millis};
|
|
||||||
use crate::serial_core::{
|
|
||||||
codec::Codec,
|
|
||||||
frame::{TactileAFrame, TactileAFrameStatusCode},
|
|
||||||
};
|
|
||||||
use async_trait::async_trait;
|
|
||||||
use csv::StringRecord;
|
|
||||||
use anyhow::anyhow;
|
|
||||||
use std::io::Read;
|
|
||||||
use log::debug;
|
|
||||||
|
|
||||||
const FRAME_BUFFER_MIN_LENGTH: usize = 15;
|
|
||||||
|
|
||||||
pub struct TactileACodec {
|
|
||||||
buffer: Vec<u8>,
|
|
||||||
expected_data_len: usize,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct TactileACsvExporter {
|
|
||||||
channels: usize,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct TactileACsvImporter {
|
|
||||||
channels: usize,
|
|
||||||
data_row: usize,
|
|
||||||
packets: Vec<TactileADataPacket>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct TactileAHandler;
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct TactileADataPacket {
|
|
||||||
pub data: Vec<i32>,
|
|
||||||
pub dts_ms: u64,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<u8> for TactileAFrameStatusCode {
|
|
||||||
fn from(value: u8) -> Self {
|
|
||||||
match value {
|
|
||||||
0 => TactileAFrameStatusCode::Success,
|
|
||||||
_ => TactileAFrameStatusCode::Failure,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryFrom<&TactileARepFrame> for TactileADataPacket {
|
|
||||||
type Error = CodecError;
|
|
||||||
fn try_from(value: &TactileARepFrame) -> Result<TactileADataPacket, Self::Error> {
|
|
||||||
let data = TactileACodec::parse_data_frame(&value.payload)?;
|
|
||||||
let dts_ms = value.dts_ms;
|
|
||||||
Ok(TactileADataPacket {
|
|
||||||
data: data,
|
|
||||||
dts_ms: dts_ms,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TactileACodec {
|
|
||||||
pub fn new(cols: usize, rows: usize) -> TactileACodec {
|
|
||||||
Self {
|
|
||||||
buffer: Vec::new(),
|
|
||||||
expected_data_len: cols * rows * 2,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse_data_frame(data: &[u8]) -> Result<Vec<i32>, CodecError> {
|
|
||||||
if data.len() % 2 != 0 {
|
|
||||||
return Err(CodecError::InvalidLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
let vals: Vec<i32> = data
|
|
||||||
.chunks_exact(2)
|
|
||||||
.map(|chunk| {
|
|
||||||
let raw = u16::from_le_bytes([chunk[0], chunk[1]]) as i32;
|
|
||||||
if raw < 15 {
|
|
||||||
0
|
|
||||||
} else {
|
|
||||||
raw
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect::<Vec<i32>>();
|
|
||||||
|
|
||||||
Ok(vals)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn build_req_frame(cols: usize, rows: usize) -> anyhow::Result<TactileAFrame> {
|
|
||||||
let header = [0x55, 0xAA];
|
|
||||||
let payload_len: usize = 9;
|
|
||||||
let device_addr: u8 = 0x34;
|
|
||||||
let extend_code: u8 = 0x00;
|
|
||||||
let func_code: u8 = 0xFB;
|
|
||||||
let start_addr: u32 = 7168;
|
|
||||||
let except_data_len: usize = cols * rows * 2;
|
|
||||||
let checksum: u8 = 0;
|
|
||||||
Ok(TactileAFrame::Req(TactileAReqFrame {
|
|
||||||
meta: TactileAFrameMetaData {
|
|
||||||
header,
|
|
||||||
payload_len,
|
|
||||||
device_addr,
|
|
||||||
extend_code,
|
|
||||||
func_code,
|
|
||||||
start_addr,
|
|
||||||
except_data_len,
|
|
||||||
checksum,
|
|
||||||
},
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Codec<TactileAFrame> for TactileACodec {
|
|
||||||
fn decode(
|
|
||||||
&mut self,
|
|
||||||
input: &[u8],
|
|
||||||
session_started_at: std::time::Instant,
|
|
||||||
) -> Result<Vec<TactileAFrame>, CodecError> {
|
|
||||||
self.buffer.extend_from_slice(input);
|
|
||||||
let mut frames: Vec<TactileAFrame> = Vec::new();
|
|
||||||
|
|
||||||
loop {
|
|
||||||
if self.buffer.len() < FRAME_BUFFER_MIN_LENGTH {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let header_pos = self.buffer.windows(2).position(|w| w == [0xAA, 0x55]);
|
|
||||||
|
|
||||||
let Some(pos) = header_pos else {
|
|
||||||
self.buffer.clear();
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
if pos > 0 {
|
|
||||||
self.buffer.drain(0..pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.buffer.len() < FRAME_BUFFER_MIN_LENGTH {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let header = [self.buffer[0], self.buffer[1]];
|
|
||||||
let payload_len = u16::from_le_bytes([self.buffer[2], self.buffer[3]]) as usize;
|
|
||||||
let device_addr = self.buffer[4];
|
|
||||||
let extend_code = self.buffer[5];
|
|
||||||
let func_code = self.buffer[6];
|
|
||||||
let start_addr = u32::from_le_bytes([
|
|
||||||
self.buffer[7],
|
|
||||||
self.buffer[8],
|
|
||||||
self.buffer[9],
|
|
||||||
self.buffer[10],
|
|
||||||
]);
|
|
||||||
let except_data_len = u16::from_le_bytes([self.buffer[11], self.buffer[12]]) as usize;
|
|
||||||
let status = TactileAFrameStatusCode::from(self.buffer[13]);
|
|
||||||
if except_data_len != self.expected_data_len {
|
|
||||||
debug!(
|
|
||||||
"unexpected payload length: expected {}, got {}, buffer_len={}",
|
|
||||||
self.expected_data_len,
|
|
||||||
except_data_len,
|
|
||||||
self.buffer.len()
|
|
||||||
);
|
|
||||||
self.buffer.drain(0..1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let frame_length = except_data_len + FRAME_BUFFER_MIN_LENGTH;
|
|
||||||
if self.buffer.len() < frame_length {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let need_check_data = self.buffer[0..14 + except_data_len].to_vec();
|
|
||||||
let payload = self.buffer[14..14 + except_data_len].to_vec();
|
|
||||||
let crc8_itu_alg = crc::Crc::<u8>::new(&crc::CRC_8_I_432_1);
|
|
||||||
let checksum = crc8_itu_alg.checksum(&need_check_data.as_slice());
|
|
||||||
if self.buffer[frame_length - 1] != checksum {
|
|
||||||
debug!(
|
|
||||||
"checksum mismatch: expected {:02X}, got {:02X}, frame_len={}",
|
|
||||||
checksum,
|
|
||||||
self.buffer[frame_length - 1],
|
|
||||||
frame_length
|
|
||||||
);
|
|
||||||
self.buffer.drain(0..1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let dts_ms = elapsed_millis(session_started_at);
|
|
||||||
let meta: TactileAFrameMetaData = TactileAFrameMetaData {
|
|
||||||
header,
|
|
||||||
payload_len,
|
|
||||||
device_addr,
|
|
||||||
extend_code,
|
|
||||||
func_code,
|
|
||||||
start_addr,
|
|
||||||
except_data_len,
|
|
||||||
checksum,
|
|
||||||
};
|
|
||||||
frames.push(TactileAFrame::Rep({
|
|
||||||
TactileARepFrame {
|
|
||||||
meta,
|
|
||||||
status,
|
|
||||||
payload,
|
|
||||||
dts_ms,
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
self.buffer.drain(0..frame_length);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(frames)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn encode(
|
|
||||||
&self,
|
|
||||||
frame: &TactileAFrame,
|
|
||||||
) -> Result<Vec<u8>, crate::serial_core::error::CodecError> {
|
|
||||||
match frame {
|
|
||||||
TactileAFrame::Req(f) => {
|
|
||||||
let mut req_bytes: Vec<u8> = Vec::new();
|
|
||||||
req_bytes.extend_from_slice(f.meta.header.as_slice());
|
|
||||||
req_bytes.extend_from_slice((f.meta.payload_len as u16).to_le_bytes().as_slice());
|
|
||||||
req_bytes.push(f.meta.device_addr);
|
|
||||||
req_bytes.push(f.meta.extend_code);
|
|
||||||
req_bytes.push(f.meta.func_code);
|
|
||||||
|
|
||||||
req_bytes.extend_from_slice(f.meta.start_addr.to_le_bytes().as_slice());
|
|
||||||
req_bytes.extend_from_slice((f.meta.except_data_len as u16).to_le_bytes().as_slice());
|
|
||||||
let checksum = calc_crc8_itu(req_bytes.as_slice());
|
|
||||||
req_bytes.push(checksum);
|
|
||||||
Ok(req_bytes)
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
Err(CodecError::InvalidFrameType)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
impl FrameHandler<TactileAFrame, i32> for TactileAHandler {
|
|
||||||
async fn on_frame(&mut self, frame: &TactileAFrame) -> anyhow::Result<Option<Vec<i32>>> {
|
|
||||||
match frame {
|
|
||||||
TactileAFrame::Rep(rep) => {
|
|
||||||
let vals = TactileACodec::parse_data_frame(&rep.payload)?;
|
|
||||||
Ok(Some(vals))
|
|
||||||
}
|
|
||||||
_ => Ok(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TactileACsvExporter {
|
|
||||||
fn new(channels: usize) -> Self {
|
|
||||||
TactileACsvExporter { channels }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CsvExporter<TactileARepFrame> for TactileACsvExporter {
|
|
||||||
type Error = CodecError;
|
|
||||||
fn csv_header(&self, _recording: &Recording<TactileARepFrame>) -> Vec<String> {
|
|
||||||
let mut header: Vec<String> = Vec::new();
|
|
||||||
for i in 0..self.channels {
|
|
||||||
header.push(format!("channel{}", i + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
header.push("dts".to_string());
|
|
||||||
header.push("summary".to_string());
|
|
||||||
header
|
|
||||||
}
|
|
||||||
|
|
||||||
fn csv_row(
|
|
||||||
&self,
|
|
||||||
item: &RecordedFrame<TactileARepFrame>,
|
|
||||||
) -> anyhow::Result<Vec<String>> {
|
|
||||||
let packet = TactileADataPacket::try_from(&item.frame)?;
|
|
||||||
let summary: i32 = packet.data.iter().sum();
|
|
||||||
let mut row: Vec<String> = packet.data.iter().map(|x| x.to_string()).collect();
|
|
||||||
row.push(packet.dts_ms.to_string());
|
|
||||||
row.push(summary.to_string());
|
|
||||||
Ok(row)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CsvExporter<TactileAFrame> for TactileACsvExporter {
|
|
||||||
type Error = CodecError;
|
|
||||||
|
|
||||||
fn csv_header(&self, _recording: &Recording<TactileAFrame>) -> Vec<String> {
|
|
||||||
let mut header: Vec<String> = Vec::new();
|
|
||||||
for i in 0..self.channels {
|
|
||||||
header.push(format!("channel{}", i + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
header.push("dts".to_string());
|
|
||||||
header
|
|
||||||
}
|
|
||||||
|
|
||||||
fn csv_row(
|
|
||||||
&self,
|
|
||||||
item: &RecordedFrame<TactileAFrame>,
|
|
||||||
) -> anyhow::Result<Vec<String>> {
|
|
||||||
let rep = match &item.frame {
|
|
||||||
TactileAFrame::Rep(rep) => rep,
|
|
||||||
TactileAFrame::Req(_) => return Err(anyhow!("request frame cannot be exported to csv row")),
|
|
||||||
};
|
|
||||||
|
|
||||||
let packet = TactileADataPacket::try_from(rep)?;
|
|
||||||
let mut row: Vec<String> = packet.data.iter().map(|x| x.to_string()).collect();
|
|
||||||
row.push(packet.dts_ms.to_string());
|
|
||||||
Ok(row)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TactileACsvImporter {
|
|
||||||
pub fn new(_path: &str) -> TactileACsvImporter {
|
|
||||||
Self {
|
|
||||||
channels: 0,
|
|
||||||
data_row: 0,
|
|
||||||
packets: Vec::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_record(&mut self, record: StringRecord) -> anyhow::Result<TactileADataPacket> {
|
|
||||||
if self.channels == 0 {
|
|
||||||
return Err(anyhow!("csv header is missing channel columns"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if record.len() < self.channels + 1 {
|
|
||||||
return Err(anyhow!("csv row has insufficient columns"));
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut data = Vec::with_capacity(self.channels);
|
|
||||||
for index in 0..self.channels {
|
|
||||||
let cell = record.get(index).ok_or_else(|| anyhow!("missing channel cell"))?;
|
|
||||||
data.push(cell.parse::<i32>()?);
|
|
||||||
}
|
|
||||||
|
|
||||||
let dts_cell = record
|
|
||||||
.get(self.channels)
|
|
||||||
.ok_or_else(|| anyhow!("missing dts cell"))?;
|
|
||||||
let dts_ms = dts_cell.parse::<u64>()?;
|
|
||||||
|
|
||||||
Ok(TactileADataPacket {
|
|
||||||
data: data,
|
|
||||||
dts_ms: dts_ms,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CsvImporter<TactileADataPacket> for TactileACsvImporter {
|
|
||||||
fn load<R: Read>(&mut self, reader: R) -> anyhow::Result<Vec<TactileADataPacket>> {
|
|
||||||
let mut rdr = csv::Reader::from_reader(reader);
|
|
||||||
let headers = rdr.headers()?.clone();
|
|
||||||
self.channels = headers.len().saturating_sub(1);
|
|
||||||
self.data_row = 0;
|
|
||||||
self.packets.clear();
|
|
||||||
|
|
||||||
for record in rdr.records() {
|
|
||||||
let record = record?;
|
|
||||||
let packet = self.parse_record(record)?;
|
|
||||||
self.packets.push(packet);
|
|
||||||
self.data_row += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(self.packets.clone())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn export_recording_csv<W>(recording: &Recording<TactileAFrame>, writer: W) -> anyhow::Result<()>
|
|
||||||
where
|
|
||||||
W: std::io::Write,
|
|
||||||
{
|
|
||||||
let channel_nb = recording
|
|
||||||
.frames
|
|
||||||
.iter()
|
|
||||||
.find_map(|frame| match &frame.frame {
|
|
||||||
TactileAFrame::Rep(rep) => Some(rep.payload.len() / 2),
|
|
||||||
TactileAFrame::Req(_) => None,
|
|
||||||
})
|
|
||||||
.unwrap_or(0);
|
|
||||||
|
|
||||||
let exporter = TactileACsvExporter::new(channel_nb);
|
|
||||||
write_csv(recording, &exporter, writer)
|
|
||||||
}
|
|
||||||
@@ -1,254 +0,0 @@
|
|||||||
use std::io::Read;
|
|
||||||
use std::time::Instant;
|
|
||||||
use crate::serial_core::frame::{FrameHandler};
|
|
||||||
use crate::serial_core::{codec::Codec, error::CodecError, frame::TestFrame};
|
|
||||||
use anyhow::anyhow;
|
|
||||||
use async_trait::async_trait;
|
|
||||||
use csv::StringRecord;
|
|
||||||
use crate::serial_core::record::{write_csv, CsvExporter, CsvImporter, RecordedFrame, Recording};
|
|
||||||
use crate::serial_core::utils::{
|
|
||||||
elapsed_millis,
|
|
||||||
usize_to_u16_be_bytes
|
|
||||||
};
|
|
||||||
pub struct TestCodec {
|
|
||||||
buffer: Vec<u8>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct TestHandler;
|
|
||||||
|
|
||||||
impl TestCodec {
|
|
||||||
pub fn new() -> TestCodec {
|
|
||||||
Self { buffer: Vec::new() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Codec<TestFrame> for TestCodec {
|
|
||||||
fn decode(&mut self, input: &[u8], session_started_at: Instant) -> Result<Vec<TestFrame>, CodecError> {
|
|
||||||
self.buffer.extend_from_slice(input);
|
|
||||||
let mut frames = Vec::new();
|
|
||||||
|
|
||||||
loop {
|
|
||||||
if self.buffer.len() < 6 {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let header_pos = self.buffer.windows(2).position(|w| w == [0xAA, 0x55]);
|
|
||||||
|
|
||||||
let Some(pos) = header_pos else {
|
|
||||||
self.buffer.clear();
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
if pos > 0 {
|
|
||||||
self.buffer.drain(0..pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.buffer.len() < 6 {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let cmd = self.buffer[2];
|
|
||||||
let length_bytes = [self.buffer[3], self.buffer[4]];
|
|
||||||
let length = u16::from_be_bytes(length_bytes) as usize;
|
|
||||||
let frame_length = (length + 6) as usize;
|
|
||||||
if self.buffer.len() < frame_length {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
let payload = self.buffer[5..5 + length].to_vec();
|
|
||||||
// let checksum = crc8(payload.as_slice());
|
|
||||||
let crc8_alg = crc::Crc::<u8>::new(&crc::CRC_8_SMBUS);
|
|
||||||
let checksum = crc8_alg.checksum(payload.as_slice());
|
|
||||||
if self.buffer[frame_length - 1] != checksum {
|
|
||||||
self.buffer.drain(0..1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let dts = elapsed_millis(session_started_at);
|
|
||||||
frames.push(TestFrame {
|
|
||||||
header: [0xAA, 0x55],
|
|
||||||
cmd: cmd,
|
|
||||||
length: length,
|
|
||||||
payload: payload,
|
|
||||||
checksum: checksum,
|
|
||||||
dts_ms: dts,
|
|
||||||
});
|
|
||||||
|
|
||||||
self.buffer.drain(0..frame_length);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(frames)
|
|
||||||
}
|
|
||||||
fn encode(&self, frame: &TestFrame) -> Result<Vec<u8>, CodecError> {
|
|
||||||
let _ = u16::try_from(frame.payload.len()).map_err(|_| CodecError::PayloadTooLarge)?;
|
|
||||||
let mut out = Vec::with_capacity(6 + frame.length);
|
|
||||||
out.extend_from_slice(&frame.header);
|
|
||||||
out.push(frame.cmd);
|
|
||||||
out.extend_from_slice(&usize_to_u16_be_bytes(frame.length));
|
|
||||||
out.extend_from_slice(&frame.payload);
|
|
||||||
out.push(frame.checksum);
|
|
||||||
|
|
||||||
Ok(out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
impl FrameHandler<TestFrame, i32> for TestHandler {
|
|
||||||
async fn on_frame(&mut self, frame: &TestFrame) -> anyhow::Result<Option<Vec<i32>>> {
|
|
||||||
match frame.cmd {
|
|
||||||
0x01 => {
|
|
||||||
let vals = parse_data_frame(&frame.payload)?;
|
|
||||||
Ok(Some(vals))
|
|
||||||
}
|
|
||||||
_ => Ok(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_data_frame(data: &[u8]) -> Result<Vec<i32>, CodecError> {
|
|
||||||
if data.len() % 2 != 0 {
|
|
||||||
return Err(CodecError::InvalidLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
let vals: Vec<i32> = data
|
|
||||||
.chunks_exact(2)
|
|
||||||
.map(|chunk| u16::from_be_bytes([chunk[0], chunk[1]]) as i32)
|
|
||||||
.collect::<Vec<i32>>();
|
|
||||||
|
|
||||||
Ok(vals)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct TestCsvExporter;
|
|
||||||
pub struct TestCsvImporter {
|
|
||||||
channels: usize,
|
|
||||||
data_row: usize,
|
|
||||||
packets: Vec<TestDataPacket>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct TestDataPacket {
|
|
||||||
pub data: Vec<i32>,
|
|
||||||
pub dts_ms: u64
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryFrom<&TestFrame> for TestDataPacket {
|
|
||||||
type Error = CodecError;
|
|
||||||
fn try_from(frame: &TestFrame) -> Result<TestDataPacket, Self::Error> {
|
|
||||||
let data = parse_data_frame(&frame.payload)?;
|
|
||||||
let dts = frame.dts_ms;
|
|
||||||
Ok(TestDataPacket { data: data, dts_ms: dts })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// impl From<TestFrame> for TestDataPacket {
|
|
||||||
// fn from(frame: TestFrame) -> Self {
|
|
||||||
// let data = parse_data_frame(&frame.payload)?;
|
|
||||||
// let dts = frame.dts_ms;
|
|
||||||
// TestDataPacket { data: data, dts_ms: dts }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
impl CsvExporter<TestFrame> for TestCsvExporter {
|
|
||||||
type Error = CodecError;
|
|
||||||
fn csv_header(&self, recording: &Recording<TestFrame>) -> Vec<String> {
|
|
||||||
let channel_nb = recording
|
|
||||||
.frames
|
|
||||||
.iter()
|
|
||||||
.find_map(|frame| parse_data_frame(&frame.frame.payload).ok().map(|vals| vals.len()))
|
|
||||||
.unwrap_or(0);
|
|
||||||
let mut header: Vec<String> = Vec::new();
|
|
||||||
for i in 0..channel_nb {
|
|
||||||
header.push(format!("channel{}", i + 1));
|
|
||||||
}
|
|
||||||
header.push("dts".to_string());
|
|
||||||
|
|
||||||
header
|
|
||||||
}
|
|
||||||
|
|
||||||
fn csv_row(&self, item: &RecordedFrame<TestFrame>) -> anyhow::Result<Vec<String>> {
|
|
||||||
let packet: TestDataPacket = TestDataPacket::try_from(&item.frame)?;
|
|
||||||
let mut row: Vec<String> = packet.data.iter().map(|&x| x.to_string()).collect();
|
|
||||||
row.push(packet.dts_ms.to_string());
|
|
||||||
Ok(row)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TestCsvImporter {
|
|
||||||
pub fn new(_path: &str) -> TestCsvImporter {
|
|
||||||
Self {
|
|
||||||
channels: 0,
|
|
||||||
data_row: 0,
|
|
||||||
packets: Vec::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_record(&mut self, record: StringRecord) -> anyhow::Result<TestDataPacket>{
|
|
||||||
if self.channels == 0 {
|
|
||||||
return Err(anyhow!("csv header is missing channel columns"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if record.len() < self.channels + 1 {
|
|
||||||
return Err(anyhow!("csv row has insufficient columns"));
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut data = Vec::with_capacity(self.channels);
|
|
||||||
for index in 0..self.channels {
|
|
||||||
let cell = record.get(index).ok_or_else(|| anyhow!("missing channel cell"))?;
|
|
||||||
data.push(cell.parse::<i32>()?);
|
|
||||||
}
|
|
||||||
|
|
||||||
let dts_cell = record
|
|
||||||
.get(self.channels)
|
|
||||||
.ok_or_else(|| anyhow!("missing dts cell"))?;
|
|
||||||
let dts_ms = dts_cell.parse::<u64>()?;
|
|
||||||
|
|
||||||
Ok(TestDataPacket {
|
|
||||||
data: data,
|
|
||||||
dts_ms: dts_ms,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CsvImporter<TestDataPacket> for TestCsvImporter {
|
|
||||||
fn load<R: Read>(&mut self, reader: R) -> anyhow::Result<Vec<TestDataPacket>> {
|
|
||||||
let mut rdr = csv::Reader::from_reader(reader);
|
|
||||||
let headers = rdr.headers()?.clone();
|
|
||||||
self.channels = headers.len().saturating_sub(1);
|
|
||||||
self.data_row = 0;
|
|
||||||
self.packets.clear();
|
|
||||||
|
|
||||||
for record in rdr.records() {
|
|
||||||
let record = record?;
|
|
||||||
let packet = self.parse_record(record)?;
|
|
||||||
self.packets.push(packet);
|
|
||||||
self.data_row += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(self.packets.clone())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pub fn export_recording_csv<W>(recording: &Recording<TestFrame>, writer: W) -> anyhow::Result<()>
|
|
||||||
where
|
|
||||||
W: std::io::Write,
|
|
||||||
{
|
|
||||||
write_csv(recording, &TestCsvExporter, writer)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
use csv::Reader;
|
|
||||||
use std::io::Cursor;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_read_csv_basic() -> anyhow::Result<()> {
|
|
||||||
let mut rdr = Reader::from_path("recording_20260329_125238.csv")?;
|
|
||||||
let headers = rdr.headers()?;
|
|
||||||
|
|
||||||
for result in rdr.records() {
|
|
||||||
let record = result?;
|
|
||||||
let _ = record;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
use anyhow::Result;
|
|
||||||
use async_trait::async_trait;
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub struct TestFrame {
|
|
||||||
pub header: [u8; 2],
|
|
||||||
pub cmd: u8,
|
|
||||||
pub length: usize,
|
|
||||||
pub payload: Vec<u8>,
|
|
||||||
pub checksum: u8,
|
|
||||||
pub dts_ms: u64
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub struct TactileAFrameMetaData {
|
|
||||||
pub header: [u8; 2],
|
|
||||||
pub payload_len: usize,
|
|
||||||
pub device_addr: u8,
|
|
||||||
pub extend_code: u8,
|
|
||||||
pub func_code: u8,
|
|
||||||
pub start_addr: u32,
|
|
||||||
pub except_data_len: usize,
|
|
||||||
// pub status: u8,
|
|
||||||
// pub payload_data: Vec<u8>,
|
|
||||||
pub checksum: u8,
|
|
||||||
// pub dts_ms: u64,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub struct TactileAReqFrame {
|
|
||||||
pub meta: TactileAFrameMetaData,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub struct TactileARepFrame {
|
|
||||||
pub meta: TactileAFrameMetaData,
|
|
||||||
pub status: TactileAFrameStatusCode,
|
|
||||||
pub payload: Vec<u8>,
|
|
||||||
pub dts_ms: u64
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub enum TactileAFrameStatusCode {
|
|
||||||
Success,
|
|
||||||
Failure
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub enum TactileAFrame {
|
|
||||||
Req(TactileAReqFrame),
|
|
||||||
Rep(TactileARepFrame)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
pub trait FrameHandler<F, T>: Send {
|
|
||||||
async fn on_frame(&mut self, frame: &F) -> Result<Option<Vec<T>>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,34 +1,4 @@
|
|||||||
use crate::serial_core::{
|
|
||||||
frame::{TactileAFrame, TestFrame},
|
|
||||||
record::Recording,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub mod codec;
|
|
||||||
pub mod codecs;
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod frame;
|
|
||||||
pub mod model;
|
pub mod model;
|
||||||
pub mod serial;
|
pub mod serial;
|
||||||
pub mod record;
|
pub mod record;
|
||||||
pub mod utils;
|
|
||||||
#[cfg(feature = "multi-dim")]
|
|
||||||
pub mod multi_dim_force;
|
|
||||||
|
|
||||||
pub type TestRecording = Recording<TestFrame>;
|
|
||||||
pub type TactileARecording = Recording<TactileAFrame>;
|
|
||||||
|
|
||||||
pub struct SerialConnection {
|
|
||||||
pub port: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn connect(port: &str) -> Result<SerialConnection, String> {
|
|
||||||
let port = port.trim();
|
|
||||||
|
|
||||||
if port.is_empty() {
|
|
||||||
return Err("Serial port is required".to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(SerialConnection {
|
|
||||||
port: port.to_string(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
use crate::serial_core::frame::TestFrame;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
const MAX_POINTS: usize = 28;
|
|
||||||
const MAX_SUMMARY_POINTS: usize = 42;
|
const MAX_SUMMARY_POINTS: usize = 42;
|
||||||
const PANEL_STALE_AFTER: Duration = Duration::from_millis(2400);
|
const PANEL_STALE_AFTER: Duration = Duration::from_millis(2400);
|
||||||
|
|
||||||
@@ -13,7 +11,6 @@ pub struct HudPacket {
|
|||||||
pub panels: Vec<HudSignalPanel>,
|
pub panels: Vec<HudSignalPanel>,
|
||||||
pub summary: HudSummary,
|
pub summary: HudSummary,
|
||||||
pub pressure_matrix: Option<Vec<f32>>,
|
pub pressure_matrix: Option<Vec<f32>>,
|
||||||
pub spatial_force: Option<HudSpatialForce>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Serialize, Clone)]
|
#[derive(serde::Serialize, Clone)]
|
||||||
@@ -75,33 +72,19 @@ pub struct HudSignalIcon {
|
|||||||
pub tone: HudTone,
|
pub tone: HudTone,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Serialize, Clone)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct HudSpatialForce {
|
|
||||||
pub angle_deg: f32,
|
|
||||||
pub magnitude: f32,
|
|
||||||
pub confidence: f32,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct HudPanelUpdate {
|
|
||||||
source_id: String,
|
|
||||||
values: Vec<f32>,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct PanelEntry {
|
|
||||||
panel: HudSignalPanel,
|
|
||||||
last_seen: Instant,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct HudChartState {
|
pub struct HudChartState {
|
||||||
panels: HashMap<String, PanelEntry>,
|
panels: HashMap<String, PanelEntry>,
|
||||||
order: Vec<String>,
|
order: Vec<String>,
|
||||||
summary_points: Vec<f32>,
|
summary_points: Vec<f32>,
|
||||||
pressure_matrix: Option<Vec<f32>>,
|
pressure_matrix: Option<Vec<f32>>,
|
||||||
spatial_force: Option<HudSpatialForce>,
|
|
||||||
last_frame_seen: Option<Instant>,
|
last_frame_seen: Option<Instant>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct PanelEntry {
|
||||||
|
panel: HudSignalPanel,
|
||||||
|
last_seen: Instant,
|
||||||
|
}
|
||||||
|
|
||||||
impl HudChartState {
|
impl HudChartState {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -109,97 +92,27 @@ impl HudChartState {
|
|||||||
order: Vec::new(),
|
order: Vec::new(),
|
||||||
summary_points: Vec::new(),
|
summary_points: Vec::new(),
|
||||||
pressure_matrix: None,
|
pressure_matrix: None,
|
||||||
spatial_force: None,
|
|
||||||
last_frame_seen: None,
|
last_frame_seen: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn record_summary(&mut self, value: f32) {
|
pub fn record_summary(&mut self, value: f32) {
|
||||||
push_summary_point(&mut self.summary_points, value);
|
push_summary_point(&mut self.summary_points, value);
|
||||||
|
self.last_frame_seen = Some(Instant::now());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_summary(&mut self) {
|
pub fn record_pressure_matrix(&mut self, values: &[f32]) {
|
||||||
self.summary_points.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn record_pressure_matrix(&mut self, values: &[i32]) {
|
|
||||||
if values.is_empty() {
|
if values.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
self.pressure_matrix = Some(values.to_vec());
|
||||||
self.pressure_matrix = Some(values.iter().map(|value| *value as f32).collect());
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn record_spatial_force(&mut self, spatial_force: Option<HudSpatialForce>) {
|
|
||||||
self.spatial_force = spatial_force;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn apply_frame(&mut self, frame: &TestFrame, decoded_values: Option<&[i32]>) -> HudPacket {
|
|
||||||
let now = Instant::now();
|
|
||||||
self.last_frame_seen = Some(now);
|
|
||||||
|
|
||||||
for update in expand_frame_updates(frame, decoded_values) {
|
|
||||||
self.apply_update(update, now);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.prune_stale_at(now);
|
|
||||||
self.snapshot()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn prune_stale(&mut self) -> Option<HudPacket> {
|
pub fn prune_stale(&mut self) -> Option<HudPacket> {
|
||||||
|
let now = Instant::now();
|
||||||
let before = self.panels.len();
|
let before = self.panels.len();
|
||||||
let summary_points_before = self.summary_points.len();
|
let summary_before = self.summary_points.len();
|
||||||
let had_pressure_matrix = self.pressure_matrix.is_some();
|
|
||||||
let had_spatial_force = self.spatial_force.is_some();
|
|
||||||
self.prune_stale_at(Instant::now());
|
|
||||||
|
|
||||||
if before == self.panels.len()
|
|
||||||
&& summary_points_before == self.summary_points.len()
|
|
||||||
&& had_pressure_matrix == self.pressure_matrix.is_some()
|
|
||||||
&& had_spatial_force == self.spatial_force.is_some()
|
|
||||||
{
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(self.snapshot())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn apply_update(&mut self, update: HudPanelUpdate, now: Instant) {
|
|
||||||
if update.values.is_empty() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if !self.panels.contains_key(&update.source_id) {
|
|
||||||
let next_side = side_for_index(self.order.len());
|
|
||||||
self.order.push(update.source_id.clone());
|
|
||||||
self.panels.insert(
|
|
||||||
update.source_id.clone(),
|
|
||||||
PanelEntry {
|
|
||||||
panel: build_panel(&update.source_id, next_side, update.values.len()),
|
|
||||||
last_seen: now,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let entry = self
|
|
||||||
.panels
|
|
||||||
.get_mut(&update.source_id)
|
|
||||||
.expect("panel entry should exist after insertion");
|
|
||||||
|
|
||||||
entry.last_seen = now;
|
|
||||||
entry.panel.active = true;
|
|
||||||
ensure_panel_channels(&mut entry.panel, update.values.len());
|
|
||||||
|
|
||||||
for (index, value) in update.values.into_iter().enumerate() {
|
|
||||||
if let Some(series) = entry.panel.series.get_mut(index) {
|
|
||||||
push_point(&mut series.points, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
refresh_panel_stats(&mut entry.panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn prune_stale_at(&mut self, now: Instant) {
|
|
||||||
self.panels
|
self.panels
|
||||||
.retain(|_, entry| now.duration_since(entry.last_seen) <= PANEL_STALE_AFTER);
|
.retain(|_, entry| now.duration_since(entry.last_seen) <= PANEL_STALE_AFTER);
|
||||||
self.order.retain(|id| self.panels.contains_key(id));
|
self.order.retain(|id| self.panels.contains_key(id));
|
||||||
@@ -212,9 +125,18 @@ impl HudChartState {
|
|||||||
if summary_stale {
|
if summary_stale {
|
||||||
self.summary_points.clear();
|
self.summary_points.clear();
|
||||||
self.pressure_matrix = None;
|
self.pressure_matrix = None;
|
||||||
self.spatial_force = None;
|
|
||||||
self.last_frame_seen = None;
|
self.last_frame_seen = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if before == self.panels.len() && summary_before == self.summary_points.len() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(self.snapshot())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn build_snapshot(&mut self) -> HudPacket {
|
||||||
|
self.snapshot()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn snapshot(&mut self) -> HudPacket {
|
fn snapshot(&mut self) -> HudPacket {
|
||||||
@@ -231,7 +153,6 @@ impl HudChartState {
|
|||||||
panels,
|
panels,
|
||||||
summary: build_summary(&self.summary_points),
|
summary: build_summary(&self.summary_points),
|
||||||
pressure_matrix: self.pressure_matrix.clone(),
|
pressure_matrix: self.pressure_matrix.clone(),
|
||||||
spatial_force: self.spatial_force.clone(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,106 +171,6 @@ impl Default for HudChartState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_panel(source_id: &str, side: HudPanelSide, channel_count: usize) -> HudSignalPanel {
|
|
||||||
HudSignalPanel {
|
|
||||||
id: format!("panel-{source_id}"),
|
|
||||||
code: source_id.to_string(),
|
|
||||||
title: format!("Source {source_id}"),
|
|
||||||
side,
|
|
||||||
active: true,
|
|
||||||
series: build_panel_series(source_id, channel_count, &[]),
|
|
||||||
icons: build_panel_icons(source_id, channel_count),
|
|
||||||
latest: None,
|
|
||||||
min: None,
|
|
||||||
max: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn expand_frame_updates(frame: &TestFrame, decoded_values: Option<&[i32]>) -> Vec<HudPanelUpdate> {
|
|
||||||
if let Some(values) = decoded_values {
|
|
||||||
if values.is_empty() {
|
|
||||||
return Vec::new();
|
|
||||||
}
|
|
||||||
|
|
||||||
return vec![HudPanelUpdate {
|
|
||||||
source_id: format_source_id(frame.cmd),
|
|
||||||
values: values.iter().map(|value| *value as f32).collect(),
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
let chunks = frame.payload.chunks_exact(4);
|
|
||||||
|
|
||||||
if !frame.payload.is_empty() && chunks.remainder().is_empty() {
|
|
||||||
return chunks.map(build_update_from_chunk).collect();
|
|
||||||
}
|
|
||||||
|
|
||||||
vec![HudPanelUpdate {
|
|
||||||
source_id: format_source_id(frame.cmd),
|
|
||||||
values: fallback_values(frame),
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build_update_from_chunk(chunk: &[u8]) -> HudPanelUpdate {
|
|
||||||
HudPanelUpdate {
|
|
||||||
source_id: format_source_id(chunk[0]),
|
|
||||||
values: chunk[1..]
|
|
||||||
.iter()
|
|
||||||
.enumerate()
|
|
||||||
.map(|(index, byte)| normalize_value(*byte, tone_for_index(index)))
|
|
||||||
.collect(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn fallback_values(frame: &TestFrame) -> Vec<f32> {
|
|
||||||
let mut bytes = frame.payload.clone();
|
|
||||||
|
|
||||||
if bytes.is_empty() {
|
|
||||||
bytes.extend([
|
|
||||||
frame.cmd,
|
|
||||||
frame.length as u8,
|
|
||||||
frame.checksum,
|
|
||||||
frame.cmd.wrapping_add(frame.checksum),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
while bytes.len() < 3 {
|
|
||||||
let previous = *bytes.last().unwrap_or(&frame.cmd);
|
|
||||||
bytes.push(
|
|
||||||
previous
|
|
||||||
.wrapping_add(frame.cmd)
|
|
||||||
.wrapping_add(bytes.len() as u8),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes
|
|
||||||
.into_iter()
|
|
||||||
.enumerate()
|
|
||||||
.map(|(index, byte)| normalize_value(byte, tone_for_index(index)))
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn normalize_value(byte: u8, tone: HudTone) -> f32 {
|
|
||||||
let base = (byte as f32 / 255.0) * 100.0;
|
|
||||||
let offset = match tone {
|
|
||||||
HudTone::Cyan => 6.0,
|
|
||||||
HudTone::Lime => 0.0,
|
|
||||||
HudTone::Orange => -6.0,
|
|
||||||
HudTone::Violet => 10.0,
|
|
||||||
HudTone::Gold => -10.0,
|
|
||||||
HudTone::Rose => 3.0,
|
|
||||||
};
|
|
||||||
|
|
||||||
(base + offset).clamp(0.0, 100.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn format_source_id(byte: u8) -> String {
|
|
||||||
if byte.is_ascii_alphanumeric() {
|
|
||||||
(byte as char).to_ascii_uppercase().to_string()
|
|
||||||
} else {
|
|
||||||
format!("CH{:02X}", byte)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn side_for_index(index: usize) -> HudPanelSide {
|
fn side_for_index(index: usize) -> HudPanelSide {
|
||||||
if index % 2 == 0 {
|
if index % 2 == 0 {
|
||||||
HudPanelSide::Left
|
HudPanelSide::Left
|
||||||
@@ -358,91 +179,6 @@ fn side_for_index(index: usize) -> HudPanelSide {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn push_point(points: &mut Vec<f32>, value: f32) {
|
|
||||||
if points.len() >= MAX_POINTS {
|
|
||||||
points.remove(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
points.push((value * 10.0).round() / 10.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build_panel_series(
|
|
||||||
source_id: &str,
|
|
||||||
channel_count: usize,
|
|
||||||
previous: &[HudSignalSeries],
|
|
||||||
) -> Vec<HudSignalSeries> {
|
|
||||||
(0..channel_count)
|
|
||||||
.map(|index| HudSignalSeries {
|
|
||||||
id: format!("{source_id}-series-{}", index + 1),
|
|
||||||
tone: tone_for_index(index),
|
|
||||||
points: previous
|
|
||||||
.get(index)
|
|
||||||
.map(|series| series.points.clone())
|
|
||||||
.unwrap_or_default(),
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build_panel_icons(source_id: &str, channel_count: usize) -> Vec<HudSignalIcon> {
|
|
||||||
(0..channel_count)
|
|
||||||
.map(|index| HudSignalIcon {
|
|
||||||
id: format!("{source_id}-icon-{}", index + 1),
|
|
||||||
label: if channel_count == 1 {
|
|
||||||
"TOTAL".to_string()
|
|
||||||
} else {
|
|
||||||
format!("{source_id}-{}", index + 1)
|
|
||||||
},
|
|
||||||
tone: tone_for_index(index),
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn ensure_panel_channels(panel: &mut HudSignalPanel, channel_count: usize) {
|
|
||||||
if panel.series.len() == channel_count && panel.icons.len() == channel_count {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
panel.series = build_panel_series(&panel.code, channel_count, &panel.series);
|
|
||||||
panel.icons = build_panel_icons(&panel.code, channel_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn refresh_panel_stats(panel: &mut HudSignalPanel) {
|
|
||||||
let latest_values: Vec<f32> = panel
|
|
||||||
.series
|
|
||||||
.iter()
|
|
||||||
.filter_map(|series| series.points.last().copied())
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
panel.latest = if latest_values.is_empty() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(latest_values.iter().sum::<f32>() / latest_values.len() as f32)
|
|
||||||
};
|
|
||||||
|
|
||||||
panel.min = panel
|
|
||||||
.series
|
|
||||||
.iter()
|
|
||||||
.flat_map(|series| series.points.iter().copied())
|
|
||||||
.reduce(f32::min);
|
|
||||||
|
|
||||||
panel.max = panel
|
|
||||||
.series
|
|
||||||
.iter()
|
|
||||||
.flat_map(|series| series.points.iter().copied())
|
|
||||||
.reduce(f32::max);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn tone_for_index(index: usize) -> HudTone {
|
|
||||||
match index % 6 {
|
|
||||||
0 => HudTone::Cyan,
|
|
||||||
1 => HudTone::Lime,
|
|
||||||
2 => HudTone::Orange,
|
|
||||||
3 => HudTone::Violet,
|
|
||||||
4 => HudTone::Gold,
|
|
||||||
_ => HudTone::Rose,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn push_summary_point(points: &mut Vec<f32>, value: f32) {
|
fn push_summary_point(points: &mut Vec<f32>, value: f32) {
|
||||||
if points.len() >= MAX_SUMMARY_POINTS {
|
if points.len() >= MAX_SUMMARY_POINTS {
|
||||||
points.remove(0);
|
points.remove(0);
|
||||||
@@ -467,61 +203,3 @@ fn now_millis() -> u64 {
|
|||||||
.map(|duration| duration.as_millis() as u64)
|
.map(|duration| duration.as_millis() as u64)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[cfg(test)]
|
|
||||||
// mod tests {
|
|
||||||
// use super::*;
|
|
||||||
//
|
|
||||||
// fn sample_frame() -> TestFrame {
|
|
||||||
// TestFrame {
|
|
||||||
// header: [0xAA, 0x55],
|
|
||||||
// cmd: 0x01,
|
|
||||||
// length: 4,
|
|
||||||
// payload: vec![0x00, 0x0A, 0x00, 0x14],
|
|
||||||
// checksum: 0,
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// #[test]
|
|
||||||
// fn prune_stale_clears_panels_and_summary_after_timeout() {
|
|
||||||
// let mut state = HudChartState::new();
|
|
||||||
// let frame = sample_frame();
|
|
||||||
//
|
|
||||||
// state.record_summary(30.0);
|
|
||||||
// let _ = state.apply_frame(&frame, Some(&[10, 20]));
|
|
||||||
//
|
|
||||||
// let stale_now = Instant::now();
|
|
||||||
// let stale_seen = stale_now - PANEL_STALE_AFTER - Duration::from_millis(1);
|
|
||||||
//
|
|
||||||
// state.last_frame_seen = Some(stale_seen);
|
|
||||||
//
|
|
||||||
// for entry in state.panels.values_mut() {
|
|
||||||
// entry.last_seen = stale_seen;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// let packet = state
|
|
||||||
// .prune_stale()
|
|
||||||
// .expect("stale data should emit an update");
|
|
||||||
//
|
|
||||||
// assert!(packet.panels.is_empty());
|
|
||||||
// assert!(packet.summary.points.is_empty());
|
|
||||||
// assert!(state.panels.is_empty());
|
|
||||||
// assert!(state.summary_points.is_empty());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// #[test]
|
|
||||||
// fn prune_stale_keeps_recent_summary_points() {
|
|
||||||
// let mut state = HudChartState::new();
|
|
||||||
// let frame = sample_frame();
|
|
||||||
//
|
|
||||||
// state.record_summary(30.0);
|
|
||||||
// let _ = state.apply_frame(&frame, Some(&[10, 20]));
|
|
||||||
//
|
|
||||||
// state.last_frame_seen = Some(Instant::now());
|
|
||||||
//
|
|
||||||
// assert!(state.prune_stale().is_none());
|
|
||||||
// assert_eq!(state.summary_points, vec![30.0]);
|
|
||||||
// assert_eq!(state.panels.len(), 1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
@@ -1,506 +0,0 @@
|
|||||||
const SENSOR_ROWS: usize = 12;
|
|
||||||
const SENSOR_COLS: usize = 7;
|
|
||||||
const SENSOR_COUNT: usize = SENSOR_ROWS * SENSOR_COLS;
|
|
||||||
|
|
||||||
const NOISE_COLLECT_MS: f32 = 300.0;
|
|
||||||
const THRESH_K: f32 = 5.0;
|
|
||||||
const MIN_THRESHOLD: f32 = 50.0;
|
|
||||||
const CONTACT_CONFIRM_MS: f32 = 20.0;
|
|
||||||
const RELEASE_CONFIRM_MS: f32 = 50.0;
|
|
||||||
const INIT_COLLECT_MS: f32 = 80.0;
|
|
||||||
const SNAP_CENTER_X: f32 = 3.0;
|
|
||||||
const SNAP_CENTER_Y: f32 = 5.5;
|
|
||||||
const SNAP_RANGE_X: f32 = 0.25;
|
|
||||||
const SNAP_RANGE_Y: f32 = 0.25;
|
|
||||||
const POST_REFINE_WINDOW_MS: f32 = 800.0;
|
|
||||||
const POST_STABLE_MS: f32 = 200.0;
|
|
||||||
const POST_STABLE_THRESH: f32 = 0.1;
|
|
||||||
const COP_LPF_ALPHA: f32 = 0.25;
|
|
||||||
const EPSILON: f32 = 1e-8;
|
|
||||||
const DISPLAY_ANGLE_OFFSET_DEG: f32 = -90.0;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
|
||||||
pub struct PztSpatialAnalysis {
|
|
||||||
pub angle_deg: f32,
|
|
||||||
pub magnitude: f32,
|
|
||||||
pub planar_x: f32,
|
|
||||||
pub planar_y: f32,
|
|
||||||
pub confidence: f32,
|
|
||||||
pub contact_active: bool,
|
|
||||||
pub reportable: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
||||||
enum CoPState {
|
|
||||||
NoContact = 0,
|
|
||||||
InitCollecting = 1,
|
|
||||||
PostRefining = 2,
|
|
||||||
Ready = 3,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct PztProcessor {
|
|
||||||
dynamic_thresh: Option<f32>,
|
|
||||||
noise_samples: Vec<f32>,
|
|
||||||
noise_start_ms: Option<f32>,
|
|
||||||
first_contact_cop_x: Option<f32>,
|
|
||||||
first_contact_cop_y: Option<f32>,
|
|
||||||
state: CoPState,
|
|
||||||
init_x_buf: Vec<f32>,
|
|
||||||
init_y_buf: Vec<f32>,
|
|
||||||
init_start_ms: Option<f32>,
|
|
||||||
post_start_ms: Option<f32>,
|
|
||||||
post_stable_start_ms: Option<f32>,
|
|
||||||
post_cand_x: Option<f32>,
|
|
||||||
post_cand_y: Option<f32>,
|
|
||||||
post_refined: bool,
|
|
||||||
contact_candidate_start_ms: Option<f32>,
|
|
||||||
release_candidate_start_ms: Option<f32>,
|
|
||||||
filtered_cop_x: Option<f32>,
|
|
||||||
filtered_cop_y: Option<f32>,
|
|
||||||
synthetic_timestamp_ms: f32,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PztProcessor {
|
|
||||||
pub fn new() -> Self {
|
|
||||||
let mut processor = Self {
|
|
||||||
dynamic_thresh: None,
|
|
||||||
noise_samples: Vec::new(),
|
|
||||||
noise_start_ms: None,
|
|
||||||
first_contact_cop_x: None,
|
|
||||||
first_contact_cop_y: None,
|
|
||||||
state: CoPState::NoContact,
|
|
||||||
init_x_buf: Vec::new(),
|
|
||||||
init_y_buf: Vec::new(),
|
|
||||||
init_start_ms: None,
|
|
||||||
post_start_ms: None,
|
|
||||||
post_stable_start_ms: None,
|
|
||||||
post_cand_x: None,
|
|
||||||
post_cand_y: None,
|
|
||||||
post_refined: false,
|
|
||||||
contact_candidate_start_ms: None,
|
|
||||||
release_candidate_start_ms: None,
|
|
||||||
filtered_cop_x: None,
|
|
||||||
filtered_cop_y: None,
|
|
||||||
synthetic_timestamp_ms: 0.0,
|
|
||||||
};
|
|
||||||
processor.reset_all();
|
|
||||||
processor
|
|
||||||
}
|
|
||||||
|
|
||||||
fn reset_all(&mut self) {
|
|
||||||
self.dynamic_thresh = None;
|
|
||||||
self.noise_samples.clear();
|
|
||||||
self.noise_start_ms = None;
|
|
||||||
self.reset_contact_state();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn reset_contact_state(&mut self) {
|
|
||||||
self.first_contact_cop_x = None;
|
|
||||||
self.first_contact_cop_y = None;
|
|
||||||
self.state = CoPState::NoContact;
|
|
||||||
self.init_x_buf.clear();
|
|
||||||
self.init_y_buf.clear();
|
|
||||||
self.init_start_ms = None;
|
|
||||||
self.post_start_ms = None;
|
|
||||||
self.post_stable_start_ms = None;
|
|
||||||
self.post_cand_x = None;
|
|
||||||
self.post_cand_y = None;
|
|
||||||
self.post_refined = false;
|
|
||||||
self.contact_candidate_start_ms = None;
|
|
||||||
self.release_candidate_start_ms = None;
|
|
||||||
self.filtered_cop_x = None;
|
|
||||||
self.filtered_cop_y = None;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_pzt_analysis_at(
|
|
||||||
&mut self,
|
|
||||||
adc_data: &[f32],
|
|
||||||
timestamp_ms: f32,
|
|
||||||
) -> Result<PztSpatialAnalysis, &'static str> {
|
|
||||||
if adc_data.len() != SENSOR_COUNT {
|
|
||||||
return Err("ADC data length must be 84");
|
|
||||||
}
|
|
||||||
|
|
||||||
let frame = Self::prepare_frame(adc_data);
|
|
||||||
let total_pressure = frame.iter().sum::<f32>();
|
|
||||||
self.update_dynamic_threshold(total_pressure, timestamp_ms);
|
|
||||||
|
|
||||||
let raw_contact = self.is_raw_contact(total_pressure);
|
|
||||||
let contact_valid = self.debounce_contact(raw_contact, timestamp_ms);
|
|
||||||
if !contact_valid {
|
|
||||||
self.handle_no_contact();
|
|
||||||
return Ok(Self::empty_analysis(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
let Some((cop_x, cop_y)) = Self::compute_cop(&frame, total_pressure) else {
|
|
||||||
return Ok(Self::empty_analysis(false));
|
|
||||||
};
|
|
||||||
let (cop_x, cop_y) = self.filter_cop(cop_x, cop_y);
|
|
||||||
self.update_state_machine(cop_x, cop_y, timestamp_ms);
|
|
||||||
|
|
||||||
let (base_x, base_y, dx, dy) = match (self.first_contact_cop_x, self.first_contact_cop_y) {
|
|
||||||
(Some(base_x), Some(base_y)) => (base_x, base_y, cop_x - base_x, base_y - cop_y),
|
|
||||||
_ => (cop_x, cop_y, 0.0, 0.0),
|
|
||||||
};
|
|
||||||
let _ = (base_x, base_y);
|
|
||||||
|
|
||||||
let (angle_deg, magnitude) = Self::compute_vector_angle(dx, dy);
|
|
||||||
let reportable = self.state != CoPState::NoContact && magnitude > 0.0;
|
|
||||||
|
|
||||||
Ok(PztSpatialAnalysis {
|
|
||||||
angle_deg,
|
|
||||||
magnitude,
|
|
||||||
planar_x: dx,
|
|
||||||
planar_y: dy,
|
|
||||||
confidence: (self.state as i32 as f32 / CoPState::Ready as i32 as f32).clamp(0.0, 1.0),
|
|
||||||
contact_active: self.state != CoPState::NoContact,
|
|
||||||
reportable,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_pzt_analysis(
|
|
||||||
&mut self,
|
|
||||||
adc_data: &[f32],
|
|
||||||
) -> Result<PztSpatialAnalysis, &'static str> {
|
|
||||||
self.synthetic_timestamp_ms += 16.667;
|
|
||||||
self.get_pzt_analysis_at(adc_data, self.synthetic_timestamp_ms)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_pzt_angle(&mut self, adc_data: &[f32]) -> Result<f32, &'static str> {
|
|
||||||
Ok(self.get_pzt_analysis(adc_data)?.angle_deg)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn should_report(analysis: &PztSpatialAnalysis) -> bool {
|
|
||||||
analysis.reportable
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn reset_baseline(&mut self) {
|
|
||||||
self.reset_all();
|
|
||||||
self.synthetic_timestamp_ms = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn prepare_frame(adc_data: &[f32]) -> [f32; SENSOR_COUNT] {
|
|
||||||
let mut frame = [0.0; SENSOR_COUNT];
|
|
||||||
for (target, value) in frame.iter_mut().zip(adc_data.iter().copied()) {
|
|
||||||
*target = value.max(0.0);
|
|
||||||
}
|
|
||||||
frame
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_dynamic_threshold(&mut self, total_pressure: f32, timestamp_ms: f32) {
|
|
||||||
if self.dynamic_thresh.is_some() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.noise_start_ms.is_none() {
|
|
||||||
self.noise_start_ms = Some(timestamp_ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.noise_samples.push(total_pressure);
|
|
||||||
let noise_start = self.noise_start_ms.unwrap_or(timestamp_ms);
|
|
||||||
if timestamp_ms - noise_start >= NOISE_COLLECT_MS {
|
|
||||||
let mean = mean(&self.noise_samples);
|
|
||||||
let std = stddev(&self.noise_samples, mean);
|
|
||||||
self.dynamic_thresh = Some((mean + THRESH_K * std).max(MIN_THRESHOLD));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_raw_contact(&self, total_pressure: f32) -> bool {
|
|
||||||
self.dynamic_thresh
|
|
||||||
.map(|threshold| total_pressure >= threshold)
|
|
||||||
.unwrap_or(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn debounce_contact(&mut self, raw_contact: bool, timestamp_ms: f32) -> bool {
|
|
||||||
let currently_in_contact = self.state != CoPState::NoContact;
|
|
||||||
|
|
||||||
if raw_contact {
|
|
||||||
self.release_candidate_start_ms = None;
|
|
||||||
|
|
||||||
if currently_in_contact {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
let contact_start = *self.contact_candidate_start_ms.get_or_insert(timestamp_ms);
|
|
||||||
return timestamp_ms - contact_start >= CONTACT_CONFIRM_MS;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.contact_candidate_start_ms = None;
|
|
||||||
if !currently_in_contact {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let release_start = *self.release_candidate_start_ms.get_or_insert(timestamp_ms);
|
|
||||||
timestamp_ms - release_start < RELEASE_CONFIRM_MS
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_no_contact(&mut self) {
|
|
||||||
if self.state != CoPState::NoContact {
|
|
||||||
self.reset_contact_state();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn compute_cop(frame: &[f32; SENSOR_COUNT], total_pressure: f32) -> Option<(f32, f32)> {
|
|
||||||
if total_pressure <= 0.0 {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut weighted_col_sum = 0.0;
|
|
||||||
let mut weighted_row_sum = 0.0;
|
|
||||||
for row in 0..SENSOR_ROWS {
|
|
||||||
for col in 0..SENSOR_COLS {
|
|
||||||
let value = frame[row * SENSOR_COLS + col];
|
|
||||||
weighted_col_sum += value * col as f32;
|
|
||||||
weighted_row_sum += value * row as f32;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Some((
|
|
||||||
weighted_col_sum / total_pressure,
|
|
||||||
weighted_row_sum / total_pressure,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn filter_cop(&mut self, cop_x: f32, cop_y: f32) -> (f32, f32) {
|
|
||||||
if COP_LPF_ALPHA <= 0.0 {
|
|
||||||
return (cop_x, cop_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
match (self.filtered_cop_x, self.filtered_cop_y) {
|
|
||||||
(Some(prev_x), Some(prev_y)) => {
|
|
||||||
let next_x = COP_LPF_ALPHA * cop_x + (1.0 - COP_LPF_ALPHA) * prev_x;
|
|
||||||
let next_y = COP_LPF_ALPHA * cop_y + (1.0 - COP_LPF_ALPHA) * prev_y;
|
|
||||||
self.filtered_cop_x = Some(next_x);
|
|
||||||
self.filtered_cop_y = Some(next_y);
|
|
||||||
(next_x, next_y)
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
self.filtered_cop_x = Some(cop_x);
|
|
||||||
self.filtered_cop_y = Some(cop_y);
|
|
||||||
(cop_x, cop_y)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_state_machine(&mut self, cop_x: f32, cop_y: f32, timestamp_ms: f32) {
|
|
||||||
if self.state == CoPState::NoContact {
|
|
||||||
self.state = CoPState::InitCollecting;
|
|
||||||
self.init_start_ms = Some(timestamp_ms);
|
|
||||||
self.init_x_buf.clear();
|
|
||||||
self.init_y_buf.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.state == CoPState::InitCollecting {
|
|
||||||
self.init_x_buf.push(cop_x);
|
|
||||||
self.init_y_buf.push(cop_y);
|
|
||||||
|
|
||||||
let init_start = self.init_start_ms.unwrap_or(timestamp_ms);
|
|
||||||
if timestamp_ms - init_start >= INIT_COLLECT_MS {
|
|
||||||
let mut base_x = median(&self.init_x_buf);
|
|
||||||
let mut base_y = median(&self.init_y_buf);
|
|
||||||
(base_x, base_y) = Self::apply_center_snap(base_x, base_y);
|
|
||||||
|
|
||||||
self.first_contact_cop_x = Some(base_x);
|
|
||||||
self.first_contact_cop_y = Some(base_y);
|
|
||||||
self.post_start_ms = Some(timestamp_ms);
|
|
||||||
self.post_cand_x = None;
|
|
||||||
self.post_cand_y = None;
|
|
||||||
self.post_stable_start_ms = None;
|
|
||||||
self.state = CoPState::PostRefining;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.state == CoPState::PostRefining {
|
|
||||||
self.post_refine(cop_x, cop_y, timestamp_ms);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn apply_center_snap(base_x: f32, base_y: f32) -> (f32, f32) {
|
|
||||||
if (base_x - SNAP_CENTER_X).abs() <= SNAP_RANGE_X
|
|
||||||
&& (base_y - SNAP_CENTER_Y).abs() <= SNAP_RANGE_Y
|
|
||||||
{
|
|
||||||
return (SNAP_CENTER_X, SNAP_CENTER_Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
(base_x, base_y)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn post_refine(&mut self, cop_x: f32, cop_y: f32, timestamp_ms: f32) {
|
|
||||||
let post_start = *self.post_start_ms.get_or_insert(timestamp_ms);
|
|
||||||
if timestamp_ms - post_start >= POST_REFINE_WINDOW_MS {
|
|
||||||
self.post_refined = true;
|
|
||||||
self.state = CoPState::Ready;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let (Some(cand_x), Some(cand_y)) = (self.post_cand_x, self.post_cand_y) else {
|
|
||||||
self.post_cand_x = Some(cop_x);
|
|
||||||
self.post_cand_y = Some(cop_y);
|
|
||||||
self.post_stable_start_ms = Some(timestamp_ms);
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
let dist = ((cop_x - cand_x).powi(2) + (cop_y - cand_y).powi(2)).sqrt();
|
|
||||||
if dist <= POST_STABLE_THRESH {
|
|
||||||
let stable_start = *self.post_stable_start_ms.get_or_insert(timestamp_ms);
|
|
||||||
if timestamp_ms - stable_start >= POST_STABLE_MS {
|
|
||||||
let (refined_x, refined_y) = Self::apply_center_snap(cand_x, cand_y);
|
|
||||||
self.first_contact_cop_x = Some(refined_x);
|
|
||||||
self.first_contact_cop_y = Some(refined_y);
|
|
||||||
self.post_refined = true;
|
|
||||||
self.state = CoPState::Ready;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self.post_cand_x = Some(cop_x);
|
|
||||||
self.post_cand_y = Some(cop_y);
|
|
||||||
self.post_stable_start_ms = Some(timestamp_ms);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn compute_vector_angle(x: f32, y: f32) -> (f32, f32) {
|
|
||||||
let magnitude = (x * x + y * y).sqrt();
|
|
||||||
let angle = (y.atan2(x + EPSILON).to_degrees() + DISPLAY_ANGLE_OFFSET_DEG).rem_euclid(360.0);
|
|
||||||
(angle, magnitude)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn empty_analysis(contact_active: bool) -> PztSpatialAnalysis {
|
|
||||||
PztSpatialAnalysis {
|
|
||||||
angle_deg: 0.0,
|
|
||||||
magnitude: 0.0,
|
|
||||||
planar_x: 0.0,
|
|
||||||
planar_y: 0.0,
|
|
||||||
confidence: 0.0,
|
|
||||||
contact_active,
|
|
||||||
reportable: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mean(values: &[f32]) -> f32 {
|
|
||||||
if values.is_empty() {
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
values.iter().sum::<f32>() / values.len() as f32
|
|
||||||
}
|
|
||||||
|
|
||||||
fn stddev(values: &[f32], mean: f32) -> f32 {
|
|
||||||
if values.is_empty() {
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
let variance = values
|
|
||||||
.iter()
|
|
||||||
.map(|value| {
|
|
||||||
let delta = value - mean;
|
|
||||||
delta * delta
|
|
||||||
})
|
|
||||||
.sum::<f32>()
|
|
||||||
/ values.len() as f32;
|
|
||||||
variance.sqrt()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn median(values: &[f32]) -> f32 {
|
|
||||||
if values.is_empty() {
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut sorted = values.to_vec();
|
|
||||||
sorted.sort_by(|left, right| left.partial_cmp(right).unwrap_or(std::cmp::Ordering::Equal));
|
|
||||||
let mid = sorted.len() / 2;
|
|
||||||
if sorted.len() % 2 == 0 {
|
|
||||||
(sorted[mid - 1] + sorted[mid]) * 0.5
|
|
||||||
} else {
|
|
||||||
sorted[mid]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::{PztProcessor, SENSOR_COLS, SENSOR_ROWS};
|
|
||||||
|
|
||||||
fn index(row: usize, col: usize) -> usize {
|
|
||||||
row * SENSOR_COLS + col
|
|
||||||
}
|
|
||||||
|
|
||||||
fn make_frame(active: &[(usize, usize, f32)]) -> [f32; SENSOR_ROWS * SENSOR_COLS] {
|
|
||||||
let mut frame = [0.0; SENSOR_ROWS * SENSOR_COLS];
|
|
||||||
for (row, col, value) in active {
|
|
||||||
frame[index(*row, *col)] = *value;
|
|
||||||
}
|
|
||||||
frame
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn idle_frame_does_not_report_contact() {
|
|
||||||
let mut processor = PztProcessor::new();
|
|
||||||
let frame = [0.0; SENSOR_ROWS * SENSOR_COLS];
|
|
||||||
let analysis = processor.get_pzt_analysis_at(&frame, 0.0).unwrap();
|
|
||||||
assert!(!analysis.contact_active);
|
|
||||||
assert!(!analysis.reportable);
|
|
||||||
assert_eq!(analysis.magnitude, 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn rightward_cop_shift_reports_rightward_angle() {
|
|
||||||
let mut processor = PztProcessor::new();
|
|
||||||
let quiet = [0.0; SENSOR_ROWS * SENSOR_COLS];
|
|
||||||
for step in 0..20 {
|
|
||||||
let _ = processor
|
|
||||||
.get_pzt_analysis_at(&quiet, step as f32 * 20.0)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
let center_contact = make_frame(&[
|
|
||||||
(5, 2, 120.0),
|
|
||||||
(5, 3, 180.0),
|
|
||||||
(5, 4, 120.0),
|
|
||||||
(6, 2, 120.0),
|
|
||||||
(6, 3, 180.0),
|
|
||||||
(6, 4, 120.0),
|
|
||||||
]);
|
|
||||||
for step in 20..70 {
|
|
||||||
let _ = processor
|
|
||||||
.get_pzt_analysis_at(¢er_contact, step as f32 * 20.0)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
let right_contact = make_frame(&[
|
|
||||||
(5, 3, 120.0),
|
|
||||||
(5, 4, 220.0),
|
|
||||||
(5, 5, 260.0),
|
|
||||||
(6, 3, 120.0),
|
|
||||||
(6, 4, 220.0),
|
|
||||||
(6, 5, 260.0),
|
|
||||||
]);
|
|
||||||
let analysis = processor
|
|
||||||
.get_pzt_analysis_at(&right_contact, 1_500.0)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
assert!(analysis.contact_active);
|
|
||||||
assert!(analysis.reportable);
|
|
||||||
assert!(analysis.magnitude > 0.0);
|
|
||||||
assert!(analysis.angle_deg >= 225.0 && analysis.angle_deg <= 315.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn release_debounce_holds_short_gap() {
|
|
||||||
let mut processor = PztProcessor::new();
|
|
||||||
let quiet = [0.0; SENSOR_ROWS * SENSOR_COLS];
|
|
||||||
for step in 0..20 {
|
|
||||||
let _ = processor
|
|
||||||
.get_pzt_analysis_at(&quiet, step as f32 * 20.0)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
let contact = make_frame(&[(5, 3, 300.0), (5, 4, 300.0), (6, 3, 300.0), (6, 4, 300.0)]);
|
|
||||||
for step in 20..70 {
|
|
||||||
let _ = processor
|
|
||||||
.get_pzt_analysis_at(&contact, step as f32 * 20.0)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
let weak = make_frame(&[(5, 3, 10.0), (5, 4, 10.0), (6, 3, 10.0), (6, 4, 10.0)]);
|
|
||||||
let analysis = processor.get_pzt_analysis_at(&weak, 1_410.0).unwrap();
|
|
||||||
assert!(analysis.contact_active);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
use eskin_finger_sdk::types::FingerSample;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct FrameTiming {
|
pub struct FrameTiming {
|
||||||
pub pts_ms: Option<u64>,
|
pub pts_ms: Option<u64>,
|
||||||
@@ -7,50 +9,82 @@ pub struct FrameTiming {
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct RecordedFrame<F> {
|
pub struct RecordedFrame<F> {
|
||||||
pub timing: FrameTiming,
|
pub timing: FrameTiming,
|
||||||
pub frame: F
|
pub frame: F,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct Recording<F> {
|
pub struct Recording<F> {
|
||||||
pub frames: Vec<RecordedFrame<F>>
|
pub frames: Vec<RecordedFrame<F>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F> Recording<F> {
|
impl<F> Recording<F> {
|
||||||
pub fn new() -> Recording<F> { Self { frames: Vec::new() } }
|
pub fn new() -> Recording<F> {
|
||||||
pub fn push(&mut self, ite: RecordedFrame<F>) {
|
Self {
|
||||||
self.frames.push(ite);
|
frames: Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn push(&mut self, item: RecordedFrame<F>) {
|
||||||
|
self.frames.push(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait CsvExporter<F> {
|
pub type FingerRecording = Recording<FingerSample>;
|
||||||
type Error: std::error::Error + Send + Sync + 'static;
|
|
||||||
fn csv_header(&self, recording: &Recording<F>) -> Vec<String>;
|
|
||||||
fn csv_row(&self, item: &RecordedFrame<F>) -> anyhow::Result<Vec<String>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: CsvImporter
|
pub fn export_recording_csv<W>(
|
||||||
pub trait CsvImporter<P> {
|
recording: &Recording<FingerSample>,
|
||||||
fn load<R: std::io::Read>(&mut self, reader: R) -> anyhow::Result<Vec<P>>;
|
mut writer: W,
|
||||||
}
|
|
||||||
|
|
||||||
pub fn write_csv<F, E, W>(
|
|
||||||
recording: &Recording<F>,
|
|
||||||
exporter: &E,
|
|
||||||
writer: W,
|
|
||||||
) -> anyhow::Result<()>
|
) -> anyhow::Result<()>
|
||||||
where
|
where
|
||||||
E: CsvExporter<F>,
|
|
||||||
W: std::io::Write,
|
W: std::io::Write,
|
||||||
{
|
{
|
||||||
let header = exporter.csv_header(&recording);
|
// Infer channel count from the first sample's combined_forces (just fz)
|
||||||
let mut wrt = csv::Writer::from_writer(writer);
|
// We write: timestamp_us, sequence, module, fx, fy, fz
|
||||||
wrt.write_record(header)?;
|
let mut wrt = csv::Writer::from_writer(&mut writer);
|
||||||
for f in &recording.frames {
|
wrt.write_record(["timestamp_us", "sequence", "module", "fx", "fy", "fz"])?;
|
||||||
let row = exporter.csv_row(f)?;
|
|
||||||
wrt.write_record(&row)?;
|
for frame in &recording.frames {
|
||||||
|
let s = &frame.frame;
|
||||||
|
wrt.write_record(&[
|
||||||
|
s.timestamp_us.to_string(),
|
||||||
|
s.sequence.to_string(),
|
||||||
|
format!("{:?}", s.combined_forces.module),
|
||||||
|
s.combined_forces.force.fx.to_string(),
|
||||||
|
s.combined_forces.force.fy.to_string(),
|
||||||
|
s.combined_forces.force.fz.to_string(),
|
||||||
|
])?;
|
||||||
}
|
}
|
||||||
|
|
||||||
wrt.flush()?;
|
wrt.flush()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct FingerSampleCsvPacket {
|
||||||
|
pub timestamp_us: u64,
|
||||||
|
pub sequence: u32,
|
||||||
|
pub fz: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn import_csv<R: std::io::Read>(
|
||||||
|
reader: R,
|
||||||
|
) -> anyhow::Result<Vec<FingerSampleCsvPacket>> {
|
||||||
|
let mut rdr = csv::Reader::from_reader(reader);
|
||||||
|
let mut packets = Vec::new();
|
||||||
|
|
||||||
|
for result in rdr.records() {
|
||||||
|
let record = result?;
|
||||||
|
if record.len() < 6 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let timestamp_us = record.get(0).unwrap_or("0").parse::<u64>().unwrap_or(0);
|
||||||
|
let sequence = record.get(1).unwrap_or("0").parse::<u32>().unwrap_or(0);
|
||||||
|
let fz = record.get(5).unwrap_or("0").parse::<u32>().unwrap_or(0);
|
||||||
|
|
||||||
|
packets.push(FingerSampleCsvPacket {
|
||||||
|
timestamp_us,
|
||||||
|
sequence,
|
||||||
|
fz,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(packets)
|
||||||
|
}
|
||||||
@@ -1,462 +1,160 @@
|
|||||||
#[cfg(feature = "devkit")]
|
use crate::serial_core::model::HudChartState;
|
||||||
use crate::devkit::{proto::SensorFrame, DevKitState};
|
|
||||||
use crate::serial_core::codec::Codec;
|
|
||||||
use crate::serial_core::codecs::tactile_a::TactileACodec;
|
|
||||||
use crate::serial_core::frame::{FrameHandler, TactileAFrame, TestFrame};
|
|
||||||
use crate::serial_core::model::{HudChartState, HudPacket, HudSpatialForce};
|
|
||||||
#[cfg(feature = "multi-dim")]
|
|
||||||
use crate::serial_core::multi_dim_force::PztProcessor;
|
|
||||||
use crate::serial_core::record::Recording;
|
use crate::serial_core::record::Recording;
|
||||||
use crate::serial_core::record::{FrameTiming, RecordedFrame};
|
use eskin_finger_sdk::channel::DeviceEvent;
|
||||||
use anyhow::Result;
|
use eskin_finger_sdk::config::DeviceConfig;
|
||||||
use std::future::pending;
|
use eskin_finger_sdk::device::{EskinDevice, EskinDeviceInner};
|
||||||
#[cfg(feature = "devkit")]
|
use eskin_finger_sdk::transport::SerialPortTransport;
|
||||||
use std::sync::atomic::Ordering;
|
use eskin_finger_sdk::types::FingerSample;
|
||||||
use std::sync::{Arc, Mutex};
|
|
||||||
use std::time::Instant;
|
|
||||||
#[cfg(feature = "devkit")]
|
|
||||||
use tauri::Manager;
|
|
||||||
use tauri::{AppHandle, Emitter};
|
use tauri::{AppHandle, Emitter};
|
||||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
|
||||||
use tokio::time::{self, Duration, MissedTickBehavior};
|
|
||||||
use tokio_serial::SerialStream;
|
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
|
|
||||||
const AUTO_SUB_INTERVAL: Duration = Duration::from_nanos(16_666_667);
|
use super::model::HudPacket;
|
||||||
|
|
||||||
pub enum PollMode<F> {
|
pub struct SdkSession {
|
||||||
Disable,
|
pub device: EskinDeviceInner,
|
||||||
Enabled(Box<dyn PollRequester<F>>),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PendingSubFrame<F> {
|
pub fn open_device(port: &str) -> Result<SdkSession, String> {
|
||||||
frame: F,
|
let port = port.trim();
|
||||||
values: Vec<i32>,
|
if port.is_empty() {
|
||||||
spatial_force: Option<HudSpatialForce>,
|
return Err("Serial port is required".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait SerialFrame: Clone + Send + 'static {
|
let transport = SerialPortTransport::new(port, 921600);
|
||||||
fn dts_ms(&self) -> u64;
|
let config = DeviceConfig::default();
|
||||||
|
let mut device = EskinDeviceInner::new(config, Box::new(transport));
|
||||||
|
device.open().map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
fn to_hud_packet(
|
Ok(SdkSession { device })
|
||||||
&self,
|
|
||||||
chart_state: &mut HudChartState,
|
|
||||||
display_values: Option<&[i32]>,
|
|
||||||
) -> Option<HudPacket>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SerialFrame for TestFrame {
|
pub async fn run_stream(
|
||||||
fn dts_ms(&self) -> u64 {
|
|
||||||
self.dts_ms
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_hud_packet(
|
|
||||||
&self,
|
|
||||||
chart_state: &mut HudChartState,
|
|
||||||
display_values: Option<&[i32]>,
|
|
||||||
) -> Option<HudPacket> {
|
|
||||||
Some(chart_state.apply_frame(self, display_values))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SerialFrame for TactileAFrame {
|
|
||||||
fn dts_ms(&self) -> u64 {
|
|
||||||
match self {
|
|
||||||
TactileAFrame::Req(_) => 0,
|
|
||||||
TactileAFrame::Rep(rep) => rep.dts_ms,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_hud_packet(
|
|
||||||
&self,
|
|
||||||
chart_state: &mut HudChartState,
|
|
||||||
display_values: Option<&[i32]>,
|
|
||||||
) -> Option<HudPacket> {
|
|
||||||
match self {
|
|
||||||
TactileAFrame::Req(_) => None,
|
|
||||||
TactileAFrame::Rep(rep) => {
|
|
||||||
let proxy = TestFrame {
|
|
||||||
header: rep.meta.header,
|
|
||||||
cmd: rep.meta.func_code,
|
|
||||||
length: rep.meta.except_data_len,
|
|
||||||
payload: rep.payload.clone(),
|
|
||||||
checksum: rep.meta.checksum,
|
|
||||||
dts_ms: rep.dts_ms,
|
|
||||||
};
|
|
||||||
|
|
||||||
Some(chart_state.apply_frame(&proxy, display_values))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait PollRequester<F>: Send {
|
|
||||||
fn poll_interval(&self) -> Option<Duration> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn should_request(&mut self) -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
fn next_request(&mut self) -> Result<Option<F>> {
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn on_rx_frame(&mut self, _frame: &F) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
pub struct NoopPollRequester;
|
|
||||||
|
|
||||||
impl<F> PollRequester<F> for NoopPollRequester {}
|
|
||||||
|
|
||||||
pub struct TactileAPollRequester {
|
|
||||||
period: Duration,
|
|
||||||
cols: usize,
|
|
||||||
rows: usize,
|
|
||||||
awaiting_reply: bool,
|
|
||||||
last_request_at: Option<Instant>,
|
|
||||||
reply_timeout: Duration,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TactileAPollRequester {
|
|
||||||
pub fn new(period: Duration, cols: usize, rows: usize, reply_timeout: Duration) -> Self {
|
|
||||||
Self {
|
|
||||||
period,
|
|
||||||
cols,
|
|
||||||
rows,
|
|
||||||
awaiting_reply: false,
|
|
||||||
last_request_at: None,
|
|
||||||
reply_timeout,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PollRequester<TactileAFrame> for TactileAPollRequester {
|
|
||||||
fn poll_interval(&self) -> Option<Duration> {
|
|
||||||
Some(self.period)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn should_request(&mut self) -> bool {
|
|
||||||
if !self.awaiting_reply {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
let timed_out = self
|
|
||||||
.last_request_at
|
|
||||||
.map(|t| t.elapsed() >= self.reply_timeout)
|
|
||||||
.unwrap_or(false);
|
|
||||||
|
|
||||||
if timed_out {
|
|
||||||
self.awaiting_reply = false;
|
|
||||||
self.last_request_at = None;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
fn next_request(&mut self) -> Result<Option<TactileAFrame>> {
|
|
||||||
let req = TactileACodec::build_req_frame(self.cols, self.rows)?;
|
|
||||||
self.awaiting_reply = true;
|
|
||||||
self.last_request_at = Some(Instant::now());
|
|
||||||
Ok(Some(req))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn on_rx_frame(&mut self, frame: &TactileAFrame) {
|
|
||||||
if matches!(frame, TactileAFrame::Rep(_)) {
|
|
||||||
self.awaiting_reply = false;
|
|
||||||
self.last_request_at = None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn run_serial<C, H, T, F>(
|
|
||||||
app: AppHandle,
|
app: AppHandle,
|
||||||
port: SerialStream,
|
device: &mut EskinDeviceInner,
|
||||||
codec: C,
|
|
||||||
handler: H,
|
|
||||||
session_started_at: Instant,
|
|
||||||
recording: Arc<Mutex<Recording<F>>>,
|
|
||||||
cancel: CancellationToken,
|
cancel: CancellationToken,
|
||||||
) -> Result<()>
|
) -> Result<(), String> {
|
||||||
where
|
device
|
||||||
F: SerialFrame,
|
.start_stream()
|
||||||
C: Codec<F> + Send + 'static,
|
.map_err(|e| format!("start_stream failed: {e}"))?;
|
||||||
H: FrameHandler<F, T> + Send + 'static,
|
|
||||||
T: Into<i32>,
|
|
||||||
{
|
|
||||||
run_serial_with_poll(
|
|
||||||
app,
|
|
||||||
port,
|
|
||||||
codec,
|
|
||||||
handler,
|
|
||||||
session_started_at,
|
|
||||||
recording,
|
|
||||||
cancel,
|
|
||||||
PollMode::Disable,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn run_serial_with_poll<C, H, T, F>(
|
|
||||||
app: AppHandle,
|
|
||||||
mut port: SerialStream,
|
|
||||||
mut codec: C,
|
|
||||||
mut handler: H,
|
|
||||||
session_started_at: Instant,
|
|
||||||
recording: Arc<Mutex<Recording<F>>>,
|
|
||||||
cancel: CancellationToken,
|
|
||||||
poll_mode: PollMode<F>,
|
|
||||||
) -> Result<()>
|
|
||||||
where
|
|
||||||
F: SerialFrame,
|
|
||||||
C: Codec<F> + Send + 'static,
|
|
||||||
H: FrameHandler<F, T> + Send + 'static,
|
|
||||||
T: Into<i32>,
|
|
||||||
{
|
|
||||||
let mut requester = match poll_mode {
|
|
||||||
PollMode::Disable => None,
|
|
||||||
PollMode::Enabled(r) => Some(r),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut poll_interval = requester.as_ref().and_then(|r| r.poll_interval()).map(|d| {
|
|
||||||
let mut it = time::interval(d);
|
|
||||||
it.set_missed_tick_behavior(MissedTickBehavior::Skip);
|
|
||||||
it
|
|
||||||
});
|
|
||||||
let mut poll_sub_interval = time::interval(AUTO_SUB_INTERVAL);
|
|
||||||
poll_sub_interval.set_missed_tick_behavior(MissedTickBehavior::Skip);
|
|
||||||
|
|
||||||
|
let channels = device.channels();
|
||||||
let mut chart_state = HudChartState::new();
|
let mut chart_state = HudChartState::new();
|
||||||
let mut buffer = [0u8; 1024];
|
|
||||||
let mut prune_interval = time::interval(Duration::from_millis(450));
|
|
||||||
#[cfg(feature = "multi-dim")]
|
|
||||||
let mut pzt_processor = PztProcessor::new();
|
|
||||||
let mut pending_sub_frame: Option<PendingSubFrame<F>> = None;
|
|
||||||
prune_interval.set_missed_tick_behavior(MissedTickBehavior::Delay);
|
|
||||||
|
|
||||||
loop {
|
let result = loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = cancel.cancelled() => break,
|
_ = cancel.cancelled() => {
|
||||||
_ = async {
|
break Ok(());
|
||||||
match poll_interval.as_mut() {
|
|
||||||
Some(it) => {
|
|
||||||
it.tick().await;
|
|
||||||
}
|
}
|
||||||
None => pending::<()>().await,
|
_ = tokio::time::sleep(tokio::time::Duration::from_millis(1)) => {}
|
||||||
}
|
}
|
||||||
} => {
|
|
||||||
if let Some(r) = requester.as_mut() {
|
|
||||||
if r.should_request() {
|
|
||||||
if let Some(req) = r.next_request()? {
|
|
||||||
let bytes = codec.encode(&req)?;
|
|
||||||
port.write_all(&bytes).await?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ = prune_interval.tick() => {
|
|
||||||
if let Some(packet) = chart_state.prune_stale() {
|
|
||||||
app.emit("hud_stream", packet)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ = poll_sub_interval.tick() => {
|
|
||||||
if let Some(pending) = pending_sub_frame.take() {
|
|
||||||
let display_values = build_display_values(
|
|
||||||
&mut chart_state,
|
|
||||||
pending.values.as_slice(),
|
|
||||||
pending.spatial_force,
|
|
||||||
);
|
|
||||||
|
|
||||||
if let Some(packet) = pending
|
// Try to receive a sample (non-blocking-ish via small timeout)
|
||||||
.frame
|
match channels.recv_sample(5) {
|
||||||
.to_hud_packet(&mut chart_state, display_values.as_deref())
|
Ok(sample) => {
|
||||||
|
if let Some(packet) = build_hud_packet_from_sample(&sample, &mut chart_state) {
|
||||||
|
let _ = app.emit("hud_stream", packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(eskin_finger_sdk::error::SdkError::Timeout) => {
|
||||||
|
// No sample yet, check for events
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
break Err(format!("sample recv error: {e}"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drain any events
|
||||||
|
if let Err(e) = drain_events(&channels) {
|
||||||
|
break Err(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let _ = device.stop_stream();
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn run_stream_with_record(
|
||||||
|
app: AppHandle,
|
||||||
|
device: &mut EskinDeviceInner,
|
||||||
|
cancel: CancellationToken,
|
||||||
|
recording: std::sync::Arc<std::sync::Mutex<Recording<FingerSample>>>,
|
||||||
|
) -> Result<(), String> {
|
||||||
|
device
|
||||||
|
.start_stream()
|
||||||
|
.map_err(|e| format!("start_stream failed: {e}"))?;
|
||||||
|
|
||||||
|
let channels = device.channels();
|
||||||
|
let mut chart_state = HudChartState::new();
|
||||||
|
|
||||||
|
let result = loop {
|
||||||
|
tokio::select! {
|
||||||
|
_ = cancel.cancelled() => {
|
||||||
|
break Ok(());
|
||||||
|
}
|
||||||
|
_ = tokio::time::sleep(tokio::time::Duration::from_millis(1)) => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
match channels.recv_sample(5) {
|
||||||
|
Ok(sample) => {
|
||||||
|
// Record
|
||||||
{
|
{
|
||||||
app.emit("hud_stream", packet)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
read_result = port.read(&mut buffer) => {
|
|
||||||
let n = read_result?;
|
|
||||||
if n == 0 {
|
|
||||||
// Some serial drivers can resolve reads with 0 bytes repeatedly.
|
|
||||||
// Yield here so timer-driven poll requests are not starved by a busy loop.
|
|
||||||
tokio::task::yield_now().await;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let frames = codec.decode(&buffer[..n], session_started_at)?;
|
|
||||||
for frame in frames {
|
|
||||||
if let Some(r) = requester.as_mut() {
|
|
||||||
r.on_rx_frame(&frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
let decode_res = handler
|
|
||||||
.on_frame(&frame)
|
|
||||||
.await?
|
|
||||||
.map(|vals| vals.into_iter().map(Into::into).collect::<Vec<i32>>());
|
|
||||||
|
|
||||||
let mut record = recording
|
let mut record = recording
|
||||||
.lock()
|
.lock()
|
||||||
.map_err(|_| anyhow::anyhow!("recording state poisoned"))?;
|
.map_err(|_| "recording state poisoned".to_string())?;
|
||||||
record.push(RecordedFrame {
|
record.push(crate::serial_core::record::RecordedFrame {
|
||||||
timing: FrameTiming {
|
timing: crate::serial_core::record::FrameTiming {
|
||||||
pts_ms: None,
|
pts_ms: None,
|
||||||
dts_ms: frame.dts_ms(),
|
dts_ms: sample.timestamp_us / 1000,
|
||||||
},
|
},
|
||||||
frame: frame.clone(),
|
frame: sample.clone(),
|
||||||
});
|
|
||||||
drop(record);
|
|
||||||
|
|
||||||
if let Some(vals) = decode_res {
|
|
||||||
#[cfg(feature = "multi-dim")]
|
|
||||||
let mut spatial_force = None;
|
|
||||||
#[cfg(not(feature = "multi-dim"))]
|
|
||||||
let spatial_force = None;
|
|
||||||
#[cfg(feature = "multi-dim")]
|
|
||||||
{
|
|
||||||
let pzt_values = vals.iter().map(|value| *value as f32).collect::<Vec<f32>>();
|
|
||||||
if let Ok(analysis) = pzt_processor.get_pzt_analysis_at(&pzt_values, frame.dts_ms() as f32) {
|
|
||||||
if PztProcessor::should_report(&analysis) {
|
|
||||||
spatial_force = Some(HudSpatialForce {
|
|
||||||
angle_deg: analysis.angle_deg,
|
|
||||||
magnitude: analysis.magnitude,
|
|
||||||
confidence: analysis.confidence,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// #[cfg(feature = "devkit")]
|
|
||||||
// {
|
|
||||||
// let summary = vals.iter().copied().sum::<i32>();
|
|
||||||
// #[cfg(feature = "debug")]
|
|
||||||
// let force = raw_to_g1(summary as u32);
|
|
||||||
// #[cfg(not(feature = "debug"))]
|
|
||||||
// let force = summary as f64;
|
|
||||||
// push_devkit_frame(&app, vals.as_slice(), frame.dts_ms(), force);
|
|
||||||
// }
|
|
||||||
|
|
||||||
pending_sub_frame = Some(PendingSubFrame {
|
if let Some(packet) = build_hud_packet_from_sample(&sample, &mut chart_state) {
|
||||||
frame: frame.clone(),
|
let _ = app.emit("hud_stream", packet);
|
||||||
values: vals,
|
|
||||||
spatial_force,
|
|
||||||
});
|
|
||||||
} else if let Some(packet) = frame.to_hud_packet(&mut chart_state, None) {
|
|
||||||
app.emit("hud_stream", packet)?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Err(eskin_finger_sdk::error::SdkError::Timeout) => {}
|
||||||
|
Err(e) => {
|
||||||
|
break Err(format!("sample recv error: {e}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build_display_values(
|
if let Err(e) = drain_events(&channels) {
|
||||||
|
break Err(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let _ = device.stop_stream();
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
fn drain_events(channels: &std::sync::Arc<eskin_finger_sdk::channel::ChannelManager>) -> Result<(), String> {
|
||||||
|
loop {
|
||||||
|
match channels.recv_event(0) {
|
||||||
|
Ok(DeviceEvent::IoError(msg)) => {
|
||||||
|
eprintln!("SDK stream io error: {msg}");
|
||||||
|
return Err(format!("stream io error: {msg}"));
|
||||||
|
}
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(eskin_finger_sdk::error::SdkError::Timeout) => return Ok(()),
|
||||||
|
Err(eskin_finger_sdk::error::SdkError::ChannelClosed) => {
|
||||||
|
return Err("event channel closed".into());
|
||||||
|
}
|
||||||
|
Err(_) => return Ok(()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn build_hud_packet_from_sample(
|
||||||
|
sample: &FingerSample,
|
||||||
chart_state: &mut HudChartState,
|
chart_state: &mut HudChartState,
|
||||||
values: &[i32],
|
) -> Option<HudPacket> {
|
||||||
spatial_force: Option<HudSpatialForce>,
|
let fz = sample.combined_forces.force.fz as f32;
|
||||||
) -> Option<Vec<i32>> {
|
chart_state.record_summary(fz);
|
||||||
let summary = values.iter().copied().sum::<i32>();
|
if !sample.raw_adcs.is_empty() {
|
||||||
chart_state.record_spatial_force(spatial_force);
|
let pressure: Vec<f32> = sample.raw_adcs.iter().map(|&v| v as f32).collect();
|
||||||
|
chart_state.record_pressure_matrix(&pressure);
|
||||||
let x = raw_to_g1(summary as u32).min(MAX_DISPLAY_FORCE);
|
|
||||||
if x <= MIN_DISPLAY_FORCE {
|
|
||||||
let zero_values = vec![0; values.len()];
|
|
||||||
chart_state.record_summary(0.0);
|
|
||||||
chart_state.record_pressure_matrix(&zero_values);
|
|
||||||
return Some(vec![0]);
|
|
||||||
}
|
}
|
||||||
|
Some(chart_state.build_snapshot())
|
||||||
chart_state.record_pressure_matrix(values);
|
|
||||||
chart_state.record_summary(x as f32);
|
|
||||||
Some(vec![x.round() as i32])
|
|
||||||
}
|
|
||||||
|
|
||||||
const MIN_DISPLAY_FORCE: f64 = 0.1;
|
|
||||||
const MAX_DISPLAY_FORCE: f64 = 25.6;
|
|
||||||
|
|
||||||
#[cfg(feature = "devkit")]
|
|
||||||
fn push_devkit_frame(app: &AppHandle, values: &[i32], dts_ms: u64, resultant_force: f64) {
|
|
||||||
let devkit_state = app.state::<DevKitState>();
|
|
||||||
if !devkit_state.running.load(Ordering::Relaxed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let (rows, cols) = infer_matrix_shape(values.len());
|
|
||||||
let timestamp_ms = std::time::SystemTime::now()
|
|
||||||
.duration_since(std::time::UNIX_EPOCH)
|
|
||||||
.unwrap_or_default()
|
|
||||||
.as_millis() as u64;
|
|
||||||
|
|
||||||
let seq = timestamp_ms;
|
|
||||||
let matrix = values
|
|
||||||
.iter()
|
|
||||||
.map(|value| (*value).max(0) as u32)
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
devkit_state.push_frame(SensorFrame {
|
|
||||||
seq,
|
|
||||||
timestamp_ms,
|
|
||||||
rows,
|
|
||||||
cols,
|
|
||||||
matrix,
|
|
||||||
resultant_force,
|
|
||||||
dts_ms: dts_ms as u32,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "devkit")]
|
|
||||||
fn infer_matrix_shape(len: usize) -> (u32, u32) {
|
|
||||||
if len == 84 {
|
|
||||||
return (12, 7);
|
|
||||||
}
|
|
||||||
|
|
||||||
if len == 0 {
|
|
||||||
return (0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut best = (len, 1);
|
|
||||||
let mut factor = 1usize;
|
|
||||||
while factor * factor <= len {
|
|
||||||
if len % factor == 0 {
|
|
||||||
best = (len / factor, factor);
|
|
||||||
}
|
|
||||||
factor += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
(best.0 as u32, best.1 as u32)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn raw_to_g1(raw: u32) -> f64 {
|
|
||||||
const X: [u32; 12] = [
|
|
||||||
0, 20829, 102371, 132956, 165568, 182033, 217263, 263098, 283747, 365120, 410556, 477190
|
|
||||||
];
|
|
||||||
|
|
||||||
const Y: [f64; 12] = [
|
|
||||||
0.0, 57.0, 257.0, 357.0, 457.0, 557.0, 657.0, 857.0, 1057.0, 1557.0, 2057.0, 2557.0
|
|
||||||
];
|
|
||||||
|
|
||||||
let n = X.len();
|
|
||||||
if raw <= X[0] {
|
|
||||||
return Y[0] / 100.0;
|
|
||||||
}
|
|
||||||
if raw >= X[n - 1] {
|
|
||||||
return Y[n - 1] / 100.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut left = 0;
|
|
||||||
let mut right = n - 1;
|
|
||||||
|
|
||||||
while left + 1 < right {
|
|
||||||
let mid = (left + right) / 2;
|
|
||||||
if raw < X[mid] {
|
|
||||||
right = mid;
|
|
||||||
} else {
|
|
||||||
left = mid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let ratio = (raw - X[left]) as f64 / (X[right] - X[left]) as f64;
|
|
||||||
Y[left] / 100.0 + ratio * (Y[right] - Y[left]) / 100.0
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
|
|
||||||
use std::time::Instant;
|
|
||||||
|
|
||||||
pub fn usize_to_u16_be_bytes(n: usize) -> [u8; 2] {
|
|
||||||
(n as u16).to_be_bytes()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn usize_to_u16_le_bytes(n: usize) -> [u8; 2] {
|
|
||||||
(n as u16).to_be_bytes()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn u16_to_hex_be_bytes(n: u16) -> [u8; 2] {
|
|
||||||
(n as u16).to_be_bytes()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn u16_to_hex_le_bytes(n: u16) -> [u8; 2] {
|
|
||||||
(n as u16).to_le_bytes()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn calc_crc8_smbus(c: &[u8]) -> u8 {
|
|
||||||
let crc8_smbus = crc::Crc::<u8>::new(&crc::CRC_8_SMBUS);
|
|
||||||
let checksum = crc8_smbus.checksum(c);
|
|
||||||
return checksum;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn calc_crc8_itu(c: &[u8]) -> u8 {
|
|
||||||
let crc8_itu_alg = crc::Crc::<u8>::new(&crc::CRC_8_I_432_1);
|
|
||||||
let checksum = crc8_itu_alg.checksum(c);
|
|
||||||
return checksum;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn elapsed_millis(start_at: Instant) -> u64 {
|
|
||||||
start_at.elapsed().as_millis() as u64
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod test {
|
|
||||||
use anyhow::Ok;
|
|
||||||
|
|
||||||
use crate::serial_core::utils::{calc_crc8_itu, calc_crc8_smbus};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_crc8_itu() -> anyhow::Result<()> {
|
|
||||||
let req_vec = vec![0x55, 0xAA, 0x09, 0x00, 0x34, 0x00, 0xFB, 0x00, 0x1C, 0x00, 0x00, 0x18, 0x00];
|
|
||||||
let checksum = calc_crc8_itu(req_vec.as_slice());
|
|
||||||
assert_eq!(checksum, 0x7A);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_crc8_smbus() -> anyhow::Result<()> {
|
|
||||||
let req_vec = vec![0x55, 0xAA, 0x09, 0x00, 0x34, 0x00, 0xFB, 0x00, 0x1C, 0x00, 0x00, 0x18, 0x00];
|
|
||||||
let checksum = calc_crc8_smbus(req_vec.as_slice());
|
|
||||||
assert_eq!(checksum, 0x2F);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -41,7 +41,9 @@
|
|||||||
"template": "nsis/installer.nsi"
|
"template": "nsis/installer.nsi"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resources": []
|
"resources": [
|
||||||
|
"resources/je-skin-devkit-server.exe"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"updater": {
|
"updater": {
|
||||||
|
|||||||
@@ -6,21 +6,17 @@
|
|||||||
import { fly } from "svelte/transition";
|
import { fly } from "svelte/transition";
|
||||||
import { DEFAULT_PRESSURE_RANGE_MAX, DEFAULT_PRESSURE_RANGE_MIN } from "$lib/config/pressure-range";
|
import { DEFAULT_PRESSURE_RANGE_MAX, DEFAULT_PRESSURE_RANGE_MIN } from "$lib/config/pressure-range";
|
||||||
import ConfigPanel from "$lib/components/ConfigPanel.svelte";
|
import ConfigPanel from "$lib/components/ConfigPanel.svelte";
|
||||||
import ModelStage from "$lib/components/ModelStage.svelte";
|
|
||||||
import NeonBreakoutArena from "$lib/components/NeonBreakoutArena.svelte";
|
import NeonBreakoutArena from "$lib/components/NeonBreakoutArena.svelte";
|
||||||
import PressureMatrixViewer from "$lib/components/PressureMatrixViewer.svelte";
|
import PressureMatrixViewer from "$lib/components/PressureMatrixViewer.svelte";
|
||||||
import SignalChart from "$lib/components/SignalChart.svelte";
|
import SignalChart from "$lib/components/SignalChart.svelte";
|
||||||
import SpatialForcePanel from "$lib/components/SpatialForcePanel.svelte";
|
|
||||||
import SummaryCurve from "$lib/components/SummaryCurve.svelte";
|
import SummaryCurve from "$lib/components/SummaryCurve.svelte";
|
||||||
import type {
|
import type {
|
||||||
HudColorMapOption,
|
HudColorMapOption,
|
||||||
HudSignalPanel,
|
HudSignalPanel,
|
||||||
HudSpatialForce,
|
|
||||||
HudSummary,
|
HudSummary,
|
||||||
LocaleCode,
|
LocaleCode,
|
||||||
MatrixDisplayMode,
|
MatrixDisplayMode,
|
||||||
PressureColorMapPreset,
|
PressureColorMapPreset
|
||||||
StageViewMode
|
|
||||||
} from "$lib/types/hud";
|
} from "$lib/types/hud";
|
||||||
|
|
||||||
export let locale: LocaleCode = "zh-CN";
|
export let locale: LocaleCode = "zh-CN";
|
||||||
@@ -28,7 +24,6 @@
|
|||||||
export let rightPanels: HudSignalPanel[] = [];
|
export let rightPanels: HudSignalPanel[] = [];
|
||||||
export let summary: HudSummary;
|
export let summary: HudSummary;
|
||||||
export let pressureMatrix: number[] | null = null;
|
export let pressureMatrix: number[] | null = null;
|
||||||
export let spatialForce: HudSpatialForce | null = null;
|
|
||||||
export let showConfigPanel = false;
|
export let showConfigPanel = false;
|
||||||
export let configPanelTitle = "";
|
export let configPanelTitle = "";
|
||||||
export let configPanelHint = "";
|
export let configPanelHint = "";
|
||||||
@@ -46,8 +41,6 @@
|
|||||||
export let rangeMax = DEFAULT_PRESSURE_RANGE_MAX;
|
export let rangeMax = DEFAULT_PRESSURE_RANGE_MAX;
|
||||||
export let colorMapPreset: PressureColorMapPreset = "emerald";
|
export let colorMapPreset: PressureColorMapPreset = "emerald";
|
||||||
export let matrixDisplayMode: MatrixDisplayMode = "dots";
|
export let matrixDisplayMode: MatrixDisplayMode = "dots";
|
||||||
export let stageViewMode: StageViewMode = "webgl";
|
|
||||||
export let modelUrl = "/models/je-skin-model.glb";
|
|
||||||
export let replaySectionLabel = "";
|
export let replaySectionLabel = "";
|
||||||
export let replayPlayLabel = "";
|
export let replayPlayLabel = "";
|
||||||
export let replayPauseLabel = "";
|
export let replayPauseLabel = "";
|
||||||
@@ -60,9 +53,8 @@
|
|||||||
export let replayProgress = 0;
|
export let replayProgress = 0;
|
||||||
export let replayFileName = "";
|
export let replayFileName = "";
|
||||||
export let replayFrameInfo = "";
|
export let replayFrameInfo = "";
|
||||||
|
export let showPrecisionTestPanel = false;
|
||||||
export let sessionStartedAt: number = Date.now();
|
export let sessionStartedAt: number = Date.now();
|
||||||
export let summaryReleasePending = false;
|
|
||||||
export let spatialForcePanelVisible = false;
|
|
||||||
|
|
||||||
let stagePlaneEl: HTMLDivElement | undefined;
|
let stagePlaneEl: HTMLDivElement | undefined;
|
||||||
let panelZoneEl: HTMLDivElement | undefined;
|
let panelZoneEl: HTMLDivElement | undefined;
|
||||||
@@ -89,10 +81,9 @@
|
|||||||
$: replaySide = summarySide === "left" ? "right" : "left";
|
$: replaySide = summarySide === "left" ? "right" : "left";
|
||||||
$: replayToggleButtonText = replayIsPlaying ? replayPauseLabel : replayPlayLabel;
|
$: replayToggleButtonText = replayIsPlaying ? replayPauseLabel : replayPlayLabel;
|
||||||
$: replayProgressPercent = Math.round(Math.min(1, Math.max(0, replayProgress)) * 100);
|
$: replayProgressPercent = Math.round(Math.min(1, Math.max(0, replayProgress)) * 100);
|
||||||
$: summaryCurveVisible =
|
$: summaryCurveVisible = summary.points.length > 0 && summary.points.some((value) => Number.isFinite(value) && Math.abs(value) >= 0.0001);
|
||||||
summary.points.length > 0 &&
|
$: splitMatrixTitle = locale === "zh-CN" ? "数字矩阵" : "Matrix";
|
||||||
(summaryReleasePending || summary.points.some((value) => Number.isFinite(value) && Math.abs(value) >= 0.0001));
|
$: splitMatrixHint = locale === "zh-CN" ? "实时压力数据 / 数字矩阵" : "Live pressure matrix";
|
||||||
$: isModelStage = stageViewMode === "model3d";
|
|
||||||
|
|
||||||
function toPxNumber(rawValue: string): number {
|
function toPxNumber(rawValue: string): number {
|
||||||
const value = Number.parseFloat(rawValue);
|
const value = Number.parseFloat(rawValue);
|
||||||
@@ -117,7 +108,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
panelZoneTopPx = 16;
|
panelZoneTopPx = showPrecisionTestPanel ? 24 : 16;
|
||||||
|
|
||||||
const panelZoneBottomPx = panelZoneEl ? toPxNumber(getComputedStyle(panelZoneEl).bottom) : 0;
|
const panelZoneBottomPx = panelZoneEl ? toPxNumber(getComputedStyle(panelZoneEl).bottom) : 0;
|
||||||
const zoneHeight = Math.max(0, stagePlaneEl.clientHeight - panelZoneTopPx - panelZoneBottomPx);
|
const zoneHeight = Math.max(0, stagePlaneEl.clientHeight - panelZoneTopPx - panelZoneBottomPx);
|
||||||
@@ -185,12 +176,43 @@
|
|||||||
bind:this={stagePlaneEl}
|
bind:this={stagePlaneEl}
|
||||||
style="--panel-zone-top-dyn: {panelZoneTopPx}px; --rail-scale-left: {leftRailScale}; --rail-scale-right: {rightRailScale};"
|
style="--panel-zone-top-dyn: {panelZoneTopPx}px; --rail-scale-left: {leftRailScale}; --rail-scale-right: {rightRailScale};"
|
||||||
>
|
>
|
||||||
{#if isModelStage}
|
{#if showPrecisionTestPanel}
|
||||||
<div class="canvas-wrap">
|
<div class="split-game-wrap">
|
||||||
{#key modelUrl}
|
<section class="split-panel split-matrix-panel">
|
||||||
<ModelStage {locale} {modelUrl} />
|
<header class="split-panel-head">
|
||||||
|
<p>{splitMatrixTitle}</p>
|
||||||
|
<span>{splitMatrixHint}</span>
|
||||||
|
</header>
|
||||||
|
<div class="split-panel-body">
|
||||||
|
{#key `${matrixRows}x${matrixCols}:${colorMapPreset}:split`}
|
||||||
|
<PressureMatrixViewer
|
||||||
|
{summary}
|
||||||
|
{pressureMatrix}
|
||||||
|
{matrixRows}
|
||||||
|
{matrixCols}
|
||||||
|
{rangeMin}
|
||||||
|
{rangeMax}
|
||||||
|
{colorMapPreset}
|
||||||
|
{matrixDisplayMode}
|
||||||
|
{locale}
|
||||||
|
showStatsPanel={true}
|
||||||
|
/>
|
||||||
{/key}
|
{/key}
|
||||||
</div>
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="split-panel split-breakout-panel">
|
||||||
|
<NeonBreakoutArena
|
||||||
|
{locale}
|
||||||
|
{pressureMatrix}
|
||||||
|
{matrixRows}
|
||||||
|
{matrixCols}
|
||||||
|
{rangeMin}
|
||||||
|
{rangeMax}
|
||||||
|
{colorMapPreset}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="canvas-wrap">
|
<div class="canvas-wrap">
|
||||||
{#key `${matrixRows}x${matrixCols}:${colorMapPreset}`}
|
{#key `${matrixRows}x${matrixCols}:${colorMapPreset}`}
|
||||||
@@ -210,7 +232,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if showConfigPanel && !isModelStage}
|
{#if showConfigPanel && !showPrecisionTestPanel}
|
||||||
<div class="config-panel-wrap">
|
<div class="config-panel-wrap">
|
||||||
<ConfigPanel
|
<ConfigPanel
|
||||||
bind:matrixRows
|
bind:matrixRows
|
||||||
@@ -232,7 +254,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if !isModelStage}
|
{#if !showPrecisionTestPanel}
|
||||||
<div class="panel-zone" bind:this={panelZoneEl}>
|
<div class="panel-zone" bind:this={panelZoneEl}>
|
||||||
<aside class="side-rail left-rail">
|
<aside class="side-rail left-rail">
|
||||||
<div class="rail-stack" bind:this={leftStackEl}>
|
<div class="rail-stack" bind:this={leftStackEl}>
|
||||||
@@ -280,24 +302,6 @@
|
|||||||
<SignalChart {panel} panelIndex={index} {locale} />
|
<SignalChart {panel} panelIndex={index} {locale} />
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
{#if spatialForcePanelVisible}
|
|
||||||
<div
|
|
||||||
class="panel-motion-shell"
|
|
||||||
in:fly={{ x: 180, duration: 340, opacity: 0.08, easing: cubicOut }}
|
|
||||||
out:fly={{ x: 180, duration: 280, opacity: 0.06, easing: cubicIn }}
|
|
||||||
>
|
|
||||||
<SpatialForcePanel
|
|
||||||
{spatialForce}
|
|
||||||
{locale}
|
|
||||||
side="right"
|
|
||||||
panelIndex={rightPanels.length}
|
|
||||||
panelCode="3D"
|
|
||||||
panelTitle={locale === "zh-CN" ? "三维力" : "3D Force"}
|
|
||||||
badgeLabel=""
|
|
||||||
badgeTone="lime"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if summaryCurveVisible && summarySide === "right"}
|
{#if summaryCurveVisible && summarySide === "right"}
|
||||||
<div
|
<div
|
||||||
@@ -313,7 +317,7 @@
|
|||||||
{sessionStartedAt}
|
{sessionStartedAt}
|
||||||
isRealtime={!replayHasData}
|
isRealtime={!replayHasData}
|
||||||
side="right"
|
side="right"
|
||||||
panelIndex={rightPanels.length + (spatialForcePanelVisible ? 1 : 0)}
|
panelIndex={rightPanels.length}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -322,7 +326,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if replayHasData && !isModelStage}
|
{#if replayHasData && !showPrecisionTestPanel}
|
||||||
<aside class="replay-floating-panel" class:is-left={replaySide === "left"} class:is-right={replaySide === "right"}>
|
<aside class="replay-floating-panel" class:is-left={replaySide === "left"} class:is-right={replaySide === "right"}>
|
||||||
<div class="replay-panel-head">
|
<div class="replay-panel-head">
|
||||||
<div class="replay-panel-title-group">
|
<div class="replay-panel-title-group">
|
||||||
@@ -360,7 +364,7 @@
|
|||||||
</aside>
|
</aside>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if !isModelStage}
|
{#if !showPrecisionTestPanel}
|
||||||
<div class="stage-bottom-overlay">
|
<div class="stage-bottom-overlay">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
import type {
|
import type {
|
||||||
ConnectionState,
|
ConnectionState,
|
||||||
|
HudConfigLink,
|
||||||
HudNoticeTone,
|
HudNoticeTone,
|
||||||
LocaleCode,
|
LocaleCode,
|
||||||
StageViewMode,
|
MatrixDisplayMode,
|
||||||
WindowControlAction
|
WindowControlAction
|
||||||
} from "$lib/types/hud";
|
} from "$lib/types/hud";
|
||||||
|
|
||||||
@@ -27,9 +28,12 @@
|
|||||||
export let serialPortValue = "";
|
export let serialPortValue = "";
|
||||||
export let serialPortOptions: string[] = [];
|
export let serialPortOptions: string[] = [];
|
||||||
export let refreshPortsLabel = "";
|
export let refreshPortsLabel = "";
|
||||||
|
export let configLinksLabel = "";
|
||||||
|
export let configLinks: HudConfigLink[] = [];
|
||||||
export let matrixViewLabel = "";
|
export let matrixViewLabel = "";
|
||||||
|
export let matrixViewNumericLabel = "";
|
||||||
export let matrixViewDotsLabel = "";
|
export let matrixViewDotsLabel = "";
|
||||||
export let stageViewMode: StageViewMode = "webgl";
|
export let matrixDisplayMode: MatrixDisplayMode = "dots";
|
||||||
export let connectActionLabel = "";
|
export let connectActionLabel = "";
|
||||||
export let disconnectActionLabel = "";
|
export let disconnectActionLabel = "";
|
||||||
export let exportActionLabel = "";
|
export let exportActionLabel = "";
|
||||||
@@ -50,8 +54,8 @@
|
|||||||
const dispatch = createEventDispatcher<{
|
const dispatch = createEventDispatcher<{
|
||||||
windowcontrol: WindowControlAction;
|
windowcontrol: WindowControlAction;
|
||||||
localechange: LocaleCode;
|
localechange: LocaleCode;
|
||||||
|
configlink: string;
|
||||||
matrixdisplaytoggle: boolean;
|
matrixdisplaytoggle: boolean;
|
||||||
stagemodechange: StageViewMode;
|
|
||||||
portchange: string;
|
portchange: string;
|
||||||
serialrefresh: void;
|
serialrefresh: void;
|
||||||
serialconnect: string;
|
serialconnect: string;
|
||||||
@@ -93,8 +97,12 @@
|
|||||||
dispatch("localechange", nextLocale);
|
dispatch("localechange", nextLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
function emitStageModeChange(nextMode: StageViewMode): void {
|
function emitConfigLink(linkId: string): void {
|
||||||
dispatch("stagemodechange", nextMode);
|
dispatch("configlink", linkId);
|
||||||
|
}
|
||||||
|
|
||||||
|
function emitMatrixDisplayToggle(): void {
|
||||||
|
dispatch("matrixdisplaytoggle", matrixDisplayMode !== "dots");
|
||||||
}
|
}
|
||||||
|
|
||||||
function emitPortChange(event: Event): void {
|
function emitPortChange(event: Event): void {
|
||||||
@@ -177,6 +185,38 @@
|
|||||||
|
|
||||||
<div class="control-bar">
|
<div class="control-bar">
|
||||||
<div class="control-main-row">
|
<div class="control-main-row">
|
||||||
|
<section class="config-links" aria-label={configLinksLabel}>
|
||||||
|
{#each configLinks as link (link.id)}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="config-link tone-{link.tone ?? 'neutral'}"
|
||||||
|
class:is-active={Boolean(link.active)}
|
||||||
|
on:click={() => emitConfigLink(link.id)}
|
||||||
|
>
|
||||||
|
<span class="config-indicator" aria-hidden="true"></span>
|
||||||
|
<span class="config-label">{link.label}</span>
|
||||||
|
</button>
|
||||||
|
{/each}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="matrix-switch-wrap" aria-label={matrixViewLabel}>
|
||||||
|
<span class="matrix-switch-label">{matrixViewLabel}</span>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="matrix-switch-btn"
|
||||||
|
class:is-active={matrixDisplayMode === "dots"}
|
||||||
|
role="switch"
|
||||||
|
aria-checked={matrixDisplayMode === "dots"}
|
||||||
|
aria-label={matrixViewDotsLabel}
|
||||||
|
on:click={emitMatrixDisplayToggle}
|
||||||
|
>
|
||||||
|
<span class="matrix-switch-track" aria-hidden="true">
|
||||||
|
<span class="matrix-switch-thumb"></span>
|
||||||
|
</span>
|
||||||
|
<span class="matrix-switch-copy">{matrixDisplayMode === "dots" ? matrixViewDotsLabel : matrixViewNumericLabel}</span>
|
||||||
|
</button>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="state-card" aria-label={connectionLabel}>
|
<section class="state-card" aria-label={connectionLabel}>
|
||||||
<span class="state-dot" class:ok={connectionTone === "ok"} class:warn={connectionTone === "warn"}></span>
|
<span class="state-dot" class:ok={connectionTone === "ok"} class:warn={connectionTone === "warn"}></span>
|
||||||
<span class="state-label">{connectionLabel}</span>
|
<span class="state-label">{connectionLabel}</span>
|
||||||
@@ -445,6 +485,108 @@
|
|||||||
background: var(--panel-surface);
|
background: var(--panel-surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.matrix-switch-wrap {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
min-block-size: 2rem;
|
||||||
|
border: 1px solid var(--panel-line);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.16rem 0.22rem 0.16rem 0.56rem;
|
||||||
|
background: var(--panel-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-switch-label {
|
||||||
|
color: var(--panel-text-dim);
|
||||||
|
font-size: 0.66rem;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
line-height: 1;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-switch-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.42rem;
|
||||||
|
min-block-size: 1.62rem;
|
||||||
|
border: 1px solid rgb(var(--hud-border-rgb) / 0.26);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.18rem 0.28rem 0.18rem 0.22rem;
|
||||||
|
background: rgb(var(--hud-surface-deep-rgb) / 0.84);
|
||||||
|
color: rgb(var(--hud-text-main-rgb) / 0.92);
|
||||||
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
border-color 180ms ease,
|
||||||
|
box-shadow 180ms ease,
|
||||||
|
background-color 180ms ease,
|
||||||
|
color 180ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-switch-btn:hover {
|
||||||
|
border-color: rgb(var(--hud-cyan-rgb) / 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-switch-btn.is-active {
|
||||||
|
border-color: rgb(var(--hud-cyan-rgb) / 0.5);
|
||||||
|
background:
|
||||||
|
linear-gradient(180deg, rgb(var(--hud-surface-alt-rgb) / 0.94), rgb(var(--hud-surface-rgb) / 0.9)),
|
||||||
|
radial-gradient(circle at 50% 0, rgb(var(--hud-cyan-rgb) / 0.12), transparent 60%);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 0 0 1px rgb(var(--hud-text-main-rgb) / 0.05),
|
||||||
|
0 0 12px rgb(var(--hud-cyan-rgb) / 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-switch-track {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
inline-size: 2.2rem;
|
||||||
|
block-size: 1.2rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.14rem;
|
||||||
|
background: rgb(var(--hud-surface-rgb) / 0.9);
|
||||||
|
box-shadow: inset 0 0 0 1px rgb(var(--hud-border-rgb) / 0.24);
|
||||||
|
transition:
|
||||||
|
background-color 180ms ease,
|
||||||
|
box-shadow 180ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-switch-btn.is-active .matrix-switch-track {
|
||||||
|
background: rgb(var(--hud-cyan-rgb) / 0.18);
|
||||||
|
box-shadow: inset 0 0 0 1px rgb(var(--hud-cyan-rgb) / 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-switch-thumb {
|
||||||
|
inline-size: 0.92rem;
|
||||||
|
block-size: 0.92rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgb(var(--hud-text-main-rgb) / 0.96);
|
||||||
|
box-shadow:
|
||||||
|
0 1px 4px rgb(0 0 0 / 0.26),
|
||||||
|
0 0 10px rgb(var(--hud-text-main-rgb) / 0.12);
|
||||||
|
transform: translateX(0);
|
||||||
|
transition:
|
||||||
|
transform 180ms ease,
|
||||||
|
background-color 180ms ease,
|
||||||
|
box-shadow 180ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-switch-btn.is-active .matrix-switch-thumb {
|
||||||
|
transform: translateX(0.96rem);
|
||||||
|
background: rgb(var(--hud-cyan-rgb) / 0.96);
|
||||||
|
box-shadow:
|
||||||
|
0 1px 4px rgb(0 0 0 / 0.26),
|
||||||
|
0 0 12px rgb(var(--hud-cyan-rgb) / 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-switch-copy {
|
||||||
|
font-size: 0.74rem;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
white-space: nowrap;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.state-dot {
|
.state-dot {
|
||||||
inline-size: 0.55rem;
|
inline-size: 0.55rem;
|
||||||
block-size: 0.55rem;
|
block-size: 0.55rem;
|
||||||
@@ -908,6 +1050,93 @@
|
|||||||
background: rgb(10 16 20 / 0.7);
|
background: rgb(10 16 20 / 0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.config-links {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.2rem;
|
||||||
|
min-block-size: 2rem;
|
||||||
|
border: 1px solid rgb(95 132 158 / 0.36);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.17rem 0.2rem;
|
||||||
|
background: linear-gradient(180deg, rgb(9 15 19 / 0.9), rgb(4 8 12 / 0.86));
|
||||||
|
box-shadow: inset 0 0 0 1px rgb(140 184 210 / 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.34rem;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.26rem 0.64rem;
|
||||||
|
background: transparent;
|
||||||
|
color: rgb(164 188 208 / 0.9);
|
||||||
|
font-size: 0.81rem;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
color 180ms ease,
|
||||||
|
border-color 180ms ease,
|
||||||
|
background-color 180ms ease,
|
||||||
|
box-shadow 220ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-indicator {
|
||||||
|
inline-size: 0.34rem;
|
||||||
|
block-size: 0.34rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgb(136 157 174 / 0.88);
|
||||||
|
box-shadow: 0 0 0 2px rgb(136 157 174 / 0.16);
|
||||||
|
transition:
|
||||||
|
background-color 180ms ease,
|
||||||
|
box-shadow 200ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-label {
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-link:hover {
|
||||||
|
color: #d7edfb;
|
||||||
|
border-color: rgb(62 232 255 / 0.26);
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-link.is-active {
|
||||||
|
color: #f1fdff;
|
||||||
|
border-color: rgb(106 150 180 / 0.56);
|
||||||
|
background: rgb(18 27 35 / 0.9);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 0 0 1px rgb(167 218 252 / 0.08),
|
||||||
|
0 0 10px rgb(62 232 255 / 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-link.tone-cyan.is-active {
|
||||||
|
border-color: rgb(62 232 255 / 0.48);
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-link.tone-lime.is-active {
|
||||||
|
border-color: rgb(133 255 68 / 0.52);
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-link.tone-orange.is-active {
|
||||||
|
border-color: rgb(255 91 63 / 0.52);
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-link.tone-cyan.is-active .config-indicator {
|
||||||
|
background: var(--hud-cyan);
|
||||||
|
box-shadow: 0 0 0 2px rgb(62 232 255 / 0.17);
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-link.tone-lime.is-active .config-indicator {
|
||||||
|
background: var(--hud-lime);
|
||||||
|
box-shadow: 0 0 0 2px rgb(133 255 68 / 0.17);
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-link.tone-orange.is-active .config-indicator {
|
||||||
|
background: var(--hud-orange);
|
||||||
|
box-shadow: 0 0 0 2px rgb(255 91 63 / 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
.locale-btn {
|
.locale-btn {
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
@@ -934,11 +1163,21 @@
|
|||||||
background: rgb(24 31 25 / 0.9);
|
background: rgb(24 31 25 / 0.9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1080px) {
|
||||||
|
.config-links {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 820px) {
|
@media (max-width: 820px) {
|
||||||
.control-main-row {
|
.control-main-row {
|
||||||
gap: 0.44rem;
|
gap: 0.44rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.config-links {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
.serial-select {
|
.serial-select {
|
||||||
padding-inline-start: 0.45rem;
|
padding-inline-start: 0.45rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,469 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { onMount } from "svelte";
|
|
||||||
import * as THREE from "three";
|
|
||||||
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
||||||
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
||||||
import type { GLTF } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
||||||
import type { LocaleCode } from "$lib/types/hud";
|
|
||||||
|
|
||||||
type ModelLoadState = "loading" | "ready" | "missing" | "error";
|
|
||||||
|
|
||||||
export let locale: LocaleCode = "zh-CN";
|
|
||||||
export let modelUrl = "/models/je-skin-model.gltf";
|
|
||||||
|
|
||||||
let rootEl: HTMLDivElement | undefined;
|
|
||||||
let canvasEl: HTMLCanvasElement | undefined;
|
|
||||||
let loadState: ModelLoadState = "loading";
|
|
||||||
let loadProgress = 0;
|
|
||||||
let loadError = "";
|
|
||||||
|
|
||||||
const FLOOR_Y = -1.15;
|
|
||||||
const MODEL_FLOOR_CLEARANCE = 0.035;
|
|
||||||
const MODEL_TARGET_HEIGHT = 8.4;
|
|
||||||
const MODEL_MIN_SCALE = 0.02;
|
|
||||||
const MODEL_MAX_SCALE = 80;
|
|
||||||
const CAMERA_DISTANCE_FACTOR = 1.35;
|
|
||||||
const CAMERA_DISTANCE_MIN = 7.5;
|
|
||||||
const CAMERA_DISTANCE_MAX = 24;
|
|
||||||
|
|
||||||
$: copy =
|
|
||||||
locale === "zh-CN"
|
|
||||||
? {
|
|
||||||
title: "3D 模型舱",
|
|
||||||
subtitle: "Dark Grid / Future Lab",
|
|
||||||
loading: "正在加载模型",
|
|
||||||
ready: "模型已载入",
|
|
||||||
missing: "等待模型文件",
|
|
||||||
error: "模型加载失败",
|
|
||||||
modelPath: "模型路径",
|
|
||||||
hint: "请使用 glTF 2.0 的 .glb/.gltf;旧版 glTF 1.0 需要先转换"
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
title: "3D Model Bay",
|
|
||||||
subtitle: "Dark Grid / Future Lab",
|
|
||||||
loading: "Loading model",
|
|
||||||
ready: "Model loaded",
|
|
||||||
missing: "Waiting for model file",
|
|
||||||
error: "Model load failed",
|
|
||||||
modelPath: "Model path",
|
|
||||||
hint: "Use glTF 2.0 .glb/.gltf assets; older glTF 1.0 files need conversion first"
|
|
||||||
};
|
|
||||||
$: statusText =
|
|
||||||
loadState === "ready"
|
|
||||||
? copy.ready
|
|
||||||
: loadState === "missing"
|
|
||||||
? copy.missing
|
|
||||||
: loadState === "error"
|
|
||||||
? copy.error
|
|
||||||
: `${copy.loading} ${Math.round(loadProgress)}%`;
|
|
||||||
|
|
||||||
function disposeObject3D(object: THREE.Object3D): void {
|
|
||||||
object.traverse((child) => {
|
|
||||||
const mesh = child as THREE.Mesh;
|
|
||||||
if (mesh.geometry) {
|
|
||||||
mesh.geometry.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
const material = mesh.material;
|
|
||||||
if (Array.isArray(material)) {
|
|
||||||
for (const item of material) {
|
|
||||||
item.dispose();
|
|
||||||
}
|
|
||||||
} else if (material) {
|
|
||||||
material.dispose();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildPlaceholderModel(): THREE.Group {
|
|
||||||
const group = new THREE.Group();
|
|
||||||
const cyan = new THREE.Color(0x5ee7ff);
|
|
||||||
const lime = new THREE.Color(0xa6ff7a);
|
|
||||||
|
|
||||||
const platform = new THREE.Mesh(
|
|
||||||
new THREE.CylinderGeometry(5.8, 6.7, 0.36, 96),
|
|
||||||
new THREE.MeshStandardMaterial({
|
|
||||||
color: 0x0c1824,
|
|
||||||
emissive: 0x07131f,
|
|
||||||
metalness: 0.62,
|
|
||||||
roughness: 0.34
|
|
||||||
})
|
|
||||||
);
|
|
||||||
platform.position.y = 0.18;
|
|
||||||
group.add(platform);
|
|
||||||
|
|
||||||
const ringGeometry = new THREE.TorusGeometry(4.35, 0.035, 10, 128);
|
|
||||||
const ringMaterial = new THREE.MeshBasicMaterial({ color: cyan, transparent: true, opacity: 0.78 });
|
|
||||||
for (let index = 0; index < 3; index += 1) {
|
|
||||||
const ring = new THREE.Mesh(ringGeometry, ringMaterial);
|
|
||||||
ring.position.y = 0.52 + index * 0.52;
|
|
||||||
ring.rotation.x = Math.PI / 2;
|
|
||||||
group.add(ring);
|
|
||||||
}
|
|
||||||
|
|
||||||
const coreMaterial = new THREE.MeshStandardMaterial({
|
|
||||||
color: 0x1b2a38,
|
|
||||||
emissive: 0x0a2632,
|
|
||||||
metalness: 0.48,
|
|
||||||
roughness: 0.42,
|
|
||||||
transparent: true,
|
|
||||||
opacity: 0.72
|
|
||||||
});
|
|
||||||
const core = new THREE.Mesh(new THREE.BoxGeometry(2.2, 3.4, 1.1), coreMaterial);
|
|
||||||
core.position.y = 2.4;
|
|
||||||
core.rotation.y = -0.36;
|
|
||||||
group.add(core);
|
|
||||||
|
|
||||||
const sensorMaterial = new THREE.MeshBasicMaterial({ color: lime, transparent: true, opacity: 0.88 });
|
|
||||||
for (let index = 0; index < 7; index += 1) {
|
|
||||||
const bead = new THREE.Mesh(new THREE.SphereGeometry(0.13, 18, 18), sensorMaterial);
|
|
||||||
bead.position.set(-0.72 + index * 0.24, 3.18 + Math.sin(index * 0.72) * 0.18, 0.6);
|
|
||||||
group.add(bead);
|
|
||||||
}
|
|
||||||
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
function clamp(value: number, min: number, max: number): number {
|
|
||||||
return Math.min(max, Math.max(min, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeObjectToStage(object: THREE.Object3D): THREE.Box3 {
|
|
||||||
object.updateMatrixWorld(true);
|
|
||||||
let bounds = new THREE.Box3().setFromObject(object);
|
|
||||||
const size = bounds.getSize(new THREE.Vector3());
|
|
||||||
const currentHeight = Math.max(size.y, 0.001);
|
|
||||||
const scale = clamp(MODEL_TARGET_HEIGHT / currentHeight, MODEL_MIN_SCALE, MODEL_MAX_SCALE);
|
|
||||||
|
|
||||||
object.scale.multiplyScalar(scale);
|
|
||||||
object.updateMatrixWorld(true);
|
|
||||||
|
|
||||||
bounds = new THREE.Box3().setFromObject(object);
|
|
||||||
const center = bounds.getCenter(new THREE.Vector3());
|
|
||||||
object.position.x -= center.x;
|
|
||||||
object.position.z -= center.z;
|
|
||||||
object.position.y += FLOOR_Y + MODEL_FLOOR_CLEARANCE - bounds.min.y;
|
|
||||||
object.updateMatrixWorld(true);
|
|
||||||
|
|
||||||
return new THREE.Box3().setFromObject(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
function frameObject(object: THREE.Object3D, camera: THREE.PerspectiveCamera, controls: OrbitControls): void {
|
|
||||||
const bounds = normalizeObjectToStage(object);
|
|
||||||
const size = bounds.getSize(new THREE.Vector3());
|
|
||||||
const maxAxis = Math.max(size.x, size.y, size.z, 1);
|
|
||||||
const distance = clamp(maxAxis * CAMERA_DISTANCE_FACTOR, CAMERA_DISTANCE_MIN, CAMERA_DISTANCE_MAX);
|
|
||||||
const targetY = FLOOR_Y + Math.max(size.y * 0.46, 1.4);
|
|
||||||
|
|
||||||
camera.position.set(distance * 0.48, targetY + distance * 0.24, distance * 0.68);
|
|
||||||
camera.near = Math.max(distance / 80, 0.01);
|
|
||||||
camera.far = distance * 24;
|
|
||||||
camera.updateProjectionMatrix();
|
|
||||||
controls.target.set(0, targetY, 0);
|
|
||||||
controls.minDistance = Math.max(distance * 0.32, 2);
|
|
||||||
controls.maxDistance = Math.max(distance * 2.5, 12);
|
|
||||||
controls.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
if (!rootEl || !canvasEl) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const renderer = new THREE.WebGLRenderer({
|
|
||||||
canvas: canvasEl,
|
|
||||||
antialias: true,
|
|
||||||
alpha: true,
|
|
||||||
powerPreference: "high-performance"
|
|
||||||
});
|
|
||||||
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
|
|
||||||
renderer.setClearColor(0x03070d, 1);
|
|
||||||
renderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
||||||
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
|
||||||
renderer.toneMappingExposure = 1.08;
|
|
||||||
|
|
||||||
const scene = new THREE.Scene();
|
|
||||||
scene.fog = new THREE.FogExp2(0x03070d, 0.028);
|
|
||||||
|
|
||||||
const camera = new THREE.PerspectiveCamera(38, 1, 0.05, 600);
|
|
||||||
camera.position.set(8, 6, 9);
|
|
||||||
|
|
||||||
const controls = new OrbitControls(camera, canvasEl);
|
|
||||||
controls.enableDamping = true;
|
|
||||||
controls.dampingFactor = 0.08;
|
|
||||||
controls.minDistance = 2.4;
|
|
||||||
controls.maxDistance = 32;
|
|
||||||
controls.target.set(0, FLOOR_Y + 3.2, 0);
|
|
||||||
|
|
||||||
const labGroup = new THREE.Group();
|
|
||||||
scene.add(labGroup);
|
|
||||||
|
|
||||||
const grid = new THREE.GridHelper(42, 42, 0x63e6ff, 0x123047);
|
|
||||||
grid.position.y = FLOOR_Y;
|
|
||||||
const gridMaterial = grid.material;
|
|
||||||
if (Array.isArray(gridMaterial)) {
|
|
||||||
for (const material of gridMaterial) {
|
|
||||||
material.transparent = true;
|
|
||||||
material.opacity = 0.28;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gridMaterial.transparent = true;
|
|
||||||
gridMaterial.opacity = 0.28;
|
|
||||||
}
|
|
||||||
labGroup.add(grid);
|
|
||||||
|
|
||||||
const backGrid = new THREE.GridHelper(42, 42, 0x5ee7ff, 0x0c2436);
|
|
||||||
backGrid.position.set(0, 9.5, -17);
|
|
||||||
backGrid.rotation.x = Math.PI / 2;
|
|
||||||
const backGridMaterial = backGrid.material;
|
|
||||||
if (Array.isArray(backGridMaterial)) {
|
|
||||||
for (const material of backGridMaterial) {
|
|
||||||
material.transparent = true;
|
|
||||||
material.opacity = 0.12;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
backGridMaterial.transparent = true;
|
|
||||||
backGridMaterial.opacity = 0.12;
|
|
||||||
}
|
|
||||||
labGroup.add(backGrid);
|
|
||||||
|
|
||||||
const floor = new THREE.Mesh(
|
|
||||||
new THREE.PlaneGeometry(42, 42),
|
|
||||||
new THREE.MeshStandardMaterial({
|
|
||||||
color: 0x050c14,
|
|
||||||
metalness: 0.28,
|
|
||||||
roughness: 0.64,
|
|
||||||
transparent: true,
|
|
||||||
opacity: 0.72
|
|
||||||
})
|
|
||||||
);
|
|
||||||
floor.rotation.x = -Math.PI / 2;
|
|
||||||
floor.position.y = FLOOR_Y - 0.018;
|
|
||||||
labGroup.add(floor);
|
|
||||||
|
|
||||||
const ambient = new THREE.AmbientLight(0x9fb8d0, 0.22);
|
|
||||||
const keyLight = new THREE.DirectionalLight(0x7be7ff, 1.5);
|
|
||||||
keyLight.position.set(8, 12, 8);
|
|
||||||
const rimLight = new THREE.PointLight(0xa6ff7a, 26, 24, 2.1);
|
|
||||||
rimLight.position.set(-4.5, 4.8, -3.6);
|
|
||||||
const sideLight = new THREE.PointLight(0x5c8cff, 15, 28, 1.7);
|
|
||||||
sideLight.position.set(5.8, 3.2, -5.4);
|
|
||||||
scene.add(ambient, keyLight, rimLight, sideLight);
|
|
||||||
|
|
||||||
let activeModel: THREE.Object3D = buildPlaceholderModel();
|
|
||||||
scene.add(activeModel);
|
|
||||||
frameObject(activeModel, camera, controls);
|
|
||||||
|
|
||||||
const loader = new GLTFLoader();
|
|
||||||
loader.load(
|
|
||||||
modelUrl,
|
|
||||||
(gltf: GLTF) => {
|
|
||||||
scene.remove(activeModel);
|
|
||||||
disposeObject3D(activeModel);
|
|
||||||
activeModel = gltf.scene;
|
|
||||||
activeModel.traverse((child) => {
|
|
||||||
const mesh = child as THREE.Mesh;
|
|
||||||
if (mesh.isMesh) {
|
|
||||||
mesh.castShadow = true;
|
|
||||||
mesh.receiveShadow = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
scene.add(activeModel);
|
|
||||||
frameObject(activeModel, camera, controls);
|
|
||||||
loadState = "ready";
|
|
||||||
loadProgress = 100;
|
|
||||||
},
|
|
||||||
(event) => {
|
|
||||||
if (event.total > 0) {
|
|
||||||
loadProgress = (event.loaded / event.total) * 100;
|
|
||||||
} else {
|
|
||||||
loadProgress = 12;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
(error) => {
|
|
||||||
const message = error instanceof Error ? error.message : String(error);
|
|
||||||
loadError = message || "Unknown model loader error";
|
|
||||||
loadState = message.toLowerCase().includes("404") ? "missing" : "error";
|
|
||||||
loadProgress = 0;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const resize = () => {
|
|
||||||
if (!rootEl) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const width = rootEl.clientWidth;
|
|
||||||
const height = rootEl.clientHeight;
|
|
||||||
if (width <= 0 || height <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderer.setSize(width, height, false);
|
|
||||||
camera.aspect = width / height;
|
|
||||||
camera.updateProjectionMatrix();
|
|
||||||
};
|
|
||||||
|
|
||||||
resize();
|
|
||||||
const resizeObserver = new ResizeObserver(resize);
|
|
||||||
resizeObserver.observe(rootEl);
|
|
||||||
|
|
||||||
renderer.setAnimationLoop((timestamp) => {
|
|
||||||
const seconds = timestamp / 1000;
|
|
||||||
labGroup.position.y = Math.sin(seconds * 0.75) * 0.015;
|
|
||||||
if (loadState !== "ready") {
|
|
||||||
activeModel.rotation.y = seconds * 0.32;
|
|
||||||
}
|
|
||||||
controls.update();
|
|
||||||
renderer.render(scene, camera);
|
|
||||||
});
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
resizeObserver.disconnect();
|
|
||||||
renderer.setAnimationLoop(null);
|
|
||||||
controls.dispose();
|
|
||||||
disposeObject3D(activeModel);
|
|
||||||
disposeObject3D(labGroup);
|
|
||||||
renderer.dispose();
|
|
||||||
};
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="model-stage" bind:this={rootEl}>
|
|
||||||
<canvas class="model-canvas" bind:this={canvasEl} aria-label={copy.title}></canvas>
|
|
||||||
<div class="model-vignette" aria-hidden="true"></div>
|
|
||||||
<div class="model-scanlines" aria-hidden="true"></div>
|
|
||||||
|
|
||||||
<section class="model-hud" aria-label={copy.title}>
|
|
||||||
<p class="model-kicker">{copy.subtitle}</p>
|
|
||||||
<h2>{copy.title}</h2>
|
|
||||||
<div class="model-status-row">
|
|
||||||
<span class="status-light" class:is-ready={loadState === "ready"}></span>
|
|
||||||
<span>{statusText}</span>
|
|
||||||
</div>
|
|
||||||
<p class="model-path">{copy.modelPath}: {modelUrl}</p>
|
|
||||||
<p class="model-hint">{loadError || copy.hint}</p>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.model-stage {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
background:
|
|
||||||
radial-gradient(circle at 52% 62%, rgb(94 231 255 / 0.12), transparent 26%),
|
|
||||||
radial-gradient(circle at 24% 18%, rgb(166 255 122 / 0.07), transparent 24%),
|
|
||||||
linear-gradient(180deg, #03070d 0%, #07111b 48%, #02050a 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-canvas,
|
|
||||||
.model-vignette,
|
|
||||||
.model-scanlines {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
inline-size: 100%;
|
|
||||||
block-size: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-canvas {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-vignette,
|
|
||||||
.model-scanlines {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-vignette {
|
|
||||||
background:
|
|
||||||
linear-gradient(90deg, rgb(0 0 0 / 0.36), transparent 22%, transparent 78%, rgb(0 0 0 / 0.34)),
|
|
||||||
radial-gradient(circle at center, transparent 48%, rgb(0 0 0 / 0.58) 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-scanlines {
|
|
||||||
opacity: 0.32;
|
|
||||||
background:
|
|
||||||
repeating-linear-gradient(180deg, rgb(94 231 255 / 0.045) 0, rgb(94 231 255 / 0.045) 1px, transparent 1px, transparent 4px);
|
|
||||||
mix-blend-mode: screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-hud {
|
|
||||||
position: absolute;
|
|
||||||
top: clamp(1.2rem, 2.8vw, 2.2rem);
|
|
||||||
left: clamp(1.2rem, 2.8vw, 2.4rem);
|
|
||||||
z-index: 2;
|
|
||||||
display: grid;
|
|
||||||
gap: 0.42rem;
|
|
||||||
max-inline-size: min(22rem, 42vw);
|
|
||||||
padding: 0.9rem 1rem 1rem;
|
|
||||||
border: 1px solid rgb(94 231 255 / 0.24);
|
|
||||||
border-radius: 0.7rem;
|
|
||||||
background:
|
|
||||||
linear-gradient(180deg, rgb(8 18 28 / 0.82), rgb(3 9 15 / 0.72)),
|
|
||||||
radial-gradient(circle at 0 0, rgb(94 231 255 / 0.1), transparent 44%);
|
|
||||||
box-shadow:
|
|
||||||
inset 0 1px 0 rgb(255 255 255 / 0.06),
|
|
||||||
0 0 28px rgb(94 231 255 / 0.08);
|
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-kicker,
|
|
||||||
.model-path,
|
|
||||||
.model-hint {
|
|
||||||
margin: 0;
|
|
||||||
color: rgb(198 226 239 / 0.72);
|
|
||||||
font-size: 0.6rem;
|
|
||||||
letter-spacing: 0.1em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
line-height: 1.35;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
margin: 0;
|
|
||||||
color: rgb(241 251 255 / 0.96);
|
|
||||||
font-size: clamp(1.15rem, 1.1vw + 0.88rem, 1.72rem);
|
|
||||||
line-height: 1.05;
|
|
||||||
font-weight: 650;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-status-row {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.44rem;
|
|
||||||
color: rgb(229 249 255 / 0.94);
|
|
||||||
font-size: 0.78rem;
|
|
||||||
letter-spacing: 0.04em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-light {
|
|
||||||
inline-size: 0.58rem;
|
|
||||||
block-size: 0.58rem;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: rgb(255 188 92 / 0.95);
|
|
||||||
box-shadow: 0 0 0 2px rgb(255 188 92 / 0.16), 0 0 12px rgb(255 188 92 / 0.18);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-light.is-ready {
|
|
||||||
background: rgb(166 255 122 / 0.95);
|
|
||||||
box-shadow: 0 0 0 2px rgb(166 255 122 / 0.16), 0 0 14px rgb(166 255 122 / 0.22);
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-path {
|
|
||||||
color: rgb(94 231 255 / 0.78);
|
|
||||||
text-transform: none;
|
|
||||||
word-break: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
.model-hint {
|
|
||||||
color: rgb(198 226 239 / 0.66);
|
|
||||||
text-transform: none;
|
|
||||||
letter-spacing: 0.04em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 960px) {
|
|
||||||
.model-hud {
|
|
||||||
max-inline-size: min(20rem, calc(100% - 2.4rem));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -67,7 +67,6 @@
|
|||||||
const CAMERA_TARGET_Z = MATRIX_OFFSET_Z - 0.4;
|
const CAMERA_TARGET_Z = MATRIX_OFFSET_Z - 0.4;
|
||||||
const MATRIX_ROTATION_Y = 0;
|
const MATRIX_ROTATION_Y = 0;
|
||||||
const rangeStopPositions = [0, 0.25, 0.5, 0.75, 0.875, 1] as const;
|
const rangeStopPositions = [0, 0.25, 0.5, 0.75, 0.875, 1] as const;
|
||||||
const maxDisplayForce = 25.6;
|
|
||||||
|
|
||||||
const labelVector = new THREE.Vector3();
|
const labelVector = new THREE.Vector3();
|
||||||
$: resolvedColorPalette = pressureColorPalettes[colorMapPreset] ?? pressureColorPalettes.emerald;
|
$: resolvedColorPalette = pressureColorPalettes[colorMapPreset] ?? pressureColorPalettes.emerald;
|
||||||
@@ -146,10 +145,6 @@
|
|||||||
return "--";
|
return "--";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value >= maxDisplayForce) {
|
|
||||||
return `${maxDisplayForce.toFixed(1)}+`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value.toFixed(1);
|
return value.toFixed(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,6 +672,14 @@
|
|||||||
<span class="stats-key">{viewerI18n.current}</span>
|
<span class="stats-key">{viewerI18n.current}</span>
|
||||||
<strong class="stats-value">{formatForceStat(stats.current)}</strong>
|
<strong class="stats-value">{formatForceStat(stats.current)}</strong>
|
||||||
</article>
|
</article>
|
||||||
|
<article class="stats-card">
|
||||||
|
<span class="stats-key">{viewerI18n.max}</span>
|
||||||
|
<strong class="stats-value">{formatForceStat(stats.max)}</strong>
|
||||||
|
</article>
|
||||||
|
<article class="stats-card">
|
||||||
|
<span class="stats-key">{viewerI18n.min}</span>
|
||||||
|
<strong class="stats-value">{formatForceStat(stats.min)}</strong>
|
||||||
|
</article>
|
||||||
</div>
|
</div>
|
||||||
<p class="stats-note">{statsNote}</p>
|
<p class="stats-note">{statsNote}</p>
|
||||||
</section>
|
</section>
|
||||||
@@ -765,7 +768,7 @@
|
|||||||
|
|
||||||
.stats-grid {
|
.stats-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1fr);
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
gap: 0.46rem;
|
gap: 0.46rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
const viewportWidth = 100;
|
const viewportWidth = 100;
|
||||||
const viewportHeight = 36;
|
const viewportHeight = 36;
|
||||||
const maxDisplayForce = 25.6;
|
|
||||||
|
|
||||||
const toneColorMap: Record<SignalTone, string> = {
|
const toneColorMap: Record<SignalTone, string> = {
|
||||||
cyan: "62 232 255",
|
cyan: "62 232 255",
|
||||||
@@ -33,15 +32,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatMetric(value: number | null): string {
|
function formatMetric(value: number | null): string {
|
||||||
if (value === null) {
|
return value === null ? "--" : value.toFixed(1);
|
||||||
return "--";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value >= maxDisplayForce) {
|
|
||||||
return `${maxDisplayForce.toFixed(1)}+`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value.toFixed(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveBounds(seriesCollection: HudSignalPanel["series"]): { min: number; max: number } {
|
function resolveBounds(seriesCollection: HudSignalPanel["series"]): { min: number; max: number } {
|
||||||
|
|||||||
@@ -1,514 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import type { HudSpatialForce } from "$lib/types/hud";
|
|
||||||
|
|
||||||
export let spatialForce: HudSpatialForce | null = null;
|
|
||||||
export let side: "left" | "right" = "right";
|
|
||||||
export let panelIndex = 0;
|
|
||||||
export let locale: "zh-CN" | "en-US" = "zh-CN";
|
|
||||||
export let panelCode = "TAN";
|
|
||||||
export let panelTitle = "";
|
|
||||||
export let badgeLabel = "";
|
|
||||||
export let badgeTone: "cyan" | "lime" | "orange" = "cyan";
|
|
||||||
export let requireMagnitude = true;
|
|
||||||
|
|
||||||
function normalizeAngle(value: number): number {
|
|
||||||
return ((value % 360) + 360) % 360;
|
|
||||||
}
|
|
||||||
|
|
||||||
function shortestAngleDelta(from: number, to: number): number {
|
|
||||||
const delta = ((to - from + 540) % 360) - 180;
|
|
||||||
return delta === -180 ? 180 : delta;
|
|
||||||
}
|
|
||||||
|
|
||||||
const displayAngleOffsetDeg = 90;
|
|
||||||
const jumpAngleThresholdDeg = 72;
|
|
||||||
|
|
||||||
let visualAngleDeg = 0;
|
|
||||||
let previousRawAngleDeg: number | null = null;
|
|
||||||
let snapVector = false;
|
|
||||||
let snapResetFrame: number | null = null;
|
|
||||||
|
|
||||||
function setSnapVector(): void {
|
|
||||||
snapVector = true;
|
|
||||||
|
|
||||||
if (typeof window === "undefined") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (snapResetFrame !== null) {
|
|
||||||
window.cancelAnimationFrame(snapResetFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
snapResetFrame = window.requestAnimationFrame(() => {
|
|
||||||
snapVector = false;
|
|
||||||
snapResetFrame = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateVisualAngle(rawAngleDeg: number, active: boolean): void {
|
|
||||||
if (!active) {
|
|
||||||
previousRawAngleDeg = null;
|
|
||||||
visualAngleDeg = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (previousRawAngleDeg === null) {
|
|
||||||
previousRawAngleDeg = rawAngleDeg;
|
|
||||||
visualAngleDeg = rawAngleDeg;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const delta = shortestAngleDelta(previousRawAngleDeg, rawAngleDeg);
|
|
||||||
if (Math.abs(delta) < 0.001) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Math.abs(delta) >= jumpAngleThresholdDeg) {
|
|
||||||
setSnapVector();
|
|
||||||
}
|
|
||||||
|
|
||||||
visualAngleDeg += delta;
|
|
||||||
previousRawAngleDeg = rawAngleDeg;
|
|
||||||
}
|
|
||||||
|
|
||||||
$: i18n =
|
|
||||||
locale === "zh-CN"
|
|
||||||
? {
|
|
||||||
title: "三维力",
|
|
||||||
waiting: "等待数据",
|
|
||||||
angle: "ANGLE",
|
|
||||||
heading: "方向角",
|
|
||||||
strength: "强度",
|
|
||||||
confidence: "置信度"
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
title: "3D Force",
|
|
||||||
waiting: "Waiting",
|
|
||||||
angle: "ANGLE",
|
|
||||||
heading: "Heading",
|
|
||||||
strength: "Strength",
|
|
||||||
confidence: "Confidence"
|
|
||||||
};
|
|
||||||
$: resolvedTitle = panelTitle || i18n.title;
|
|
||||||
$: resolvedBadgeLabel = badgeLabel || i18n.angle;
|
|
||||||
|
|
||||||
$: hasData =
|
|
||||||
spatialForce !== null &&
|
|
||||||
Number.isFinite(spatialForce.angleDeg) &&
|
|
||||||
(!requireMagnitude || (Number.isFinite(spatialForce.magnitude) && Math.abs(spatialForce.magnitude) >= 0.0001));
|
|
||||||
$: angleDeg = hasData ? normalizeAngle((spatialForce?.angleDeg ?? 0) + displayAngleOffsetDeg) : 0;
|
|
||||||
$: updateVisualAngle(angleDeg, hasData);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<article
|
|
||||||
class="signal-panel spatial-panel side-{side}"
|
|
||||||
class:is-empty={!hasData}
|
|
||||||
aria-label={resolvedTitle}
|
|
||||||
style="--panel-index: {panelIndex};"
|
|
||||||
>
|
|
||||||
<header class="panel-head">
|
|
||||||
<div class="head-text">
|
|
||||||
<p class="panel-code">{panelCode}</p>
|
|
||||||
<p class="panel-title">{resolvedTitle}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if resolvedBadgeLabel}
|
|
||||||
<div class="icon-layer" aria-hidden="true">
|
|
||||||
<span class={`icon-chip tone-${badgeTone}`}>{resolvedBadgeLabel}</span>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="panel-body">
|
|
||||||
<div class="compass-stage">
|
|
||||||
<div class="compass-core">
|
|
||||||
<div class="compass-ring compass-ring-outer"></div>
|
|
||||||
<div class="compass-ring compass-ring-inner"></div>
|
|
||||||
<div class="compass-axis axis-horizontal"></div>
|
|
||||||
<div class="compass-axis axis-vertical"></div>
|
|
||||||
{#if hasData}
|
|
||||||
<div
|
|
||||||
class="compass-vector"
|
|
||||||
class:is-snap={snapVector}
|
|
||||||
style="transform: translateY(-50%) rotate({-visualAngleDeg}deg);"
|
|
||||||
>
|
|
||||||
<span class="vector-shaft"></span>
|
|
||||||
<span class="vector-head"></span>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div class="compass-center"></div>
|
|
||||||
<span class="compass-label label-top">0</span>
|
|
||||||
<span class="compass-label label-right">270</span>
|
|
||||||
<span class="compass-label label-bottom">180</span>
|
|
||||||
<span class="compass-label label-left">90</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
<style>
|
|
||||||
.signal-panel {
|
|
||||||
--offset-x: 12%;
|
|
||||||
--enter-ms: 1800ms;
|
|
||||||
--fade-ms: 1000ms;
|
|
||||||
overflow: hidden;
|
|
||||||
inline-size: var(--rail-width, min(100%, clamp(34rem, 44vw, 44rem)));
|
|
||||||
max-inline-size: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
flex: 0 0 var(--rail-width, auto);
|
|
||||||
justify-self: start;
|
|
||||||
display: grid;
|
|
||||||
grid-template-rows: auto 1fr auto;
|
|
||||||
gap: 0.68rem;
|
|
||||||
padding: 0.88rem 0.96rem 1rem;
|
|
||||||
border: 1px solid rgb(var(--hud-border-strong-rgb) / 0.42);
|
|
||||||
border-radius: 0.92rem;
|
|
||||||
background:
|
|
||||||
linear-gradient(160deg, rgb(var(--hud-surface-alt-rgb) / 0.76) 0%, rgb(var(--hud-surface-rgb) / 0.62) 48%, rgb(var(--hud-surface-deep-rgb) / 0.76) 100%),
|
|
||||||
radial-gradient(circle at 12% 0, rgb(var(--hud-glow-rgb) / 0.1), transparent 40%);
|
|
||||||
box-shadow:
|
|
||||||
inset 0 0 0 1px rgb(var(--hud-border-strong-rgb) / 0.08),
|
|
||||||
inset 0 -24px 32px rgb(0 0 0 / 0.48),
|
|
||||||
0 0 14px rgb(var(--hud-glow-rgb) / 0.14);
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateX(0) scale(1) rotate(0);
|
|
||||||
transition:
|
|
||||||
opacity var(--fade-ms) cubic-bezier(0.18, 0.88, 0.3, 1),
|
|
||||||
transform var(--enter-ms) cubic-bezier(0.2, 0.9, 0.28, 1),
|
|
||||||
border-color 460ms ease,
|
|
||||||
filter 760ms ease;
|
|
||||||
transition-delay: calc(var(--panel-index) * 140ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
.signal-panel.side-left {
|
|
||||||
--offset-x: -132%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signal-panel.side-right {
|
|
||||||
--offset-x: 132%;
|
|
||||||
justify-self: end;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spatial-panel.is-empty {
|
|
||||||
opacity: 0.82;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spatial-panel::after {
|
|
||||||
content: "";
|
|
||||||
display: block;
|
|
||||||
block-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spatial-panel {
|
|
||||||
margin-block-end: clamp(0.8rem, 1.8vh, 1.4rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-head {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: flex-start;
|
|
||||||
gap: 0.4rem;
|
|
||||||
margin-block-end: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.head-text {
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-code {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 0.63rem;
|
|
||||||
color: rgb(var(--hud-text-dim-rgb) / 0.88);
|
|
||||||
letter-spacing: 0.12em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-title {
|
|
||||||
margin: 0.12rem 0 0;
|
|
||||||
font-size: 1.08rem;
|
|
||||||
color: rgb(var(--hud-text-main-rgb) / 0.96);
|
|
||||||
letter-spacing: 0.05em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-layer {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
gap: 0.26rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-chip {
|
|
||||||
border: 1px solid rgb(var(--hud-border-strong-rgb) / 0.44);
|
|
||||||
border-radius: 999px;
|
|
||||||
padding: 0.08rem 0.36rem;
|
|
||||||
font-size: 0.58rem;
|
|
||||||
letter-spacing: 0.08em;
|
|
||||||
color: rgb(var(--hud-text-main-rgb) / 0.94);
|
|
||||||
background: rgb(var(--hud-surface-rgb) / 0.66);
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-chip.tone-cyan {
|
|
||||||
border-color: rgb(var(--hud-cyan-rgb) / 0.54);
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-chip.tone-lime {
|
|
||||||
border-color: rgb(var(--hud-lime-rgb) / 0.54);
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-chip.tone-orange {
|
|
||||||
border-color: rgb(var(--hud-orange-rgb) / 0.54);
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-body {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: minmax(0, 1fr);
|
|
||||||
gap: 0.72rem;
|
|
||||||
block-size: clamp(14rem, 17vw, 16.5rem);
|
|
||||||
min-block-size: 5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-stage {
|
|
||||||
position: relative;
|
|
||||||
min-block-size: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
overflow: hidden;
|
|
||||||
padding: 1.35rem 1.7rem;
|
|
||||||
border: 1px solid rgb(var(--hud-border-strong-rgb) / 0.32);
|
|
||||||
border-radius: 0.62rem;
|
|
||||||
background:
|
|
||||||
linear-gradient(180deg, rgb(var(--hud-surface-alt-rgb) / 0.68), rgb(var(--hud-surface-deep-rgb) / 0.78)),
|
|
||||||
radial-gradient(circle at 50% 0, rgb(var(--hud-glow-rgb) / 0.09), transparent 45%);
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-core {
|
|
||||||
position: relative;
|
|
||||||
inline-size: min(72%, 12.2rem, calc(100% - 3.4rem));
|
|
||||||
min-inline-size: 6.2rem;
|
|
||||||
aspect-ratio: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-ring,
|
|
||||||
.compass-axis,
|
|
||||||
.compass-center,
|
|
||||||
.compass-vector {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-ring {
|
|
||||||
border-radius: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-ring-outer {
|
|
||||||
inline-size: 100%;
|
|
||||||
block-size: 100%;
|
|
||||||
border: 1px solid rgb(var(--hud-cyan-rgb) / 0.28);
|
|
||||||
box-shadow: 0 0 18px rgb(var(--hud-glow-rgb) / 0.08);
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-ring-inner {
|
|
||||||
inline-size: 62%;
|
|
||||||
block-size: 62%;
|
|
||||||
border: 1px dashed rgb(var(--hud-border-strong-rgb) / 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-axis {
|
|
||||||
background: rgb(var(--hud-border-strong-rgb) / 0.18);
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.axis-horizontal {
|
|
||||||
inline-size: 86%;
|
|
||||||
block-size: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.axis-vertical {
|
|
||||||
inline-size: 1px;
|
|
||||||
block-size: 86%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-vector {
|
|
||||||
inline-size: 42%;
|
|
||||||
block-size: 0.9rem;
|
|
||||||
transform-origin: 0 50%;
|
|
||||||
transition: transform 220ms ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-vector.is-snap {
|
|
||||||
transition-duration: 0ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vector-shaft {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 0;
|
|
||||||
right: 0.7rem;
|
|
||||||
block-size: 2px;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
border-radius: 999px;
|
|
||||||
background: linear-gradient(90deg, rgb(var(--hud-cyan-rgb) / 0.18), rgb(var(--hud-cyan-rgb) / 0.96));
|
|
||||||
box-shadow: 0 0 14px rgb(var(--hud-cyan-rgb) / 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.vector-head {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
right: 0;
|
|
||||||
inline-size: 0;
|
|
||||||
block-size: 0;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
border-top: 0.36rem solid transparent;
|
|
||||||
border-bottom: 0.36rem solid transparent;
|
|
||||||
border-left: 0.7rem solid rgb(var(--hud-lime-rgb) / 0.96);
|
|
||||||
filter: drop-shadow(0 0 8px rgb(var(--hud-lime-rgb) / 0.24));
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-center {
|
|
||||||
inline-size: 0.56rem;
|
|
||||||
block-size: 0.56rem;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
border-radius: 50%;
|
|
||||||
background: rgb(var(--hud-text-main-rgb) / 0.92);
|
|
||||||
box-shadow: 0 0 10px rgb(var(--hud-text-main-rgb) / 0.12);
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-label {
|
|
||||||
position: absolute;
|
|
||||||
font-size: 0.58rem;
|
|
||||||
color: rgb(var(--hud-text-dim-rgb) / 0.8);
|
|
||||||
letter-spacing: 0.08em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-top {
|
|
||||||
top: 0.35rem;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-right {
|
|
||||||
top: 50%;
|
|
||||||
right: 0.42rem;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-bottom {
|
|
||||||
bottom: 0.35rem;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-left {
|
|
||||||
top: 50%;
|
|
||||||
left: 0.42rem;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-state {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: rgb(var(--hud-text-dim-rgb) / 0.76);
|
|
||||||
font-size: 0.66rem;
|
|
||||||
letter-spacing: 0.08em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
background: linear-gradient(180deg, rgb(var(--hud-surface-deep-rgb) / 0.06), rgb(var(--hud-surface-deep-rgb) / 0.18));
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 1180px) {
|
|
||||||
.signal-panel {
|
|
||||||
inline-size: var(--rail-width, min(100%, clamp(28rem, 40vw, 38rem)));
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-body {
|
|
||||||
block-size: clamp(12rem, 14.5vw, 14rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-core {
|
|
||||||
inline-size: min(64%, 10.4rem, calc(100% - 3.4rem));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-height: 900px) {
|
|
||||||
.signal-panel {
|
|
||||||
inline-size: var(--rail-width, min(100%, clamp(28rem, 38vw, 36rem)));
|
|
||||||
padding: 0.7rem 0.76rem 0.8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-body {
|
|
||||||
block-size: clamp(11.2rem, 13.5vw, 13.2rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-stage {
|
|
||||||
padding-block: 1.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-core {
|
|
||||||
inline-size: min(62%, 10rem, calc(100% - 3.4rem));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-height: 760px) {
|
|
||||||
.signal-panel {
|
|
||||||
inline-size: var(--rail-width, min(100%, clamp(24rem, 34vw, 30rem)));
|
|
||||||
padding: 0.62rem 0.68rem 0.72rem;
|
|
||||||
gap: 0.48rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-body {
|
|
||||||
block-size: clamp(9.4rem, 11vw, 10.8rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-stage {
|
|
||||||
padding: 1rem 1.45rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-core {
|
|
||||||
inline-size: min(58%, 8.2rem, calc(100% - 2.9rem));
|
|
||||||
min-inline-size: 5.6rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-height: 680px) {
|
|
||||||
.signal-panel {
|
|
||||||
inline-size: var(--rail-width, min(100%, clamp(20rem, 28vw, 26rem)));
|
|
||||||
padding: 0.52rem 0.58rem 0.6rem;
|
|
||||||
gap: 0.36rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-body {
|
|
||||||
block-size: clamp(7.6rem, 9vw, 8.8rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-stage {
|
|
||||||
padding: 0.82rem 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-core {
|
|
||||||
inline-size: min(54%, 6.4rem, calc(100% - 2.5rem));
|
|
||||||
min-inline-size: 4.8rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
.signal-panel {
|
|
||||||
inline-size: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel-body {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
block-size: auto;
|
|
||||||
min-block-size: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compass-core {
|
|
||||||
inline-size: min(58vw, 12rem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -11,26 +11,15 @@
|
|||||||
export let sessionStartedAt: number = Date.now();
|
export let sessionStartedAt: number = Date.now();
|
||||||
export let isRealtime = false;
|
export let isRealtime = false;
|
||||||
|
|
||||||
let canvasEl: HTMLCanvasElement | undefined;
|
|
||||||
let currentTimeSeconds = 0;
|
let currentTimeSeconds = 0;
|
||||||
let timerId: ReturnType<typeof setInterval> | null = null;
|
let timerId: ReturnType<typeof setInterval> | null = null;
|
||||||
let resizeObserver: ResizeObserver | null = null;
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
timerId = setInterval(() => {
|
timerId = setInterval(() => {
|
||||||
currentTimeSeconds = Math.round((Date.now() - sessionStartedAt) / 100) / 10;
|
currentTimeSeconds = Math.round((Date.now() - sessionStartedAt) / 100) / 10;
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
if (canvasEl) {
|
|
||||||
resizeObserver = new ResizeObserver(() => {
|
|
||||||
drawCanvas(canvasEl, plotPoints, yAxisTicks, xAxisTicks, sampleCount);
|
|
||||||
});
|
|
||||||
resizeObserver.observe(canvasEl);
|
|
||||||
}
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (timerId != null) clearInterval(timerId);
|
if (timerId != null) clearInterval(timerId);
|
||||||
resizeObserver?.disconnect();
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -44,8 +33,7 @@
|
|||||||
const plotInsetRight = 4;
|
const plotInsetRight = 4;
|
||||||
const plotInsetTop = 4;
|
const plotInsetTop = 4;
|
||||||
const plotInsetBottom = 9;
|
const plotInsetBottom = 9;
|
||||||
const maxDisplayForce = 25.6;
|
const fixedYBounds = { min: 0, max: 25 };
|
||||||
const fixedYBounds = { min: 0, max: maxDisplayForce };
|
|
||||||
|
|
||||||
interface CurveSample {
|
interface CurveSample {
|
||||||
x: number;
|
x: number;
|
||||||
@@ -68,6 +56,14 @@
|
|||||||
return Math.min(max, Math.max(min, value));
|
return Math.min(max, Math.max(min, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatValue(value: number | null): string {
|
||||||
|
if (value === null) {
|
||||||
|
return "--";
|
||||||
|
}
|
||||||
|
|
||||||
|
return value.toFixed(1);
|
||||||
|
}
|
||||||
|
|
||||||
function formatAxisValue(value: number, axis: "x" | "y"): string {
|
function formatAxisValue(value: number, axis: "x" | "y"): string {
|
||||||
if (!Number.isFinite(value)) {
|
if (!Number.isFinite(value)) {
|
||||||
return "--";
|
return "--";
|
||||||
@@ -229,117 +225,24 @@
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawCanvas(
|
function createLinePath(points: PlotPoint[]): string {
|
||||||
canvas: HTMLCanvasElement | undefined,
|
if (points.length === 0) {
|
||||||
points: PlotPoint[],
|
return "";
|
||||||
yTicks: AxisTick[],
|
|
||||||
xTicks: AxisTick[],
|
|
||||||
count: number
|
|
||||||
): void {
|
|
||||||
if (!canvas) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const context = canvas.getContext("2d");
|
return points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x} ${point.y}`).join(" ");
|
||||||
if (!context) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cssWidth = Math.max(1, canvas.clientWidth);
|
function createAreaPath(points: PlotPoint[]): string {
|
||||||
const cssHeight = Math.max(1, canvas.clientHeight);
|
if (points.length < 2) {
|
||||||
const dpr = typeof window === "undefined" ? 1 : window.devicePixelRatio || 1;
|
return "";
|
||||||
const targetWidth = Math.round(cssWidth * dpr);
|
|
||||||
const targetHeight = Math.round(cssHeight * dpr);
|
|
||||||
|
|
||||||
if (canvas.width !== targetWidth || canvas.height !== targetHeight) {
|
|
||||||
canvas.width = targetWidth;
|
|
||||||
canvas.height = targetHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context.setTransform(targetWidth / viewportWidth, 0, 0, targetHeight / viewportHeight, 0, 0);
|
const linePath = createLinePath(points);
|
||||||
context.clearRect(0, 0, viewportWidth, viewportHeight);
|
const firstPoint = points[0];
|
||||||
|
|
||||||
context.save();
|
|
||||||
context.lineWidth = 0.45;
|
|
||||||
context.strokeStyle = "rgb(120 180 150 / 0.16)";
|
|
||||||
for (const tick of yTicks) {
|
|
||||||
context.beginPath();
|
|
||||||
context.moveTo(plotInsetLeft, tick.plotY);
|
|
||||||
context.lineTo(viewportWidth - plotInsetRight, tick.plotY);
|
|
||||||
context.stroke();
|
|
||||||
}
|
|
||||||
context.restore();
|
|
||||||
|
|
||||||
if (points.length >= 2) {
|
|
||||||
const baselineY = viewportHeight - plotInsetBottom;
|
|
||||||
const fill = context.createLinearGradient(0, plotInsetTop, 0, baselineY);
|
|
||||||
fill.addColorStop(0, "rgb(62 232 255 / 0.28)");
|
|
||||||
fill.addColorStop(1, "rgb(62 232 255 / 0.02)");
|
|
||||||
|
|
||||||
context.save();
|
|
||||||
context.beginPath();
|
|
||||||
context.moveTo(points[0].x, points[0].y);
|
|
||||||
for (let index = 1; index < points.length; index += 1) {
|
|
||||||
context.lineTo(points[index].x, points[index].y);
|
|
||||||
}
|
|
||||||
context.lineTo(points[points.length - 1].x, baselineY);
|
|
||||||
context.lineTo(points[0].x, baselineY);
|
|
||||||
context.closePath();
|
|
||||||
context.fillStyle = fill;
|
|
||||||
context.fill();
|
|
||||||
context.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (points.length > 0) {
|
|
||||||
context.save();
|
|
||||||
context.beginPath();
|
|
||||||
context.moveTo(points[0].x, points[0].y);
|
|
||||||
for (let index = 1; index < points.length; index += 1) {
|
|
||||||
context.lineTo(points[index].x, points[index].y);
|
|
||||||
}
|
|
||||||
context.lineWidth = 1.35;
|
|
||||||
context.lineCap = "round";
|
|
||||||
context.lineJoin = "round";
|
|
||||||
context.strokeStyle = "rgb(130 232 255 / 0.96)";
|
|
||||||
context.shadowColor = "rgb(62 232 255 / 0.22)";
|
|
||||||
context.shadowBlur = 4;
|
|
||||||
context.stroke();
|
|
||||||
context.restore();
|
|
||||||
|
|
||||||
const lastPoint = points[points.length - 1];
|
const lastPoint = points[points.length - 1];
|
||||||
context.save();
|
|
||||||
context.beginPath();
|
|
||||||
context.arc(lastPoint.x, lastPoint.y, 1.7, 0, Math.PI * 2);
|
|
||||||
context.fillStyle = "rgb(73 222 128 / 0.98)";
|
|
||||||
context.shadowColor = "rgb(73 222 128 / 0.3)";
|
|
||||||
context.shadowBlur = 6;
|
|
||||||
context.fill();
|
|
||||||
context.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
context.save();
|
return `${linePath} L ${lastPoint.x} ${viewportHeight - plotInsetBottom} L ${firstPoint.x} ${viewportHeight - plotInsetBottom} Z`;
|
||||||
context.font = "600 3.2px sans-serif";
|
|
||||||
context.textBaseline = "middle";
|
|
||||||
context.shadowColor = "rgb(0 0 0 / 0.3)";
|
|
||||||
context.shadowBlur = 4;
|
|
||||||
context.fillStyle = "rgb(145 185 165 / 0.84)";
|
|
||||||
for (const tick of yTicks) {
|
|
||||||
context.textAlign = "right";
|
|
||||||
context.fillText(tick.label, tick.plotX, tick.plotY + 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.fillStyle = "rgb(180 220 200 / 0.9)";
|
|
||||||
context.textBaseline = "alphabetic";
|
|
||||||
for (let index = 0; index < xTicks.length; index += 1) {
|
|
||||||
const tick = xTicks[index];
|
|
||||||
context.textAlign = index === 0 ? "left" : index === xTicks.length - 1 ? "right" : "center";
|
|
||||||
context.fillText(tick.label, tick.plotX, tick.plotY);
|
|
||||||
}
|
|
||||||
context.restore();
|
|
||||||
|
|
||||||
if (count === 0) {
|
|
||||||
context.clearRect(0, 0, viewportWidth, viewportHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$: sourceYValues = yValues && yValues.length ? yValues : summary.points;
|
$: sourceYValues = yValues && yValues.length ? yValues : summary.points;
|
||||||
@@ -358,9 +261,14 @@
|
|||||||
$: xDataBounds = resolveDataBounds(samples.map((sample) => sample.x));
|
$: xDataBounds = resolveDataBounds(samples.map((sample) => sample.x));
|
||||||
$: yDataBounds = resolveDataBounds(samples.map((sample) => sample.y));
|
$: yDataBounds = resolveDataBounds(samples.map((sample) => sample.y));
|
||||||
$: plotPoints = convertPoints(samples, xScaleBounds, yScaleBounds);
|
$: plotPoints = convertPoints(samples, xScaleBounds, yScaleBounds);
|
||||||
|
$: linePath = createLinePath(plotPoints);
|
||||||
|
$: areaPath = createAreaPath(plotPoints);
|
||||||
|
$: lastPoint = plotPoints.length > 0 ? plotPoints[plotPoints.length - 1] : null;
|
||||||
$: yAxisTicks = sampleCount > 0 ? buildYAxisTicks(yScaleBounds, yDataBounds) : [];
|
$: yAxisTicks = sampleCount > 0 ? buildYAxisTicks(yScaleBounds, yDataBounds) : [];
|
||||||
$: xAxisTicks = sampleCount > 0 ? buildXAxisTicks(xScaleBounds) : [];
|
$: xAxisTicks = sampleCount > 0 ? buildXAxisTicks(xScaleBounds) : [];
|
||||||
$: drawCanvas(canvasEl, plotPoints, yAxisTicks, xAxisTicks, sampleCount);
|
$: latestValue = formatValue(summary.latest);
|
||||||
|
$: minValue = formatValue(summary.min);
|
||||||
|
$: maxValue = formatValue(summary.max);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<article
|
<article
|
||||||
@@ -372,12 +280,62 @@
|
|||||||
<header class="panel-head">
|
<header class="panel-head">
|
||||||
<div class="head-text">
|
<div class="head-text">
|
||||||
<p class="panel-code">RF</p>
|
<p class="panel-code">RF</p>
|
||||||
<p class="panel-title">{locale === "zh-CN" ? "合力" : "Resultant Force"}</p>
|
<p class="panel-title">{summary.label}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="icon-layer" aria-hidden="true">
|
||||||
|
<span class="icon-chip tone-cyan">NOW</span>
|
||||||
|
<span class="icon-chip tone-lime">MIN</span>
|
||||||
|
<span class="icon-chip tone-orange">MAX</span>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="chart-stage">
|
<div class="chart-stage">
|
||||||
<canvas bind:this={canvasEl} aria-label={summary.label}></canvas>
|
<svg viewBox="0 0 {viewportWidth} {viewportHeight}" preserveAspectRatio="none" role="img" aria-label={summary.label}>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="summary-fill" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||||
|
<stop offset="0%" stop-color="rgb(62 232 255 / 0.28)" />
|
||||||
|
<stop offset="100%" stop-color="rgb(62 232 255 / 0.02)" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<g class="grid-lines" aria-hidden="true">
|
||||||
|
{#each yAxisTicks as tick (`grid-${tick.value}`)}
|
||||||
|
<line x1={plotInsetLeft} y1={tick.plotY} x2={viewportWidth - plotInsetRight} y2={tick.plotY}></line>
|
||||||
|
{/each}
|
||||||
|
</g>
|
||||||
|
|
||||||
|
{#if areaPath}
|
||||||
|
<path d={areaPath} class="summary-area"></path>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if linePath}
|
||||||
|
<path d={linePath} class="summary-line"></path>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if lastPoint}
|
||||||
|
<circle cx={lastPoint.x} cy={lastPoint.y} r="1.7" class="summary-dot"></circle>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<g class="axis-labels" aria-hidden="true">
|
||||||
|
{#each yAxisTicks as tick, index (`y-${index}`)}
|
||||||
|
<text class="axis-label y-axis-label" x={tick.plotX} y={tick.plotY + 1.1} text-anchor="end">
|
||||||
|
{tick.label}
|
||||||
|
</text>
|
||||||
|
{/each}
|
||||||
|
|
||||||
|
{#each xAxisTicks as tick, index (`x-${index}`)}
|
||||||
|
<text
|
||||||
|
class="axis-label x-axis-label"
|
||||||
|
x={tick.plotX}
|
||||||
|
y={tick.plotY}
|
||||||
|
text-anchor={index === 0 ? "start" : index === xAxisTicks.length - 1 ? "end" : "middle"}
|
||||||
|
>
|
||||||
|
{tick.label}
|
||||||
|
</text>
|
||||||
|
{/each}
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
|
||||||
{#if sampleCount === 0}
|
{#if sampleCount === 0}
|
||||||
<div class="empty-state">
|
<div class="empty-state">
|
||||||
@@ -385,6 +343,24 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<footer class="panel-foot">
|
||||||
|
<p class="foot-item">
|
||||||
|
<span class="dot tone-cyan"></span>
|
||||||
|
<span class="metric-text">{i18n.now}</span>
|
||||||
|
<span class="value">{latestValue}</span>
|
||||||
|
</p>
|
||||||
|
<p class="foot-item">
|
||||||
|
<span class="dot tone-lime"></span>
|
||||||
|
<span class="metric-text">{i18n.min}</span>
|
||||||
|
<span class="value">{minValue}</span>
|
||||||
|
</p>
|
||||||
|
<p class="foot-item">
|
||||||
|
<span class="dot tone-orange"></span>
|
||||||
|
<span class="metric-text">{i18n.max}</span>
|
||||||
|
<span class="value">{maxValue}</span>
|
||||||
|
</p>
|
||||||
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -393,13 +369,10 @@
|
|||||||
--enter-ms: 1800ms;
|
--enter-ms: 1800ms;
|
||||||
--fade-ms: 1000ms;
|
--fade-ms: 1000ms;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
inline-size: var(--rail-width, min(100%, clamp(34rem, 44vw, 44rem)));
|
inline-size: min(100%, clamp(34rem, 44vw, 44rem));
|
||||||
max-inline-size: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
flex: 0 0 var(--rail-width, auto);
|
|
||||||
justify-self: start;
|
justify-self: start;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: auto 1fr;
|
grid-template-rows: auto 1fr auto;
|
||||||
gap: 0.68rem;
|
gap: 0.68rem;
|
||||||
padding: 0.88rem 0.96rem 1rem;
|
padding: 0.88rem 0.96rem 1rem;
|
||||||
border: 1px solid rgb(var(--hud-border-strong-rgb) / 0.42);
|
border: 1px solid rgb(var(--hud-border-strong-rgb) / 0.42);
|
||||||
@@ -465,6 +438,36 @@
|
|||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-layer {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.26rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-chip {
|
||||||
|
border: 1px solid rgb(var(--hud-border-strong-rgb) / 0.44);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.08rem 0.36rem;
|
||||||
|
font-size: 0.58rem;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
color: rgb(var(--hud-text-main-rgb) / 0.94);
|
||||||
|
background: rgb(var(--hud-surface-rgb) / 0.66);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-chip.tone-cyan {
|
||||||
|
border-color: rgb(var(--hud-cyan-rgb) / 0.54);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-chip.tone-lime {
|
||||||
|
border-color: rgb(var(--hud-lime-rgb) / 0.56);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-chip.tone-orange {
|
||||||
|
border-color: rgb(var(--hud-orange-rgb) / 0.58);
|
||||||
|
}
|
||||||
|
|
||||||
.chart-stage {
|
.chart-stage {
|
||||||
position: relative;
|
position: relative;
|
||||||
block-size: clamp(12rem, 15.5vw, 15rem);
|
block-size: clamp(12rem, 15.5vw, 15rem);
|
||||||
@@ -477,12 +480,53 @@
|
|||||||
radial-gradient(circle at 50% 0, rgb(var(--hud-glow-rgb) / 0.09), transparent 45%);
|
radial-gradient(circle at 50% 0, rgb(var(--hud-glow-rgb) / 0.09), transparent 45%);
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas {
|
svg {
|
||||||
display: block;
|
display: block;
|
||||||
inline-size: 100%;
|
inline-size: 100%;
|
||||||
block-size: 100%;
|
block-size: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grid-lines line {
|
||||||
|
stroke: rgb(var(--hud-border-strong-rgb) / 0.16);
|
||||||
|
stroke-width: 0.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-area {
|
||||||
|
fill: url(#summary-fill);
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-line {
|
||||||
|
fill: none;
|
||||||
|
stroke: rgb(var(--hud-cyan-rgb) / 0.96);
|
||||||
|
stroke-width: 1.35;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
filter: drop-shadow(0 0 4px rgb(var(--hud-cyan-rgb) / 0.22));
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-dot {
|
||||||
|
fill: rgb(var(--hud-lime-rgb) / 0.98);
|
||||||
|
filter: drop-shadow(0 0 6px rgb(var(--hud-lime-rgb) / 0.3));
|
||||||
|
}
|
||||||
|
|
||||||
|
.axis-label {
|
||||||
|
fill: rgb(var(--hud-text-main-rgb) / 0.88);
|
||||||
|
font-size: 3.2px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
text-shadow:
|
||||||
|
0 1px 0 rgb(0 0 0 / 0.46),
|
||||||
|
0 0 4px rgb(0 0 0 / 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.y-axis-label {
|
||||||
|
fill: rgb(var(--hud-text-dim-rgb) / 0.84);
|
||||||
|
}
|
||||||
|
|
||||||
|
.x-axis-label {
|
||||||
|
fill: rgb(var(--hud-text-dim-rgb) / 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
@@ -496,9 +540,58 @@
|
|||||||
background: linear-gradient(180deg, rgb(var(--hud-surface-deep-rgb) / 0.06), rgb(var(--hud-surface-deep-rgb) / 0.18));
|
background: linear-gradient(180deg, rgb(var(--hud-surface-deep-rgb) / 0.06), rgb(var(--hud-surface-deep-rgb) / 0.18));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.panel-foot {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
gap: 0.8rem;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.foot-item {
|
||||||
|
margin: 0;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.22rem;
|
||||||
|
color: rgb(var(--hud-text-main-rgb) / 0.9);
|
||||||
|
font-size: 0.68rem;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-text {
|
||||||
|
color: rgb(var(--hud-text-dim-rgb) / 0.82);
|
||||||
|
text-transform: uppercase;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
inline-size: 0.34rem;
|
||||||
|
block-size: 0.34rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot.tone-cyan {
|
||||||
|
background: rgb(var(--hud-cyan-rgb));
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot.tone-lime {
|
||||||
|
background: rgb(var(--hud-lime-rgb));
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot.tone-orange {
|
||||||
|
background: rgb(var(--hud-orange-rgb));
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
min-inline-size: 2.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 1180px) {
|
@media (max-width: 1180px) {
|
||||||
.signal-panel {
|
.signal-panel {
|
||||||
inline-size: var(--rail-width, min(100%, clamp(28rem, 40vw, 38rem)));
|
inline-size: min(100%, clamp(28rem, 40vw, 38rem));
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart-stage {
|
.chart-stage {
|
||||||
@@ -508,7 +601,7 @@
|
|||||||
|
|
||||||
@media (max-height: 900px) {
|
@media (max-height: 900px) {
|
||||||
.signal-panel {
|
.signal-panel {
|
||||||
inline-size: var(--rail-width, min(100%, clamp(28rem, 38vw, 36rem)));
|
inline-size: min(100%, clamp(28rem, 38vw, 36rem));
|
||||||
padding: 0.7rem 0.76rem 0.8rem;
|
padding: 0.7rem 0.76rem 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,7 +612,7 @@
|
|||||||
|
|
||||||
@media (max-height: 760px) {
|
@media (max-height: 760px) {
|
||||||
.signal-panel {
|
.signal-panel {
|
||||||
inline-size: var(--rail-width, min(100%, clamp(24rem, 34vw, 30rem)));
|
inline-size: min(100%, clamp(24rem, 34vw, 30rem));
|
||||||
padding: 0.62rem 0.68rem 0.72rem;
|
padding: 0.62rem 0.68rem 0.72rem;
|
||||||
gap: 0.48rem;
|
gap: 0.48rem;
|
||||||
}
|
}
|
||||||
@@ -531,7 +624,7 @@
|
|||||||
|
|
||||||
@media (max-height: 680px) {
|
@media (max-height: 680px) {
|
||||||
.signal-panel {
|
.signal-panel {
|
||||||
inline-size: var(--rail-width, min(100%, clamp(20rem, 28vw, 26rem)));
|
inline-size: min(100%, clamp(20rem, 28vw, 26rem));
|
||||||
padding: 0.52rem 0.58rem 0.6rem;
|
padding: 0.52rem 0.58rem 0.6rem;
|
||||||
gap: 0.36rem;
|
gap: 0.36rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ export type LocaleCode = "zh-CN" | "en-US";
|
|||||||
export type WindowControlAction = "minimize" | "toggle-maximize" | "close";
|
export type WindowControlAction = "minimize" | "toggle-maximize" | "close";
|
||||||
|
|
||||||
export type ConnectionState = "online" | "connecting" | "offline";
|
export type ConnectionState = "online" | "connecting" | "offline";
|
||||||
export type StageViewMode = "webgl" | "model3d";
|
|
||||||
|
|
||||||
export type StageStatusTone = "ok" | "warn" | "idle";
|
export type StageStatusTone = "ok" | "warn" | "idle";
|
||||||
export type HudNoticeTone = "ok" | "warn" | "info";
|
export type HudNoticeTone = "ok" | "warn" | "info";
|
||||||
@@ -14,6 +13,8 @@ export type MatrixDisplayMode = "numeric" | "dots";
|
|||||||
|
|
||||||
export type SignalPanelSide = "left" | "right";
|
export type SignalPanelSide = "left" | "right";
|
||||||
|
|
||||||
|
export type HudConfigTone = "neutral" | "cyan" | "lime" | "orange";
|
||||||
|
|
||||||
export interface HudSignalSeries {
|
export interface HudSignalSeries {
|
||||||
id: string;
|
id: string;
|
||||||
tone: SignalTone;
|
tone: SignalTone;
|
||||||
@@ -39,18 +40,11 @@ export interface HudSignalPanel {
|
|||||||
max: number | null;
|
max: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HudSpatialForce {
|
|
||||||
angleDeg: number;
|
|
||||||
magnitude: number;
|
|
||||||
confidence: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HudPacket {
|
export interface HudPacket {
|
||||||
ts: number;
|
ts: number;
|
||||||
panels: HudSignalPanel[];
|
panels: HudSignalPanel[];
|
||||||
summary: HudSummary;
|
summary: HudSummary;
|
||||||
pressureMatrix: number[] | null;
|
pressureMatrix: number[] | null;
|
||||||
spatialForce: HudSpatialForce | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HudSummary {
|
export interface HudSummary {
|
||||||
@@ -62,6 +56,13 @@ export interface HudSummary {
|
|||||||
max: number | null;
|
max: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface HudConfigLink {
|
||||||
|
id: string;
|
||||||
|
label: string;
|
||||||
|
tone?: HudConfigTone;
|
||||||
|
active?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface HudColorMapOption {
|
export interface HudColorMapOption {
|
||||||
id: PressureColorMapPreset;
|
id: PressureColorMapPreset;
|
||||||
label: string;
|
label: string;
|
||||||
@@ -85,9 +86,6 @@ export interface HudCopy {
|
|||||||
matrixViewLabel: string;
|
matrixViewLabel: string;
|
||||||
matrixViewNumericLabel: string;
|
matrixViewNumericLabel: string;
|
||||||
matrixViewDotsLabel: string;
|
matrixViewDotsLabel: string;
|
||||||
stageModeLabel: string;
|
|
||||||
stageModeWebglLabel: string;
|
|
||||||
stageModeModelLabel: string;
|
|
||||||
resetConfigLabel: string;
|
resetConfigLabel: string;
|
||||||
applyLiveHint: string;
|
applyLiveHint: string;
|
||||||
runtimeReady: string;
|
runtimeReady: string;
|
||||||
@@ -98,6 +96,7 @@ export interface HudCopy {
|
|||||||
deviceLabel: string;
|
deviceLabel: string;
|
||||||
sampleRateLabel: string;
|
sampleRateLabel: string;
|
||||||
channelsLabel: string;
|
channelsLabel: string;
|
||||||
|
configLinksLabel: string;
|
||||||
refreshPortsLabel: string;
|
refreshPortsLabel: string;
|
||||||
connectActionLabel: string;
|
connectActionLabel: string;
|
||||||
disconnectActionLabel: string;
|
disconnectActionLabel: string;
|
||||||
@@ -159,7 +158,6 @@ export interface SerialRecordStateResult {
|
|||||||
export interface SerialImportFrameResult {
|
export interface SerialImportFrameResult {
|
||||||
data: number[];
|
data: number[];
|
||||||
dtsMs: number;
|
dtsMs: number;
|
||||||
spatialForce: HudSpatialForce | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SerialImportResult {
|
export interface SerialImportResult {
|
||||||
|
|||||||
@@ -19,20 +19,20 @@
|
|||||||
FileExplorerRoot,
|
FileExplorerRoot,
|
||||||
HudColorMapOption,
|
HudColorMapOption,
|
||||||
HudCopy,
|
HudCopy,
|
||||||
|
HudConfigLink,
|
||||||
HudNoticeTone,
|
HudNoticeTone,
|
||||||
HudPacket,
|
HudPacket,
|
||||||
HudSpatialForce,
|
|
||||||
PressureColorMapPreset,
|
PressureColorMapPreset,
|
||||||
HudSignalPanel,
|
HudSignalPanel,
|
||||||
HudSignalSeries,
|
HudSignalSeries,
|
||||||
HudSummary,
|
HudSummary,
|
||||||
LocaleCode,
|
LocaleCode,
|
||||||
|
MatrixDisplayMode,
|
||||||
SerialConnectResult,
|
SerialConnectResult,
|
||||||
SerialExportResult,
|
SerialExportResult,
|
||||||
SerialRecordStateResult,
|
SerialRecordStateResult,
|
||||||
SerialImportResult,
|
SerialImportResult,
|
||||||
SignalTone,
|
SignalTone,
|
||||||
StageViewMode,
|
|
||||||
WindowControlAction
|
WindowControlAction
|
||||||
} from "$lib/types/hud";
|
} from "$lib/types/hud";
|
||||||
|
|
||||||
@@ -42,28 +42,6 @@
|
|||||||
interface ReplayFrame {
|
interface ReplayFrame {
|
||||||
values: number[];
|
values: number[];
|
||||||
dtsMs: number;
|
dtsMs: number;
|
||||||
spatialForce?: HudSpatialForce | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DevKitPztAngleEvent {
|
|
||||||
seq: number;
|
|
||||||
timestampMs: number;
|
|
||||||
dtsMs: number;
|
|
||||||
angle: number;
|
|
||||||
magnitude: number;
|
|
||||||
state: number;
|
|
||||||
copX: number;
|
|
||||||
copY: number;
|
|
||||||
baseX: number;
|
|
||||||
baseY: number;
|
|
||||||
totalPress: number;
|
|
||||||
threshold: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DevKitReplayFramePushResult {
|
|
||||||
seq: number;
|
|
||||||
timestampMs: number;
|
|
||||||
dtsMs: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const copyByLocale: Record<LocaleCode, HudCopy> = {
|
const copyByLocale: Record<LocaleCode, HudCopy> = {
|
||||||
@@ -82,11 +60,8 @@
|
|||||||
rangeMaxLabel: "最大值",
|
rangeMaxLabel: "最大值",
|
||||||
colorMapLabel: "映射颜色",
|
colorMapLabel: "映射颜色",
|
||||||
matrixViewLabel: "矩阵模式",
|
matrixViewLabel: "矩阵模式",
|
||||||
matrixViewNumericLabel: "数字模式",
|
matrixViewNumericLabel: "数字矩阵",
|
||||||
matrixViewDotsLabel: "点矩阵",
|
matrixViewDotsLabel: "点矩阵",
|
||||||
stageModeLabel: "渲染模式",
|
|
||||||
stageModeWebglLabel: "WebGL",
|
|
||||||
stageModeModelLabel: "3D 模型",
|
|
||||||
resetConfigLabel: "恢复默认",
|
resetConfigLabel: "恢复默认",
|
||||||
applyLiveHint: "实时生效 / 矩阵尺寸变更将重建 viewer",
|
applyLiveHint: "实时生效 / 矩阵尺寸变更将重建 viewer",
|
||||||
runtimeReady: "WEBGL2 READY",
|
runtimeReady: "WEBGL2 READY",
|
||||||
@@ -97,6 +72,7 @@
|
|||||||
deviceLabel: "设备",
|
deviceLabel: "设备",
|
||||||
sampleRateLabel: "采样率",
|
sampleRateLabel: "采样率",
|
||||||
channelsLabel: "通道",
|
channelsLabel: "通道",
|
||||||
|
configLinksLabel: "配置链接",
|
||||||
refreshPortsLabel: "刷新",
|
refreshPortsLabel: "刷新",
|
||||||
connectActionLabel: "连接",
|
connectActionLabel: "连接",
|
||||||
disconnectActionLabel: "断开",
|
disconnectActionLabel: "断开",
|
||||||
@@ -145,9 +121,6 @@
|
|||||||
matrixViewLabel: "Matrix Mode",
|
matrixViewLabel: "Matrix Mode",
|
||||||
matrixViewNumericLabel: "Numeric",
|
matrixViewNumericLabel: "Numeric",
|
||||||
matrixViewDotsLabel: "Dots",
|
matrixViewDotsLabel: "Dots",
|
||||||
stageModeLabel: "Render Mode",
|
|
||||||
stageModeWebglLabel: "WebGL",
|
|
||||||
stageModeModelLabel: "3D Model",
|
|
||||||
resetConfigLabel: "Reset",
|
resetConfigLabel: "Reset",
|
||||||
applyLiveHint: "Live apply / size changes recreate the viewer",
|
applyLiveHint: "Live apply / size changes recreate the viewer",
|
||||||
runtimeReady: "WEBGL2 READY",
|
runtimeReady: "WEBGL2 READY",
|
||||||
@@ -158,6 +131,7 @@
|
|||||||
deviceLabel: "Device",
|
deviceLabel: "Device",
|
||||||
sampleRateLabel: "Sample Rate",
|
sampleRateLabel: "Sample Rate",
|
||||||
channelsLabel: "Channels",
|
channelsLabel: "Channels",
|
||||||
|
configLinksLabel: "Config Links",
|
||||||
refreshPortsLabel: "Refresh",
|
refreshPortsLabel: "Refresh",
|
||||||
connectActionLabel: "Connect",
|
connectActionLabel: "Connect",
|
||||||
disconnectActionLabel: "Disconnect",
|
disconnectActionLabel: "Disconnect",
|
||||||
@@ -194,9 +168,6 @@
|
|||||||
const pointsPerSeries = 28;
|
const pointsPerSeries = 28;
|
||||||
const summaryPointsPerSeries = 42;
|
const summaryPointsPerSeries = 42;
|
||||||
const signalRenderTickMs = 1200;
|
const signalRenderTickMs = 1200;
|
||||||
const summaryReleaseForceEpsilon = 0.1;
|
|
||||||
const releaseClearDelayMs = 5000;
|
|
||||||
const spatialForceMagnitudeEpsilon = 0.0001;
|
|
||||||
const replayDefaultFrameMs = 40;
|
const replayDefaultFrameMs = 40;
|
||||||
const showSignalPanels = false;
|
const showSignalPanels = false;
|
||||||
const mockToneCycle: SignalTone[] = ["cyan", "lime", "orange", "violet", "gold", "rose"];
|
const mockToneCycle: SignalTone[] = ["cyan", "lime", "orange", "violet", "gold", "rose"];
|
||||||
@@ -243,18 +214,19 @@
|
|||||||
let sampleRateValue = "100Hz";
|
let sampleRateValue = "100Hz";
|
||||||
let channelsValue = "84";
|
let channelsValue = "84";
|
||||||
let isWindowMaximized = false;
|
let isWindowMaximized = false;
|
||||||
|
let activeConfigLinkId = "stream-on";
|
||||||
|
let isConfigPanelOpen = false;
|
||||||
|
let isPrecisionTestOpen = false;
|
||||||
let hasSignalData = false;
|
let hasSignalData = false;
|
||||||
let signalPanels: HudSignalPanel[] = buildInactivePanels();
|
let signalPanels: HudSignalPanel[] = buildInactivePanels();
|
||||||
let summary: HudSummary = buildEmptySummary();
|
let summary: HudSummary = buildEmptySummary();
|
||||||
let pressureMatrix: number[] | null = null;
|
let pressureMatrix: number[] | null = null;
|
||||||
let spatialForce: HudSpatialForce | null = null;
|
|
||||||
let devkitSpatialForce: HudSpatialForce | null = null;
|
|
||||||
let matrixRows = 12;
|
let matrixRows = 12;
|
||||||
let matrixCols = 7;
|
let matrixCols = 7;
|
||||||
let rangeMin = DEFAULT_PRESSURE_RANGE_MIN;
|
let rangeMin = DEFAULT_PRESSURE_RANGE_MIN;
|
||||||
let rangeMax = DEFAULT_PRESSURE_RANGE_MAX;
|
let rangeMax = DEFAULT_PRESSURE_RANGE_MAX;
|
||||||
let colorMapPreset: PressureColorMapPreset = "emerald";
|
let colorMapPreset: PressureColorMapPreset = "emerald";
|
||||||
let stageViewMode: StageViewMode = "webgl";
|
let matrixDisplayMode: MatrixDisplayMode = "dots";
|
||||||
let replayFrames: ReplayFrame[] = [];
|
let replayFrames: ReplayFrame[] = [];
|
||||||
let replayCurrentIndex = 0;
|
let replayCurrentIndex = 0;
|
||||||
let replayHasDisplayedFrame = false;
|
let replayHasDisplayedFrame = false;
|
||||||
@@ -263,8 +235,6 @@
|
|||||||
let replayProgress = 0;
|
let replayProgress = 0;
|
||||||
let replayFileName = "";
|
let replayFileName = "";
|
||||||
let replayTimerId: number | null = null;
|
let replayTimerId: number | null = null;
|
||||||
let replayPendingDevkitSeq: number | null = null;
|
|
||||||
let replayDevkitSeqCounter = 0;
|
|
||||||
let fileExplorerOpen = false;
|
let fileExplorerOpen = false;
|
||||||
let fileExplorerMode: FileExplorerMode = "open";
|
let fileExplorerMode: FileExplorerMode = "open";
|
||||||
let fileExplorerBusy = false;
|
let fileExplorerBusy = false;
|
||||||
@@ -290,15 +260,17 @@
|
|||||||
rowsKept: number;
|
rowsKept: number;
|
||||||
} | null = null;
|
} | null = null;
|
||||||
let devkitStatusTimer: number | null = null;
|
let devkitStatusTimer: number | null = null;
|
||||||
let devkitSpatialForceClearTimer: number | null = null;
|
|
||||||
let summaryClearTimer: number | null = null;
|
|
||||||
let spatialForceClearTimer: number | null = null;
|
|
||||||
let summaryReleaseHidden = true;
|
|
||||||
let spatialForceReleaseHidden = false;
|
|
||||||
let spatialForcePanelVisible = false;
|
|
||||||
let sessionStartedAt: number = Date.now();
|
let sessionStartedAt: number = Date.now();
|
||||||
|
|
||||||
$: uiCopy = copyByLocale[locale];
|
$: uiCopy = copyByLocale[locale];
|
||||||
|
$: configLinks = buildConfigLinks(
|
||||||
|
locale,
|
||||||
|
activeConfigLinkId,
|
||||||
|
isConfigPanelOpen,
|
||||||
|
isPrecisionTestOpen,
|
||||||
|
devkitEnabled,
|
||||||
|
isDevKitConfigOpen
|
||||||
|
);
|
||||||
$: leftSignalPanels = signalPanels.filter((panel) => panel.side === "left");
|
$: leftSignalPanels = signalPanels.filter((panel) => panel.side === "left");
|
||||||
$: rightSignalPanels = signalPanels.filter((panel) => panel.side === "right");
|
$: rightSignalPanels = signalPanels.filter((panel) => panel.side === "right");
|
||||||
$: rangeTicks = buildRangeTicks(rangeMin, rangeMax);
|
$: rangeTicks = buildRangeTicks(rangeMin, rangeMax);
|
||||||
@@ -306,7 +278,6 @@
|
|||||||
$: rangeScaleStyle = buildRangeScaleStyle(colorMapPreset);
|
$: rangeScaleStyle = buildRangeScaleStyle(colorMapPreset);
|
||||||
$: replayHasData = replayFrames.length > 0;
|
$: replayHasData = replayFrames.length > 0;
|
||||||
$: replayFrameInfo = replayHasData ? `${replayHasDisplayedFrame ? replayCurrentIndex + 1 : 0}/${replayFrames.length}` : "";
|
$: replayFrameInfo = replayHasData ? `${replayHasDisplayedFrame ? replayCurrentIndex + 1 : 0}/${replayFrames.length}` : "";
|
||||||
$: summaryReleasePending = summaryClearTimer != null;
|
|
||||||
$: fileExplorerTitle =
|
$: fileExplorerTitle =
|
||||||
fileExplorerMode === "open" ? uiCopy.fileExplorerImportTitle : uiCopy.fileExplorerExportTitle;
|
fileExplorerMode === "open" ? uiCopy.fileExplorerImportTitle : uiCopy.fileExplorerExportTitle;
|
||||||
$: fileExplorerConfirmLabel =
|
$: fileExplorerConfirmLabel =
|
||||||
@@ -316,83 +287,6 @@
|
|||||||
return typeof window !== "undefined" && "__TAURI_INTERNALS__" in window;
|
return typeof window !== "undefined" && "__TAURI_INTERNALS__" in window;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearDevkitSpatialForce(): void {
|
|
||||||
devkitSpatialForce = null;
|
|
||||||
if (devkitSpatialForceClearTimer != null && typeof window !== "undefined") {
|
|
||||||
window.clearTimeout(devkitSpatialForceClearTimer);
|
|
||||||
devkitSpatialForceClearTimer = null;
|
|
||||||
}
|
|
||||||
hasSignalData =
|
|
||||||
signalPanels.length > 0 ||
|
|
||||||
summary.points.length > 0 ||
|
|
||||||
spatialForce !== null ||
|
|
||||||
spatialForcePanelVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
function scheduleDevkitSpatialForceClear(): void {
|
|
||||||
if (typeof window === "undefined") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (devkitSpatialForceClearTimer != null) {
|
|
||||||
window.clearTimeout(devkitSpatialForceClearTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
devkitSpatialForceClearTimer = window.setTimeout(() => {
|
|
||||||
devkitSpatialForce = null;
|
|
||||||
devkitSpatialForceClearTimer = null;
|
|
||||||
hasSignalData = signalPanels.length > 0 || summary.points.length > 0 || spatialForce !== null;
|
|
||||||
}, 420);
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelSummaryClear(): void {
|
|
||||||
if (summaryClearTimer != null && typeof window !== "undefined") {
|
|
||||||
window.clearTimeout(summaryClearTimer);
|
|
||||||
}
|
|
||||||
summaryClearTimer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function scheduleSummaryClear(): void {
|
|
||||||
if (typeof window === "undefined" || summary.points.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (summaryClearTimer != null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
summaryClearTimer = window.setTimeout(() => {
|
|
||||||
summary = buildEmptySummary();
|
|
||||||
summaryClearTimer = null;
|
|
||||||
summaryReleaseHidden = true;
|
|
||||||
hasSignalData = signalPanels.length > 0 || spatialForce !== null || spatialForcePanelVisible;
|
|
||||||
}, releaseClearDelayMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelSpatialForceClear(): void {
|
|
||||||
if (spatialForceClearTimer != null && typeof window !== "undefined") {
|
|
||||||
window.clearTimeout(spatialForceClearTimer);
|
|
||||||
}
|
|
||||||
spatialForceClearTimer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function scheduleSpatialForceClear(): void {
|
|
||||||
if (typeof window === "undefined" || !spatialForcePanelVisible) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (spatialForceClearTimer != null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
spatialForceClearTimer = window.setTimeout(() => {
|
|
||||||
spatialForceClearTimer = null;
|
|
||||||
spatialForceReleaseHidden = true;
|
|
||||||
spatialForcePanelVisible = false;
|
|
||||||
hasSignalData = signalPanels.length > 0 || summary.points.length > 0 || spatialForce !== null;
|
|
||||||
}, releaseClearDelayMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
function clamp(value: number, min: number, max: number): number {
|
function clamp(value: number, min: number, max: number): number {
|
||||||
return Math.min(max, Math.max(min, value));
|
return Math.min(max, Math.max(min, value));
|
||||||
}
|
}
|
||||||
@@ -745,8 +639,7 @@
|
|||||||
});
|
});
|
||||||
frames = result.frames.map((frame) => ({
|
frames = result.frames.map((frame) => ({
|
||||||
values: frame.data,
|
values: frame.data,
|
||||||
dtsMs: frame.dtsMs,
|
dtsMs: frame.dtsMs
|
||||||
spatialForce: frame.spatialForce
|
|
||||||
}));
|
}));
|
||||||
importedFrameCount = result.frameCount;
|
importedFrameCount = result.frameCount;
|
||||||
importedChannelCount = result.channelCount;
|
importedChannelCount = result.channelCount;
|
||||||
@@ -776,8 +669,7 @@
|
|||||||
|
|
||||||
const frames = result.frames.map((frame) => ({
|
const frames = result.frames.map((frame) => ({
|
||||||
values: frame.data,
|
values: frame.data,
|
||||||
dtsMs: frame.dtsMs,
|
dtsMs: frame.dtsMs
|
||||||
spatialForce: frame.spatialForce
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
applyImportedFrames(result.fileName, frames, result.frameCount, result.channelCount);
|
applyImportedFrames(result.fileName, frames, result.frameCount, result.channelCount);
|
||||||
@@ -798,43 +690,6 @@
|
|||||||
replayTimerId = null;
|
replayTimerId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildReplayDevkitSeq(frameIndex: number): number {
|
|
||||||
replayDevkitSeqCounter = (replayDevkitSeqCounter + 1) % 1000;
|
|
||||||
return Date.now() * 1000 + replayDevkitSeqCounter + frameIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
function canPushReplayFrameToDevkit(frame: ReplayFrame): boolean {
|
|
||||||
return (
|
|
||||||
isTauriRuntime() &&
|
|
||||||
devkitEnabled &&
|
|
||||||
devkitRunning &&
|
|
||||||
frame.values.length === 84
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pushReplayFrameToDevkit(frame: ReplayFrame, frameIndex: number): void {
|
|
||||||
if (!canPushReplayFrameToDevkit(frame)) {
|
|
||||||
replayPendingDevkitSeq = null;
|
|
||||||
clearDevkitSpatialForce();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const seq = buildReplayDevkitSeq(frameIndex);
|
|
||||||
replayPendingDevkitSeq = seq;
|
|
||||||
clearDevkitSpatialForce();
|
|
||||||
|
|
||||||
void invoke<DevKitReplayFramePushResult>("devkit_push_replay_frame", {
|
|
||||||
values: frame.values.map((value) => Math.max(0, Math.round(Number(value) || 0))),
|
|
||||||
dtsMs: clamp(Math.round(frame.dtsMs), 0, 4_294_967_295),
|
|
||||||
seq
|
|
||||||
}).catch((error) => {
|
|
||||||
if (replayPendingDevkitSeq === seq) {
|
|
||||||
replayPendingDevkitSeq = null;
|
|
||||||
}
|
|
||||||
console.error("Failed to push replay frame to DevKit:", error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function frameValuesToMatrix(values: number[]): number[] {
|
function frameValuesToMatrix(values: number[]): number[] {
|
||||||
const totalCells = Math.max(matrixRows * matrixCols, 1);
|
const totalCells = Math.max(matrixRows * matrixCols, 1);
|
||||||
const matrix = new Array<number>(totalCells).fill(0);
|
const matrix = new Array<number>(totalCells).fill(0);
|
||||||
@@ -853,14 +708,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetReplayVisualState(): void {
|
function resetReplayVisualState(): void {
|
||||||
cancelSummaryClear();
|
|
||||||
cancelSpatialForceClear();
|
|
||||||
spatialForceReleaseHidden = false;
|
|
||||||
spatialForcePanelVisible = false;
|
|
||||||
pressureMatrix = buildZeroMatrix();
|
pressureMatrix = buildZeroMatrix();
|
||||||
spatialForce = null;
|
|
||||||
replayPendingDevkitSeq = null;
|
|
||||||
clearDevkitSpatialForce();
|
|
||||||
signalPanels = buildInactivePanels();
|
signalPanels = buildInactivePanels();
|
||||||
summary = buildEmptySummary();
|
summary = buildEmptySummary();
|
||||||
hasSignalData = false;
|
hasSignalData = false;
|
||||||
@@ -895,14 +743,7 @@
|
|||||||
replayCurrentIndex = safeIndex;
|
replayCurrentIndex = safeIndex;
|
||||||
replayHasDisplayedFrame = true;
|
replayHasDisplayedFrame = true;
|
||||||
replayProgress = replayFrames.length > 1 ? safeIndex / (replayFrames.length - 1) : 1;
|
replayProgress = replayFrames.length > 1 ? safeIndex / (replayFrames.length - 1) : 1;
|
||||||
const frame = replayFrames[safeIndex];
|
pressureMatrix = frameValuesToMatrix(replayFrames[safeIndex].values);
|
||||||
cancelSummaryClear();
|
|
||||||
cancelSpatialForceClear();
|
|
||||||
spatialForceReleaseHidden = false;
|
|
||||||
pressureMatrix = frameValuesToMatrix(frame.values);
|
|
||||||
spatialForce = frame.spatialForce ?? null;
|
|
||||||
spatialForcePanelVisible = spatialForce !== null;
|
|
||||||
pushReplayFrameToDevkit(frame, safeIndex);
|
|
||||||
signalPanels = buildInactivePanels();
|
signalPanels = buildInactivePanels();
|
||||||
summary = buildReplaySummaryAt(safeIndex);
|
summary = buildReplaySummaryAt(safeIndex);
|
||||||
hasSignalData = true;
|
hasSignalData = true;
|
||||||
@@ -1071,99 +912,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isZeroLikeValue(value: number): boolean {
|
function isZeroLikeValue(value: number): boolean {
|
||||||
return !Number.isFinite(value) || Math.abs(value) <= summaryReleaseForceEpsilon;
|
return !Number.isFinite(value) || Math.abs(value) < 0.0001;
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldHideSummary(points: number[]): boolean {
|
function shouldHideSummary(points: number[]): boolean {
|
||||||
return points.length === 0 || points.every((value) => isZeroLikeValue(value));
|
return points.length === 0 || points.every((value) => isZeroLikeValue(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
function latestSummaryValue(summaryValue: HudSummary): number | null {
|
|
||||||
if (Number.isFinite(summaryValue.latest)) {
|
|
||||||
return summaryValue.latest;
|
|
||||||
}
|
|
||||||
|
|
||||||
const latestPoint = summaryValue.points[summaryValue.points.length - 1];
|
|
||||||
return Number.isFinite(latestPoint) ? latestPoint : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function hasActiveSummary(summaryValue: HudSummary): boolean {
|
|
||||||
const latest = latestSummaryValue(summaryValue);
|
|
||||||
return latest !== null && !isZeroLikeValue(latest);
|
|
||||||
}
|
|
||||||
|
|
||||||
function hasActiveSpatialForce(spatialForceValue: HudSpatialForce | null): boolean {
|
|
||||||
return (
|
|
||||||
spatialForceValue !== null &&
|
|
||||||
Number.isFinite(spatialForceValue.angleDeg) &&
|
|
||||||
Number.isFinite(spatialForceValue.magnitude) &&
|
|
||||||
Math.abs(spatialForceValue.magnitude) > spatialForceMagnitudeEpsilon
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildPacketSummary(summaryValue: HudSummary): HudSummary {
|
|
||||||
const nowSeconds = Math.round((Date.now() - sessionStartedAt) / 100) / 10;
|
|
||||||
const pointCount = summaryValue.points.length;
|
|
||||||
const spacing =
|
|
||||||
pointCount > 1 ? Math.min(1.2, nowSeconds / Math.max(pointCount - 1, 1)) : 0;
|
|
||||||
const startX = Math.max(0, nowSeconds - spacing * Math.max(pointCount - 1, 0));
|
|
||||||
const xValues = summaryValue.points.map((_, index) => Math.round((startX + index * spacing) * 10) / 10);
|
|
||||||
return { ...summaryValue, xValues };
|
|
||||||
}
|
|
||||||
|
|
||||||
function estimateSummarySpacing(xValues: number[]): number {
|
|
||||||
const diffs = xValues
|
|
||||||
.slice(1)
|
|
||||||
.map((value, index) => value - xValues[index])
|
|
||||||
.filter((value) => Number.isFinite(value) && value > 0);
|
|
||||||
|
|
||||||
if (diffs.length === 0) {
|
|
||||||
return 1.2;
|
|
||||||
}
|
|
||||||
|
|
||||||
const average = diffs.reduce((sum, value) => sum + value, 0) / diffs.length;
|
|
||||||
return Math.max(0.1, Math.min(1.2, Math.round(average * 10) / 10));
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildContinuousSummary(summaryValue: HudSummary): HudSummary {
|
|
||||||
if (
|
|
||||||
summary.points.length === 0 ||
|
|
||||||
!summary.xValues ||
|
|
||||||
summary.xValues.length !== summary.points.length
|
|
||||||
) {
|
|
||||||
return buildPacketSummary(summaryValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
const pointCount = summaryValue.points.length;
|
|
||||||
const previousXValues = summary.xValues;
|
|
||||||
const previousCount = previousXValues.length;
|
|
||||||
|
|
||||||
if (pointCount === 0) {
|
|
||||||
return buildEmptySummary();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pointCount < previousCount) {
|
|
||||||
return buildPacketSummary(summaryValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
const spacing = estimateSummarySpacing(previousXValues);
|
|
||||||
let xValues: number[];
|
|
||||||
|
|
||||||
if (pointCount > previousCount) {
|
|
||||||
xValues = previousXValues.slice();
|
|
||||||
while (xValues.length < pointCount) {
|
|
||||||
const previousX = xValues[xValues.length - 1] ?? 0;
|
|
||||||
xValues.push(Math.round((previousX + spacing) * 10) / 10);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
xValues = previousXValues.slice(1);
|
|
||||||
const previousX = previousXValues[previousXValues.length - 1] ?? 0;
|
|
||||||
xValues.push(Math.round((previousX + spacing) * 10) / 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
return { ...summaryValue, xValues };
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeSummary(summaryValue: HudSummary): HudSummary {
|
function normalizeSummary(summaryValue: HudSummary): HudSummary {
|
||||||
return shouldHideSummary(summaryValue.points) ? buildEmptySummary() : summaryValue;
|
return shouldHideSummary(summaryValue.points) ? buildEmptySummary() : summaryValue;
|
||||||
}
|
}
|
||||||
@@ -1231,65 +986,37 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
signalPanels = showSignalPanels ? packet.panels : buildInactivePanels();
|
signalPanels = showSignalPanels ? packet.panels : buildInactivePanels();
|
||||||
const packetHasActiveSummary = hasActiveSummary(packet.summary);
|
|
||||||
if (packet.summary.points.length > 0) {
|
if (packet.summary.points.length > 0) {
|
||||||
if (packetHasActiveSummary) {
|
const nowSeconds = Math.round((Date.now() - sessionStartedAt) / 100) / 10;
|
||||||
summaryReleaseHidden = false;
|
const pointCount = packet.summary.points.length;
|
||||||
summary = buildContinuousSummary(packet.summary);
|
const spacing =
|
||||||
cancelSummaryClear();
|
pointCount > 1 ? Math.min(1.2, nowSeconds / Math.max(pointCount - 1, 1)) : 0;
|
||||||
} else if (summaryReleaseHidden) {
|
const startX = Math.max(0, nowSeconds - spacing * Math.max(pointCount - 1, 0));
|
||||||
summary = buildEmptySummary();
|
const xValues = packet.summary.points.map((_, index) => Math.round((startX + index * spacing) * 10) / 10);
|
||||||
|
summary = { ...packet.summary, xValues };
|
||||||
} else {
|
} else {
|
||||||
summary = buildContinuousSummary(packet.summary);
|
summary = packet.summary;
|
||||||
scheduleSummaryClear();
|
|
||||||
}
|
|
||||||
} else if (!summaryReleaseHidden) {
|
|
||||||
scheduleSummaryClear();
|
|
||||||
}
|
}
|
||||||
pressureMatrix = packet.pressureMatrix;
|
pressureMatrix = packet.pressureMatrix;
|
||||||
const nextSpatialForce = packet.spatialForce ?? null;
|
hasSignalData = signalPanels.length > 0 || packet.summary.points.length > 0;
|
||||||
if (packetHasActiveSummary && hasActiveSpatialForce(nextSpatialForce)) {
|
|
||||||
spatialForceReleaseHidden = false;
|
|
||||||
spatialForcePanelVisible = true;
|
|
||||||
spatialForce = nextSpatialForce;
|
|
||||||
cancelSpatialForceClear();
|
|
||||||
} else {
|
|
||||||
spatialForce = null;
|
|
||||||
if (spatialForceReleaseHidden || !spatialForcePanelVisible) {
|
|
||||||
spatialForcePanelVisible = false;
|
|
||||||
}
|
|
||||||
scheduleSpatialForceClear();
|
|
||||||
}
|
|
||||||
hasSignalData =
|
|
||||||
signalPanels.length > 0 ||
|
|
||||||
summary.points.length > 0 ||
|
|
||||||
spatialForce !== null ||
|
|
||||||
spatialForcePanelVisible;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearHudPanels(): void {
|
function clearHudPanels(): void {
|
||||||
cancelSummaryClear();
|
|
||||||
cancelSpatialForceClear();
|
|
||||||
summaryReleaseHidden = true;
|
|
||||||
spatialForceReleaseHidden = false;
|
|
||||||
spatialForcePanelVisible = false;
|
|
||||||
hasSignalData = false;
|
hasSignalData = false;
|
||||||
signalPanels = buildInactivePanels();
|
signalPanels = buildInactivePanels();
|
||||||
summary = buildEmptySummary();
|
summary = buildEmptySummary();
|
||||||
pressureMatrix = null;
|
pressureMatrix = null;
|
||||||
spatialForce = null;
|
|
||||||
clearDevkitSpatialForce();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function startMockFeed(push: (packet: HudPacket) => void): () => void {
|
function startMockFeed(push: (packet: HudPacket) => void): () => void {
|
||||||
let panels = buildInactivePanels();
|
let panels = buildInactivePanels();
|
||||||
let summaryValue = buildSummary(createSummaryPoints(randomBetween(480, 1440)));
|
let summaryValue = buildSummary(createSummaryPoints(randomBetween(480, 1440)));
|
||||||
push({ ts: Date.now(), panels, summary: summaryValue, pressureMatrix: null, spatialForce: null });
|
push({ ts: Date.now(), panels, summary: summaryValue, pressureMatrix: null });
|
||||||
|
|
||||||
const timerId = window.setInterval(() => {
|
const timerId = window.setInterval(() => {
|
||||||
summaryValue = evolveSummary(summaryValue);
|
summaryValue = evolveSummary(summaryValue);
|
||||||
|
|
||||||
push({ ts: Date.now(), panels, summary: summaryValue, pressureMatrix: null, spatialForce: null });
|
push({ ts: Date.now(), panels, summary: summaryValue, pressureMatrix: null });
|
||||||
}, signalRenderTickMs);
|
}, signalRenderTickMs);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
@@ -1303,6 +1030,69 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildConfigLinks(
|
||||||
|
currentLocale: LocaleCode,
|
||||||
|
activeId: string,
|
||||||
|
isSettingsOpen: boolean,
|
||||||
|
isPrecisionOpen: boolean,
|
||||||
|
isDevKitEnabled: boolean,
|
||||||
|
isDevKitOpen: boolean
|
||||||
|
): HudConfigLink[] {
|
||||||
|
const labels =
|
||||||
|
currentLocale === "zh-CN"
|
||||||
|
? {
|
||||||
|
streamOn: "打开",
|
||||||
|
streamOff: "关闭",
|
||||||
|
precisionTest: "游戏",
|
||||||
|
settings: "参数"
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
streamOn: "Open",
|
||||||
|
streamOff: "Close",
|
||||||
|
precisionTest: "Game",
|
||||||
|
settings: "Setup"
|
||||||
|
};
|
||||||
|
const devkitLabel = currentLocale === "zh-CN" ? "开发工具" : "DevKit";
|
||||||
|
|
||||||
|
const links: HudConfigLink[] = [
|
||||||
|
{
|
||||||
|
id: "stream-on",
|
||||||
|
label: labels.streamOn,
|
||||||
|
tone: "lime",
|
||||||
|
active: activeId === "stream-on"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "stream-off",
|
||||||
|
label: labels.streamOff,
|
||||||
|
tone: "orange",
|
||||||
|
active: activeId === "stream-off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "precision-test",
|
||||||
|
label: labels.precisionTest,
|
||||||
|
tone: "lime",
|
||||||
|
active: isPrecisionOpen
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "settings",
|
||||||
|
label: labels.settings,
|
||||||
|
tone: "neutral",
|
||||||
|
active: isSettingsOpen
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isDevKitEnabled) {
|
||||||
|
links.push({
|
||||||
|
id: "devkit",
|
||||||
|
label: devkitLabel,
|
||||||
|
tone: "cyan",
|
||||||
|
active: isDevKitOpen
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return links;
|
||||||
|
}
|
||||||
|
|
||||||
async function ensureDefaultWindowSize(): Promise<void> {
|
async function ensureDefaultWindowSize(): Promise<void> {
|
||||||
if (!isTauriRuntime()) {
|
if (!isTauriRuntime()) {
|
||||||
return;
|
return;
|
||||||
@@ -1852,6 +1642,35 @@
|
|||||||
resetReplayVisualState();
|
resetReplayVisualState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleConfigLink(event: CustomEvent<string>): void {
|
||||||
|
if (event.detail === "precision-test") {
|
||||||
|
isPrecisionTestOpen = !isPrecisionTestOpen;
|
||||||
|
isConfigPanelOpen = false;
|
||||||
|
isDevKitConfigOpen = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.detail === "settings") {
|
||||||
|
isPrecisionTestOpen = false;
|
||||||
|
isConfigPanelOpen = !isConfigPanelOpen;
|
||||||
|
isDevKitConfigOpen = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.detail === "devkit") {
|
||||||
|
isPrecisionTestOpen = false;
|
||||||
|
isConfigPanelOpen = false;
|
||||||
|
isDevKitConfigOpen = !isDevKitConfigOpen;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isPrecisionTestOpen = false;
|
||||||
|
isConfigPanelOpen = false;
|
||||||
|
isDevKitConfigOpen = false;
|
||||||
|
activeConfigLinkId = event.detail;
|
||||||
|
console.info("[hud] config link clicked:", event.detail);
|
||||||
|
}
|
||||||
|
|
||||||
async function handleWindowControl(event: CustomEvent<WindowControlAction>): Promise<void> {
|
async function handleWindowControl(event: CustomEvent<WindowControlAction>): Promise<void> {
|
||||||
if (!isTauriRuntime()) {
|
if (!isTauriRuntime()) {
|
||||||
return;
|
return;
|
||||||
@@ -1920,8 +1739,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStageModeChange(event: CustomEvent<StageViewMode>): void {
|
function handleMatrixDisplayToggle(event: CustomEvent<boolean>): void {
|
||||||
stageViewMode = event.detail;
|
matrixDisplayMode = event.detail ? "dots" : "numeric";
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
@@ -1951,29 +1770,12 @@
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error("Failed to listen for hud_stream:", error);
|
console.error("Failed to listen for hud_stream:", error);
|
||||||
});
|
});
|
||||||
void listen<DevKitPztAngleEvent>("devkit_pzt_angle", (event) => {
|
void listen<{ seq: number; timestampMs: number; dtsMs: number; angle: number }>(
|
||||||
if (replayHasData) {
|
"devkit_pzt_angle",
|
||||||
if (replayPendingDevkitSeq == null || event.payload.seq !== replayPendingDevkitSeq) {
|
(event) => {
|
||||||
return;
|
console.log("[devkit_pzt_angle]", event.payload);
|
||||||
}
|
}
|
||||||
replayPendingDevkitSeq = null;
|
)
|
||||||
}
|
|
||||||
|
|
||||||
const angleDeg = Number(event.payload.angle);
|
|
||||||
const magnitude = Number(event.payload.magnitude);
|
|
||||||
const isReportable = event.payload.state > 0 && Number.isFinite(magnitude) && magnitude > 0;
|
|
||||||
if (!Number.isFinite(angleDeg) || !isReportable) {
|
|
||||||
clearDevkitSpatialForce();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
devkitSpatialForce = {
|
|
||||||
angleDeg,
|
|
||||||
magnitude,
|
|
||||||
confidence: 0
|
|
||||||
};
|
|
||||||
scheduleDevkitSpatialForceClear();
|
|
||||||
})
|
|
||||||
.then((unlisten) => {
|
.then((unlisten) => {
|
||||||
if (disposed) {
|
if (disposed) {
|
||||||
unlisten();
|
unlisten();
|
||||||
@@ -1992,9 +1794,6 @@
|
|||||||
return () => {
|
return () => {
|
||||||
disposed = true;
|
disposed = true;
|
||||||
pauseReplayPlayback();
|
pauseReplayPlayback();
|
||||||
cancelSummaryClear();
|
|
||||||
cancelSpatialForceClear();
|
|
||||||
clearDevkitSpatialForce();
|
|
||||||
stopMockFeed?.();
|
stopMockFeed?.();
|
||||||
unlistenHudStream?.();
|
unlistenHudStream?.();
|
||||||
unlistenDevkitPztAngle?.();
|
unlistenDevkitPztAngle?.();
|
||||||
@@ -2033,10 +1832,12 @@
|
|||||||
sampleRateValue={sampleRateValue}
|
sampleRateValue={sampleRateValue}
|
||||||
channelsLabel={uiCopy.channelsLabel}
|
channelsLabel={uiCopy.channelsLabel}
|
||||||
channelsValue={channelsValue}
|
channelsValue={channelsValue}
|
||||||
|
configLinksLabel={uiCopy.configLinksLabel}
|
||||||
refreshPortsLabel={uiCopy.refreshPortsLabel}
|
refreshPortsLabel={uiCopy.refreshPortsLabel}
|
||||||
matrixViewLabel={uiCopy.matrixViewLabel}
|
matrixViewLabel={uiCopy.matrixViewLabel}
|
||||||
|
matrixViewNumericLabel={uiCopy.matrixViewNumericLabel}
|
||||||
matrixViewDotsLabel={uiCopy.matrixViewDotsLabel}
|
matrixViewDotsLabel={uiCopy.matrixViewDotsLabel}
|
||||||
{stageViewMode}
|
{matrixDisplayMode}
|
||||||
connectActionLabel={uiCopy.connectActionLabel}
|
connectActionLabel={uiCopy.connectActionLabel}
|
||||||
disconnectActionLabel={uiCopy.disconnectActionLabel}
|
disconnectActionLabel={uiCopy.disconnectActionLabel}
|
||||||
exportActionLabel={uiCopy.exportActionLabel}
|
exportActionLabel={uiCopy.exportActionLabel}
|
||||||
@@ -2048,6 +1849,7 @@
|
|||||||
noticeCancelLabel={locale === "zh-CN" ? "取消" : "Cancel"}
|
noticeCancelLabel={locale === "zh-CN" ? "取消" : "Cancel"}
|
||||||
noticeShowActions={updateNoticeVisible}
|
noticeShowActions={updateNoticeVisible}
|
||||||
noticeActionBusy={updateInstallBusy}
|
noticeActionBusy={updateInstallBusy}
|
||||||
|
{configLinks}
|
||||||
{isRefreshingPorts}
|
{isRefreshingPorts}
|
||||||
{isExporting}
|
{isExporting}
|
||||||
isConnectDisabled={!serialPortValue || connectionState === "connecting"}
|
isConnectDisabled={!serialPortValue || connectionState === "connecting"}
|
||||||
@@ -2056,7 +1858,8 @@
|
|||||||
on:windowcontrol={handleWindowControl}
|
on:windowcontrol={handleWindowControl}
|
||||||
on:localechange={handleLocaleChange}
|
on:localechange={handleLocaleChange}
|
||||||
on:portchange={handlePortChange}
|
on:portchange={handlePortChange}
|
||||||
on:stagemodechange={handleStageModeChange}
|
on:configlink={handleConfigLink}
|
||||||
|
on:matrixdisplaytoggle={handleMatrixDisplayToggle}
|
||||||
on:serialrefresh={handleSerialRefresh}
|
on:serialrefresh={handleSerialRefresh}
|
||||||
on:serialconnect={handleSerialConnect}
|
on:serialconnect={handleSerialConnect}
|
||||||
on:serialexport={handleSerialExportRequest}
|
on:serialexport={handleSerialExportRequest}
|
||||||
@@ -2076,7 +1879,7 @@
|
|||||||
bind:rangeMin
|
bind:rangeMin
|
||||||
bind:rangeMax
|
bind:rangeMax
|
||||||
bind:colorMapPreset
|
bind:colorMapPreset
|
||||||
{stageViewMode}
|
bind:matrixDisplayMode
|
||||||
configPanelTitle={uiCopy.configPanelTitle}
|
configPanelTitle={uiCopy.configPanelTitle}
|
||||||
configPanelHint={uiCopy.configPanelHint}
|
configPanelHint={uiCopy.configPanelHint}
|
||||||
matrixSizeLabel={uiCopy.matrixSizeLabel}
|
matrixSizeLabel={uiCopy.matrixSizeLabel}
|
||||||
@@ -2098,23 +1901,22 @@
|
|||||||
{replayFileName}
|
{replayFileName}
|
||||||
{replayFrameInfo}
|
{replayFrameInfo}
|
||||||
{sessionStartedAt}
|
{sessionStartedAt}
|
||||||
{summaryReleasePending}
|
|
||||||
{spatialForcePanelVisible}
|
|
||||||
resetConfigLabel={uiCopy.resetConfigLabel}
|
resetConfigLabel={uiCopy.resetConfigLabel}
|
||||||
applyLiveHint={uiCopy.applyLiveHint}
|
applyLiveHint={uiCopy.applyLiveHint}
|
||||||
leftPanels={leftSignalPanels}
|
leftPanels={leftSignalPanels}
|
||||||
rightPanels={rightSignalPanels}
|
rightPanels={rightSignalPanels}
|
||||||
{pressureMatrix}
|
{pressureMatrix}
|
||||||
{spatialForce}
|
showConfigPanel={isConfigPanelOpen}
|
||||||
showConfigPanel={false}
|
showPrecisionTestPanel={isPrecisionTestOpen}
|
||||||
{summary}
|
{summary}
|
||||||
on:replaytoggle={handleReplayToggle}
|
on:replaytoggle={handleReplayToggle}
|
||||||
on:replaystop={handleReplayStop}
|
on:replaystop={handleReplayStop}
|
||||||
on:replayseek={handleReplaySeek}
|
on:replayseek={handleReplaySeek}
|
||||||
on:replayspeed={handleReplaySpeed}
|
on:replayspeed={handleReplaySpeed}
|
||||||
on:replayclose={handleReplayClose}
|
on:replayclose={handleReplayClose}
|
||||||
|
on:configclose={() => (isConfigPanelOpen = false)}
|
||||||
>
|
>
|
||||||
{#if stageViewMode === "webgl"}
|
{#if !isPrecisionTestOpen}
|
||||||
<section class="range-scale" aria-label="Signal Range">
|
<section class="range-scale" aria-label="Signal Range">
|
||||||
<p class="range-label">{locale === "zh-CN" ? "范围" : "Range"}</p>
|
<p class="range-label">{locale === "zh-CN" ? "范围" : "Range"}</p>
|
||||||
<div class="range-track">
|
<div class="range-track">
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
# 3D model assets
|
|
||||||
|
|
||||||
Put the first pipeline model here:
|
|
||||||
|
|
||||||
- Preferred: `static/models/je-skin-model.glb`
|
|
||||||
- Format: glTF 2.0 `.glb`
|
|
||||||
- Also supported after changing `modelUrl`: glTF 2.0 `.gltf` with its `.bin` and texture files in the same folder
|
|
||||||
- Not supported directly: older glTF 1.0 assets. Convert them to glTF 2.0 first.
|
|
||||||
|
|
||||||
Runtime URL used by the app:
|
|
||||||
|
|
||||||
```text
|
|
||||||
/models/je-skin-model.glb
|
|
||||||
```
|
|
||||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user