Files
templates/c/set-protocol/ports/android
Andrey 876b58517c feat(set-protocol): Раздели GAS и добавь пакетный сбор регистров
Сохрани адресацию отдельных регистров GAS 0x3 и выдели слотам тип 0x4 с маской Word0. Добавь единое C-ядро GAS_WATCH2, тонкие Python/JNI-порты и проверки общих эталонных байтов.

Совместимость: тип 0x4 больше не обслуживает Modbus Coil. Потребителям PCAN_MSG_MODBUS_COIL и ProtoCanMsgToModbusCoil нужно перейти на GAS_SLOT и отдельный API слотов; регистровый GAS остаётся на 0x3.
2026-10-23 14:14:48 +03:00
..

Android port

Android.mk builds libsetprotocol.so from the same C99 sources used by MCU and desktop builds. setprotocol_jni.c contains only JNI marshalling; protocol rules remain in the core. Add the Kotlin directory as an Android source directory and include this Android.mk from the application NDK build.

The JNI streaming parser returns fixed 15-byte records SEQ | FLAGS | CAN_ID_LE | DLC | DATA[8]. Dynamic allocation is confined to the Android adapter for protocol operations; the portable protocol core remains allocation free.

nativeSpectrum calls the shared host DSP module set_spectrum.c (bounded heap workspace, up to 2×16384 doubles). trends/SpectrumAnalyzer maps timestamps and errors but does not duplicate FFT/filter math. Run it off the UI thread. trends/PlotViewport is a toolkit-free normalized zoom/pan model.

legacycan/LegacyCanTerminal.kt contains the two historical CAN_terminal wire formats, the complete Projects.ini node/command catalog, and shared codecs for register writes and command frames. Android UI code must use this module instead of reproducing the Delphi byte rotation or CAN-ID routing rules.

kotlin/ru/setcorp/setprotocol/update/FirmwareCatalog.kt is a UI-independent firmware release client. It reads the optional firmware.releases array from the shared update.json, accepts only HTTPS assets, limits their size and returns image bytes only after SHA-256 verification. Applications provide their own UI and pass optional HTTP Basic credentials.