diff --git a/docs/checklist.md b/.env.local similarity index 100% rename from docs/checklist.md rename to .env.local diff --git a/.gitignore b/.gitignore index c355b4b8..6240da8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,39 +1,21 @@ -# PlatformIO -.pio -.cache/ - -# Build artifacts -*.elf -*.bin -*.map - -# Secrets -src/config_secrets.h - -# Doxygen Output -docs/doxygen/ -firmware-docs - -# Python build artifacts -scripts/__pycache__/ -*.pyc - -# Node.js -node_modules/ -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Editor directories and files -.vscode/ -.idea/ -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? -tests/reports/ -src/firmware.ino.cpp -data/ -dist -build +# build output +dist/ +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..62445bd4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,10 @@ +[submodule "elena-rc2/lib/polymech-base"] + path = elena-rc2/lib/polymech-base + url = https://git.polymech.io/polymech/firmware-base.git + +[submodule "cassandra-rc2/components/espsoftwareserial"] + path = cassandra-rc2/components/espsoftwareserial + url = https://github.com/plerup/espsoftwareserial.git +[submodule "cassandra-rc2/components/Vector"] + path = cassandra-rc2/components/Vector + url = https://github.com/janelia-arduino/Vector.git diff --git a/README.md b/README.md index 361fa8b1..f48ae649 100644 --- a/README.md +++ b/README.md @@ -1,114 +1,17 @@ -# Polymech Cassandra Firmware +## Firmware ports of OSR-Plastic -This repository contains the firmware for the Polymech Cassandra project, running on an ESP32-S3. - -## Overview - -The firmware manages various hardware components and provides multiple interfaces for control and monitoring: - -* **Serial Interface:** For debugging, testing, and direct command execution. -* **Modbus TCP Server:** Allows interaction with components using the Modbus protocol over WiFi. -* **REST API & Web UI:** Provides a web-based interface (status page, API documentation) and a RESTful API for interacting with the system over WiFi. - -## Architecture - -The firmware is built upon a component-based architecture: - -* **`App` / `PHApp`:** The main application class (`src/PHApp.h`). -* **`Component`:** Base class (`src/Component.h`) for all functional units. -* **`Bridge`:** (`src/Bridge.h`) Facilitates serial command dispatch. -* **`SerialMessage`:** (`src/SerialMessage.h`) Handles serial communication. -* **`ModbusManager`:** (`src/ModbusManager.h`) Manages the Modbus TCP server. -* **`RESTServer`:** (`src/RestServer.h`) Implements the web server and REST API. -* **Details:** See [docs/components.md](./docs/components.md) for how components are structured, configured, and added. - -## Interfaces - -### 1. Serial Communication - -A command-line interface is available over the USB serial port used for programming and monitoring. - -* **Purpose:** Debugging, direct method calls on components. -* **Command Format:** `<>` -* **Examples & Details:** See [docs/serial.md](./docs/serial.md) -* **Sending Commands:** Use `npm run send -- ""` or a standard serial terminal. - -### 2. Modbus TCP - -The device runs a Modbus TCP server (slave/responder) on port 502. - -* **Implementation:** Managed by `ModbusManager` using the `eModbus` library. -* **Component Interaction:** Components supporting Modbus (like `Relay` or `PHApp` itself) implement `readNetworkValue` and `writeNetworkValue` methods. They are registered with the `ModbusManager` along with their corresponding Modbus addresses. -* **Configuration:** Modbus addresses are defined in `src/config-modbus.h`. -* **Design Details:** See [docs/design-network.md](./docs/design-network.md) -* **Testing:** Use the `python scripts/modbus_*.py` scripts directly (npm script argument passing has issues): - - ```bash - # Read Coil 51 - python scripts/modbus_read_coils.py --address 51 --ip-address - # Write Coil 51 ON - python scripts/modbus_write_coil.py --address 51 --value 1 --ip-address - # Read Register 20 - python scripts/modbus_read_registers.py --address 20 --ip-address - # Write Register 20 - python scripts/modbus_write_register.py --address 20 --value 123 --ip-address - ``` - -### 3. Web Interface & REST API - -A web server runs on port 80, providing: - -* **Status Page:** `http:///` -* **Swagger UI:** `http:///api-docs` (Interactive API documentation) -* **REST API:** `http:///api/v1/...` -* **Working Endpoints:** - * `GET /api/v1/system/info`: Device status. - * `GET /api/v1/coils`: List of registered coils. - * `GET /api/v1/registers`: List of registered registers. - * `GET /api/v1/coils?address=`: Read a specific registered coil. - * `GET /api/v1/registers?address=`: Read a specific registered register. - * `POST /api/v1/relay/test`: Trigger internal relay test. -* **Non-Functional Endpoints (Known Issue):** - * `POST /coils/{address}`: Returns 404. - * `POST /registers/{address}`: Returns 404. -* **Details & Examples:** See [docs/web.md](./docs/web.md) -* **Testing:** Use `npm run test-api-ip` (note that some tests related to POST endpoints will fail). - -## Building and Development - -See [firmware/.cursor/rules](./.cursor/rules) for a summary of common workflow commands. - -**Key `npm` Scripts:** - -* `npm run build`: Compile the firmware. -* `npm run upload`: Upload the firmware to the device. -* `npm run clean`: Clean build artifacts. -* `npm run monitor`: Open the serial monitor. -* `npm run build-web`: Generate web assets (from `swagger.yaml`, `front/`) and build firmware. -* `npm run send -- ""`: Send a serial command. -* `npm run test-api-ip`: Run the REST API test script against the device IP. -* *(Modbus tests need direct python execution, see Modbus section above)* - -## Configuration - -* **Hardware Pins, Features:** `src/config.h`, `src/config_adv.h` -* **WiFi Credentials:** `src/config_secrets.h` (ensure this file exists and is populated) -* **Modbus Addresses:** `src/config-modbus.h` -* **Component IDs:** `src/enums.h` (enum `COMPONENT_KEY`) ## Todos ### Web -* [x] pid stats -* [ ] prof enabled -* [ ] warmup toggle -* [-] press prof - remaining ( parent ) -* [ ] auto - interlock ( rs 485 connect ) => modes -* [ ] press : sp ( ui - mobile) -* [ ] partitions : settings not applied - -### FW - -* [x] press - profile ( check abort => vis error ) -* [x] sp drag / lag +- [ ] pid stats +- [ ] prof enabled +- [ ] warmup toggle +- [ ] sp drag / lag +- [ ] press prof - remaining ( parent ) +- [ ] auto - interlock ( rs 485 connect ) => modes +- [ ] press : sp ( ui - mobile) +- [ ] press - profile ( check abort => vis error ) +- [ ] partitions : settings not applied +- [ ] diff --git a/.clangd b/cassandra-rc2/.clangd similarity index 100% rename from .clangd rename to cassandra-rc2/.clangd diff --git a/cassandra-rc2/.config/dotnet-tools.json b/cassandra-rc2/.config/dotnet-tools.json new file mode 100644 index 00000000..85b913ca --- /dev/null +++ b/cassandra-rc2/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "csharpier": { + "version": "1.0.3", + "commands": [ + "csharpier" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/cassandra-rc2/.cursor/rules/PressCylinder.mdc b/cassandra-rc2/.cursor/rules/PressCylinder.mdc new file mode 100644 index 00000000..12dcba64 --- /dev/null +++ b/cassandra-rc2/.cursor/rules/PressCylinder.mdc @@ -0,0 +1,27 @@ +--- +description: +globs: +alwaysApply: false +--- +# PressCylinder Component + +The `PressCylinder` is a component that orchestrates a `[Solenoid.h](mdc:cassandra-rc2/lib/polymech-base/src/components/Solenoid.h)` and a `[Loadcell.h](mdc:cassandra-rc2/lib/polymech-base/src/components/Loadcell.h)` to achieve a target pressure. + +## Files +- Header: `[PressCylinder.h](mdc:cassandra-rc2/lib/polymech-base/src/components/PressCylinder.h)` +- Implementation: `[PressCylinder.cpp](mdc:cassandra-rc2/lib/polymech-base/src/components/PressCylinder.cpp)` + +## Dependencies +- It controls a `[Solenoid.h](mdc:cassandra-rc2/lib/polymech-base/src/components/Solenoid.h)`. +- It reads pressure values from a `[Loadcell.h](mdc:cassandra-rc2/lib/polymech-base/src/components/Loadcell.h)`. +- It can optionally be controlled by a `[Joystick.h](mdc:cassandra-rc2/lib/polymech-base/src/components/Joystick.h)` for manual operation. + +## Functionality +The component has two primary modes: +1. **Auto Mode**: Automatically opens/closes the solenoid to reach a Modbus-defined pressure setpoint (`targetSP`), based on the current value from the loadcell. +2. **Manual Mode**: Allows for direct control of the solenoid using the joystick (`UP` opens the solenoid). + +## Configuration +- The component is enabled by the `ENABLE_PRESS_CYLINDER` flag in `[config.h](mdc:cassandra-rc2/src/config.h)`. +- It is instantiated and its dependencies are injected within `[PHApp.cpp](mdc:cassandra-rc2/src/PHApp.cpp)`. + diff --git a/cassandra-rc2/.cursor/rules/comments.mdc b/cassandra-rc2/.cursor/rules/comments.mdc new file mode 100644 index 00000000..b93c988b --- /dev/null +++ b/cassandra-rc2/.cursor/rules/comments.mdc @@ -0,0 +1,5 @@ +--- +description: +globs: +alwaysApply: false +--- diff --git a/cassandra-rc2/.cursor/rules/loadcell-component.mdc b/cassandra-rc2/.cursor/rules/loadcell-component.mdc new file mode 100644 index 00000000..370121b1 --- /dev/null +++ b/cassandra-rc2/.cursor/rules/loadcell-component.mdc @@ -0,0 +1,38 @@ +--- +description: +globs: +alwaysApply: false +--- +# Loadcell Component Integration + +This document outlines the structure and integration of the `Loadcell` component, which is designed to interface with an RS485 load cell. + +## Key Files + +- **Header File**: Defines the class structure, Modbus registers, and public methods. + - `lib/polymech-base/src/components/Loadcell.h` +- **Implementation File**: Contains the logic for setup, main loop, and Modbus communication. + - `lib/polymech-base/src/components/Loadcell.cpp` + +## Enabling the Component + +To enable or disable the `Loadcell` component, you must define or comment out the `ENABLE_LOADCELL` macro in the main configuration file: + +- `src/config.h` + +## Feature Inclusion + +The component's header is conditionally included in the project through the `features.h` file. This ensures that the `Loadcell` is only compiled when its feature flag is enabled. + +- `src/features.h` + +## Device Registration + +The `Loadcell` is registered as a slave device on the RS485 bus. The instantiation and registration logic can be found in the `registerApplicationDevices` function: + +- `src/RS485Devices.cpp` + +## Data Handling + +The Process Value (PV) from the load cell is managed by a `ValueWrapper`. This allows for efficient, event-driven updates throughout the system. The `ValueWrapper` is initialized in the constructor of `Loadcell.cpp`. + diff --git a/.cursorignore b/cassandra-rc2/.cursorignore similarity index 100% rename from .cursorignore rename to cassandra-rc2/.cursorignore diff --git a/cassandra-rc2/.gitignore b/cassandra-rc2/.gitignore new file mode 100644 index 00000000..c355b4b8 --- /dev/null +++ b/cassandra-rc2/.gitignore @@ -0,0 +1,39 @@ +# PlatformIO +.pio +.cache/ + +# Build artifacts +*.elf +*.bin +*.map + +# Secrets +src/config_secrets.h + +# Doxygen Output +docs/doxygen/ +firmware-docs + +# Python build artifacts +scripts/__pycache__/ +*.pyc + +# Node.js +node_modules/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.vscode/ +.idea/ +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +tests/reports/ +src/firmware.ino.cpp +data/ +dist +build diff --git a/CMakeLists.txt b/cassandra-rc2/CMakeLists.txt similarity index 100% rename from CMakeLists.txt rename to cassandra-rc2/CMakeLists.txt diff --git a/cassandra-rc2/README.md b/cassandra-rc2/README.md new file mode 100644 index 00000000..361fa8b1 --- /dev/null +++ b/cassandra-rc2/README.md @@ -0,0 +1,114 @@ +# Polymech Cassandra Firmware + +This repository contains the firmware for the Polymech Cassandra project, running on an ESP32-S3. + +## Overview + +The firmware manages various hardware components and provides multiple interfaces for control and monitoring: + +* **Serial Interface:** For debugging, testing, and direct command execution. +* **Modbus TCP Server:** Allows interaction with components using the Modbus protocol over WiFi. +* **REST API & Web UI:** Provides a web-based interface (status page, API documentation) and a RESTful API for interacting with the system over WiFi. + +## Architecture + +The firmware is built upon a component-based architecture: + +* **`App` / `PHApp`:** The main application class (`src/PHApp.h`). +* **`Component`:** Base class (`src/Component.h`) for all functional units. +* **`Bridge`:** (`src/Bridge.h`) Facilitates serial command dispatch. +* **`SerialMessage`:** (`src/SerialMessage.h`) Handles serial communication. +* **`ModbusManager`:** (`src/ModbusManager.h`) Manages the Modbus TCP server. +* **`RESTServer`:** (`src/RestServer.h`) Implements the web server and REST API. +* **Details:** See [docs/components.md](./docs/components.md) for how components are structured, configured, and added. + +## Interfaces + +### 1. Serial Communication + +A command-line interface is available over the USB serial port used for programming and monitoring. + +* **Purpose:** Debugging, direct method calls on components. +* **Command Format:** `<>` +* **Examples & Details:** See [docs/serial.md](./docs/serial.md) +* **Sending Commands:** Use `npm run send -- ""` or a standard serial terminal. + +### 2. Modbus TCP + +The device runs a Modbus TCP server (slave/responder) on port 502. + +* **Implementation:** Managed by `ModbusManager` using the `eModbus` library. +* **Component Interaction:** Components supporting Modbus (like `Relay` or `PHApp` itself) implement `readNetworkValue` and `writeNetworkValue` methods. They are registered with the `ModbusManager` along with their corresponding Modbus addresses. +* **Configuration:** Modbus addresses are defined in `src/config-modbus.h`. +* **Design Details:** See [docs/design-network.md](./docs/design-network.md) +* **Testing:** Use the `python scripts/modbus_*.py` scripts directly (npm script argument passing has issues): + + ```bash + # Read Coil 51 + python scripts/modbus_read_coils.py --address 51 --ip-address + # Write Coil 51 ON + python scripts/modbus_write_coil.py --address 51 --value 1 --ip-address + # Read Register 20 + python scripts/modbus_read_registers.py --address 20 --ip-address + # Write Register 20 + python scripts/modbus_write_register.py --address 20 --value 123 --ip-address + ``` + +### 3. Web Interface & REST API + +A web server runs on port 80, providing: + +* **Status Page:** `http:///` +* **Swagger UI:** `http:///api-docs` (Interactive API documentation) +* **REST API:** `http:///api/v1/...` +* **Working Endpoints:** + * `GET /api/v1/system/info`: Device status. + * `GET /api/v1/coils`: List of registered coils. + * `GET /api/v1/registers`: List of registered registers. + * `GET /api/v1/coils?address=`: Read a specific registered coil. + * `GET /api/v1/registers?address=`: Read a specific registered register. + * `POST /api/v1/relay/test`: Trigger internal relay test. +* **Non-Functional Endpoints (Known Issue):** + * `POST /coils/{address}`: Returns 404. + * `POST /registers/{address}`: Returns 404. +* **Details & Examples:** See [docs/web.md](./docs/web.md) +* **Testing:** Use `npm run test-api-ip` (note that some tests related to POST endpoints will fail). + +## Building and Development + +See [firmware/.cursor/rules](./.cursor/rules) for a summary of common workflow commands. + +**Key `npm` Scripts:** + +* `npm run build`: Compile the firmware. +* `npm run upload`: Upload the firmware to the device. +* `npm run clean`: Clean build artifacts. +* `npm run monitor`: Open the serial monitor. +* `npm run build-web`: Generate web assets (from `swagger.yaml`, `front/`) and build firmware. +* `npm run send -- ""`: Send a serial command. +* `npm run test-api-ip`: Run the REST API test script against the device IP. +* *(Modbus tests need direct python execution, see Modbus section above)* + +## Configuration + +* **Hardware Pins, Features:** `src/config.h`, `src/config_adv.h` +* **WiFi Credentials:** `src/config_secrets.h` (ensure this file exists and is populated) +* **Modbus Addresses:** `src/config-modbus.h` +* **Component IDs:** `src/enums.h` (enum `COMPONENT_KEY`) + +## Todos + +### Web + +* [x] pid stats +* [ ] prof enabled +* [ ] warmup toggle +* [-] press prof - remaining ( parent ) +* [ ] auto - interlock ( rs 485 connect ) => modes +* [ ] press : sp ( ui - mobile) +* [ ] partitions : settings not applied + +### FW + +* [x] press - profile ( check abort => vis error ) +* [x] sp drag / lag diff --git a/cassandra-uploader.spec b/cassandra-rc2/cassandra-uploader.spec similarity index 100% rename from cassandra-uploader.spec rename to cassandra-rc2/cassandra-uploader.spec diff --git a/cassandra.code-workspace b/cassandra-rc2/cassandra.code-workspace similarity index 100% rename from cassandra.code-workspace rename to cassandra-rc2/cassandra.code-workspace diff --git a/compile_commands.json b/cassandra-rc2/compile_commands.json similarity index 100% rename from compile_commands.json rename to cassandra-rc2/compile_commands.json diff --git a/config/amperage_budget.json b/cassandra-rc2/config/amperage_budget.json similarity index 100% rename from config/amperage_budget.json rename to cassandra-rc2/config/amperage_budget.json diff --git a/config/assets/1.mp3 b/cassandra-rc2/config/assets/1.mp3 similarity index 100% rename from config/assets/1.mp3 rename to cassandra-rc2/config/assets/1.mp3 diff --git a/config/assets/2.mp3 b/cassandra-rc2/config/assets/2.mp3 similarity index 100% rename from config/assets/2.mp3 rename to cassandra-rc2/config/assets/2.mp3 diff --git a/config/assets/3.mp3 b/cassandra-rc2/config/assets/3.mp3 similarity index 100% rename from config/assets/3.mp3 rename to cassandra-rc2/config/assets/3.mp3 diff --git a/config/assets/4.mp3 b/cassandra-rc2/config/assets/4.mp3 similarity index 100% rename from config/assets/4.mp3 rename to cassandra-rc2/config/assets/4.mp3 diff --git a/config/cassandra-config.json b/cassandra-rc2/config/cassandra-config.json similarity index 100% rename from config/cassandra-config.json rename to cassandra-rc2/config/cassandra-config.json diff --git a/config/elena-config.json b/cassandra-rc2/config/elena-config.json similarity index 100% rename from config/elena-config.json rename to cassandra-rc2/config/elena-config.json diff --git a/config/favicon.ico b/cassandra-rc2/config/favicon.ico similarity index 100% rename from config/favicon.ico rename to cassandra-rc2/config/favicon.ico diff --git a/config/layout.json b/cassandra-rc2/config/layout.json similarity index 100% rename from config/layout.json rename to cassandra-rc2/config/layout.json diff --git a/config/layout_blank.json b/cassandra-rc2/config/layout_blank.json similarity index 100% rename from config/layout_blank.json rename to cassandra-rc2/config/layout_blank.json diff --git a/config/network.json b/cassandra-rc2/config/network.json similarity index 100% rename from config/network.json rename to cassandra-rc2/config/network.json diff --git a/config/plunger.json b/cassandra-rc2/config/plunger.json similarity index 100% rename from config/plunger.json rename to cassandra-rc2/config/plunger.json diff --git a/config/plunger_default.json b/cassandra-rc2/config/plunger_default.json similarity index 100% rename from config/plunger_default.json rename to cassandra-rc2/config/plunger_default.json diff --git a/config/press-cylinder.json b/cassandra-rc2/config/press-cylinder.json similarity index 100% rename from config/press-cylinder.json rename to cassandra-rc2/config/press-cylinder.json diff --git a/config/pressure_profiles.json b/cassandra-rc2/config/pressure_profiles.json similarity index 100% rename from config/pressure_profiles.json rename to cassandra-rc2/config/pressure_profiles.json diff --git a/config/profile_defaults.json b/cassandra-rc2/config/profile_defaults.json similarity index 100% rename from config/profile_defaults.json rename to cassandra-rc2/config/profile_defaults.json diff --git a/config/profile_defaults2.json b/cassandra-rc2/config/profile_defaults2.json similarity index 100% rename from config/profile_defaults2.json rename to cassandra-rc2/config/profile_defaults2.json diff --git a/config/settings.json b/cassandra-rc2/config/settings.json similarity index 100% rename from config/settings.json rename to cassandra-rc2/config/settings.json diff --git a/config/signal_plots.json b/cassandra-rc2/config/signal_plots.json similarity index 100% rename from config/signal_plots.json rename to cassandra-rc2/config/signal_plots.json diff --git a/config/state.json b/cassandra-rc2/config/state.json similarity index 100% rename from config/state.json rename to cassandra-rc2/config/state.json diff --git a/custom_partitions.csv b/cassandra-rc2/custom_partitions.csv similarity index 100% rename from custom_partitions.csv rename to cassandra-rc2/custom_partitions.csv diff --git a/docs/.gitignore b/cassandra-rc2/docs/.gitignore similarity index 100% rename from docs/.gitignore rename to cassandra-rc2/docs/.gitignore diff --git a/docs/.npmignore b/cassandra-rc2/docs/.npmignore similarity index 100% rename from docs/.npmignore rename to cassandra-rc2/docs/.npmignore diff --git a/docs/Doxyfile b/cassandra-rc2/docs/Doxyfile similarity index 100% rename from docs/Doxyfile rename to cassandra-rc2/docs/Doxyfile diff --git a/docs/LICENSE b/cassandra-rc2/docs/LICENSE similarity index 100% rename from docs/LICENSE rename to cassandra-rc2/docs/LICENSE diff --git a/docs/Makefile b/cassandra-rc2/docs/Makefile similarity index 100% rename from docs/Makefile rename to cassandra-rc2/docs/Makefile diff --git a/docs/Readme.md b/cassandra-rc2/docs/Readme.md similarity index 100% rename from docs/Readme.md rename to cassandra-rc2/docs/Readme.md diff --git a/docs/amp-budget.md b/cassandra-rc2/docs/amp-budget.md similarity index 100% rename from docs/amp-budget.md rename to cassandra-rc2/docs/amp-budget.md diff --git a/docs/astro/changelog.mdx b/cassandra-rc2/docs/astro/changelog.mdx similarity index 100% rename from docs/astro/changelog.mdx rename to cassandra-rc2/docs/astro/changelog.mdx diff --git a/docs/casting.md b/cassandra-rc2/docs/casting.md similarity index 100% rename from docs/casting.md rename to cassandra-rc2/docs/casting.md diff --git a/sdkconfig.defaults b/cassandra-rc2/docs/checklist.md similarity index 100% rename from sdkconfig.defaults rename to cassandra-rc2/docs/checklist.md diff --git a/docs/classes.drawio b/cassandra-rc2/docs/classes.drawio similarity index 100% rename from docs/classes.drawio rename to cassandra-rc2/docs/classes.drawio diff --git a/docs/components.md b/cassandra-rc2/docs/components.md similarity index 100% rename from docs/components.md rename to cassandra-rc2/docs/components.md diff --git a/docs/di.md b/cassandra-rc2/docs/di.md similarity index 100% rename from docs/di.md rename to cassandra-rc2/docs/di.md diff --git a/docs/diagrams/classes-all.drawio b/cassandra-rc2/docs/diagrams/classes-all.drawio similarity index 100% rename from docs/diagrams/classes-all.drawio rename to cassandra-rc2/docs/diagrams/classes-all.drawio diff --git a/docs/diagrams/classes-template.drawio b/cassandra-rc2/docs/diagrams/classes-template.drawio similarity index 100% rename from docs/diagrams/classes-template.drawio rename to cassandra-rc2/docs/diagrams/classes-template.drawio diff --git a/docs/diagrams/classes.drawio b/cassandra-rc2/docs/diagrams/classes.drawio similarity index 100% rename from docs/diagrams/classes.drawio rename to cassandra-rc2/docs/diagrams/classes.drawio diff --git a/docs/diagrams/overview.drawio b/cassandra-rc2/docs/diagrams/overview.drawio similarity index 100% rename from docs/diagrams/overview.drawio rename to cassandra-rc2/docs/diagrams/overview.drawio diff --git a/docs/docs-rest.md b/cassandra-rc2/docs/docs-rest.md similarity index 100% rename from docs/docs-rest.md rename to cassandra-rc2/docs/docs-rest.md diff --git a/docs/doxygen-awesome-darkmode-toggle.js b/cassandra-rc2/docs/doxygen-awesome-darkmode-toggle.js similarity index 100% rename from docs/doxygen-awesome-darkmode-toggle.js rename to cassandra-rc2/docs/doxygen-awesome-darkmode-toggle.js diff --git a/docs/doxygen-awesome-fragment-copy-button.js b/cassandra-rc2/docs/doxygen-awesome-fragment-copy-button.js similarity index 100% rename from docs/doxygen-awesome-fragment-copy-button.js rename to cassandra-rc2/docs/doxygen-awesome-fragment-copy-button.js diff --git a/docs/doxygen-awesome-interactive-toc.js b/cassandra-rc2/docs/doxygen-awesome-interactive-toc.js similarity index 100% rename from docs/doxygen-awesome-interactive-toc.js rename to cassandra-rc2/docs/doxygen-awesome-interactive-toc.js diff --git a/docs/doxygen-awesome-paragraph-link.js b/cassandra-rc2/docs/doxygen-awesome-paragraph-link.js similarity index 100% rename from docs/doxygen-awesome-paragraph-link.js rename to cassandra-rc2/docs/doxygen-awesome-paragraph-link.js diff --git a/docs/doxygen-awesome-sidebar-only-darkmode-toggle.css b/cassandra-rc2/docs/doxygen-awesome-sidebar-only-darkmode-toggle.css similarity index 100% rename from docs/doxygen-awesome-sidebar-only-darkmode-toggle.css rename to cassandra-rc2/docs/doxygen-awesome-sidebar-only-darkmode-toggle.css diff --git a/docs/doxygen-awesome-sidebar-only.css b/cassandra-rc2/docs/doxygen-awesome-sidebar-only.css similarity index 100% rename from docs/doxygen-awesome-sidebar-only.css rename to cassandra-rc2/docs/doxygen-awesome-sidebar-only.css diff --git a/docs/doxygen-awesome-tabs.js b/cassandra-rc2/docs/doxygen-awesome-tabs.js similarity index 100% rename from docs/doxygen-awesome-tabs.js rename to cassandra-rc2/docs/doxygen-awesome-tabs.js diff --git a/docs/doxygen-awesome.css b/cassandra-rc2/docs/doxygen-awesome.css similarity index 100% rename from docs/doxygen-awesome.css rename to cassandra-rc2/docs/doxygen-awesome.css diff --git a/docs/doxygen-custom/custom-alternative.css b/cassandra-rc2/docs/doxygen-custom/custom-alternative.css similarity index 100% rename from docs/doxygen-custom/custom-alternative.css rename to cassandra-rc2/docs/doxygen-custom/custom-alternative.css diff --git a/docs/doxygen-custom/custom.css b/cassandra-rc2/docs/doxygen-custom/custom.css similarity index 100% rename from docs/doxygen-custom/custom.css rename to cassandra-rc2/docs/doxygen-custom/custom.css diff --git a/docs/doxygen-custom/header.html b/cassandra-rc2/docs/doxygen-custom/header.html similarity index 100% rename from docs/doxygen-custom/header.html rename to cassandra-rc2/docs/doxygen-custom/header.html diff --git a/docs/doxygen-custom/toggle-alternative-theme.js b/cassandra-rc2/docs/doxygen-custom/toggle-alternative-theme.js similarity index 100% rename from docs/doxygen-custom/toggle-alternative-theme.js rename to cassandra-rc2/docs/doxygen-custom/toggle-alternative-theme.js diff --git a/docs/img/cab-real.JPG b/cassandra-rc2/docs/img/cab-real.JPG similarity index 100% rename from docs/img/cab-real.JPG rename to cassandra-rc2/docs/img/cab-real.JPG diff --git a/docs/img/cab.png b/cassandra-rc2/docs/img/cab.png similarity index 100% rename from docs/img/cab.png rename to cassandra-rc2/docs/img/cab.png diff --git a/docs/img/cp-air.png b/cassandra-rc2/docs/img/cp-air.png similarity index 100% rename from docs/img/cp-air.png rename to cassandra-rc2/docs/img/cp-air.png diff --git a/docs/img/cp-cartoon.png b/cassandra-rc2/docs/img/cp-cartoon.png similarity index 100% rename from docs/img/cp-cartoon.png rename to cassandra-rc2/docs/img/cp-cartoon.png diff --git a/docs/img/cp-max.png b/cassandra-rc2/docs/img/cp-max.png similarity index 100% rename from docs/img/cp-max.png rename to cassandra-rc2/docs/img/cp-max.png diff --git a/docs/img/cp-real.jpeg b/cassandra-rc2/docs/img/cp-real.jpeg similarity index 100% rename from docs/img/cp-real.jpeg rename to cassandra-rc2/docs/img/cp-real.jpeg diff --git a/docs/img/cp-simple.png b/cassandra-rc2/docs/img/cp-simple.png similarity index 100% rename from docs/img/cp-simple.png rename to cassandra-rc2/docs/img/cp-simple.png diff --git a/docs/img/elz-m-rc2.jpg b/cassandra-rc2/docs/img/elz-m-rc2.jpg similarity index 100% rename from docs/img/elz-m-rc2.jpg rename to cassandra-rc2/docs/img/elz-m-rc2.jpg diff --git a/docs/img/screenshot-latest.jpg b/cassandra-rc2/docs/img/screenshot-latest.jpg similarity index 100% rename from docs/img/screenshot-latest.jpg rename to cassandra-rc2/docs/img/screenshot-latest.jpg diff --git a/docs/img/screenshot-modbus.jpg b/cassandra-rc2/docs/img/screenshot-modbus.jpg similarity index 100% rename from docs/img/screenshot-modbus.jpg rename to cassandra-rc2/docs/img/screenshot-modbus.jpg diff --git a/docs/img/theme-variants-base.drawio.svg b/cassandra-rc2/docs/img/theme-variants-base.drawio.svg similarity index 100% rename from docs/img/theme-variants-base.drawio.svg rename to cassandra-rc2/docs/img/theme-variants-base.drawio.svg diff --git a/docs/img/theme-variants-sidebar-only.drawio.svg b/cassandra-rc2/docs/img/theme-variants-sidebar-only.drawio.svg similarity index 100% rename from docs/img/theme-variants-sidebar-only.drawio.svg rename to cassandra-rc2/docs/img/theme-variants-sidebar-only.drawio.svg diff --git a/docs/llm.md b/cassandra-rc2/docs/llm.md similarity index 100% rename from docs/llm.md rename to cassandra-rc2/docs/llm.md diff --git a/docs/logo.drawio.svg b/cassandra-rc2/docs/logo.drawio.svg similarity index 100% rename from docs/logo.drawio.svg rename to cassandra-rc2/docs/logo.drawio.svg diff --git a/docs/manual.md b/cassandra-rc2/docs/manual.md similarity index 100% rename from docs/manual.md rename to cassandra-rc2/docs/manual.md diff --git a/docs/mb-lang.md b/cassandra-rc2/docs/mb-lang.md similarity index 100% rename from docs/mb-lang.md rename to cassandra-rc2/docs/mb-lang.md diff --git a/docs/mb-plc.md b/cassandra-rc2/docs/mb-plc.md similarity index 100% rename from docs/mb-plc.md rename to cassandra-rc2/docs/mb-plc.md diff --git a/docs/mb-rtu-filters.md b/cassandra-rc2/docs/mb-rtu-filters.md similarity index 100% rename from docs/mb-rtu-filters.md rename to cassandra-rc2/docs/mb-rtu-filters.md diff --git a/docs/mb-script-design.md b/cassandra-rc2/docs/mb-script-design.md similarity index 100% rename from docs/mb-script-design.md rename to cassandra-rc2/docs/mb-script-design.md diff --git a/docs/mb-script-testing.md b/cassandra-rc2/docs/mb-script-testing.md similarity index 100% rename from docs/mb-script-testing.md rename to cassandra-rc2/docs/mb-script-testing.md diff --git a/docs/mb-sync.md b/cassandra-rc2/docs/mb-sync.md similarity index 100% rename from docs/mb-sync.md rename to cassandra-rc2/docs/mb-sync.md diff --git a/docs/mb-todos.md b/cassandra-rc2/docs/mb-todos.md similarity index 100% rename from docs/mb-todos.md rename to cassandra-rc2/docs/mb-todos.md diff --git a/docs/modbus-rtu.md b/cassandra-rc2/docs/modbus-rtu.md similarity index 100% rename from docs/modbus-rtu.md rename to cassandra-rc2/docs/modbus-rtu.md diff --git a/docs/mqtt-pid.md b/cassandra-rc2/docs/mqtt-pid.md similarity index 100% rename from docs/mqtt-pid.md rename to cassandra-rc2/docs/mqtt-pid.md diff --git a/docs/nc-mb.md b/cassandra-rc2/docs/nc-mb.md similarity index 100% rename from docs/nc-mb.md rename to cassandra-rc2/docs/nc-mb.md diff --git a/docs/nc-persistence.md b/cassandra-rc2/docs/nc-persistence.md similarity index 100% rename from docs/nc-persistence.md rename to cassandra-rc2/docs/nc-persistence.md diff --git a/docs/network-values.md b/cassandra-rc2/docs/network-values.md similarity index 100% rename from docs/network-values.md rename to cassandra-rc2/docs/network-values.md diff --git a/docs/network_component.md b/cassandra-rc2/docs/network_component.md similarity index 100% rename from docs/network_component.md rename to cassandra-rc2/docs/network_component.md diff --git a/docs/notes.md b/cassandra-rc2/docs/notes.md similarity index 100% rename from docs/notes.md rename to cassandra-rc2/docs/notes.md diff --git a/docs/omron-cooling.md b/cassandra-rc2/docs/omron-cooling.md similarity index 100% rename from docs/omron-cooling.md rename to cassandra-rc2/docs/omron-cooling.md diff --git a/docs/omron/E5DC-B_H175-E1-08.pdf b/cassandra-rc2/docs/omron/E5DC-B_H175-E1-08.pdf similarity index 100% rename from docs/omron/E5DC-B_H175-E1-08.pdf rename to cassandra-rc2/docs/omron/E5DC-B_H175-E1-08.pdf diff --git a/docs/omron/convert.md b/cassandra-rc2/docs/omron/convert.md similarity index 100% rename from docs/omron/convert.md rename to cassandra-rc2/docs/omron/convert.md diff --git a/docs/omron/convert.sh b/cassandra-rc2/docs/omron/convert.sh similarity index 100% rename from docs/omron/convert.sh rename to cassandra-rc2/docs/omron/convert.sh diff --git a/docs/omron/e5dc_8_100.jpg b/cassandra-rc2/docs/omron/e5dc_8_100.jpg similarity index 100% rename from docs/omron/e5dc_8_100.jpg rename to cassandra-rc2/docs/omron/e5dc_8_100.jpg diff --git a/docs/omron/e5dc_8_101.jpg b/cassandra-rc2/docs/omron/e5dc_8_101.jpg similarity index 100% rename from docs/omron/e5dc_8_101.jpg rename to cassandra-rc2/docs/omron/e5dc_8_101.jpg diff --git a/docs/omron/e5dc_8_102.jpg b/cassandra-rc2/docs/omron/e5dc_8_102.jpg similarity index 100% rename from docs/omron/e5dc_8_102.jpg rename to cassandra-rc2/docs/omron/e5dc_8_102.jpg diff --git a/docs/omron/e5dc_8_103.jpg b/cassandra-rc2/docs/omron/e5dc_8_103.jpg similarity index 100% rename from docs/omron/e5dc_8_103.jpg rename to cassandra-rc2/docs/omron/e5dc_8_103.jpg diff --git a/docs/omron/e5dc_8_104.jpg b/cassandra-rc2/docs/omron/e5dc_8_104.jpg similarity index 100% rename from docs/omron/e5dc_8_104.jpg rename to cassandra-rc2/docs/omron/e5dc_8_104.jpg diff --git a/docs/omron/e5dc_8_105.jpg b/cassandra-rc2/docs/omron/e5dc_8_105.jpg similarity index 100% rename from docs/omron/e5dc_8_105.jpg rename to cassandra-rc2/docs/omron/e5dc_8_105.jpg diff --git a/docs/omron/e5dc_8_106.jpg b/cassandra-rc2/docs/omron/e5dc_8_106.jpg similarity index 100% rename from docs/omron/e5dc_8_106.jpg rename to cassandra-rc2/docs/omron/e5dc_8_106.jpg diff --git a/docs/omron/e5dc_8_87.jpg b/cassandra-rc2/docs/omron/e5dc_8_87.jpg similarity index 100% rename from docs/omron/e5dc_8_87.jpg rename to cassandra-rc2/docs/omron/e5dc_8_87.jpg diff --git a/docs/omron/e5dc_8_92.jpg b/cassandra-rc2/docs/omron/e5dc_8_92.jpg similarity index 100% rename from docs/omron/e5dc_8_92.jpg rename to cassandra-rc2/docs/omron/e5dc_8_92.jpg diff --git a/docs/omron/e5dc_8_93.jpg b/cassandra-rc2/docs/omron/e5dc_8_93.jpg similarity index 100% rename from docs/omron/e5dc_8_93.jpg rename to cassandra-rc2/docs/omron/e5dc_8_93.jpg diff --git a/docs/omron/e5dc_8_94.jpg b/cassandra-rc2/docs/omron/e5dc_8_94.jpg similarity index 100% rename from docs/omron/e5dc_8_94.jpg rename to cassandra-rc2/docs/omron/e5dc_8_94.jpg diff --git a/docs/omron/e5dc_8_95.jpg b/cassandra-rc2/docs/omron/e5dc_8_95.jpg similarity index 100% rename from docs/omron/e5dc_8_95.jpg rename to cassandra-rc2/docs/omron/e5dc_8_95.jpg diff --git a/docs/omron/e5dc_8_96.jpg b/cassandra-rc2/docs/omron/e5dc_8_96.jpg similarity index 100% rename from docs/omron/e5dc_8_96.jpg rename to cassandra-rc2/docs/omron/e5dc_8_96.jpg diff --git a/docs/omron/e5dc_8_97.jpg b/cassandra-rc2/docs/omron/e5dc_8_97.jpg similarity index 100% rename from docs/omron/e5dc_8_97.jpg rename to cassandra-rc2/docs/omron/e5dc_8_97.jpg diff --git a/docs/omron/e5dc_8_98.jpg b/cassandra-rc2/docs/omron/e5dc_8_98.jpg similarity index 100% rename from docs/omron/e5dc_8_98.jpg rename to cassandra-rc2/docs/omron/e5dc_8_98.jpg diff --git a/docs/omron/e5dc_8_99.jpg b/cassandra-rc2/docs/omron/e5dc_8_99.jpg similarity index 100% rename from docs/omron/e5dc_8_99.jpg rename to cassandra-rc2/docs/omron/e5dc_8_99.jpg diff --git a/docs/omron/extract.sh b/cassandra-rc2/docs/omron/extract.sh similarity index 100% rename from docs/omron/extract.sh rename to cassandra-rc2/docs/omron/extract.sh diff --git a/docs/omron/modbus.md b/cassandra-rc2/docs/omron/modbus.md similarity index 100% rename from docs/omron/modbus.md rename to cassandra-rc2/docs/omron/modbus.md diff --git a/docs/omron/omron.h b/cassandra-rc2/docs/omron/omron.h similarity index 100% rename from docs/omron/omron.h rename to cassandra-rc2/docs/omron/omron.h diff --git a/docs/omron/readme.md b/cassandra-rc2/docs/omron/readme.md similarity index 100% rename from docs/omron/readme.md rename to cassandra-rc2/docs/omron/readme.md diff --git a/docs/pc.md b/cassandra-rc2/docs/pc.md similarity index 100% rename from docs/pc.md rename to cassandra-rc2/docs/pc.md diff --git a/docs/plunger-manual.md b/cassandra-rc2/docs/plunger-manual.md similarity index 100% rename from docs/plunger-manual.md rename to cassandra-rc2/docs/plunger-manual.md diff --git a/docs/plunger-settings.md b/cassandra-rc2/docs/plunger-settings.md similarity index 100% rename from docs/plunger-settings.md rename to cassandra-rc2/docs/plunger-settings.md diff --git a/docs/press-cylinder.md b/cassandra-rc2/docs/press-cylinder.md similarity index 100% rename from docs/press-cylinder.md rename to cassandra-rc2/docs/press-cylinder.md diff --git a/docs/pressure-profile.md b/cassandra-rc2/docs/pressure-profile.md similarity index 100% rename from docs/pressure-profile.md rename to cassandra-rc2/docs/pressure-profile.md diff --git a/docs/protobuf.md b/cassandra-rc2/docs/protobuf.md similarity index 100% rename from docs/protobuf.md rename to cassandra-rc2/docs/protobuf.md diff --git a/docs/seq-heating.md b/cassandra-rc2/docs/seq-heating.md similarity index 100% rename from docs/seq-heating.md rename to cassandra-rc2/docs/seq-heating.md diff --git a/docs/sequence.drawio b/cassandra-rc2/docs/sequence.drawio similarity index 100% rename from docs/sequence.drawio rename to cassandra-rc2/docs/sequence.drawio diff --git a/docs/serial.md b/cassandra-rc2/docs/serial.md similarity index 100% rename from docs/serial.md rename to cassandra-rc2/docs/serial.md diff --git a/docs/temp-override.md b/cassandra-rc2/docs/temp-override.md similarity index 100% rename from docs/temp-override.md rename to cassandra-rc2/docs/temp-override.md diff --git a/docs/web.md b/cassandra-rc2/docs/web.md similarity index 100% rename from docs/web.md rename to cassandra-rc2/docs/web.md diff --git a/docs/wifi-settings.md b/cassandra-rc2/docs/wifi-settings.md similarity index 100% rename from docs/wifi-settings.md rename to cassandra-rc2/docs/wifi-settings.md diff --git a/docs/wifi.md b/cassandra-rc2/docs/wifi.md similarity index 100% rename from docs/wifi.md rename to cassandra-rc2/docs/wifi.md diff --git a/docs/ws-updates.md b/cassandra-rc2/docs/ws-updates.md similarity index 100% rename from docs/ws-updates.md rename to cassandra-rc2/docs/ws-updates.md diff --git a/idf_component.yml b/cassandra-rc2/idf_component.yml similarity index 100% rename from idf_component.yml rename to cassandra-rc2/idf_component.yml diff --git a/include/README b/cassandra-rc2/include/README similarity index 100% rename from include/README rename to cassandra-rc2/include/README diff --git a/include/ar.h b/cassandra-rc2/include/ar.h similarity index 100% rename from include/ar.h rename to cassandra-rc2/include/ar.h diff --git a/lib/ArduinoJson/ArduinoJson.h b/cassandra-rc2/lib/ArduinoJson/ArduinoJson.h similarity index 100% rename from lib/ArduinoJson/ArduinoJson.h rename to cassandra-rc2/lib/ArduinoJson/ArduinoJson.h diff --git a/lib/ArduinoJson/CHANGELOG.md b/cassandra-rc2/lib/ArduinoJson/CHANGELOG.md similarity index 100% rename from lib/ArduinoJson/CHANGELOG.md rename to cassandra-rc2/lib/ArduinoJson/CHANGELOG.md diff --git a/lib/ArduinoJson/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/CMakeLists.txt diff --git a/lib/ArduinoJson/CONTRIBUTING.md b/cassandra-rc2/lib/ArduinoJson/CONTRIBUTING.md similarity index 100% rename from lib/ArduinoJson/CONTRIBUTING.md rename to cassandra-rc2/lib/ArduinoJson/CONTRIBUTING.md diff --git a/lib/ArduinoJson/LICENSE.txt b/cassandra-rc2/lib/ArduinoJson/LICENSE.txt similarity index 100% rename from lib/ArduinoJson/LICENSE.txt rename to cassandra-rc2/lib/ArduinoJson/LICENSE.txt diff --git a/lib/ArduinoJson/README.md b/cassandra-rc2/lib/ArduinoJson/README.md similarity index 100% rename from lib/ArduinoJson/README.md rename to cassandra-rc2/lib/ArduinoJson/README.md diff --git a/lib/ArduinoJson/SUPPORT.md b/cassandra-rc2/lib/ArduinoJson/SUPPORT.md similarity index 100% rename from lib/ArduinoJson/SUPPORT.md rename to cassandra-rc2/lib/ArduinoJson/SUPPORT.md diff --git a/lib/ArduinoJson/appveyor.yml b/cassandra-rc2/lib/ArduinoJson/appveyor.yml similarity index 100% rename from lib/ArduinoJson/appveyor.yml rename to cassandra-rc2/lib/ArduinoJson/appveyor.yml diff --git a/lib/ArduinoJson/component.mk b/cassandra-rc2/lib/ArduinoJson/component.mk similarity index 100% rename from lib/ArduinoJson/component.mk rename to cassandra-rc2/lib/ArduinoJson/component.mk diff --git a/lib/ArduinoJson/examples/JsonConfigFile/JsonConfigFile.ino b/cassandra-rc2/lib/ArduinoJson/examples/JsonConfigFile/JsonConfigFile.ino similarity index 100% rename from lib/ArduinoJson/examples/JsonConfigFile/JsonConfigFile.ino rename to cassandra-rc2/lib/ArduinoJson/examples/JsonConfigFile/JsonConfigFile.ino diff --git a/lib/ArduinoJson/examples/JsonFilterExample/JsonFilterExample.ino b/cassandra-rc2/lib/ArduinoJson/examples/JsonFilterExample/JsonFilterExample.ino similarity index 100% rename from lib/ArduinoJson/examples/JsonFilterExample/JsonFilterExample.ino rename to cassandra-rc2/lib/ArduinoJson/examples/JsonFilterExample/JsonFilterExample.ino diff --git a/lib/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino b/cassandra-rc2/lib/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino similarity index 100% rename from lib/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino rename to cassandra-rc2/lib/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino diff --git a/lib/ArduinoJson/examples/JsonHttpClient/JsonHttpClient.ino b/cassandra-rc2/lib/ArduinoJson/examples/JsonHttpClient/JsonHttpClient.ino similarity index 100% rename from lib/ArduinoJson/examples/JsonHttpClient/JsonHttpClient.ino rename to cassandra-rc2/lib/ArduinoJson/examples/JsonHttpClient/JsonHttpClient.ino diff --git a/lib/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino b/cassandra-rc2/lib/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino similarity index 100% rename from lib/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino rename to cassandra-rc2/lib/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino diff --git a/lib/ArduinoJson/examples/JsonServer/JsonServer.ino b/cassandra-rc2/lib/ArduinoJson/examples/JsonServer/JsonServer.ino similarity index 100% rename from lib/ArduinoJson/examples/JsonServer/JsonServer.ino rename to cassandra-rc2/lib/ArduinoJson/examples/JsonServer/JsonServer.ino diff --git a/lib/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino b/cassandra-rc2/lib/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino similarity index 100% rename from lib/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino rename to cassandra-rc2/lib/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino diff --git a/lib/ArduinoJson/examples/MsgPackParser/MsgPackParser.ino b/cassandra-rc2/lib/ArduinoJson/examples/MsgPackParser/MsgPackParser.ino similarity index 100% rename from lib/ArduinoJson/examples/MsgPackParser/MsgPackParser.ino rename to cassandra-rc2/lib/ArduinoJson/examples/MsgPackParser/MsgPackParser.ino diff --git a/lib/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino b/cassandra-rc2/lib/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino similarity index 100% rename from lib/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino rename to cassandra-rc2/lib/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino diff --git a/lib/ArduinoJson/examples/StringExample/StringExample.ino b/cassandra-rc2/lib/ArduinoJson/examples/StringExample/StringExample.ino similarity index 100% rename from lib/ArduinoJson/examples/StringExample/StringExample.ino rename to cassandra-rc2/lib/ArduinoJson/examples/StringExample/StringExample.ino diff --git a/lib/ArduinoJson/extras/ArduinoJsonConfig.cmake.in b/cassandra-rc2/lib/ArduinoJson/extras/ArduinoJsonConfig.cmake.in similarity index 100% rename from lib/ArduinoJson/extras/ArduinoJsonConfig.cmake.in rename to cassandra-rc2/lib/ArduinoJson/extras/ArduinoJsonConfig.cmake.in diff --git a/lib/ArduinoJson/extras/CompileOptions.cmake b/cassandra-rc2/lib/ArduinoJson/extras/CompileOptions.cmake similarity index 100% rename from lib/ArduinoJson/extras/CompileOptions.cmake rename to cassandra-rc2/lib/ArduinoJson/extras/CompileOptions.cmake diff --git a/lib/ArduinoJson/extras/ci/espidf/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/ci/espidf/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/ci/espidf/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/ci/espidf/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/ci/espidf/main/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/ci/espidf/main/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/ci/espidf/main/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/ci/espidf/main/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/ci/espidf/main/component.mk b/cassandra-rc2/lib/ArduinoJson/extras/ci/espidf/main/component.mk similarity index 100% rename from lib/ArduinoJson/extras/ci/espidf/main/component.mk rename to cassandra-rc2/lib/ArduinoJson/extras/ci/espidf/main/component.mk diff --git a/lib/ArduinoJson/extras/ci/espidf/main/main.cpp b/cassandra-rc2/lib/ArduinoJson/extras/ci/espidf/main/main.cpp similarity index 100% rename from lib/ArduinoJson/extras/ci/espidf/main/main.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/ci/espidf/main/main.cpp diff --git a/lib/ArduinoJson/extras/ci/particle.sh b/cassandra-rc2/lib/ArduinoJson/extras/ci/particle.sh similarity index 100% rename from lib/ArduinoJson/extras/ci/particle.sh rename to cassandra-rc2/lib/ArduinoJson/extras/ci/particle.sh diff --git a/lib/ArduinoJson/extras/conf_test/avr.cpp b/cassandra-rc2/lib/ArduinoJson/extras/conf_test/avr.cpp similarity index 100% rename from lib/ArduinoJson/extras/conf_test/avr.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/conf_test/avr.cpp diff --git a/lib/ArduinoJson/extras/conf_test/esp8266.cpp b/cassandra-rc2/lib/ArduinoJson/extras/conf_test/esp8266.cpp similarity index 100% rename from lib/ArduinoJson/extras/conf_test/esp8266.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/conf_test/esp8266.cpp diff --git a/lib/ArduinoJson/extras/conf_test/x64.cpp b/cassandra-rc2/lib/ArduinoJson/extras/conf_test/x64.cpp similarity index 100% rename from lib/ArduinoJson/extras/conf_test/x64.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/conf_test/x64.cpp diff --git a/lib/ArduinoJson/extras/conf_test/x86.cpp b/cassandra-rc2/lib/ArduinoJson/extras/conf_test/x86.cpp similarity index 100% rename from lib/ArduinoJson/extras/conf_test/x86.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/conf_test/x86.cpp diff --git a/lib/ArduinoJson/extras/fuzzing/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/fuzzing/Makefile b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/Makefile similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/Makefile rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/Makefile diff --git a/lib/ArduinoJson/extras/fuzzing/json_fuzzer.cpp b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_fuzzer.cpp similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/json_fuzzer.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_fuzzer.cpp diff --git a/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Comments.json b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Comments.json similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Comments.json rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Comments.json diff --git a/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyArray.json b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyArray.json similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyArray.json rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyArray.json diff --git a/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyObject.json b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyObject.json similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyObject.json rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyObject.json diff --git a/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/ExcessiveNesting.json b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/ExcessiveNesting.json similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/json_seed_corpus/ExcessiveNesting.json rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/ExcessiveNesting.json diff --git a/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/IntegerOverflow.json b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/IntegerOverflow.json similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/json_seed_corpus/IntegerOverflow.json rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/IntegerOverflow.json diff --git a/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Numbers.json b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Numbers.json similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Numbers.json rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Numbers.json diff --git a/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/OpenWeatherMap.json b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/OpenWeatherMap.json similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/json_seed_corpus/OpenWeatherMap.json rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/OpenWeatherMap.json diff --git a/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Strings.json b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Strings.json similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Strings.json rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Strings.json diff --git a/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/WeatherUnderground.json b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/WeatherUnderground.json similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/json_seed_corpus/WeatherUnderground.json rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/WeatherUnderground.json diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_fuzzer.cpp b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_fuzzer.cpp similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_fuzzer.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_fuzzer.cpp diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/false b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/false similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/false rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/false diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_negative b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_negative similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_negative rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_negative diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_positive b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_positive similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_positive rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_positive diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/true b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/true similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/true rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/true diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64 diff --git a/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8 b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8 similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8 rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8 diff --git a/lib/ArduinoJson/extras/fuzzing/reproducer.cpp b/cassandra-rc2/lib/ArduinoJson/extras/fuzzing/reproducer.cpp similarity index 100% rename from lib/ArduinoJson/extras/fuzzing/reproducer.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/fuzzing/reproducer.cpp diff --git a/lib/ArduinoJson/extras/particle/project.properties b/cassandra-rc2/lib/ArduinoJson/extras/particle/project.properties similarity index 100% rename from lib/ArduinoJson/extras/particle/project.properties rename to cassandra-rc2/lib/ArduinoJson/extras/particle/project.properties diff --git a/lib/ArduinoJson/extras/particle/src/smocktest.ino b/cassandra-rc2/lib/ArduinoJson/extras/particle/src/smocktest.ino similarity index 100% rename from lib/ArduinoJson/extras/particle/src/smocktest.ino rename to cassandra-rc2/lib/ArduinoJson/extras/particle/src/smocktest.ino diff --git a/lib/ArduinoJson/extras/scripts/build-single-header.sh b/cassandra-rc2/lib/ArduinoJson/extras/scripts/build-single-header.sh similarity index 100% rename from lib/ArduinoJson/extras/scripts/build-single-header.sh rename to cassandra-rc2/lib/ArduinoJson/extras/scripts/build-single-header.sh diff --git a/lib/ArduinoJson/extras/scripts/extract_changes.awk b/cassandra-rc2/lib/ArduinoJson/extras/scripts/extract_changes.awk similarity index 100% rename from lib/ArduinoJson/extras/scripts/extract_changes.awk rename to cassandra-rc2/lib/ArduinoJson/extras/scripts/extract_changes.awk diff --git a/lib/ArduinoJson/extras/scripts/get-release-page.sh b/cassandra-rc2/lib/ArduinoJson/extras/scripts/get-release-page.sh similarity index 100% rename from lib/ArduinoJson/extras/scripts/get-release-page.sh rename to cassandra-rc2/lib/ArduinoJson/extras/scripts/get-release-page.sh diff --git a/lib/ArduinoJson/extras/scripts/publish-particle-library.sh b/cassandra-rc2/lib/ArduinoJson/extras/scripts/publish-particle-library.sh similarity index 100% rename from lib/ArduinoJson/extras/scripts/publish-particle-library.sh rename to cassandra-rc2/lib/ArduinoJson/extras/scripts/publish-particle-library.sh diff --git a/lib/ArduinoJson/extras/scripts/publish.sh b/cassandra-rc2/lib/ArduinoJson/extras/scripts/publish.sh similarity index 100% rename from lib/ArduinoJson/extras/scripts/publish.sh rename to cassandra-rc2/lib/ArduinoJson/extras/scripts/publish.sh diff --git a/lib/ArduinoJson/extras/scripts/wandbox/JsonGeneratorExample.cpp b/cassandra-rc2/lib/ArduinoJson/extras/scripts/wandbox/JsonGeneratorExample.cpp similarity index 100% rename from lib/ArduinoJson/extras/scripts/wandbox/JsonGeneratorExample.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/scripts/wandbox/JsonGeneratorExample.cpp diff --git a/lib/ArduinoJson/extras/scripts/wandbox/JsonParserExample.cpp b/cassandra-rc2/lib/ArduinoJson/extras/scripts/wandbox/JsonParserExample.cpp similarity index 100% rename from lib/ArduinoJson/extras/scripts/wandbox/JsonParserExample.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/scripts/wandbox/JsonParserExample.cpp diff --git a/lib/ArduinoJson/extras/scripts/wandbox/MsgPackParserExample.cpp b/cassandra-rc2/lib/ArduinoJson/extras/scripts/wandbox/MsgPackParserExample.cpp similarity index 100% rename from lib/ArduinoJson/extras/scripts/wandbox/MsgPackParserExample.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/scripts/wandbox/MsgPackParserExample.cpp diff --git a/lib/ArduinoJson/extras/scripts/wandbox/publish.sh b/cassandra-rc2/lib/ArduinoJson/extras/scripts/wandbox/publish.sh similarity index 100% rename from lib/ArduinoJson/extras/scripts/wandbox/publish.sh rename to cassandra-rc2/lib/ArduinoJson/extras/scripts/wandbox/publish.sh diff --git a/lib/ArduinoJson/extras/tests/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/Cpp17/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/Cpp17/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/Cpp17/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Cpp17/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/Cpp17/string_view.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Cpp17/string_view.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Cpp17/string_view.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Cpp17/string_view.cpp diff --git a/lib/ArduinoJson/extras/tests/Cpp20/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/Cpp20/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/Cpp20/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Cpp20/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/Cpp20/smoke_test.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Cpp20/smoke_test.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Cpp20/smoke_test.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Cpp20/smoke_test.cpp diff --git a/lib/ArduinoJson/extras/tests/Deprecated/BasicJsonDocument.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/BasicJsonDocument.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/BasicJsonDocument.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/BasicJsonDocument.cpp diff --git a/lib/ArduinoJson/extras/tests/Deprecated/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/Deprecated/DynamicJsonDocument.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/DynamicJsonDocument.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/DynamicJsonDocument.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/DynamicJsonDocument.cpp diff --git a/lib/ArduinoJson/extras/tests/Deprecated/StaticJsonDocument.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/StaticJsonDocument.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/StaticJsonDocument.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/StaticJsonDocument.cpp diff --git a/lib/ArduinoJson/extras/tests/Deprecated/add.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/add.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/add.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/add.cpp diff --git a/lib/ArduinoJson/extras/tests/Deprecated/containsKey.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/containsKey.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/containsKey.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/containsKey.cpp diff --git a/lib/ArduinoJson/extras/tests/Deprecated/createNestedArray.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/createNestedArray.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/createNestedArray.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/createNestedArray.cpp diff --git a/lib/ArduinoJson/extras/tests/Deprecated/createNestedObject.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/createNestedObject.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/createNestedObject.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/createNestedObject.cpp diff --git a/lib/ArduinoJson/extras/tests/Deprecated/macros.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/macros.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/macros.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/macros.cpp diff --git a/lib/ArduinoJson/extras/tests/Deprecated/memoryUsage.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/memoryUsage.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/memoryUsage.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/memoryUsage.cpp diff --git a/lib/ArduinoJson/extras/tests/Deprecated/shallowCopy.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/shallowCopy.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Deprecated/shallowCopy.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Deprecated/shallowCopy.cpp diff --git a/lib/ArduinoJson/extras/tests/FailingBuilds/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/FailingBuilds/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/FailingBuilds/Issue978.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/Issue978.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/FailingBuilds/Issue978.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/Issue978.cpp diff --git a/lib/ArduinoJson/extras/tests/FailingBuilds/assign_char.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/assign_char.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/FailingBuilds/assign_char.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/assign_char.cpp diff --git a/lib/ArduinoJson/extras/tests/FailingBuilds/deserialize_object.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/deserialize_object.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/FailingBuilds/deserialize_object.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/deserialize_object.cpp diff --git a/lib/ArduinoJson/extras/tests/FailingBuilds/read_long_long.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/read_long_long.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/FailingBuilds/read_long_long.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/read_long_long.cpp diff --git a/lib/ArduinoJson/extras/tests/FailingBuilds/variant_as_char.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/variant_as_char.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/FailingBuilds/variant_as_char.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/variant_as_char.cpp diff --git a/lib/ArduinoJson/extras/tests/FailingBuilds/write_long_long.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/write_long_long.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/FailingBuilds/write_long_long.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/FailingBuilds/write_long_long.cpp diff --git a/lib/ArduinoJson/extras/tests/Helpers/Allocators.hpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/Allocators.hpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Helpers/Allocators.hpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/Allocators.hpp diff --git a/lib/ArduinoJson/extras/tests/Helpers/Arduino.h b/cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/Arduino.h similarity index 100% rename from lib/ArduinoJson/extras/tests/Helpers/Arduino.h rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/Arduino.h diff --git a/lib/ArduinoJson/extras/tests/Helpers/CustomReader.hpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/CustomReader.hpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Helpers/CustomReader.hpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/CustomReader.hpp diff --git a/lib/ArduinoJson/extras/tests/Helpers/Literals.hpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/Literals.hpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Helpers/Literals.hpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/Literals.hpp diff --git a/lib/ArduinoJson/extras/tests/Helpers/api/Print.h b/cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/api/Print.h similarity index 100% rename from lib/ArduinoJson/extras/tests/Helpers/api/Print.h rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/api/Print.h diff --git a/lib/ArduinoJson/extras/tests/Helpers/api/Stream.h b/cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/api/Stream.h similarity index 100% rename from lib/ArduinoJson/extras/tests/Helpers/api/Stream.h rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/api/Stream.h diff --git a/lib/ArduinoJson/extras/tests/Helpers/api/String.h b/cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/api/String.h similarity index 100% rename from lib/ArduinoJson/extras/tests/Helpers/api/String.h rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/api/String.h diff --git a/lib/ArduinoJson/extras/tests/Helpers/avr/pgmspace.h b/cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/avr/pgmspace.h similarity index 100% rename from lib/ArduinoJson/extras/tests/Helpers/avr/pgmspace.h rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Helpers/avr/pgmspace.h diff --git a/lib/ArduinoJson/extras/tests/IntegrationTests/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/IntegrationTests/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/IntegrationTests/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/IntegrationTests/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/IntegrationTests/gbathree.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/IntegrationTests/gbathree.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/IntegrationTests/gbathree.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/IntegrationTests/gbathree.cpp diff --git a/lib/ArduinoJson/extras/tests/IntegrationTests/issue772.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/IntegrationTests/issue772.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/IntegrationTests/issue772.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/IntegrationTests/issue772.cpp diff --git a/lib/ArduinoJson/extras/tests/IntegrationTests/openweathermap.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/IntegrationTests/openweathermap.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/IntegrationTests/openweathermap.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/IntegrationTests/openweathermap.cpp diff --git a/lib/ArduinoJson/extras/tests/IntegrationTests/round_trip.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/IntegrationTests/round_trip.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/IntegrationTests/round_trip.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/IntegrationTests/round_trip.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/JsonArray/add.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/add.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/add.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/add.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/clear.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/clear.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/clear.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/clear.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/compare.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/compare.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/compare.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/compare.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/copyArray.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/copyArray.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/copyArray.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/copyArray.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/equals.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/equals.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/equals.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/equals.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/isNull.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/isNull.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/isNull.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/isNull.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/iterator.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/iterator.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/iterator.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/iterator.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/nesting.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/nesting.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/nesting.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/nesting.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/remove.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/remove.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/remove.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/remove.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/size.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/size.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/size.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/size.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/subscript.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/subscript.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/subscript.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/subscript.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArray/unbound.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/unbound.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArray/unbound.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArray/unbound.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArrayConst/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArrayConst/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/JsonArrayConst/equals.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/equals.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArrayConst/equals.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/equals.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArrayConst/isNull.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/isNull.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArrayConst/isNull.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/isNull.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArrayConst/iterator.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/iterator.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArrayConst/iterator.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/iterator.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArrayConst/nesting.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/nesting.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArrayConst/nesting.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/nesting.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArrayConst/size.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/size.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArrayConst/size.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/size.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonArrayConst/subscript.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/subscript.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonArrayConst/subscript.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonArrayConst/subscript.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/DeserializationError.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/DeserializationError.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/DeserializationError.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/DeserializationError.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/array.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/array.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/array.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/array.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/destination_types.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/destination_types.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/destination_types.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/destination_types.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/errors.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/errors.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/errors.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/errors.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/filter.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/filter.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/filter.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/filter.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/input_types.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/input_types.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/input_types.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/input_types.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/misc.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/misc.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/misc.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/misc.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/nestingLimit.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/nestingLimit.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/nestingLimit.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/nestingLimit.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/number.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/number.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/number.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/number.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/object.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/object.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/object.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/object.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDeserializer/string.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/string.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDeserializer/string.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDeserializer/string.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/ElementProxy.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/ElementProxy.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/ElementProxy.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/ElementProxy.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/MemberProxy.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/MemberProxy.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/MemberProxy.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/MemberProxy.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/add.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/add.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/add.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/add.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/assignment.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/assignment.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/assignment.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/assignment.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/cast.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/cast.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/cast.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/cast.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/clear.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/clear.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/clear.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/clear.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/compare.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/compare.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/compare.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/compare.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/constructor.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/constructor.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/constructor.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/constructor.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/isNull.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/isNull.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/isNull.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/isNull.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/issue1120.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/issue1120.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/issue1120.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/issue1120.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/nesting.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/nesting.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/nesting.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/nesting.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/overflowed.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/overflowed.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/overflowed.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/overflowed.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/remove.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/remove.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/remove.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/remove.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/set.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/set.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/set.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/set.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/shrinkToFit.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/shrinkToFit.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/shrinkToFit.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/shrinkToFit.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/size.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/size.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/size.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/size.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/subscript.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/subscript.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/subscript.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/subscript.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonDocument/swap.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/swap.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonDocument/swap.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonDocument/swap.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/JsonObject/clear.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/clear.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/clear.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/clear.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/compare.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/compare.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/compare.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/compare.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/equals.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/equals.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/equals.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/equals.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/isNull.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/isNull.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/isNull.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/isNull.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/iterator.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/iterator.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/iterator.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/iterator.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/nesting.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/nesting.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/nesting.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/nesting.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/remove.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/remove.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/remove.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/remove.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/set.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/set.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/set.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/set.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/size.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/size.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/size.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/size.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/std_string.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/std_string.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/std_string.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/std_string.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/subscript.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/subscript.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/subscript.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/subscript.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObject/unbound.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/unbound.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObject/unbound.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObject/unbound.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObjectConst/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObjectConst/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/JsonObjectConst/equals.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/equals.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObjectConst/equals.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/equals.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObjectConst/isNull.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/isNull.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObjectConst/isNull.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/isNull.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObjectConst/iterator.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/iterator.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObjectConst/iterator.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/iterator.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObjectConst/nesting.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/nesting.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObjectConst/nesting.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/nesting.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObjectConst/size.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/size.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObjectConst/size.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/size.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonObjectConst/subscript.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/subscript.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonObjectConst/subscript.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonObjectConst/subscript.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonSerializer/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonSerializer/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/JsonSerializer/CustomWriter.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/CustomWriter.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonSerializer/CustomWriter.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/CustomWriter.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArray.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArray.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonSerializer/JsonArray.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArray.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArrayPretty.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArrayPretty.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonSerializer/JsonArrayPretty.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArrayPretty.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObject.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObject.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonSerializer/JsonObject.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObject.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObjectPretty.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObjectPretty.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonSerializer/JsonObjectPretty.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObjectPretty.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonSerializer/JsonVariant.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/JsonVariant.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonSerializer/JsonVariant.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/JsonVariant.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonSerializer/misc.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/misc.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonSerializer/misc.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/misc.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonSerializer/std_stream.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/std_stream.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonSerializer/std_stream.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/std_stream.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonSerializer/std_string.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/std_string.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonSerializer/std_string.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonSerializer/std_string.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/add.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/add.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/add.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/add.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/as.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/as.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/as.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/as.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/clear.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/clear.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/clear.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/clear.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/compare.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/compare.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/compare.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/compare.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/converters.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/converters.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/converters.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/converters.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/copy.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/copy.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/copy.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/copy.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/is.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/is.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/is.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/is.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/isnull.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/isnull.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/isnull.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/isnull.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/misc.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/misc.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/misc.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/misc.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/nesting.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/nesting.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/nesting.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/nesting.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/nullptr.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/nullptr.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/nullptr.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/nullptr.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/or.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/or.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/or.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/or.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/overflow.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/overflow.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/overflow.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/overflow.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/remove.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/remove.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/remove.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/remove.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/set.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/set.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/set.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/set.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/size.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/size.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/size.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/size.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/stl_containers.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/stl_containers.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/stl_containers.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/stl_containers.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/subscript.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/subscript.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/subscript.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/subscript.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/types.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/types.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/types.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/types.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariant/unbound.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/unbound.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariant/unbound.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariant/unbound.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariantConst/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariantConst/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/JsonVariantConst/as.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/as.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariantConst/as.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/as.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariantConst/is.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/is.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariantConst/is.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/is.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariantConst/isnull.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/isnull.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariantConst/isnull.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/isnull.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariantConst/nesting.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/nesting.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariantConst/nesting.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/nesting.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariantConst/size.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/size.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariantConst/size.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/size.cpp diff --git a/lib/ArduinoJson/extras/tests/JsonVariantConst/subscript.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/subscript.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/JsonVariantConst/subscript.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/JsonVariantConst/subscript.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/Misc/JsonString.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/JsonString.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/JsonString.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/JsonString.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/NoArduinoHeader.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/NoArduinoHeader.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/NoArduinoHeader.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/NoArduinoHeader.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/Readers.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/Readers.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/Readers.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/Readers.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/StringAdapters.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/StringAdapters.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/StringAdapters.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/StringAdapters.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/StringWriter.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/StringWriter.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/StringWriter.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/StringWriter.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/TypeTraits.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/TypeTraits.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/TypeTraits.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/TypeTraits.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/Utf16.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/Utf16.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/Utf16.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/Utf16.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/Utf8.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/Utf8.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/Utf8.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/Utf8.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/arithmeticCompare.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/arithmeticCompare.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/arithmeticCompare.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/arithmeticCompare.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/conflicts.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/conflicts.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/conflicts.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/conflicts.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/custom_string.hpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/custom_string.hpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/custom_string.hpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/custom_string.hpp diff --git a/lib/ArduinoJson/extras/tests/Misc/issue1967.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/issue1967.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/issue1967.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/issue1967.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/issue2129.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/issue2129.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/issue2129.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/issue2129.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/printable.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/printable.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/printable.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/printable.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/unsigned_char.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/unsigned_char.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/unsigned_char.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/unsigned_char.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/version.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/version.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/version.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/version.cpp diff --git a/lib/ArduinoJson/extras/tests/Misc/weird_strcmp.hpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/weird_strcmp.hpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Misc/weird_strcmp.hpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Misc/weird_strcmp.hpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_0.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_0.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_0.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_0.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_1.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_1.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_1.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_1.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_0.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_0.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_0.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_0.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_1.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_1.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_1.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_1.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_0.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_0.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_0.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_0.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_1.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_1.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_1.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_1.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_0.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_0.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_0.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_0.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_1.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_1.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_1.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_1.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_0.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_0.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_0.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_0.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_1.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_1.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_1.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_1.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_progmem_1.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_progmem_1.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/enable_progmem_1.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_progmem_1.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/issue1707.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/issue1707.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/issue1707.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/issue1707.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_1.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_1.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_1.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_1.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_2.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_2.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_2.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_2.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_4.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_4.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_4.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_4.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_0.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_0.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_0.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_0.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_1.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_1.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_1.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_1.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_0.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_0.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_0.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_0.cpp diff --git a/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_1.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_1.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_1.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_1.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackDeserializer/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackDeserializer/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeArray.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeArray.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeArray.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeArray.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeObject.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeObject.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeObject.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeObject.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeVariant.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeVariant.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeVariant.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeVariant.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackDeserializer/destination_types.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/destination_types.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackDeserializer/destination_types.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/destination_types.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackDeserializer/doubleToFloat.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/doubleToFloat.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackDeserializer/doubleToFloat.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/doubleToFloat.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackDeserializer/errors.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/errors.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackDeserializer/errors.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/errors.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackDeserializer/filter.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/filter.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackDeserializer/filter.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/filter.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackDeserializer/input_types.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/input_types.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackDeserializer/input_types.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/input_types.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackDeserializer/nestingLimit.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/nestingLimit.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackDeserializer/nestingLimit.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackDeserializer/nestingLimit.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackSerializer/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackSerializer/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/MsgPackSerializer/destination_types.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/destination_types.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackSerializer/destination_types.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/destination_types.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackSerializer/measure.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/measure.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackSerializer/measure.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/measure.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackSerializer/misc.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/misc.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackSerializer/misc.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/misc.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeArray.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeArray.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeArray.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeArray.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeObject.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeObject.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeObject.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeObject.cpp diff --git a/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeVariant.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeVariant.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeVariant.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeVariant.cpp diff --git a/lib/ArduinoJson/extras/tests/Numbers/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/Numbers/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/Numbers/convertNumber.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/convertNumber.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Numbers/convertNumber.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/convertNumber.cpp diff --git a/lib/ArduinoJson/extras/tests/Numbers/decomposeFloat.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/decomposeFloat.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Numbers/decomposeFloat.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/decomposeFloat.cpp diff --git a/lib/ArduinoJson/extras/tests/Numbers/parseDouble.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/parseDouble.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Numbers/parseDouble.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/parseDouble.cpp diff --git a/lib/ArduinoJson/extras/tests/Numbers/parseFloat.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/parseFloat.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Numbers/parseFloat.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/parseFloat.cpp diff --git a/lib/ArduinoJson/extras/tests/Numbers/parseInteger.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/parseInteger.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Numbers/parseInteger.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/parseInteger.cpp diff --git a/lib/ArduinoJson/extras/tests/Numbers/parseNumber.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/parseNumber.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/Numbers/parseNumber.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/Numbers/parseNumber.cpp diff --git a/lib/ArduinoJson/extras/tests/ResourceManager/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/ResourceManager/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/ResourceManager/StringBuilder.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/StringBuilder.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/ResourceManager/StringBuilder.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/StringBuilder.cpp diff --git a/lib/ArduinoJson/extras/tests/ResourceManager/allocVariant.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/allocVariant.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/ResourceManager/allocVariant.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/allocVariant.cpp diff --git a/lib/ArduinoJson/extras/tests/ResourceManager/clear.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/clear.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/ResourceManager/clear.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/clear.cpp diff --git a/lib/ArduinoJson/extras/tests/ResourceManager/saveString.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/saveString.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/ResourceManager/saveString.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/saveString.cpp diff --git a/lib/ArduinoJson/extras/tests/ResourceManager/shrinkToFit.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/shrinkToFit.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/ResourceManager/shrinkToFit.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/shrinkToFit.cpp diff --git a/lib/ArduinoJson/extras/tests/ResourceManager/size.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/size.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/ResourceManager/size.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/size.cpp diff --git a/lib/ArduinoJson/extras/tests/ResourceManager/swap.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/swap.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/ResourceManager/swap.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/ResourceManager/swap.cpp diff --git a/lib/ArduinoJson/extras/tests/TextFormatter/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/TextFormatter/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/TextFormatter/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/TextFormatter/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/TextFormatter/writeFloat.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/TextFormatter/writeFloat.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/TextFormatter/writeFloat.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/TextFormatter/writeFloat.cpp diff --git a/lib/ArduinoJson/extras/tests/TextFormatter/writeInteger.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/TextFormatter/writeInteger.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/TextFormatter/writeInteger.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/TextFormatter/writeInteger.cpp diff --git a/lib/ArduinoJson/extras/tests/TextFormatter/writeString.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/TextFormatter/writeString.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/TextFormatter/writeString.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/TextFormatter/writeString.cpp diff --git a/lib/ArduinoJson/extras/tests/catch/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/extras/tests/catch/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/extras/tests/catch/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/extras/tests/catch/CMakeLists.txt diff --git a/lib/ArduinoJson/extras/tests/catch/catch.cpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/catch/catch.cpp similarity index 100% rename from lib/ArduinoJson/extras/tests/catch/catch.cpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/catch/catch.cpp diff --git a/lib/ArduinoJson/extras/tests/catch/catch.hpp b/cassandra-rc2/lib/ArduinoJson/extras/tests/catch/catch.hpp similarity index 100% rename from lib/ArduinoJson/extras/tests/catch/catch.hpp rename to cassandra-rc2/lib/ArduinoJson/extras/tests/catch/catch.hpp diff --git a/lib/ArduinoJson/idf_component.yml b/cassandra-rc2/lib/ArduinoJson/idf_component.yml similarity index 100% rename from lib/ArduinoJson/idf_component.yml rename to cassandra-rc2/lib/ArduinoJson/idf_component.yml diff --git a/lib/ArduinoJson/keywords.txt b/cassandra-rc2/lib/ArduinoJson/keywords.txt similarity index 100% rename from lib/ArduinoJson/keywords.txt rename to cassandra-rc2/lib/ArduinoJson/keywords.txt diff --git a/lib/ArduinoJson/library.json b/cassandra-rc2/lib/ArduinoJson/library.json similarity index 100% rename from lib/ArduinoJson/library.json rename to cassandra-rc2/lib/ArduinoJson/library.json diff --git a/lib/ArduinoJson/library.properties b/cassandra-rc2/lib/ArduinoJson/library.properties similarity index 100% rename from lib/ArduinoJson/library.properties rename to cassandra-rc2/lib/ArduinoJson/library.properties diff --git a/lib/ArduinoJson/src/ArduinoJson.h b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson.h similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson.h rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson.h diff --git a/lib/ArduinoJson/src/ArduinoJson.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/ArrayData.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/ArrayData.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Array/ArrayData.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/ArrayData.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/ArrayImpl.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/ArrayImpl.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Array/ArrayImpl.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/ArrayImpl.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/ElementProxy.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/ElementProxy.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Array/ElementProxy.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/ElementProxy.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/JsonArray.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/JsonArray.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Array/JsonArray.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/JsonArray.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayConst.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayConst.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayConst.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayConst.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayIterator.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayIterator.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayIterator.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayIterator.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Array/Utilities.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/Utilities.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Array/Utilities.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Array/Utilities.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionData.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionData.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Collection/CollectionData.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionData.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionImpl.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionImpl.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Collection/CollectionImpl.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Collection/CollectionImpl.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Configuration.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Configuration.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Configuration.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Configuration.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationOptions.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationOptions.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationOptions.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationOptions.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Filter.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Filter.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/Filter.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Filter.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Reader.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Reader.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/Reader.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Reader.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/FlashReader.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/FlashReader.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/FlashReader.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/FlashReader.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/RamReader.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/RamReader.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/RamReader.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/RamReader.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/VariantReader.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/VariantReader.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/VariantReader.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/VariantReader.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Deserialization/deserialize.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/deserialize.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Deserialization/deserialize.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Deserialization/deserialize.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Document/JsonDocument.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Document/JsonDocument.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Document/JsonDocument.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Document/JsonDocument.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Json/EscapeSequence.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/EscapeSequence.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Json/EscapeSequence.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/EscapeSequence.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Json/JsonDeserializer.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/JsonDeserializer.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Json/JsonDeserializer.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/JsonDeserializer.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Json/JsonSerializer.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/JsonSerializer.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Json/JsonSerializer.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/JsonSerializer.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Json/Latch.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/Latch.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Json/Latch.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/Latch.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Json/PrettyJsonSerializer.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/PrettyJsonSerializer.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Json/PrettyJsonSerializer.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/PrettyJsonSerializer.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Json/TextFormatter.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/TextFormatter.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Json/TextFormatter.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/TextFormatter.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Json/Utf16.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/Utf16.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Json/Utf16.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/Utf16.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Json/Utf8.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/Utf8.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Json/Utf8.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Json/Utf8.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Memory/Alignment.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/Alignment.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Memory/Alignment.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/Alignment.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Memory/Allocator.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/Allocator.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Memory/Allocator.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/Allocator.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Memory/MemoryPool.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/MemoryPool.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Memory/MemoryPool.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/MemoryPool.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Memory/MemoryPoolList.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/MemoryPoolList.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Memory/MemoryPoolList.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/MemoryPoolList.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Memory/ResourceManager.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/ResourceManager.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Memory/ResourceManager.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/ResourceManager.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Memory/ResourceManagerImpl.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/ResourceManagerImpl.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Memory/ResourceManagerImpl.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/ResourceManagerImpl.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Memory/StringBuffer.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/StringBuffer.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Memory/StringBuffer.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/StringBuffer.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Memory/StringBuilder.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/StringBuilder.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Memory/StringBuilder.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/StringBuilder.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Memory/StringNode.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/StringNode.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Memory/StringNode.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/StringNode.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Memory/StringPool.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/StringPool.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Memory/StringPool.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Memory/StringPool.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Misc/SerializedValue.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Misc/SerializedValue.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Misc/SerializedValue.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Misc/SerializedValue.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackBinary.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackBinary.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackBinary.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackBinary.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackExtension.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackExtension.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackExtension.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackExtension.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/MsgPack/endianness.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/endianness.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/MsgPack/endianness.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/endianness.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/MsgPack/ieee754.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/ieee754.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/MsgPack/ieee754.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/MsgPack/ieee754.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Namespace.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Namespace.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Namespace.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Namespace.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Numbers/FloatParts.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/FloatParts.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Numbers/FloatParts.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/FloatParts.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Numbers/FloatTraits.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/FloatTraits.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Numbers/FloatTraits.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/FloatTraits.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Numbers/JsonFloat.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/JsonFloat.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Numbers/JsonFloat.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/JsonFloat.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Numbers/JsonInteger.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/JsonInteger.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Numbers/JsonInteger.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/JsonInteger.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Numbers/arithmeticCompare.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/arithmeticCompare.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Numbers/arithmeticCompare.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/arithmeticCompare.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Numbers/convertNumber.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/convertNumber.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Numbers/convertNumber.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/convertNumber.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Numbers/parseNumber.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/parseNumber.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Numbers/parseNumber.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Numbers/parseNumber.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Object/JsonObject.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/JsonObject.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Object/JsonObject.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/JsonObject.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectConst.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectConst.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectConst.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectConst.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectIterator.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectIterator.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectIterator.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectIterator.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Object/JsonPair.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/JsonPair.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Object/JsonPair.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/JsonPair.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Object/ObjectData.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/ObjectData.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Object/ObjectData.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/ObjectData.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Object/ObjectImpl.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/ObjectImpl.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Object/ObjectImpl.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Object/ObjectImpl.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/alias_cast.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/alias_cast.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/alias_cast.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/alias_cast.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/assert.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/assert.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/assert.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/assert.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/attributes.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/attributes.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/attributes.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/attributes.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/ctype.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/ctype.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/ctype.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/ctype.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/integer.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/integer.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/integer.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/integer.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/limits.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/limits.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/limits.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/limits.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/math.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/math.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/math.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/math.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/mpl/max.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/mpl/max.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/mpl/max.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/mpl/max.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/pgmspace.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/pgmspace.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/pgmspace.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/pgmspace.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/pgmspace_generic.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/pgmspace_generic.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/pgmspace_generic.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/pgmspace_generic.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/preprocessor.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/preprocessor.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/preprocessor.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/preprocessor.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/conditional.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/conditional.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/conditional.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/conditional.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/decay.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/decay.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/decay.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/decay.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/declval.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/declval.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/declval.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/declval.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/enable_if.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/enable_if.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/enable_if.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/enable_if.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/function_traits.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/function_traits.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/function_traits.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/function_traits.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/integral_constant.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/integral_constant.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/integral_constant.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/integral_constant.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_array.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_array.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_array.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_array.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_base_of.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_base_of.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_base_of.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_base_of.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_class.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_class.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_class.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_class.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_const.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_const.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_const.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_const.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_convertible.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_convertible.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_convertible.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_convertible.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_enum.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_enum.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_enum.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_enum.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_integral.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_integral.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_integral.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_integral.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_pointer.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_pointer.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_pointer.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_pointer.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_same.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_same.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_same.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_same.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_signed.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_signed.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_signed.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_signed.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/make_unsigned.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/make_unsigned.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/make_unsigned.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/make_unsigned.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_const.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_const.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_const.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_const.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_cv.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_cv.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_cv.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_cv.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_reference.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_reference.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_reference.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_reference.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/type_identity.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/type_identity.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/type_identity.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/type_identity.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/void_t.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/void_t.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/void_t.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/void_t.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Polyfills/utility.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/utility.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Polyfills/utility.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Polyfills/utility.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Serialization/CountingDecorator.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/CountingDecorator.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Serialization/CountingDecorator.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/CountingDecorator.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Serialization/Writer.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writer.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Serialization/Writer.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writer.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/DummyWriter.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/DummyWriter.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/DummyWriter.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/DummyWriter.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/PrintWriter.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/PrintWriter.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/PrintWriter.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/PrintWriter.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StaticStringWriter.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StaticStringWriter.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StaticStringWriter.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StaticStringWriter.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StdStreamWriter.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StdStreamWriter.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StdStreamWriter.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StdStreamWriter.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Serialization/measure.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/measure.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Serialization/measure.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/measure.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Serialization/serialize.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/serialize.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Serialization/serialize.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Serialization/serialize.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/FlashString.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/FlashString.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/FlashString.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/FlashString.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/RamString.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/RamString.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/RamString.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/RamString.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/StringObject.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/StringObject.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/StringObject.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/Adapters/StringObject.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Strings/IsString.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/IsString.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Strings/IsString.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/IsString.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Strings/JsonString.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/JsonString.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Strings/JsonString.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/JsonString.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Strings/StringAdapter.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/StringAdapter.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Strings/StringAdapter.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/StringAdapter.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Strings/StringAdapters.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/StringAdapters.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Strings/StringAdapters.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/StringAdapters.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Strings/StringTraits.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/StringTraits.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Strings/StringTraits.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Strings/StringTraits.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/Converter.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/Converter.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/Converter.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/Converter.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/ConverterImpl.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/ConverterImpl.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/ConverterImpl.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/ConverterImpl.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariant.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariant.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariant.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariant.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantConst.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantConst.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantConst.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantConst.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantCopier.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantCopier.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantCopier.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantCopier.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantVisitor.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantVisitor.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantVisitor.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/JsonVariantVisitor.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantAttorney.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantAttorney.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantAttorney.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantAttorney.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantCompare.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantCompare.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantCompare.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantCompare.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantContent.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantContent.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantContent.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantContent.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantData.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantData.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantData.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantData.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantDataVisitor.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantDataVisitor.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantDataVisitor.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantDataVisitor.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantImpl.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantImpl.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantImpl.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantImpl.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantOperators.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantOperators.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantOperators.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantOperators.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantRefBase.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantRefBase.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantRefBase.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantRefBase.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantRefBaseImpl.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantRefBaseImpl.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantRefBaseImpl.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantRefBaseImpl.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantTag.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantTag.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantTag.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantTag.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/Variant/VariantTo.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantTo.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/Variant/VariantTo.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/Variant/VariantTo.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/compatibility.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/compatibility.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/compatibility.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/compatibility.hpp diff --git a/lib/ArduinoJson/src/ArduinoJson/version.hpp b/cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/version.hpp similarity index 100% rename from lib/ArduinoJson/src/ArduinoJson/version.hpp rename to cassandra-rc2/lib/ArduinoJson/src/ArduinoJson/version.hpp diff --git a/lib/ArduinoJson/src/CMakeLists.txt b/cassandra-rc2/lib/ArduinoJson/src/CMakeLists.txt similarity index 100% rename from lib/ArduinoJson/src/CMakeLists.txt rename to cassandra-rc2/lib/ArduinoJson/src/CMakeLists.txt diff --git a/lib/ArduinoLog/ArduinoLog.cpp b/cassandra-rc2/lib/ArduinoLog/ArduinoLog.cpp similarity index 100% rename from lib/ArduinoLog/ArduinoLog.cpp rename to cassandra-rc2/lib/ArduinoLog/ArduinoLog.cpp diff --git a/lib/ArduinoLog/ArduinoLog.h b/cassandra-rc2/lib/ArduinoLog/ArduinoLog.h similarity index 100% rename from lib/ArduinoLog/ArduinoLog.h rename to cassandra-rc2/lib/ArduinoLog/ArduinoLog.h diff --git a/lib/ArduinoLog/Images/logo.png b/cassandra-rc2/lib/ArduinoLog/Images/logo.png similarity index 100% rename from lib/ArduinoLog/Images/logo.png rename to cassandra-rc2/lib/ArduinoLog/Images/logo.png diff --git a/lib/ArduinoLog/LICENSE.md b/cassandra-rc2/lib/ArduinoLog/LICENSE.md similarity index 100% rename from lib/ArduinoLog/LICENSE.md rename to cassandra-rc2/lib/ArduinoLog/LICENSE.md diff --git a/lib/ArduinoLog/README.md b/cassandra-rc2/lib/ArduinoLog/README.md similarity index 100% rename from lib/ArduinoLog/README.md rename to cassandra-rc2/lib/ArduinoLog/README.md diff --git a/lib/ArduinoLog/examples/Log-advanced/Log-advanced.ino b/cassandra-rc2/lib/ArduinoLog/examples/Log-advanced/Log-advanced.ino similarity index 100% rename from lib/ArduinoLog/examples/Log-advanced/Log-advanced.ino rename to cassandra-rc2/lib/ArduinoLog/examples/Log-advanced/Log-advanced.ino diff --git a/lib/ArduinoLog/examples/Log-basic/Log-basic.ino b/cassandra-rc2/lib/ArduinoLog/examples/Log-basic/Log-basic.ino similarity index 100% rename from lib/ArduinoLog/examples/Log-basic/Log-basic.ino rename to cassandra-rc2/lib/ArduinoLog/examples/Log-basic/Log-basic.ino diff --git a/lib/ArduinoLog/keywords.txt b/cassandra-rc2/lib/ArduinoLog/keywords.txt similarity index 100% rename from lib/ArduinoLog/keywords.txt rename to cassandra-rc2/lib/ArduinoLog/keywords.txt diff --git a/lib/ArduinoLog/library.json b/cassandra-rc2/lib/ArduinoLog/library.json similarity index 100% rename from lib/ArduinoLog/library.json rename to cassandra-rc2/lib/ArduinoLog/library.json diff --git a/lib/ArduinoLog/library.properties b/cassandra-rc2/lib/ArduinoLog/library.properties similarity index 100% rename from lib/ArduinoLog/library.properties rename to cassandra-rc2/lib/ArduinoLog/library.properties diff --git a/lib/Arduino_MemoryFree/MemoryFree.cpp b/cassandra-rc2/lib/Arduino_MemoryFree/MemoryFree.cpp similarity index 100% rename from lib/Arduino_MemoryFree/MemoryFree.cpp rename to cassandra-rc2/lib/Arduino_MemoryFree/MemoryFree.cpp diff --git a/lib/Arduino_MemoryFree/MemoryFree.h b/cassandra-rc2/lib/Arduino_MemoryFree/MemoryFree.h similarity index 100% rename from lib/Arduino_MemoryFree/MemoryFree.h rename to cassandra-rc2/lib/Arduino_MemoryFree/MemoryFree.h diff --git a/lib/Arduino_MemoryFree/README.md b/cassandra-rc2/lib/Arduino_MemoryFree/README.md similarity index 100% rename from lib/Arduino_MemoryFree/README.md rename to cassandra-rc2/lib/Arduino_MemoryFree/README.md diff --git a/lib/Arduino_MemoryFree/examples/BareMinimum/BareMinimum.ino b/cassandra-rc2/lib/Arduino_MemoryFree/examples/BareMinimum/BareMinimum.ino similarity index 100% rename from lib/Arduino_MemoryFree/examples/BareMinimum/BareMinimum.ino rename to cassandra-rc2/lib/Arduino_MemoryFree/examples/BareMinimum/BareMinimum.ino diff --git a/lib/Arduino_MemoryFree/keywords.txt b/cassandra-rc2/lib/Arduino_MemoryFree/keywords.txt similarity index 100% rename from lib/Arduino_MemoryFree/keywords.txt rename to cassandra-rc2/lib/Arduino_MemoryFree/keywords.txt diff --git a/lib/Arduino_MemoryFree/library.properties b/cassandra-rc2/lib/Arduino_MemoryFree/library.properties similarity index 100% rename from lib/Arduino_MemoryFree/library.properties rename to cassandra-rc2/lib/Arduino_MemoryFree/library.properties diff --git a/lib/Arduino_MemoryFree/license b/cassandra-rc2/lib/Arduino_MemoryFree/license similarity index 100% rename from lib/Arduino_MemoryFree/license rename to cassandra-rc2/lib/Arduino_MemoryFree/license diff --git a/lib/Arduino_MemoryFree/pgmStrToRAM.cpp b/cassandra-rc2/lib/Arduino_MemoryFree/pgmStrToRAM.cpp similarity index 100% rename from lib/Arduino_MemoryFree/pgmStrToRAM.cpp rename to cassandra-rc2/lib/Arduino_MemoryFree/pgmStrToRAM.cpp diff --git a/lib/Arduino_MemoryFree/pgmStrToRAM.h b/cassandra-rc2/lib/Arduino_MemoryFree/pgmStrToRAM.h similarity index 100% rename from lib/Arduino_MemoryFree/pgmStrToRAM.h rename to cassandra-rc2/lib/Arduino_MemoryFree/pgmStrToRAM.h diff --git a/lib/README b/cassandra-rc2/lib/README similarity index 100% rename from lib/README rename to cassandra-rc2/lib/README diff --git a/lib/Streaming/AUTHORS b/cassandra-rc2/lib/Streaming/AUTHORS similarity index 100% rename from lib/Streaming/AUTHORS rename to cassandra-rc2/lib/Streaming/AUTHORS diff --git a/lib/Streaming/LICENSE b/cassandra-rc2/lib/Streaming/LICENSE similarity index 100% rename from lib/Streaming/LICENSE rename to cassandra-rc2/lib/Streaming/LICENSE diff --git a/lib/Streaming/README.org b/cassandra-rc2/lib/Streaming/README.org similarity index 100% rename from lib/Streaming/README.org rename to cassandra-rc2/lib/Streaming/README.org diff --git a/lib/Streaming/examples/StreamingExample/StreamingExample.ino b/cassandra-rc2/lib/Streaming/examples/StreamingExample/StreamingExample.ino similarity index 100% rename from lib/Streaming/examples/StreamingExample/StreamingExample.ino rename to cassandra-rc2/lib/Streaming/examples/StreamingExample/StreamingExample.ino diff --git a/lib/Streaming/examples/StreamingTests/StreamingTests.ino b/cassandra-rc2/lib/Streaming/examples/StreamingTests/StreamingTests.ino similarity index 100% rename from lib/Streaming/examples/StreamingTests/StreamingTests.ino rename to cassandra-rc2/lib/Streaming/examples/StreamingTests/StreamingTests.ino diff --git a/lib/Streaming/keywords.txt b/cassandra-rc2/lib/Streaming/keywords.txt similarity index 100% rename from lib/Streaming/keywords.txt rename to cassandra-rc2/lib/Streaming/keywords.txt diff --git a/lib/Streaming/library.properties b/cassandra-rc2/lib/Streaming/library.properties similarity index 100% rename from lib/Streaming/library.properties rename to cassandra-rc2/lib/Streaming/library.properties diff --git a/lib/Streaming/platformio.ini b/cassandra-rc2/lib/Streaming/platformio.ini similarity index 100% rename from lib/Streaming/platformio.ini rename to cassandra-rc2/lib/Streaming/platformio.ini diff --git a/lib/Streaming/src/Streaming.h b/cassandra-rc2/lib/Streaming/src/Streaming.h similarity index 100% rename from lib/Streaming/src/Streaming.h rename to cassandra-rc2/lib/Streaming/src/Streaming.h diff --git a/lib/Vector/LICENSE b/cassandra-rc2/lib/Vector/LICENSE similarity index 100% rename from lib/Vector/LICENSE rename to cassandra-rc2/lib/Vector/LICENSE diff --git a/lib/Vector/README.org b/cassandra-rc2/lib/Vector/README.org similarity index 100% rename from lib/Vector/README.org rename to cassandra-rc2/lib/Vector/README.org diff --git a/lib/Vector/examples/PlatformIO/README.org b/cassandra-rc2/lib/Vector/examples/PlatformIO/README.org similarity index 100% rename from lib/Vector/examples/PlatformIO/README.org rename to cassandra-rc2/lib/Vector/examples/PlatformIO/README.org diff --git a/lib/Vector/examples/PlatformIO/include/README b/cassandra-rc2/lib/Vector/examples/PlatformIO/include/README similarity index 100% rename from lib/Vector/examples/PlatformIO/include/README rename to cassandra-rc2/lib/Vector/examples/PlatformIO/include/README diff --git a/lib/Vector/examples/PlatformIO/lib/README b/cassandra-rc2/lib/Vector/examples/PlatformIO/lib/README similarity index 100% rename from lib/Vector/examples/PlatformIO/lib/README rename to cassandra-rc2/lib/Vector/examples/PlatformIO/lib/README diff --git a/lib/Vector/examples/PlatformIO/platformio.ini b/cassandra-rc2/lib/Vector/examples/PlatformIO/platformio.ini similarity index 100% rename from lib/Vector/examples/PlatformIO/platformio.ini rename to cassandra-rc2/lib/Vector/examples/PlatformIO/platformio.ini diff --git a/lib/Vector/examples/PlatformIO/src/main.cpp b/cassandra-rc2/lib/Vector/examples/PlatformIO/src/main.cpp similarity index 100% rename from lib/Vector/examples/PlatformIO/src/main.cpp rename to cassandra-rc2/lib/Vector/examples/PlatformIO/src/main.cpp diff --git a/lib/Vector/examples/PlatformIO/test/README b/cassandra-rc2/lib/Vector/examples/PlatformIO/test/README similarity index 100% rename from lib/Vector/examples/PlatformIO/test/README rename to cassandra-rc2/lib/Vector/examples/PlatformIO/test/README diff --git a/lib/Vector/examples/PlatformIO/test/test_vector.cpp b/cassandra-rc2/lib/Vector/examples/PlatformIO/test/test_vector.cpp similarity index 100% rename from lib/Vector/examples/PlatformIO/test/test_vector.cpp rename to cassandra-rc2/lib/Vector/examples/PlatformIO/test/test_vector.cpp diff --git a/lib/Vector/examples/VectorTester/VectorTester.ino b/cassandra-rc2/lib/Vector/examples/VectorTester/VectorTester.ino similarity index 100% rename from lib/Vector/examples/VectorTester/VectorTester.ino rename to cassandra-rc2/lib/Vector/examples/VectorTester/VectorTester.ino diff --git a/lib/Vector/library.json b/cassandra-rc2/lib/Vector/library.json similarity index 100% rename from lib/Vector/library.json rename to cassandra-rc2/lib/Vector/library.json diff --git a/lib/Vector/library.properties b/cassandra-rc2/lib/Vector/library.properties similarity index 100% rename from lib/Vector/library.properties rename to cassandra-rc2/lib/Vector/library.properties diff --git a/lib/Vector/src/Vector.h b/cassandra-rc2/lib/Vector/src/Vector.h similarity index 100% rename from lib/Vector/src/Vector.h rename to cassandra-rc2/lib/Vector/src/Vector.h diff --git a/lib/Vector/src/Vector/Vector.cpp b/cassandra-rc2/lib/Vector/src/Vector/Vector.cpp similarity index 100% rename from lib/Vector/src/Vector/Vector.cpp rename to cassandra-rc2/lib/Vector/src/Vector/Vector.cpp diff --git a/lib/Vector/src/Vector/VectorDefinitions.h b/cassandra-rc2/lib/Vector/src/Vector/VectorDefinitions.h similarity index 100% rename from lib/Vector/src/Vector/VectorDefinitions.h rename to cassandra-rc2/lib/Vector/src/Vector/VectorDefinitions.h diff --git a/lib/Vector/src/Vector/VectorIterator.h b/cassandra-rc2/lib/Vector/src/Vector/VectorIterator.h similarity index 100% rename from lib/Vector/src/Vector/VectorIterator.h rename to cassandra-rc2/lib/Vector/src/Vector/VectorIterator.h diff --git a/lib/polymech-base/.gitignore b/cassandra-rc2/lib/polymech-base/.gitignore similarity index 100% rename from lib/polymech-base/.gitignore rename to cassandra-rc2/lib/polymech-base/.gitignore diff --git a/.npmignore b/cassandra-rc2/lib/polymech-base/.npmignore similarity index 100% rename from .npmignore rename to cassandra-rc2/lib/polymech-base/.npmignore diff --git a/LICENSE.txt b/cassandra-rc2/lib/polymech-base/LICENSE.txt similarity index 100% rename from LICENSE.txt rename to cassandra-rc2/lib/polymech-base/LICENSE.txt diff --git a/lib/polymech-base/README.md b/cassandra-rc2/lib/polymech-base/README.md similarity index 100% rename from lib/polymech-base/README.md rename to cassandra-rc2/lib/polymech-base/README.md diff --git a/experiments/main.c b/cassandra-rc2/lib/polymech-base/experiments/main.c similarity index 100% rename from experiments/main.c rename to cassandra-rc2/lib/polymech-base/experiments/main.c diff --git a/experiments/main.cpp b/cassandra-rc2/lib/polymech-base/experiments/main.cpp similarity index 100% rename from experiments/main.cpp rename to cassandra-rc2/lib/polymech-base/experiments/main.cpp diff --git a/lib/polymech-base/library.properties b/cassandra-rc2/lib/polymech-base/library.properties similarity index 100% rename from lib/polymech-base/library.properties rename to cassandra-rc2/lib/polymech-base/library.properties diff --git a/lib/polymech-base/package.json b/cassandra-rc2/lib/polymech-base/package.json similarity index 100% rename from lib/polymech-base/package.json rename to cassandra-rc2/lib/polymech-base/package.json diff --git a/lib/polymech-base/scripts/bugs.md b/cassandra-rc2/lib/polymech-base/scripts/bugs.md similarity index 100% rename from lib/polymech-base/scripts/bugs.md rename to cassandra-rc2/lib/polymech-base/scripts/bugs.md diff --git a/lib/polymech-base/scripts/bugs.sh b/cassandra-rc2/lib/polymech-base/scripts/bugs.sh similarity index 100% rename from lib/polymech-base/scripts/bugs.sh rename to cassandra-rc2/lib/polymech-base/scripts/bugs.sh diff --git a/lib/polymech-base/scripts/clean.md b/cassandra-rc2/lib/polymech-base/scripts/clean.md similarity index 100% rename from lib/polymech-base/scripts/clean.md rename to cassandra-rc2/lib/polymech-base/scripts/clean.md diff --git a/lib/polymech-base/scripts/clean.sh b/cassandra-rc2/lib/polymech-base/scripts/clean.sh similarity index 100% rename from lib/polymech-base/scripts/clean.sh rename to cassandra-rc2/lib/polymech-base/scripts/clean.sh diff --git a/lib/polymech-base/scripts/docs.md b/cassandra-rc2/lib/polymech-base/scripts/docs.md similarity index 100% rename from lib/polymech-base/scripts/docs.md rename to cassandra-rc2/lib/polymech-base/scripts/docs.md diff --git a/lib/polymech-base/scripts/docs.sh b/cassandra-rc2/lib/polymech-base/scripts/docs.sh similarity index 100% rename from lib/polymech-base/scripts/docs.sh rename to cassandra-rc2/lib/polymech-base/scripts/docs.sh diff --git a/lib/polymech-base/scripts/modbus.md b/cassandra-rc2/lib/polymech-base/scripts/modbus.md similarity index 100% rename from lib/polymech-base/scripts/modbus.md rename to cassandra-rc2/lib/polymech-base/scripts/modbus.md diff --git a/lib/polymech-base/scripts/modbus.sh b/cassandra-rc2/lib/polymech-base/scripts/modbus.sh similarity index 100% rename from lib/polymech-base/scripts/modbus.sh rename to cassandra-rc2/lib/polymech-base/scripts/modbus.sh diff --git a/lib/polymech-base/scripts/stats.md b/cassandra-rc2/lib/polymech-base/scripts/stats.md similarity index 100% rename from lib/polymech-base/scripts/stats.md rename to cassandra-rc2/lib/polymech-base/scripts/stats.md diff --git a/lib/polymech-base/scripts/stats.sh b/cassandra-rc2/lib/polymech-base/scripts/stats.sh similarity index 100% rename from lib/polymech-base/scripts/stats.sh rename to cassandra-rc2/lib/polymech-base/scripts/stats.sh diff --git a/lib/polymech-base/src/App.cpp b/cassandra-rc2/lib/polymech-base/src/App.cpp similarity index 100% rename from lib/polymech-base/src/App.cpp rename to cassandra-rc2/lib/polymech-base/src/App.cpp diff --git a/lib/polymech-base/src/App.h b/cassandra-rc2/lib/polymech-base/src/App.h similarity index 100% rename from lib/polymech-base/src/App.h rename to cassandra-rc2/lib/polymech-base/src/App.h diff --git a/lib/polymech-base/src/Bridge.cpp b/cassandra-rc2/lib/polymech-base/src/Bridge.cpp similarity index 100% rename from lib/polymech-base/src/Bridge.cpp rename to cassandra-rc2/lib/polymech-base/src/Bridge.cpp diff --git a/lib/polymech-base/src/Bridge.h b/cassandra-rc2/lib/polymech-base/src/Bridge.h similarity index 100% rename from lib/polymech-base/src/Bridge.h rename to cassandra-rc2/lib/polymech-base/src/Bridge.h diff --git a/lib/polymech-base/src/CommandMessage.h b/cassandra-rc2/lib/polymech-base/src/CommandMessage.h similarity index 100% rename from lib/polymech-base/src/CommandMessage.h rename to cassandra-rc2/lib/polymech-base/src/CommandMessage.h diff --git a/lib/polymech-base/src/Component.cpp b/cassandra-rc2/lib/polymech-base/src/Component.cpp similarity index 100% rename from lib/polymech-base/src/Component.cpp rename to cassandra-rc2/lib/polymech-base/src/Component.cpp diff --git a/lib/polymech-base/src/Component.h b/cassandra-rc2/lib/polymech-base/src/Component.h similarity index 100% rename from lib/polymech-base/src/Component.h rename to cassandra-rc2/lib/polymech-base/src/Component.h diff --git a/lib/polymech-base/src/Logger.h b/cassandra-rc2/lib/polymech-base/src/Logger.h similarity index 100% rename from lib/polymech-base/src/Logger.h rename to cassandra-rc2/lib/polymech-base/src/Logger.h diff --git a/lib/polymech-base/src/MessageQueue.h b/cassandra-rc2/lib/polymech-base/src/MessageQueue.h similarity index 100% rename from lib/polymech-base/src/MessageQueue.h rename to cassandra-rc2/lib/polymech-base/src/MessageQueue.h diff --git a/lib/polymech-base/src/NetworkValue.h b/cassandra-rc2/lib/polymech-base/src/NetworkValue.h similarity index 100% rename from lib/polymech-base/src/NetworkValue.h rename to cassandra-rc2/lib/polymech-base/src/NetworkValue.h diff --git a/lib/polymech-base/src/NetworkValuePB.h b/cassandra-rc2/lib/polymech-base/src/NetworkValuePB.h similarity index 100% rename from lib/polymech-base/src/NetworkValuePB.h rename to cassandra-rc2/lib/polymech-base/src/NetworkValuePB.h diff --git a/lib/polymech-base/src/SerialMessage.cpp b/cassandra-rc2/lib/polymech-base/src/SerialMessage.cpp similarity index 100% rename from lib/polymech-base/src/SerialMessage.cpp rename to cassandra-rc2/lib/polymech-base/src/SerialMessage.cpp diff --git a/lib/polymech-base/src/SerialMessage.h b/cassandra-rc2/lib/polymech-base/src/SerialMessage.h similarity index 100% rename from lib/polymech-base/src/SerialMessage.h rename to cassandra-rc2/lib/polymech-base/src/SerialMessage.h diff --git a/lib/polymech-base/src/StringUtils.cpp b/cassandra-rc2/lib/polymech-base/src/StringUtils.cpp similarity index 100% rename from lib/polymech-base/src/StringUtils.cpp rename to cassandra-rc2/lib/polymech-base/src/StringUtils.cpp diff --git a/lib/polymech-base/src/StringUtils.h b/cassandra-rc2/lib/polymech-base/src/StringUtils.h similarity index 100% rename from lib/polymech-base/src/StringUtils.h rename to cassandra-rc2/lib/polymech-base/src/StringUtils.h diff --git a/lib/polymech-base/src/ValueWrapper.h b/cassandra-rc2/lib/polymech-base/src/ValueWrapper.h similarity index 100% rename from lib/polymech-base/src/ValueWrapper.h rename to cassandra-rc2/lib/polymech-base/src/ValueWrapper.h diff --git a/lib/polymech-base/src/components/3PosAnalog.h b/cassandra-rc2/lib/polymech-base/src/components/3PosAnalog.h similarity index 100% rename from lib/polymech-base/src/components/3PosAnalog.h rename to cassandra-rc2/lib/polymech-base/src/components/3PosAnalog.h diff --git a/lib/polymech-base/src/components/AmperageBudgetManager.cpp b/cassandra-rc2/lib/polymech-base/src/components/AmperageBudgetManager.cpp similarity index 100% rename from lib/polymech-base/src/components/AmperageBudgetManager.cpp rename to cassandra-rc2/lib/polymech-base/src/components/AmperageBudgetManager.cpp diff --git a/lib/polymech-base/src/components/AmperageBudgetManager.h b/cassandra-rc2/lib/polymech-base/src/components/AmperageBudgetManager.h similarity index 100% rename from lib/polymech-base/src/components/AmperageBudgetManager.h rename to cassandra-rc2/lib/polymech-base/src/components/AmperageBudgetManager.h diff --git a/lib/polymech-base/src/components/AnalogLevelSwitch.cpp b/cassandra-rc2/lib/polymech-base/src/components/AnalogLevelSwitch.cpp similarity index 100% rename from lib/polymech-base/src/components/AnalogLevelSwitch.cpp rename to cassandra-rc2/lib/polymech-base/src/components/AnalogLevelSwitch.cpp diff --git a/lib/polymech-base/src/components/AnalogLevelSwitch.h b/cassandra-rc2/lib/polymech-base/src/components/AnalogLevelSwitch.h similarity index 100% rename from lib/polymech-base/src/components/AnalogLevelSwitch.h rename to cassandra-rc2/lib/polymech-base/src/components/AnalogLevelSwitch.h diff --git a/lib/polymech-base/src/components/DeltaTypes.h b/cassandra-rc2/lib/polymech-base/src/components/DeltaTypes.h similarity index 100% rename from lib/polymech-base/src/components/DeltaTypes.h rename to cassandra-rc2/lib/polymech-base/src/components/DeltaTypes.h diff --git a/lib/polymech-base/src/components/DeltaTypesBase.h b/cassandra-rc2/lib/polymech-base/src/components/DeltaTypesBase.h similarity index 100% rename from lib/polymech-base/src/components/DeltaTypesBase.h rename to cassandra-rc2/lib/polymech-base/src/components/DeltaTypesBase.h diff --git a/lib/polymech-base/src/components/DeltaTypesEx.h b/cassandra-rc2/lib/polymech-base/src/components/DeltaTypesEx.h similarity index 100% rename from lib/polymech-base/src/components/DeltaTypesEx.h rename to cassandra-rc2/lib/polymech-base/src/components/DeltaTypesEx.h diff --git a/lib/polymech-base/src/components/Delta_VFD.cpp b/cassandra-rc2/lib/polymech-base/src/components/Delta_VFD.cpp similarity index 100% rename from lib/polymech-base/src/components/Delta_VFD.cpp rename to cassandra-rc2/lib/polymech-base/src/components/Delta_VFD.cpp diff --git a/lib/polymech-base/src/components/Delta_VFD.h b/cassandra-rc2/lib/polymech-base/src/components/Delta_VFD.h similarity index 100% rename from lib/polymech-base/src/components/Delta_VFD.h rename to cassandra-rc2/lib/polymech-base/src/components/Delta_VFD.h diff --git a/lib/polymech-base/src/components/Extruder.cpp b/cassandra-rc2/lib/polymech-base/src/components/Extruder.cpp similarity index 100% rename from lib/polymech-base/src/components/Extruder.cpp rename to cassandra-rc2/lib/polymech-base/src/components/Extruder.cpp diff --git a/lib/polymech-base/src/components/Extruder.h b/cassandra-rc2/lib/polymech-base/src/components/Extruder.h similarity index 100% rename from lib/polymech-base/src/components/Extruder.h rename to cassandra-rc2/lib/polymech-base/src/components/Extruder.h diff --git a/lib/polymech-base/src/components/Feedback3C.h b/cassandra-rc2/lib/polymech-base/src/components/Feedback3C.h similarity index 100% rename from lib/polymech-base/src/components/Feedback3C.h rename to cassandra-rc2/lib/polymech-base/src/components/Feedback3C.h diff --git a/lib/polymech-base/src/components/FeedbackBuzzer.h b/cassandra-rc2/lib/polymech-base/src/components/FeedbackBuzzer.h similarity index 100% rename from lib/polymech-base/src/components/FeedbackBuzzer.h rename to cassandra-rc2/lib/polymech-base/src/components/FeedbackBuzzer.h diff --git a/lib/polymech-base/src/components/GPIO.h b/cassandra-rc2/lib/polymech-base/src/components/GPIO.h similarity index 100% rename from lib/polymech-base/src/components/GPIO.h rename to cassandra-rc2/lib/polymech-base/src/components/GPIO.h diff --git a/lib/polymech-base/src/components/HY_VFD.cpp b/cassandra-rc2/lib/polymech-base/src/components/HY_VFD.cpp similarity index 100% rename from lib/polymech-base/src/components/HY_VFD.cpp rename to cassandra-rc2/lib/polymech-base/src/components/HY_VFD.cpp diff --git a/lib/polymech-base/src/components/HY_VFD.h b/cassandra-rc2/lib/polymech-base/src/components/HY_VFD.h similarity index 100% rename from lib/polymech-base/src/components/HY_VFD.h rename to cassandra-rc2/lib/polymech-base/src/components/HY_VFD.h diff --git a/lib/polymech-base/src/components/InfluxDB.cpp b/cassandra-rc2/lib/polymech-base/src/components/InfluxDB.cpp similarity index 100% rename from lib/polymech-base/src/components/InfluxDB.cpp rename to cassandra-rc2/lib/polymech-base/src/components/InfluxDB.cpp diff --git a/lib/polymech-base/src/components/InfluxDB.h b/cassandra-rc2/lib/polymech-base/src/components/InfluxDB.h similarity index 100% rename from lib/polymech-base/src/components/InfluxDB.h rename to cassandra-rc2/lib/polymech-base/src/components/InfluxDB.h diff --git a/lib/polymech-base/src/components/Joystick.cpp b/cassandra-rc2/lib/polymech-base/src/components/Joystick.cpp similarity index 100% rename from lib/polymech-base/src/components/Joystick.cpp rename to cassandra-rc2/lib/polymech-base/src/components/Joystick.cpp diff --git a/lib/polymech-base/src/components/Joystick.h b/cassandra-rc2/lib/polymech-base/src/components/Joystick.h similarity index 100% rename from lib/polymech-base/src/components/Joystick.h rename to cassandra-rc2/lib/polymech-base/src/components/Joystick.h diff --git a/lib/polymech-base/src/components/LEDFeedback.cpp b/cassandra-rc2/lib/polymech-base/src/components/LEDFeedback.cpp similarity index 100% rename from lib/polymech-base/src/components/LEDFeedback.cpp rename to cassandra-rc2/lib/polymech-base/src/components/LEDFeedback.cpp diff --git a/lib/polymech-base/src/components/LEDFeedback.h b/cassandra-rc2/lib/polymech-base/src/components/LEDFeedback.h similarity index 100% rename from lib/polymech-base/src/components/LEDFeedback.h rename to cassandra-rc2/lib/polymech-base/src/components/LEDFeedback.h diff --git a/lib/polymech-base/src/components/Loadcell.cpp b/cassandra-rc2/lib/polymech-base/src/components/Loadcell.cpp similarity index 100% rename from lib/polymech-base/src/components/Loadcell.cpp rename to cassandra-rc2/lib/polymech-base/src/components/Loadcell.cpp diff --git a/lib/polymech-base/src/components/Loadcell.h b/cassandra-rc2/lib/polymech-base/src/components/Loadcell.h similarity index 100% rename from lib/polymech-base/src/components/Loadcell.h rename to cassandra-rc2/lib/polymech-base/src/components/Loadcell.h diff --git a/lib/polymech-base/src/components/Logger.cpp b/cassandra-rc2/lib/polymech-base/src/components/Logger.cpp similarity index 100% rename from lib/polymech-base/src/components/Logger.cpp rename to cassandra-rc2/lib/polymech-base/src/components/Logger.cpp diff --git a/lib/polymech-base/src/components/Logger.h b/cassandra-rc2/lib/polymech-base/src/components/Logger.h similarity index 100% rename from lib/polymech-base/src/components/Logger.h rename to cassandra-rc2/lib/polymech-base/src/components/Logger.h diff --git a/lib/polymech-base/src/components/ModbusDevice.h b/cassandra-rc2/lib/polymech-base/src/components/ModbusDevice.h similarity index 100% rename from lib/polymech-base/src/components/ModbusDevice.h rename to cassandra-rc2/lib/polymech-base/src/components/ModbusDevice.h diff --git a/lib/polymech-base/src/components/ModbusLogicEngine.cpp b/cassandra-rc2/lib/polymech-base/src/components/ModbusLogicEngine.cpp similarity index 100% rename from lib/polymech-base/src/components/ModbusLogicEngine.cpp rename to cassandra-rc2/lib/polymech-base/src/components/ModbusLogicEngine.cpp diff --git a/lib/polymech-base/src/components/ModbusLogicEngine.h b/cassandra-rc2/lib/polymech-base/src/components/ModbusLogicEngine.h similarity index 100% rename from lib/polymech-base/src/components/ModbusLogicEngine.h rename to cassandra-rc2/lib/polymech-base/src/components/ModbusLogicEngine.h diff --git a/lib/polymech-base/src/components/ModbusMirror.cpp b/cassandra-rc2/lib/polymech-base/src/components/ModbusMirror.cpp similarity index 100% rename from lib/polymech-base/src/components/ModbusMirror.cpp rename to cassandra-rc2/lib/polymech-base/src/components/ModbusMirror.cpp diff --git a/lib/polymech-base/src/components/ModbusMirror.h b/cassandra-rc2/lib/polymech-base/src/components/ModbusMirror.h similarity index 100% rename from lib/polymech-base/src/components/ModbusMirror.h rename to cassandra-rc2/lib/polymech-base/src/components/ModbusMirror.h diff --git a/lib/polymech-base/src/components/NetworkValueTest.cpp b/cassandra-rc2/lib/polymech-base/src/components/NetworkValueTest.cpp similarity index 100% rename from lib/polymech-base/src/components/NetworkValueTest.cpp rename to cassandra-rc2/lib/polymech-base/src/components/NetworkValueTest.cpp diff --git a/lib/polymech-base/src/components/NetworkValueTest.h b/cassandra-rc2/lib/polymech-base/src/components/NetworkValueTest.h similarity index 100% rename from lib/polymech-base/src/components/NetworkValueTest.h rename to cassandra-rc2/lib/polymech-base/src/components/NetworkValueTest.h diff --git a/lib/polymech-base/src/components/NetworkValueTestPB.cpp b/cassandra-rc2/lib/polymech-base/src/components/NetworkValueTestPB.cpp similarity index 100% rename from lib/polymech-base/src/components/NetworkValueTestPB.cpp rename to cassandra-rc2/lib/polymech-base/src/components/NetworkValueTestPB.cpp diff --git a/lib/polymech-base/src/components/NetworkValueTestPB.h b/cassandra-rc2/lib/polymech-base/src/components/NetworkValueTestPB.h similarity index 100% rename from lib/polymech-base/src/components/NetworkValueTestPB.h rename to cassandra-rc2/lib/polymech-base/src/components/NetworkValueTestPB.h diff --git a/lib/polymech-base/src/components/OmronE5.cpp b/cassandra-rc2/lib/polymech-base/src/components/OmronE5.cpp similarity index 100% rename from lib/polymech-base/src/components/OmronE5.cpp rename to cassandra-rc2/lib/polymech-base/src/components/OmronE5.cpp diff --git a/lib/polymech-base/src/components/OmronE5.h b/cassandra-rc2/lib/polymech-base/src/components/OmronE5.h similarity index 100% rename from lib/polymech-base/src/components/OmronE5.h rename to cassandra-rc2/lib/polymech-base/src/components/OmronE5.h diff --git a/lib/polymech-base/src/components/OmronE5Types.h b/cassandra-rc2/lib/polymech-base/src/components/OmronE5Types.h similarity index 100% rename from lib/polymech-base/src/components/OmronE5Types.h rename to cassandra-rc2/lib/polymech-base/src/components/OmronE5Types.h diff --git a/lib/polymech-base/src/components/OmronE5_Ex.h b/cassandra-rc2/lib/polymech-base/src/components/OmronE5_Ex.h similarity index 100% rename from lib/polymech-base/src/components/OmronE5_Ex.h rename to cassandra-rc2/lib/polymech-base/src/components/OmronE5_Ex.h diff --git a/lib/polymech-base/src/components/OperatorSwitch.cpp b/cassandra-rc2/lib/polymech-base/src/components/OperatorSwitch.cpp similarity index 100% rename from lib/polymech-base/src/components/OperatorSwitch.cpp rename to cassandra-rc2/lib/polymech-base/src/components/OperatorSwitch.cpp diff --git a/lib/polymech-base/src/components/OperatorSwitch.h b/cassandra-rc2/lib/polymech-base/src/components/OperatorSwitch.h similarity index 100% rename from lib/polymech-base/src/components/OperatorSwitch.h rename to cassandra-rc2/lib/polymech-base/src/components/OperatorSwitch.h diff --git a/lib/polymech-base/src/components/POT.h b/cassandra-rc2/lib/polymech-base/src/components/POT.h similarity index 100% rename from lib/polymech-base/src/components/POT.h rename to cassandra-rc2/lib/polymech-base/src/components/POT.h diff --git a/lib/polymech-base/src/components/Plunger.cpp b/cassandra-rc2/lib/polymech-base/src/components/Plunger.cpp similarity index 100% rename from lib/polymech-base/src/components/Plunger.cpp rename to cassandra-rc2/lib/polymech-base/src/components/Plunger.cpp diff --git a/lib/polymech-base/src/components/Plunger.h b/cassandra-rc2/lib/polymech-base/src/components/Plunger.h similarity index 100% rename from lib/polymech-base/src/components/Plunger.h rename to cassandra-rc2/lib/polymech-base/src/components/Plunger.h diff --git a/lib/polymech-base/src/components/PlungerSettings.cpp b/cassandra-rc2/lib/polymech-base/src/components/PlungerSettings.cpp similarity index 100% rename from lib/polymech-base/src/components/PlungerSettings.cpp rename to cassandra-rc2/lib/polymech-base/src/components/PlungerSettings.cpp diff --git a/lib/polymech-base/src/components/PlungerSettings.h b/cassandra-rc2/lib/polymech-base/src/components/PlungerSettings.h similarity index 100% rename from lib/polymech-base/src/components/PlungerSettings.h rename to cassandra-rc2/lib/polymech-base/src/components/PlungerSettings.h diff --git a/lib/polymech-base/src/components/PlungerStates.cpp b/cassandra-rc2/lib/polymech-base/src/components/PlungerStates.cpp similarity index 100% rename from lib/polymech-base/src/components/PlungerStates.cpp rename to cassandra-rc2/lib/polymech-base/src/components/PlungerStates.cpp diff --git a/lib/polymech-base/src/components/PressCylinder.cpp b/cassandra-rc2/lib/polymech-base/src/components/PressCylinder.cpp similarity index 100% rename from lib/polymech-base/src/components/PressCylinder.cpp rename to cassandra-rc2/lib/polymech-base/src/components/PressCylinder.cpp diff --git a/lib/polymech-base/src/components/PressCylinder.h b/cassandra-rc2/lib/polymech-base/src/components/PressCylinder.h similarity index 100% rename from lib/polymech-base/src/components/PressCylinder.h rename to cassandra-rc2/lib/polymech-base/src/components/PressCylinder.h diff --git a/lib/polymech-base/src/components/PushButton.cpp b/cassandra-rc2/lib/polymech-base/src/components/PushButton.cpp similarity index 100% rename from lib/polymech-base/src/components/PushButton.cpp rename to cassandra-rc2/lib/polymech-base/src/components/PushButton.cpp diff --git a/lib/polymech-base/src/components/PushButton.h b/cassandra-rc2/lib/polymech-base/src/components/PushButton.h similarity index 100% rename from lib/polymech-base/src/components/PushButton.h rename to cassandra-rc2/lib/polymech-base/src/components/PushButton.h diff --git a/lib/polymech-base/src/components/RS485.cpp b/cassandra-rc2/lib/polymech-base/src/components/RS485.cpp similarity index 100% rename from lib/polymech-base/src/components/RS485.cpp rename to cassandra-rc2/lib/polymech-base/src/components/RS485.cpp diff --git a/lib/polymech-base/src/components/RS485.h b/cassandra-rc2/lib/polymech-base/src/components/RS485.h similarity index 100% rename from lib/polymech-base/src/components/RS485.h rename to cassandra-rc2/lib/polymech-base/src/components/RS485.h diff --git a/lib/polymech-base/src/components/Relay.cpp b/cassandra-rc2/lib/polymech-base/src/components/Relay.cpp similarity index 100% rename from lib/polymech-base/src/components/Relay.cpp rename to cassandra-rc2/lib/polymech-base/src/components/Relay.cpp diff --git a/lib/polymech-base/src/components/Relay.h b/cassandra-rc2/lib/polymech-base/src/components/Relay.h similarity index 100% rename from lib/polymech-base/src/components/Relay.h rename to cassandra-rc2/lib/polymech-base/src/components/Relay.h diff --git a/lib/polymech-base/src/components/RestServer.cpp b/cassandra-rc2/lib/polymech-base/src/components/RestServer.cpp similarity index 100% rename from lib/polymech-base/src/components/RestServer.cpp rename to cassandra-rc2/lib/polymech-base/src/components/RestServer.cpp diff --git a/lib/polymech-base/src/components/RestServer.h b/cassandra-rc2/lib/polymech-base/src/components/RestServer.h similarity index 100% rename from lib/polymech-base/src/components/RestServer.h rename to cassandra-rc2/lib/polymech-base/src/components/RestServer.h diff --git a/lib/polymech-base/src/components/SAKO_VFD.cpp b/cassandra-rc2/lib/polymech-base/src/components/SAKO_VFD.cpp similarity index 100% rename from lib/polymech-base/src/components/SAKO_VFD.cpp rename to cassandra-rc2/lib/polymech-base/src/components/SAKO_VFD.cpp diff --git a/lib/polymech-base/src/components/SAKO_VFD.h b/cassandra-rc2/lib/polymech-base/src/components/SAKO_VFD.h similarity index 100% rename from lib/polymech-base/src/components/SAKO_VFD.h rename to cassandra-rc2/lib/polymech-base/src/components/SAKO_VFD.h diff --git a/lib/polymech-base/src/components/Sako-Registers.h b/cassandra-rc2/lib/polymech-base/src/components/Sako-Registers.h similarity index 100% rename from lib/polymech-base/src/components/Sako-Registers.h rename to cassandra-rc2/lib/polymech-base/src/components/Sako-Registers.h diff --git a/lib/polymech-base/src/components/SakoTypes.h b/cassandra-rc2/lib/polymech-base/src/components/SakoTypes.h similarity index 100% rename from lib/polymech-base/src/components/SakoTypes.h rename to cassandra-rc2/lib/polymech-base/src/components/SakoTypes.h diff --git a/lib/polymech-base/src/components/Solenoid.cpp b/cassandra-rc2/lib/polymech-base/src/components/Solenoid.cpp similarity index 100% rename from lib/polymech-base/src/components/Solenoid.cpp rename to cassandra-rc2/lib/polymech-base/src/components/Solenoid.cpp diff --git a/lib/polymech-base/src/components/Solenoid.h b/cassandra-rc2/lib/polymech-base/src/components/Solenoid.h similarity index 100% rename from lib/polymech-base/src/components/Solenoid.h rename to cassandra-rc2/lib/polymech-base/src/components/Solenoid.h diff --git a/lib/polymech-base/src/components/StatusLight.h b/cassandra-rc2/lib/polymech-base/src/components/StatusLight.h similarity index 100% rename from lib/polymech-base/src/components/StatusLight.h rename to cassandra-rc2/lib/polymech-base/src/components/StatusLight.h diff --git a/lib/polymech-base/src/components/StepperController.h b/cassandra-rc2/lib/polymech-base/src/components/StepperController.h similarity index 100% rename from lib/polymech-base/src/components/StepperController.h rename to cassandra-rc2/lib/polymech-base/src/components/StepperController.h diff --git a/lib/polymech-base/src/components/VFD_Base.cpp b/cassandra-rc2/lib/polymech-base/src/components/VFD_Base.cpp similarity index 100% rename from lib/polymech-base/src/components/VFD_Base.cpp rename to cassandra-rc2/lib/polymech-base/src/components/VFD_Base.cpp diff --git a/lib/polymech-base/src/components/VFD_Base.h b/cassandra-rc2/lib/polymech-base/src/components/VFD_Base.h similarity index 100% rename from lib/polymech-base/src/components/VFD_Base.h rename to cassandra-rc2/lib/polymech-base/src/components/VFD_Base.h diff --git a/lib/polymech-base/src/components/commons.h b/cassandra-rc2/lib/polymech-base/src/components/commons.h similarity index 100% rename from lib/polymech-base/src/components/commons.h rename to cassandra-rc2/lib/polymech-base/src/components/commons.h diff --git a/lib/polymech-base/src/constants.h b/cassandra-rc2/lib/polymech-base/src/constants.h similarity index 100% rename from lib/polymech-base/src/constants.h rename to cassandra-rc2/lib/polymech-base/src/constants.h diff --git a/lib/polymech-base/src/enums.h b/cassandra-rc2/lib/polymech-base/src/enums.h similarity index 100% rename from lib/polymech-base/src/enums.h rename to cassandra-rc2/lib/polymech-base/src/enums.h diff --git a/lib/polymech-base/src/error_codes.h b/cassandra-rc2/lib/polymech-base/src/error_codes.h similarity index 100% rename from lib/polymech-base/src/error_codes.h rename to cassandra-rc2/lib/polymech-base/src/error_codes.h diff --git a/lib/polymech-base/src/esp32_compat.h b/cassandra-rc2/lib/polymech-base/src/esp32_compat.h similarity index 100% rename from lib/polymech-base/src/esp32_compat.h rename to cassandra-rc2/lib/polymech-base/src/esp32_compat.h diff --git a/lib/polymech-base/src/helpers/IFTTTWebhook.h b/cassandra-rc2/lib/polymech-base/src/helpers/IFTTTWebhook.h similarity index 100% rename from lib/polymech-base/src/helpers/IFTTTWebhook.h rename to cassandra-rc2/lib/polymech-base/src/helpers/IFTTTWebhook.h diff --git a/lib/polymech-base/src/json.h b/cassandra-rc2/lib/polymech-base/src/json.h similarity index 100% rename from lib/polymech-base/src/json.h rename to cassandra-rc2/lib/polymech-base/src/json.h diff --git a/lib/polymech-base/src/macros.h b/cassandra-rc2/lib/polymech-base/src/macros.h similarity index 100% rename from lib/polymech-base/src/macros.h rename to cassandra-rc2/lib/polymech-base/src/macros.h diff --git a/lib/polymech-base/src/modbus/Modbus.h b/cassandra-rc2/lib/polymech-base/src/modbus/Modbus.h similarity index 100% rename from lib/polymech-base/src/modbus/Modbus.h rename to cassandra-rc2/lib/polymech-base/src/modbus/Modbus.h diff --git a/lib/polymech-base/src/modbus/ModbusComponent.h b/cassandra-rc2/lib/polymech-base/src/modbus/ModbusComponent.h similarity index 100% rename from lib/polymech-base/src/modbus/ModbusComponent.h rename to cassandra-rc2/lib/polymech-base/src/modbus/ModbusComponent.h diff --git a/lib/polymech-base/src/modbus/ModbusRTU.cpp b/cassandra-rc2/lib/polymech-base/src/modbus/ModbusRTU.cpp similarity index 100% rename from lib/polymech-base/src/modbus/ModbusRTU.cpp rename to cassandra-rc2/lib/polymech-base/src/modbus/ModbusRTU.cpp diff --git a/lib/polymech-base/src/modbus/ModbusRTU.h b/cassandra-rc2/lib/polymech-base/src/modbus/ModbusRTU.h similarity index 100% rename from lib/polymech-base/src/modbus/ModbusRTU.h rename to cassandra-rc2/lib/polymech-base/src/modbus/ModbusRTU.h diff --git a/lib/polymech-base/src/modbus/ModbusTCP.cpp b/cassandra-rc2/lib/polymech-base/src/modbus/ModbusTCP.cpp similarity index 100% rename from lib/polymech-base/src/modbus/ModbusTCP.cpp rename to cassandra-rc2/lib/polymech-base/src/modbus/ModbusTCP.cpp diff --git a/lib/polymech-base/src/modbus/ModbusTCP.h b/cassandra-rc2/lib/polymech-base/src/modbus/ModbusTCP.h similarity index 100% rename from lib/polymech-base/src/modbus/ModbusTCP.h rename to cassandra-rc2/lib/polymech-base/src/modbus/ModbusTCP.h diff --git a/lib/polymech-base/src/modbus/ModbusTypes.cpp b/cassandra-rc2/lib/polymech-base/src/modbus/ModbusTypes.cpp similarity index 100% rename from lib/polymech-base/src/modbus/ModbusTypes.cpp rename to cassandra-rc2/lib/polymech-base/src/modbus/ModbusTypes.cpp diff --git a/lib/polymech-base/src/modbus/ModbusTypes.h b/cassandra-rc2/lib/polymech-base/src/modbus/ModbusTypes.h similarity index 100% rename from lib/polymech-base/src/modbus/ModbusTypes.h rename to cassandra-rc2/lib/polymech-base/src/modbus/ModbusTypes.h diff --git a/lib/polymech-base/src/modbus/NetworkComponent.cpp b/cassandra-rc2/lib/polymech-base/src/modbus/NetworkComponent.cpp similarity index 100% rename from lib/polymech-base/src/modbus/NetworkComponent.cpp rename to cassandra-rc2/lib/polymech-base/src/modbus/NetworkComponent.cpp diff --git a/lib/polymech-base/src/modbus/NetworkComponent.h b/cassandra-rc2/lib/polymech-base/src/modbus/NetworkComponent.h similarity index 100% rename from lib/polymech-base/src/modbus/NetworkComponent.h rename to cassandra-rc2/lib/polymech-base/src/modbus/NetworkComponent.h diff --git a/lib/polymech-base/src/net/NC_ModbusRTU.h b/cassandra-rc2/lib/polymech-base/src/net/NC_ModbusRTU.h similarity index 100% rename from lib/polymech-base/src/net/NC_ModbusRTU.h rename to cassandra-rc2/lib/polymech-base/src/net/NC_ModbusRTU.h diff --git a/lib/polymech-base/src/net/NC_ModbusTCP.h b/cassandra-rc2/lib/polymech-base/src/net/NC_ModbusTCP.h similarity index 100% rename from lib/polymech-base/src/net/NC_ModbusTCP.h rename to cassandra-rc2/lib/polymech-base/src/net/NC_ModbusTCP.h diff --git a/lib/polymech-base/src/net/NetworkComponent.h b/cassandra-rc2/lib/polymech-base/src/net/NetworkComponent.h similarity index 100% rename from lib/polymech-base/src/net/NetworkComponent.h rename to cassandra-rc2/lib/polymech-base/src/net/NetworkComponent.h diff --git a/lib/polymech-base/src/net/commons.h b/cassandra-rc2/lib/polymech-base/src/net/commons.h similarity index 100% rename from lib/polymech-base/src/net/commons.h rename to cassandra-rc2/lib/polymech-base/src/net/commons.h diff --git a/lib/polymech-base/src/pid_constants.h b/cassandra-rc2/lib/polymech-base/src/pid_constants.h similarity index 100% rename from lib/polymech-base/src/pid_constants.h rename to cassandra-rc2/lib/polymech-base/src/pid_constants.h diff --git a/lib/polymech-base/src/profiles/IPlotEvents.h b/cassandra-rc2/lib/polymech-base/src/profiles/IPlotEvents.h similarity index 100% rename from lib/polymech-base/src/profiles/IPlotEvents.h rename to cassandra-rc2/lib/polymech-base/src/profiles/IPlotEvents.h diff --git a/lib/polymech-base/src/profiles/IPlungerEvents.h b/cassandra-rc2/lib/polymech-base/src/profiles/IPlungerEvents.h similarity index 100% rename from lib/polymech-base/src/profiles/IPlungerEvents.h rename to cassandra-rc2/lib/polymech-base/src/profiles/IPlungerEvents.h diff --git a/lib/polymech-base/src/profiles/PlotBase.cpp b/cassandra-rc2/lib/polymech-base/src/profiles/PlotBase.cpp similarity index 100% rename from lib/polymech-base/src/profiles/PlotBase.cpp rename to cassandra-rc2/lib/polymech-base/src/profiles/PlotBase.cpp diff --git a/lib/polymech-base/src/profiles/PlotBase.h b/cassandra-rc2/lib/polymech-base/src/profiles/PlotBase.h similarity index 100% rename from lib/polymech-base/src/profiles/PlotBase.h rename to cassandra-rc2/lib/polymech-base/src/profiles/PlotBase.h diff --git a/lib/polymech-base/src/profiles/PressureProfile.cpp b/cassandra-rc2/lib/polymech-base/src/profiles/PressureProfile.cpp similarity index 100% rename from lib/polymech-base/src/profiles/PressureProfile.cpp rename to cassandra-rc2/lib/polymech-base/src/profiles/PressureProfile.cpp diff --git a/lib/polymech-base/src/profiles/PressureProfile.h b/cassandra-rc2/lib/polymech-base/src/profiles/PressureProfile.h similarity index 100% rename from lib/polymech-base/src/profiles/PressureProfile.h rename to cassandra-rc2/lib/polymech-base/src/profiles/PressureProfile.h diff --git a/lib/polymech-base/src/profiles/SignalPlot.cpp b/cassandra-rc2/lib/polymech-base/src/profiles/SignalPlot.cpp similarity index 100% rename from lib/polymech-base/src/profiles/SignalPlot.cpp rename to cassandra-rc2/lib/polymech-base/src/profiles/SignalPlot.cpp diff --git a/lib/polymech-base/src/profiles/SignalPlot.h b/cassandra-rc2/lib/polymech-base/src/profiles/SignalPlot.h similarity index 100% rename from lib/polymech-base/src/profiles/SignalPlot.h rename to cassandra-rc2/lib/polymech-base/src/profiles/SignalPlot.h diff --git a/lib/polymech-base/src/profiles/TemperatureProfile.cpp b/cassandra-rc2/lib/polymech-base/src/profiles/TemperatureProfile.cpp similarity index 100% rename from lib/polymech-base/src/profiles/TemperatureProfile.cpp rename to cassandra-rc2/lib/polymech-base/src/profiles/TemperatureProfile.cpp diff --git a/lib/polymech-base/src/profiles/TemperatureProfile.h b/cassandra-rc2/lib/polymech-base/src/profiles/TemperatureProfile.h similarity index 100% rename from lib/polymech-base/src/profiles/TemperatureProfile.h rename to cassandra-rc2/lib/polymech-base/src/profiles/TemperatureProfile.h diff --git a/lib/polymech-base/src/profiles/WiFiNetworkSettings.h b/cassandra-rc2/lib/polymech-base/src/profiles/WiFiNetworkSettings.h similarity index 100% rename from lib/polymech-base/src/profiles/WiFiNetworkSettings.h rename to cassandra-rc2/lib/polymech-base/src/profiles/WiFiNetworkSettings.h diff --git a/lib/polymech-base/src/xmath.h b/cassandra-rc2/lib/polymech-base/src/xmath.h similarity index 100% rename from lib/polymech-base/src/xmath.h rename to cassandra-rc2/lib/polymech-base/src/xmath.h diff --git a/lib/polymech-base/src/xstatistics.cpp b/cassandra-rc2/lib/polymech-base/src/xstatistics.cpp similarity index 100% rename from lib/polymech-base/src/xstatistics.cpp rename to cassandra-rc2/lib/polymech-base/src/xstatistics.cpp diff --git a/lib/polymech-base/src/xstatistics.h b/cassandra-rc2/lib/polymech-base/src/xstatistics.h similarity index 100% rename from lib/polymech-base/src/xstatistics.h rename to cassandra-rc2/lib/polymech-base/src/xstatistics.h diff --git a/lib/polymech-base/src/xtimer.h b/cassandra-rc2/lib/polymech-base/src/xtimer.h similarity index 100% rename from lib/polymech-base/src/xtimer.h rename to cassandra-rc2/lib/polymech-base/src/xtimer.h diff --git a/lib/polymech-base/src/xtypes.h b/cassandra-rc2/lib/polymech-base/src/xtypes.h similarity index 100% rename from lib/polymech-base/src/xtypes.h rename to cassandra-rc2/lib/polymech-base/src/xtypes.h diff --git a/cassandra-rc2/package-lock.json b/cassandra-rc2/package-lock.json new file mode 100644 index 00000000..6987c89e --- /dev/null +++ b/cassandra-rc2/package-lock.json @@ -0,0 +1,7761 @@ +{ + "name": "cassandra-rc2-firmware", + "version": "0.9.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "cassandra-rc2-firmware", + "version": "0.9.0", + "license": "ISC", + "dependencies": { + "@polymech/fs": "file:../../polymech-mono/packages/fs", + "chalk": "^5.4.1", + "fs-extra": "^11.3.0", + "protobufjs-cli": "^1.1.3", + "simple-git": "^3.30.0" + }, + "devDependencies": { + "@types/node": "^22.15.3", + "@types/serialport": "^8.0.5", + "@types/ws": "^8.18.1", + "cross-env": "^7.0.3", + "jsmodbus": "^4.0.10", + "nexe": "^5.0.0-beta.4", + "serialport": "^13.0.0", + "tslog": "^4.9.3", + "typescript": "^5.8.3", + "vitest": "^3.1.2", + "ws": "^8.18.1" + } + }, + "../../polymech-mono/packages/fs": { + "name": "@polymech/fs", + "version": "0.13.41", + "license": "BSD-3-Clause", + "dependencies": { + "@polymech/core": "file:../core", + "@repo/typescript-config": "file:../typescript-config", + "denodeify": "^1.2.1", + "glob": "^10.4.1", + "mime": "^2.0.3", + "minimatch": "^10.0.1", + "mkdirp": "^3.0.1", + "q": "^1.4.1", + "rimraf": "^6.0.1", + "write-file-atomic": "^6.0.0", + "yargs": "^17.7.2" + }, + "devDependencies": { + "@types/denodeify": "^1.2.31", + "@types/mime": "^2.0.0", + "@types/node": "^22.10.2", + "fs-extra": "^4.0.2", + "globals": "^15.14.0", + "ts-node": "^10.9.1", + "typescript": "^5.7.2" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.0.tgz", + "integrity": "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.0" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.0.tgz", + "integrity": "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg==", + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@calebboyd/semaphore": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@calebboyd/semaphore/-/semaphore-1.3.1.tgz", + "integrity": "sha512-17z9me12RgAEcMhIgR7f+BiXKbzwF9p1VraI69OxrUUSWGuSMOyOTEHQNVtMKuVrkEDVD0/Av5uiGZPBMYZljw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@discoveryjs/json-ext": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.6.3.tgz", + "integrity": "sha512-4B4OijXeVNOPZlYA2oEwWOTkzyltLao+xbotHQeqN++Rv27Y6s818+n2Qkp8q+Fxhn0t/5lA5X1Mxktud8eayQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.17.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.3.tgz", + "integrity": "sha512-W8bFfPA8DowP8l//sxjJLSLkD8iEjMc7cBVyP+u4cEv9sM7mdUCkgsj+t0n/BWPFtv7WWCN5Yzj0N6FJNUUqBQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.3.tgz", + "integrity": "sha512-PuwVXbnP87Tcff5I9ngV0lmiSu40xw1At6i3GsU77U7cjDDB4s0X2cyFuBiDa1SBk9DnvWwnGvVaGBqoFWPb7A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.3.tgz", + "integrity": "sha512-XelR6MzjlZuBM4f5z2IQHK6LkK34Cvv6Rj2EntER3lwCBFdg6h2lKbtRjpTTsdEjD/WSe1q8UyPBXP1x3i/wYQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.3.tgz", + "integrity": "sha512-ogtTpYHT/g1GWS/zKM0cc/tIebFjm1F9Aw1boQ2Y0eUQ+J89d0jFY//s9ei9jVIlkYi8AfOjiixcLJSGNSOAdQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.3.tgz", + "integrity": "sha512-eESK5yfPNTqpAmDfFWNsOhmIOaQA59tAcF/EfYvo5/QWQCzXn5iUSOnqt3ra3UdzBv073ykTtmeLJZGt3HhA+w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.3.tgz", + "integrity": "sha512-Kd8glo7sIZtwOLcPbW0yLpKmBNWMANZhrC1r6K++uDR2zyzb6AeOYtI6udbtabmQpFaxJ8uduXMAo1gs5ozz8A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.3.tgz", + "integrity": "sha512-EJiyS70BYybOBpJth3M0KLOus0n+RRMKTYzhYhFeMwp7e/RaajXvP+BWlmEXNk6uk+KAu46j/kaQzr6au+JcIw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.3.tgz", + "integrity": "sha512-Q+wSjaLpGxYf7zC0kL0nDlhsfuFkoN+EXrx2KSB33RhinWzejOd6AvgmP5JbkgXKmjhmpfgKZq24pneodYqE8Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.3.tgz", + "integrity": "sha512-dUOVmAUzuHy2ZOKIHIKHCm58HKzFqd+puLaS424h6I85GlSDRZIA5ycBixb3mFgM0Jdh+ZOSB6KptX30DD8YOQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.3.tgz", + "integrity": "sha512-xCUgnNYhRD5bb1C1nqrDV1PfkwgbswTTBRbAd8aH5PhYzikdf/ddtsYyMXFfGSsb/6t6QaPSzxtbfAZr9uox4A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.3.tgz", + "integrity": "sha512-yplPOpczHOO4jTYKmuYuANI3WhvIPSVANGcNUeMlxH4twz/TeXuzEP41tGKNGWJjuMhotpGabeFYGAOU2ummBw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.3.tgz", + "integrity": "sha512-P4BLP5/fjyihmXCELRGrLd793q/lBtKMQl8ARGpDxgzgIKJDRJ/u4r1A/HgpBpKpKZelGct2PGI4T+axcedf6g==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.3.tgz", + "integrity": "sha512-eRAOV2ODpu6P5divMEMa26RRqb2yUoYsuQQOuFUexUoQndm4MdpXXDBbUoKIc0iPa4aCO7gIhtnYomkn2x+bag==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.3.tgz", + "integrity": "sha512-ZC4jV2p7VbzTlnl8nZKLcBkfzIf4Yad1SJM4ZMKYnJqZFD4rTI+pBG65u8ev4jk3/MPwY9DvGn50wi3uhdaghg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.3.tgz", + "integrity": "sha512-LDDODcFzNtECTrUUbVCs6j9/bDVqy7DDRsuIXJg6so+mFksgwG7ZVnTruYi5V+z3eE5y+BJZw7VvUadkbfg7QA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.3.tgz", + "integrity": "sha512-s+w/NOY2k0yC2p9SLen+ymflgcpRkvwwa02fqmAwhBRI3SC12uiS10edHHXlVWwfAagYSY5UpmT/zISXPMW3tQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.3.tgz", + "integrity": "sha512-nQHDz4pXjSDC6UfOE1Fw9Q8d6GCAd9KdvMZpfVGWSJztYCarRgSDfOVBY5xwhQXseiyxapkiSJi/5/ja8mRFFA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.3.tgz", + "integrity": "sha512-1QaLtOWq0mzK6tzzp0jRN3eccmN3hezey7mhLnzC6oNlJoUJz4nym5ZD7mDnS/LZQgkrhEbEiTn515lPeLpgWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.3.tgz", + "integrity": "sha512-i5Hm68HXHdgv8wkrt+10Bc50zM0/eonPb/a/OFVfB6Qvpiirco5gBA5bz7S2SHuU+Y4LWn/zehzNX14Sp4r27g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.3.tgz", + "integrity": "sha512-zGAVApJEYTbOC6H/3QBr2mq3upG/LBEXr85/pTtKiv2IXcgKV0RT0QA/hSXZqSvLEpXeIxah7LczB4lkiYhTAQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.3.tgz", + "integrity": "sha512-fpqctI45NnCIDKBH5AXQBsD0NDPbEFczK98hk/aa6HJxbl+UtLkJV2+Bvy5hLSLk3LHmqt0NTkKNso1A9y1a4w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.3.tgz", + "integrity": "sha512-ROJhm7d8bk9dMCUZjkS8fgzsPAZEjtRJqCAmVgB0gMrvG7hfmPmz9k1rwO4jSiblFjYmNvbECL9uhaPzONMfgA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.3.tgz", + "integrity": "sha512-YWcow8peiHpNBiIXHwaswPnAXLsLVygFwCB3A7Bh5jRkIBFWHGmNQ48AlX4xDvQNoMZlPYzjVOQDYEzWCqufMQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.3.tgz", + "integrity": "sha512-qspTZOIGoXVS4DpNqUYUs9UxVb04khS1Degaw/MnfMe7goQ3lTfQ13Vw4qY/Nj0979BGvMRpAYbs/BAxEvU8ew==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.3.tgz", + "integrity": "sha512-ICgUR+kPimx0vvRzf+N/7L7tVSQeE3BYY+NhHRHXS1kBuPO7z2+7ea2HbhDyZdTephgvNvKrlDDKUexuCVBVvg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz", + "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.30", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.30.tgz", + "integrity": "sha512-GQ7Nw5G2lTu/BtHTKfXhKHok2WGetd4XYcVKGx00SjAk8GMwgJM3zr6zORiPGuOE+/vkc90KtTosSSvaCjKb2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@jsdoc/salty": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.9.tgz", + "integrity": "sha512-yYxMVH7Dqw6nO0d5NIV8OQWnitU8k6vXH8NtgqAfIa/IUqRMxRv/NUJJ08VEKbAakwxlgBl5PJdrU0dMPStsnw==", + "license": "Apache-2.0", + "dependencies": { + "lodash": "^4.17.21" + }, + "engines": { + "node": ">=v12.0.0" + } + }, + "node_modules/@kwsites/file-exists": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", + "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", + "license": "MIT", + "dependencies": { + "debug": "^4.1.1" + } + }, + "node_modules/@kwsites/file-exists/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@kwsites/promise-deferred": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", + "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==", + "license": "MIT" + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@polymech/fs": { + "resolved": "../../polymech-mono/packages/fs", + "link": true + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "license": "BSD-3-Clause" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.40.1.tgz", + "integrity": "sha512-kxz0YeeCrRUHz3zyqvd7n+TVRlNyTifBsmnmNPtk3hQURUyG9eAB+usz6DAwagMusjx/zb3AjvDUvhFGDAexGw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.40.1.tgz", + "integrity": "sha512-PPkxTOisoNC6TpnDKatjKkjRMsdaWIhyuMkA4UsBXT9WEZY4uHezBTjs6Vl4PbqQQeu6oION1w2voYZv9yquCw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.40.1.tgz", + "integrity": "sha512-VWXGISWFY18v/0JyNUy4A46KCFCb9NVsH+1100XP31lud+TzlezBbz24CYzbnA4x6w4hx+NYCXDfnvDVO6lcAA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.40.1.tgz", + "integrity": "sha512-nIwkXafAI1/QCS7pxSpv/ZtFW6TXcNUEHAIA9EIyw5OzxJZQ1YDrX+CL6JAIQgZ33CInl1R6mHet9Y/UZTg2Bw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.40.1.tgz", + "integrity": "sha512-BdrLJ2mHTrIYdaS2I99mriyJfGGenSaP+UwGi1kB9BLOCu9SR8ZpbkmmalKIALnRw24kM7qCN0IOm6L0S44iWw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.40.1.tgz", + "integrity": "sha512-VXeo/puqvCG8JBPNZXZf5Dqq7BzElNJzHRRw3vjBE27WujdzuOPecDPc/+1DcdcTptNBep3861jNq0mYkT8Z6Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.40.1.tgz", + "integrity": "sha512-ehSKrewwsESPt1TgSE/na9nIhWCosfGSFqv7vwEtjyAqZcvbGIg4JAcV7ZEh2tfj/IlfBeZjgOXm35iOOjadcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.40.1.tgz", + "integrity": "sha512-m39iO/aaurh5FVIu/F4/Zsl8xppd76S4qoID8E+dSRQvTyZTOI2gVk3T4oqzfq1PtcvOfAVlwLMK3KRQMaR8lg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.40.1.tgz", + "integrity": "sha512-Y+GHnGaku4aVLSgrT0uWe2o2Rq8te9hi+MwqGF9r9ORgXhmHK5Q71N757u0F8yU1OIwUIFy6YiJtKjtyktk5hg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.40.1.tgz", + "integrity": "sha512-jEwjn3jCA+tQGswK3aEWcD09/7M5wGwc6+flhva7dsQNRZZTe30vkalgIzV4tjkopsTS9Jd7Y1Bsj6a4lzz8gQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.40.1.tgz", + "integrity": "sha512-ySyWikVhNzv+BV/IDCsrraOAZ3UaC8SZB67FZlqVwXwnFhPihOso9rPOxzZbjp81suB1O2Topw+6Ug3JNegejQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.40.1.tgz", + "integrity": "sha512-BvvA64QxZlh7WZWqDPPdt0GH4bznuL6uOO1pmgPnnv86rpUpc8ZxgZwcEgXvo02GRIZX1hQ0j0pAnhwkhwPqWg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.40.1.tgz", + "integrity": "sha512-EQSP+8+1VuSulm9RKSMKitTav89fKbHymTf25n5+Yr6gAPZxYWpj3DzAsQqoaHAk9YX2lwEyAf9S4W8F4l3VBQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.40.1.tgz", + "integrity": "sha512-n/vQ4xRZXKuIpqukkMXZt9RWdl+2zgGNx7Uda8NtmLJ06NL8jiHxUawbwC+hdSq1rrw/9CghCpEONor+l1e2gA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.40.1.tgz", + "integrity": "sha512-h8d28xzYb98fMQKUz0w2fMc1XuGzLLjdyxVIbhbil4ELfk5/orZlSTpF/xdI9C8K0I8lCkq+1En2RJsawZekkg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.40.1.tgz", + "integrity": "sha512-XiK5z70PEFEFqcNj3/zRSz/qX4bp4QIraTy9QjwJAb/Z8GM7kVUsD0Uk8maIPeTyPCP03ChdI+VVmJriKYbRHQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.40.1.tgz", + "integrity": "sha512-2BRORitq5rQ4Da9blVovzNCMaUlyKrzMSvkVR0D4qPuOy/+pMCrh1d7o01RATwVy+6Fa1WBw+da7QPeLWU/1mQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.40.1.tgz", + "integrity": "sha512-b2bcNm9Kbde03H+q+Jjw9tSfhYkzrDUf2d5MAd1bOJuVplXvFhWz7tRtWvD8/ORZi7qSCy0idW6tf2HgxSXQSg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.40.1.tgz", + "integrity": "sha512-DfcogW8N7Zg7llVEfpqWMZcaErKfsj9VvmfSyRjCyo4BI3wPEfrzTtJkZG6gKP/Z92wFm6rz2aDO7/JfiR/whA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.40.1.tgz", + "integrity": "sha512-ECyOuDeH3C1I8jH2MK1RtBJW+YPMvSfT0a5NN0nHfQYnDSJ6tUiZH3gzwVP5/Kfh/+Tt7tpWVF9LXNTnhTJ3kA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@serialport/binding-mock": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@serialport/binding-mock/-/binding-mock-10.2.2.tgz", + "integrity": "sha512-HAFzGhk9OuFMpuor7aT5G1ChPgn5qSsklTFOTUX72Rl6p0xwcSVsRtG/xaGp6bxpN7fI9D/S8THLBWbBgS6ldw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@serialport/bindings-interface": "^1.2.1", + "debug": "^4.3.3" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@serialport/binding-mock/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@serialport/bindings-cpp": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/bindings-cpp/-/bindings-cpp-13.0.0.tgz", + "integrity": "sha512-r25o4Bk/vaO1LyUfY/ulR6hCg/aWiN6Wo2ljVlb4Pj5bqWGcSRC4Vse4a9AcapuAu/FeBzHCbKMvRQeCuKjzIQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@serialport/bindings-interface": "1.2.2", + "@serialport/parser-readline": "12.0.0", + "debug": "4.4.0", + "node-addon-api": "8.3.0", + "node-gyp-build": "4.8.4" + }, + "engines": { + "node": ">=18.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/bindings-cpp/node_modules/@serialport/parser-delimiter": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-delimiter/-/parser-delimiter-12.0.0.tgz", + "integrity": "sha512-gu26tVt5lQoybhorLTPsH2j2LnX3AOP2x/34+DUSTNaUTzu2fBXw+isVjQJpUBFWu6aeQRZw5bJol5X9Gxjblw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/bindings-cpp/node_modules/@serialport/parser-readline": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-readline/-/parser-readline-12.0.0.tgz", + "integrity": "sha512-O7cywCWC8PiOMvo/gglEBfAkLjp/SENEML46BXDykfKP5mTPM46XMaX1L0waWU6DXJpBgjaL7+yX6VriVPbN4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@serialport/parser-delimiter": "12.0.0" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/bindings-cpp/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@serialport/bindings-interface": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@serialport/bindings-interface/-/bindings-interface-1.2.2.tgz", + "integrity": "sha512-CJaUd5bLvtM9c5dmO9rPBHPXTa9R2UwpkJ0wdh9JCYcbrPWsKz+ErvR0hBLeo7NPeiFdjFO4sonRljiw4d2XiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.22 || ^14.13 || >=16" + } + }, + "node_modules/@serialport/parser-byte-length": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-byte-length/-/parser-byte-length-13.0.0.tgz", + "integrity": "sha512-32yvqeTAqJzAEtX5zCrN1Mej56GJ5h/cVFsCDPbF9S1ZSC9FWjOqNAgtByseHfFTSTs/4ZBQZZcZBpolt8sUng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-cctalk": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-cctalk/-/parser-cctalk-13.0.0.tgz", + "integrity": "sha512-RErAe57g9gvnlieVYGIn1xymb1bzNXb2QtUQd14FpmbQQYlcrmuRnJwKa1BgTCujoCkhtaTtgHlbBWOxm8U2uA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-delimiter": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-delimiter/-/parser-delimiter-13.0.0.tgz", + "integrity": "sha512-Qqyb0FX1avs3XabQqNaZSivyVbl/yl0jywImp7ePvfZKLwx7jBZjvL+Hawt9wIG6tfq6zbFM24vzCCK7REMUig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-inter-byte-timeout": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-inter-byte-timeout/-/parser-inter-byte-timeout-13.0.0.tgz", + "integrity": "sha512-a0w0WecTW7bD2YHWrpTz1uyiWA2fDNym0kjmPeNSwZ2XCP+JbirZt31l43m2ey6qXItTYVuQBthm75sPVeHnGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-packet-length": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-packet-length/-/parser-packet-length-13.0.0.tgz", + "integrity": "sha512-60ZDDIqYRi0Xs2SPZUo4Jr5LLIjtb+rvzPKMJCohrO6tAqSDponcNpcB1O4W21mKTxYjqInSz+eMrtk0LLfZIg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/@serialport/parser-readline": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-readline/-/parser-readline-13.0.0.tgz", + "integrity": "sha512-dov3zYoyf0dt1Sudd1q42VVYQ4WlliF0MYvAMA3MOyiU1IeG4hl0J6buBA2w4gl3DOCC05tGgLDN/3yIL81gsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@serialport/parser-delimiter": "13.0.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-ready": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-ready/-/parser-ready-13.0.0.tgz", + "integrity": "sha512-JNUQA+y2Rfs4bU+cGYNqOPnNMAcayhhW+XJZihSLQXOHcZsFnOa2F9YtMg9VXRWIcnHldHYtisp62Etjlw24bw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-regex": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-regex/-/parser-regex-13.0.0.tgz", + "integrity": "sha512-m7HpIf56G5XcuDdA3DB34Z0pJiwxNRakThEHjSa4mG05OnWYv0IG8l2oUyYfuGMowQWaVnQ+8r+brlPxGVH+eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-slip-encoder": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-slip-encoder/-/parser-slip-encoder-13.0.0.tgz", + "integrity": "sha512-fUHZEExm6izJ7rg0A1yjXwu4sOzeBkPAjDZPfb+XQoqgtKAk+s+HfICiYn7N2QU9gyaeCO8VKgWwi+b/DowYOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/parser-spacepacket": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/parser-spacepacket/-/parser-spacepacket-13.0.0.tgz", + "integrity": "sha512-DoXJ3mFYmyD8X/8931agJvrBPxqTaYDsPoly9/cwQSeh/q4EjQND9ySXBxpWz5WcpyCU4jOuusqCSAPsbB30Eg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/stream": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@serialport/stream/-/stream-13.0.0.tgz", + "integrity": "sha512-F7xLJKsjGo2WuEWMSEO1SimRcOA+WtWICsY13r0ahx8s2SecPQH06338g28OT7cW7uRXI7oEQAk62qh5gHJW3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@serialport/bindings-interface": "1.2.2", + "debug": "4.4.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/@serialport/stream/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@sindresorhus/is": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz", + "integrity": "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", + "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "dev": true, + "license": "MIT", + "dependencies": { + "defer-to-connect": "^2.0.1" + }, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/@types/emscripten": { + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.40.1.tgz", + "integrity": "sha512-sr53lnYkQNhjHNN0oJDdUm5564biioI5DuOpycufDVK7D3y+GR3oUswe2rlwY1nPNyusHbrJ9WoTyIHl4/Bpwg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/eslint": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", + "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/http-cache-semantics": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", + "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", + "license": "MIT" + }, + "node_modules/@types/markdown-it": { + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", + "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/linkify-it": "^5", + "@types/mdurl": "^2" + } + }, + "node_modules/@types/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.15.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz", + "integrity": "sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/serialport": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/@types/serialport/-/serialport-8.0.5.tgz", + "integrity": "sha512-Lw082WIy46fYLnOzyf+8QN/vZaR3d9ol9WNyEGHsKJJ1pmZogFbloHGbnXyNcxfV9aTbgviWU8jktrIjRheYFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/source-list-map": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.6.tgz", + "integrity": "sha512-5JcVt1u5HDmlXkwOD2nslZVllBBc7HDuOICfiZah2Z0is8M8g+ddAEawbmd3VjedfDHBzxCaXLs07QEmb7y54g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/tapable": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.12.tgz", + "integrity": "sha512-bTHG8fcxEqv1M9+TD14P8ok8hjxoOCkfKc8XXLaaD05kI7ohpeI956jtDOD3XHKBQrlyPughUtzm1jtVhHpA5Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/uglify-js": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.17.5.tgz", + "integrity": "sha512-TU+fZFBTBcXj/GpDpDaBmgWk/gn96kMZ+uocaFUlV2f8a6WdMzzI44QBCmGcCiYR0Y6ZlNRiyUyKKt5nl/lbzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "source-map": "^0.6.1" + } + }, + "node_modules/@types/webpack": { + "version": "4.41.40", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.40.tgz", + "integrity": "sha512-u6kMFSBM9HcoTpUXnL6mt2HSzftqb3JgYV6oxIgL2dl6sX6aCa5k6SOkzv5DuZjBTPUE/dJltKtwwuqrkZHpfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/tapable": "^1", + "@types/uglify-js": "*", + "@types/webpack-sources": "*", + "anymatch": "^3.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/@types/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-4nZOdMwSPHZ4pTEZzSp0AsTM4K7Qmu40UKW4tJDiOVs20UzYF9l+qUe4s0ftfN0pin06n+5cWWDJXH+sbhAiDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/source-list-map": "*", + "source-map": "^0.7.3" + } + }, + "node_modules/@types/webpack-sources/node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@types/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@vitest/expect": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.1.2.tgz", + "integrity": "sha512-O8hJgr+zREopCAqWl3uCVaOdqJwZ9qaDwUP7vy3Xigad0phZe9APxKhPcDNqYYi0rX5oMvwJMSCAXY2afqeTSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "3.1.2", + "@vitest/utils": "3.1.2", + "chai": "^5.2.0", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.1.2.tgz", + "integrity": "sha512-kOtd6K2lc7SQ0mBqYv/wdGedlqPdM/B38paPY+OwJ1XiNi44w3Fpog82UfOibmHaV9Wod18A09I9SCKLyDMqgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "3.1.2", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.17" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0 || ^6.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.1.2.tgz", + "integrity": "sha512-R0xAiHuWeDjTSB3kQ3OQpT8Rx3yhdOAIm/JM4axXxnG7Q/fS8XUwggv/A4xzbQA+drYRjzkMnpYnOGAc4oeq8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.1.2.tgz", + "integrity": "sha512-bhLib9l4xb4sUMPXnThbnhX2Yi8OutBMA8Yahxa7yavQsFDtwY/jrUZwpKp2XH9DhRFJIeytlyGpXCqZ65nR+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "3.1.2", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.1.2.tgz", + "integrity": "sha512-Q1qkpazSF/p4ApZg1vfZSQ5Yw6OCQxVMVrLjslbLFA1hMDrT2uxtqMaw8Tc/jy5DLka1sNs1Y7rBcftMiaSH/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.1.2", + "magic-string": "^0.30.17", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.1.2.tgz", + "integrity": "sha512-OEc5fSXMws6sHVe4kOFyDSj/+4MSwst0ib4un0DlcYgQvRuYQ0+M2HyqGaauUMnjq87tmUaMNDxKQx7wNfVqPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^3.0.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.1.2.tgz", + "integrity": "sha512-5GGd0ytZ7BH3H6JTj9Kw7Prn1Nbg0wZVrIvou+UWxm54d+WoXXgAgjFJ8wn3LdagWLFSEfpPeyYrByZaGEZHLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.1.2", + "loupe": "^3.1.3", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz", + "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/helper-numbers": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", + "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", + "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", + "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz", + "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.13.2", + "@webassemblyjs/helper-api-error": "1.13.2", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", + "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz", + "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz", + "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.13.2.tgz", + "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", + "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz", + "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/helper-wasm-section": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-opt": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1", + "@webassemblyjs/wast-printer": "1.14.1" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz", + "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz", + "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz", + "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-api-error": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz", + "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-3.0.1.tgz", + "integrity": "sha512-u8d0pJ5YFgneF/GuvEiDA61Tf1VDomHHYMjv/wc9XzYj7nopltpG96nXN5dJRstxZhcNpV1g+nT6CydO7pHbjA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "webpack": "^5.82.0", + "webpack-cli": "6.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-3.0.1.tgz", + "integrity": "sha512-coEmDzc2u/ffMvuW9aCjoRzNSPDl/XLuhPdlFRpT9tZHmJ/039az33CE7uH+8s0uL1j5ZNtfdv0HkfaKRBGJsQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "webpack": "^5.82.0", + "webpack-cli": "6.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-3.0.1.tgz", + "integrity": "sha512-sbgw03xQaCLiT6gcY/6u3qBDn01CWw/nbaXl3gTdTFuJJ75Gffv3E3DBpgvY2fkkrdS1fpjaXNOmJlnbtKauKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "webpack": "^5.82.0", + "webpack-cli": "6.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/@yarnpkg/fslib": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@yarnpkg/fslib/-/fslib-3.1.2.tgz", + "integrity": "sha512-FpB2F1Lrm43F94klS9UN0ceOpe/PHZSpJB7bIkvReF/ba890bSdu1NokSKr998yaFee7yqeD9Wkid5ye7azF3A==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "tslib": "^2.4.0" + }, + "engines": { + "node": ">=18.12.0" + } + }, + "node_modules/@yarnpkg/libzip": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@yarnpkg/libzip/-/libzip-3.2.1.tgz", + "integrity": "sha512-xPdiZxwCXGXxc1GDEyPjRQ5KqkgoOmieDNszLozbqghaeXIaokRbMKLUNx0Mr0LAnzII64kN3gl5qVyzfMxnIg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/emscripten": "^1.39.6", + "@yarnpkg/fslib": "^3.1.2", + "tslib": "^2.4.0" + }, + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "@yarnpkg/fslib": "^3.1.2" + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-import-phases": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz", + "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.13.0" + }, + "peerDependencies": { + "acorn": "^8.14.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-styles/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/ansi-styles/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/anymatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/app-builder": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/app-builder/-/app-builder-7.0.4.tgz", + "integrity": "sha512-QCmWZnoNN2uItlRV+gj4J6OONaFcJPyFoIuP1RkoILcuq19MlkynYB+wtH8uGv/umyynMWHI1HxnH1jGa1hNKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/archive-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/archive-type/-/archive-type-4.0.0.tgz", + "integrity": "sha512-zV4Ky0v1F8dBrdYElwTvQhweQ0P7Kwc1aluqJsYtOBP01jXcWCyW2IEfI1YiqsG+Iy7ZR+o5LF1N+PGECBxHWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "file-type": "^4.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/archive-type/node_modules/file-type": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz", + "integrity": "sha512-f2UbFQEk7LXgWpi5ntcO86OeA/cC80fuDDDaX/fZ2ZGel+AF7leRQqBBW1eJNiiQkrZlAoM6P+VYP5P6bOlDEQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/archiver": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.3.2.tgz", + "integrity": "sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "archiver-utils": "^2.1.0", + "async": "^3.2.4", + "buffer-crc32": "^0.2.1", + "readable-stream": "^3.6.0", + "readdir-glob": "^1.1.2", + "tar-stream": "^2.2.0", + "zip-stream": "^4.1.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/archiver-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-2.1.0.tgz", + "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob": "^7.1.4", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^2.0.0" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/archiver-utils/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/archiver-utils/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/archiver-utils/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true, + "license": "MIT" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.25.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.4.tgz", + "integrity": "sha512-4jYpcjabC606xJ3kw2QwGEZKX0Aw7sgQdZCvIK9dhVSPh76BKo+C+btT1RRofH7B+8iNpEbgGNVWiLki5q93yg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "caniuse-lite": "^1.0.30001737", + "electron-to-chromium": "^1.5.211", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true, + "license": "MIT" + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-lookup": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", + "integrity": "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.16" + } + }, + "node_modules/cacheable-request": { + "version": "10.2.14", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.14.tgz", + "integrity": "sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-cache-semantics": "^4.0.2", + "get-stream": "^6.0.1", + "http-cache-semantics": "^4.1.1", + "keyv": "^4.5.3", + "mimic-response": "^4.0.0", + "normalize-url": "^8.0.0", + "responselike": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001739", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001739.tgz", + "integrity": "sha512-y+j60d6ulelrNSwpPyrHdl+9mJnQzHBr08xm48Qno0nSk4h3Qojh+ziv2qE6rXf4k3tadF4o1J/1tAbVm1NtnA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/catharsis": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", + "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", + "license": "MIT", + "dependencies": { + "lodash": "^4.17.15" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/caw": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/caw/-/caw-2.0.1.tgz", + "integrity": "sha512-Cg8/ZSBEa8ZVY9HspcGUYaK63d/bN7rqS3CYCzEGUxuYv6UlmcjzDUz2fCFFHyTvUW5Pk0I+3hkA3iXlIj6guA==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-proxy": "^2.0.0", + "isurl": "^1.0.0-alpha5", + "tunnel-agent": "^0.6.0", + "url-to-options": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chai": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.0.tgz", + "integrity": "sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/check-error": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, + "node_modules/chrome-trace-event": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", + "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0" + } + }, + "node_modules/cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha512-yjLXh88P599UOyPTFX0POsd7WxnbsVsGohcwzHOLspIhhpalPw1BcqED8NblyZLKcGrL8dTgMlcaZxV2jAD41Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-response": "^1.0.0" + } + }, + "node_modules/clone-response/node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/compress-commons": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.2.tgz", + "integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-crc32": "^0.2.13", + "crc32-stream": "^4.0.2", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/config-chain": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", + "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/crc": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/crc/-/crc-3.4.0.tgz", + "integrity": "sha512-ycVC2+4/DLgXXq7QweYi2znhqDuZz6P5TQXnkQo8v15XY/5p/IWeZwsSE31Ifo8w15b8TWLsqhXOjXyilHuQxw==", + "dev": true, + "license": "MIT" + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/crc32-stream": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.3.tgz", + "integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "crc-32": "^1.2.0", + "readable-stream": "^3.4.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/decode-uri-component": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/decompress": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz", + "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "decompress-tar": "^4.0.0", + "decompress-tarbz2": "^4.0.0", + "decompress-targz": "^4.0.0", + "decompress-unzip": "^4.0.1", + "graceful-fs": "^4.1.10", + "make-dir": "^1.0.0", + "pify": "^2.3.0", + "strip-dirs": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-tar": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", + "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "file-type": "^5.2.0", + "is-stream": "^1.1.0", + "tar-stream": "^1.5.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tar/node_modules/bl": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", + "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/decompress-tar/node_modules/file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tar/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/decompress-tar/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/decompress-tar/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/decompress-tar/node_modules/tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/decompress-tarbz2": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", + "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", + "dev": true, + "license": "MIT", + "dependencies": { + "decompress-tar": "^4.1.0", + "file-type": "^6.1.0", + "is-stream": "^1.1.0", + "seek-bzip": "^1.0.5", + "unbzip2-stream": "^1.0.9" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tarbz2/node_modules/file-type": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", + "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-targz": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", + "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "decompress-tar": "^4.1.1", + "file-type": "^5.2.0", + "is-stream": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-targz/node_modules/file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-unzip": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", + "integrity": "sha512-1fqeluvxgnn86MOh66u8FjbtJpAFv5wgCT9Iw8rcBqQcCo5tO8eiJw7NNTrvt9n4CRBVq7CstiS922oPgyGLrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "file-type": "^3.8.0", + "get-stream": "^2.2.0", + "pify": "^2.3.0", + "yauzl": "^2.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-unzip/node_modules/file-type": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-unzip/node_modules/get-stream": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "integrity": "sha512-AUGhbbemXxrZJRD5cDvKtQxLuYaIbNtDTK8YqupCI393Q2KSTreEsLUN3ZxAWFGiKTzL6nKuzfcIvieflUX9qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "object-assign": "^4.0.1", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-unzip/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress/node_modules/make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress/node_modules/make-dir/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "license": "MIT" + }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/download": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/download/-/download-8.0.0.tgz", + "integrity": "sha512-ASRY5QhDk7FK+XrQtQyvhpDKanLluEEQtWl/J7Lxuf/b+i8RYh997QeXvL85xitrmRKVlx9c7eTrcRdq2GS4eA==", + "dev": true, + "license": "MIT", + "dependencies": { + "archive-type": "^4.0.0", + "content-disposition": "^0.5.2", + "decompress": "^4.2.1", + "ext-name": "^5.0.0", + "file-type": "^11.1.0", + "filenamify": "^3.0.0", + "get-stream": "^4.1.0", + "got": "^8.3.1", + "make-dir": "^2.1.0", + "p-event": "^2.1.0", + "pify": "^4.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/download/node_modules/@sindresorhus/is": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", + "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/cacheable-request": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz", + "integrity": "sha512-vag0O2LKZ/najSoUwDbVlnlCFvhBE/7mGTY2B5FgCBDcRD+oVV1HYTOwM6JZfMg/hIcM6IwnTZ1uQQL5/X3xIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "clone-response": "1.0.2", + "get-stream": "3.0.0", + "http-cache-semantics": "3.8.1", + "keyv": "3.0.0", + "lowercase-keys": "1.0.0", + "normalize-url": "2.0.1", + "responselike": "1.0.2" + } + }, + "node_modules/download/node_modules/cacheable-request/node_modules/get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/cacheable-request/node_modules/lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha512-RPlX0+PHuvxVDZ7xX+EBVAp4RsVxP/TdDSN2mJYdiq1Lc4Hz7EUSjUI7RZrKKlmrIzVhf6Jo2stj7++gVarS0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/download/node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/got": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/got/-/got-8.3.2.tgz", + "integrity": "sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^0.7.0", + "cacheable-request": "^2.1.1", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "into-stream": "^3.1.0", + "is-retry-allowed": "^1.1.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "mimic-response": "^1.0.0", + "p-cancelable": "^0.4.0", + "p-timeout": "^2.0.1", + "pify": "^3.0.0", + "safe-buffer": "^5.1.1", + "timed-out": "^4.0.1", + "url-parse-lax": "^3.0.0", + "url-to-options": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/got/node_modules/get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/got/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/http-cache-semantics": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", + "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/download/node_modules/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/download/node_modules/keyv": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", + "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.0" + } + }, + "node_modules/download/node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/download/node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/normalize-url": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-2.0.1.tgz", + "integrity": "sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "prepend-http": "^2.0.0", + "query-string": "^5.0.1", + "sort-keys": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/p-cancelable": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", + "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha512-/Fpe5guzJk1gPqdJLJR5u7eG/gNY4nImjbRDaVWVMRhne55TCmj2i9Q+54PBRfatRC8v/rIiv9BN0pMd9OV5EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "lowercase-keys": "^1.0.0" + } + }, + "node_modules/download/node_modules/sort-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", + "integrity": "sha512-/dPCrG1s3ePpWm6yBbxZq5Be1dXGLyLn9Z791chDC3NFrpkVbWGzkBwPN1knaciexFXgRJ7hzdnwZ4stHSDmjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-obj": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/duplexer3": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.5.tgz", + "integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/electron-to-chromium": { + "version": "1.5.211", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.211.tgz", + "integrity": "sha512-IGBvimJkotaLzFnwIVgW9/UD/AOJ2tByUmeOrtqBfACSbAw5b1G0XpvdaieKyc7ULmbwXVx+4e4Be8pOPBrYkw==", + "dev": true, + "license": "ISC" + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.18.3", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz", + "integrity": "sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/envinfo": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.14.0.tgz", + "integrity": "sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg==", + "dev": true, + "license": "MIT", + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.3.tgz", + "integrity": "sha512-qKA6Pvai73+M2FtftpNKRxJ78GIjmFXFxd/1DVBqGo/qNhLSfv+G12n9pNoWdytJC8U00TrViOwpjT0zgqQS8Q==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.3", + "@esbuild/android-arm": "0.25.3", + "@esbuild/android-arm64": "0.25.3", + "@esbuild/android-x64": "0.25.3", + "@esbuild/darwin-arm64": "0.25.3", + "@esbuild/darwin-x64": "0.25.3", + "@esbuild/freebsd-arm64": "0.25.3", + "@esbuild/freebsd-x64": "0.25.3", + "@esbuild/linux-arm": "0.25.3", + "@esbuild/linux-arm64": "0.25.3", + "@esbuild/linux-ia32": "0.25.3", + "@esbuild/linux-loong64": "0.25.3", + "@esbuild/linux-mips64el": "0.25.3", + "@esbuild/linux-ppc64": "0.25.3", + "@esbuild/linux-riscv64": "0.25.3", + "@esbuild/linux-s390x": "0.25.3", + "@esbuild/linux-x64": "0.25.3", + "@esbuild/netbsd-arm64": "0.25.3", + "@esbuild/netbsd-x64": "0.25.3", + "@esbuild/openbsd-arm64": "0.25.3", + "@esbuild/openbsd-x64": "0.25.3", + "@esbuild/sunos-x64": "0.25.3", + "@esbuild/win32-arm64": "0.25.3", + "@esbuild/win32-ia32": "0.25.3", + "@esbuild/win32-x64": "0.25.3" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/escodegen": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", + "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=4.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/escodegen/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-scope/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/expect-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.1.tgz", + "integrity": "sha512-/kP8CAwxzLVEeFrMm4kMmy4CCDlpipyA7MYLVrdJIkV0fYF0UaigQHRsxHiuY/GEea+bh4KSv3TIlgr+2UL6bw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/ext-list": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz", + "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "^1.28.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ext-name": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz", + "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ext-list": "^2.0.0", + "sort-keys-length": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/fdir": { + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", + "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-type": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-11.1.0.tgz", + "integrity": "sha512-rM0UO7Qm9K7TWTtA6AShI/t7H5BPjDeGVDaNyg9BjHAj3PysKy7+8C8D137R88jnR3rFJZQB/tFgydl5sN5m7g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/filenamify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-3.0.0.tgz", + "integrity": "sha512-5EFZ//MsvJgXjBAFJ+Bh2YaCTRF/VP1YOmGrgt+KJ4SFRLjI87EIdwLLuT6wQX0I4F9W41xutobzczjsOKlI/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.0", + "trim-repeated": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "license": "BSD-3-Clause", + "bin": { + "flat": "cli.js" + } + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/form-data-encoder": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.4.tgz", + "integrity": "sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.17" + } + }, + "node_modules/from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "node_modules/from2/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/from2/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/from2/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true, + "license": "MIT" + }, + "node_modules/fs-extra": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", + "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-proxy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/get-proxy/-/get-proxy-2.1.0.tgz", + "integrity": "sha512-zmZIaQTWnNQb4R4fJUEp/FC51eZsc6EkErspy3xtIYStaq8EB/hDIWipxsal+E8rz0qD7f2sL/NA9Xee4RInJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "npm-conf": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/got": { + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/got/-/got-12.6.1.tgz", + "integrity": "sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^5.2.0", + "@szmarczak/http-timer": "^5.0.1", + "cacheable-lookup": "^7.0.0", + "cacheable-request": "^10.2.8", + "decompress-response": "^6.0.0", + "form-data-encoder": "^2.1.2", + "get-stream": "^6.0.1", + "http2-wrapper": "^2.1.10", + "lowercase-keys": "^3.0.0", + "p-cancelable": "^3.0.0", + "responselike": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/got/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbol-support-x": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", + "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-to-string-tag-x": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", + "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbol-support-x": "^1.4.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/http2-wrapper": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz", + "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.2.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true, + "license": "ISC" + }, + "node_modules/interpret": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/into-stream": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", + "integrity": "sha512-TcdjPibTksa1NQximqep2r17ISRiNE9fwlfbg3F8ANdvP5/yrFTew86VcO//jk4QTaMlbjypPBq76HN2zaKfZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "from2": "^2.1.1", + "p-is-promise": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-natural-number": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", + "integrity": "sha512-Y4LTamMe0DDQIIAlaer9eKebAlDSV6huy+TWhJVPlzZh2o4tRP5SQWFlLn5N0To4mDD22/qdOq+veo1cSISLgQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", + "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "license": "MIT", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-retry-allowed": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isurl": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", + "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-to-string-tag-x": "^1.2.0", + "is-object": "^1.0.1" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js2xmlparser": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", + "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", + "license": "Apache-2.0", + "dependencies": { + "xmlcreate": "^2.0.4" + } + }, + "node_modules/jsdoc": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.4.tgz", + "integrity": "sha512-zeFezwyXeG4syyYHbvh1A967IAqq/67yXtXvuL5wnqCkFZe8I0vKfm+EO+YEvLguo6w9CDUbrAXVtJSHh2E8rw==", + "license": "Apache-2.0", + "dependencies": { + "@babel/parser": "^7.20.15", + "@jsdoc/salty": "^0.2.1", + "@types/markdown-it": "^14.1.1", + "bluebird": "^3.7.2", + "catharsis": "^0.9.0", + "escape-string-regexp": "^2.0.0", + "js2xmlparser": "^4.0.2", + "klaw": "^3.0.0", + "markdown-it": "^14.1.0", + "markdown-it-anchor": "^8.6.7", + "marked": "^4.0.10", + "mkdirp": "^1.0.4", + "requizzle": "^0.2.3", + "strip-json-comments": "^3.1.0", + "underscore": "~1.13.2" + }, + "bin": { + "jsdoc": "jsdoc.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/jsmodbus": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/jsmodbus/-/jsmodbus-4.0.10.tgz", + "integrity": "sha512-ea2VfDamQVI7RE8X9i9KU+cYoobSaemaXhaKik9FTAZJnkgslc4LoRupzepl3DywFVR3rxqjhcS2wk1BDsIe+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "crc": "3.4.0", + "debug": "^3.1.0" + }, + "bin": { + "jsmodbus": "bin/jsmodbus.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/klaw": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", + "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.9" + } + }, + "node_modules/lazystream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", + "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.5" + }, + "engines": { + "node": ">= 0.6.3" + } + }, + "node_modules/lazystream/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/lazystream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/lazystream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", + "license": "MIT", + "dependencies": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, + "node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.11.5" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "license": "MIT" + }, + "node_modules/lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.difference": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.union": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", + "integrity": "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/log-symbols/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/loupe": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.3.tgz", + "integrity": "sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==", + "dev": true, + "license": "MIT" + }, + "node_modules/lowercase-keys": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", + "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "license": "MIT", + "peer": true, + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/markdown-it-anchor": { + "version": "8.6.7", + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz", + "integrity": "sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==", + "license": "Unlicense", + "peerDependencies": { + "@types/markdown-it": "*", + "markdown-it": "*" + } + }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "license": "MIT", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "license": "MIT" + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/meriyah": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/meriyah/-/meriyah-4.5.0.tgz", + "integrity": "sha512-Rbiu0QPIxTXgOXwiIpRVJfZRQ2FWyfzYrOGBs9SN5RbaXg1CN5ELn/plodwWwluX93yzc4qO/bNIen1ThGFCxw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10.4.0" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/mimic-response": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-4.0.0.tgz", + "integrity": "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimatch/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/multistream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/multistream/-/multistream-4.1.0.tgz", + "integrity": "sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "once": "^1.4.0", + "readable-stream": "^3.6.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true, + "license": "MIT" + }, + "node_modules/nexe": { + "version": "5.0.0-beta.4", + "resolved": "https://registry.npmjs.org/nexe/-/nexe-5.0.0-beta.4.tgz", + "integrity": "sha512-FWKmhS5aZBzAF4brSuwrDM08VscAmaHiY/vkJCNRWf+cZ9HpIIdMlLQYw1CzYrengtPlJyFqAzFBb8pUkOaEEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@calebboyd/semaphore": "^1.3.1", + "@yarnpkg/fslib": "^3.0.0-rc.43", + "@yarnpkg/libzip": "^3.0.0-rc.43", + "app-builder": "^7.0.4", + "archiver": "^5.3.1", + "caw": "^2.0.1", + "chalk": "^2.4.2", + "download": "^8.0.0", + "globby": "^11.0.2", + "got": "^12.6.0", + "meriyah": "^4.3.5", + "minimist": "^1.2.8", + "mkdirp": "^1.0.4", + "multistream": "^4.1.0", + "ora": "^3.4.0", + "resolve-dependencies": "^6.0.9", + "rimraf": "^3.0.2", + "run-script-os": "^1.1.6", + "webpack-config-prefabs": "0.0.5" + }, + "bin": { + "nexe": "index.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/nexe/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/nexe/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/nexe/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/nexe/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/node-addon-api": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.3.0.tgz", + "integrity": "sha512-8VOpLHFrOQlAH+qA0ZzuGRlALRA6/LVh8QJldbrC4DY0hXoMP0l4Acq8TzFC018HztWiRqyCEj2aTWY2UvnJUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "dev": true, + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.2.tgz", + "integrity": "sha512-Ee/R3SyN4BuynXcnTaekmaVdbDAEiNrHqjQIA37mHU8G9pf7aaAD4ZX3XjBLo6rsdcxA/gtkcNYZLt30ACgynw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-conf": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz", + "integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==", + "dev": true, + "license": "MIT", + "dependencies": { + "config-chain": "^1.1.11", + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-conf/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "license": "MIT", + "dependencies": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/ora": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz", + "integrity": "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-spinners": "^2.0.0", + "log-symbols": "^2.2.0", + "strip-ansi": "^5.2.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ora/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/ora/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ora/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-cancelable": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", + "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.20" + } + }, + "node_modules/p-event": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-2.3.1.tgz", + "integrity": "sha512-NQCqOFhbpVTMX4qMe8PF8lbGtzZ+LCiN7pcNrb/413Na7+TRoe1xkKUzuWa/YEJdGQ0FvKtj35EEbDoVPO2kbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-timeout": "^2.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/p-is-promise": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha512-zL7VE4JVS2IFSkR2GQKDSPEVxkoH43/p7oEnwpdCndKYJO0HVeRB7fA8TJwuLOTBREtK0ea8eHaxdwcpob5dmg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-timeout": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz", + "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-finally": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathval": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.16" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/postcss": { + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", + "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.8", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true, + "license": "MIT" + }, + "node_modules/proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", + "dev": true, + "license": "ISC" + }, + "node_modules/protobufjs": { + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.3.tgz", + "integrity": "sha512-sildjKwVqOI2kmFDiXQ6aEB0fjYTafpEvIBs8tOR8qI4spuL9OPROLVu2qZqi/xgCfsHIwVqlaF8JBjWFHnKbw==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/protobufjs-cli": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/protobufjs-cli/-/protobufjs-cli-1.1.3.tgz", + "integrity": "sha512-MqD10lqF+FMsOayFiNOdOGNlXc4iKDCf0ZQPkPR+gizYh9gqUeGTWulABUCdI+N67w5RfJ6xhgX4J8pa8qmMXQ==", + "license": "BSD-3-Clause", + "dependencies": { + "chalk": "^4.0.0", + "escodegen": "^1.13.0", + "espree": "^9.0.0", + "estraverse": "^5.1.0", + "glob": "^8.0.0", + "jsdoc": "^4.0.0", + "minimist": "^1.2.0", + "semver": "^7.1.2", + "tmp": "^0.2.1", + "uglify-js": "^3.7.7" + }, + "bin": { + "pbjs": "bin/pbjs", + "pbts": "bin/pbts" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "protobufjs": "^7.0.0" + } + }, + "node_modules/protobufjs-cli/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/protobufjs-cli/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/protobufjs-cli/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/protobufjs-cli/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/query-string": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdir-glob": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", + "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.1.0" + } + }, + "node_modules/readdir-glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/rechoir": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve": "^1.20.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/requizzle": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.4.tgz", + "integrity": "sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==", + "license": "MIT", + "dependencies": { + "lodash": "^4.17.21" + } + }, + "node_modules/resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-dependencies": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/resolve-dependencies/-/resolve-dependencies-6.0.9.tgz", + "integrity": "sha512-1BfxvQZyAjSC3Kkcov3ZhHQiLaXVWX1dhFjWyyrPA5yb9yeW9aSC8GQP6TtkJImM7XvitN7kHrLcQxG+1VU7Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "enhanced-resolve": "^5.12.0", + "fast-glob": "^3.2.12", + "meriyah": "^4.3.5" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/responselike": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", + "integrity": "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==", + "dev": true, + "license": "MIT", + "dependencies": { + "lowercase-keys": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha512-6IzJLuGi4+R14vwagDHX+JrXmPVtPpn4mffDJ1UdR7/Edm87fl6yi8mMBIVvFtJaNTUvjughmW4hwLhRG7gC1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "4.40.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.40.1.tgz", + "integrity": "sha512-C5VvvgCCyfyotVITIAv+4efVytl5F7wt+/I2i9q9GZcEXW9BP52YYOXC58igUi+LFZVHukErIIqQSWwv/M3WRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.7" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.40.1", + "@rollup/rollup-android-arm64": "4.40.1", + "@rollup/rollup-darwin-arm64": "4.40.1", + "@rollup/rollup-darwin-x64": "4.40.1", + "@rollup/rollup-freebsd-arm64": "4.40.1", + "@rollup/rollup-freebsd-x64": "4.40.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.40.1", + "@rollup/rollup-linux-arm-musleabihf": "4.40.1", + "@rollup/rollup-linux-arm64-gnu": "4.40.1", + "@rollup/rollup-linux-arm64-musl": "4.40.1", + "@rollup/rollup-linux-loongarch64-gnu": "4.40.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.40.1", + "@rollup/rollup-linux-riscv64-gnu": "4.40.1", + "@rollup/rollup-linux-riscv64-musl": "4.40.1", + "@rollup/rollup-linux-s390x-gnu": "4.40.1", + "@rollup/rollup-linux-x64-gnu": "4.40.1", + "@rollup/rollup-linux-x64-musl": "4.40.1", + "@rollup/rollup-win32-arm64-msvc": "4.40.1", + "@rollup/rollup-win32-ia32-msvc": "4.40.1", + "@rollup/rollup-win32-x64-msvc": "4.40.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/run-script-os": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/run-script-os/-/run-script-os-1.1.6.tgz", + "integrity": "sha512-ql6P2LzhBTTDfzKts+Qo4H94VUKpxKDFz6QxxwaUZN0mwvi7L3lpOI7BqPCq7lgDh3XLl0dpeXwfcVIitlrYrw==", + "dev": true, + "license": "MIT", + "bin": { + "run-os": "index.js", + "run-script-os": "index.js" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/schema-utils": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.2.tgz", + "integrity": "sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/seek-bzip": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz", + "integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "commander": "^2.8.1" + }, + "bin": { + "seek-bunzip": "bin/seek-bunzip", + "seek-table": "bin/seek-bzip-table" + } + }, + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/serialport": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/serialport/-/serialport-13.0.0.tgz", + "integrity": "sha512-PHpnTd8isMGPfFTZNCzOZp9m4mAJSNWle9Jxu6BPTcWq7YXl5qN7tp8Sgn0h+WIGcD6JFz5QDgixC2s4VW7vzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@serialport/binding-mock": "10.2.2", + "@serialport/bindings-cpp": "13.0.0", + "@serialport/parser-byte-length": "13.0.0", + "@serialport/parser-cctalk": "13.0.0", + "@serialport/parser-delimiter": "13.0.0", + "@serialport/parser-inter-byte-timeout": "13.0.0", + "@serialport/parser-packet-length": "13.0.0", + "@serialport/parser-readline": "13.0.0", + "@serialport/parser-ready": "13.0.0", + "@serialport/parser-regex": "13.0.0", + "@serialport/parser-slip-encoder": "13.0.0", + "@serialport/parser-spacepacket": "13.0.0", + "@serialport/stream": "13.0.0", + "debug": "4.4.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/serialport/donate" + } + }, + "node_modules/serialport/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/simple-git": { + "version": "3.30.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.30.0.tgz", + "integrity": "sha512-q6lxyDsCmEal/MEGhP1aVyQ3oxnagGlBDOVSIB4XUVLl1iZh0Pah6ebC9V4xBap/RfgP2WlI8EKs0WS0rMEJHg==", + "license": "MIT", + "dependencies": { + "@kwsites/file-exists": "^1.1.1", + "@kwsites/promise-deferred": "^1.1.1", + "debug": "^4.4.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/steveukx/git-js?sponsor=1" + } + }, + "node_modules/simple-git/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha512-vzn8aSqKgytVik0iwdBEi+zevbTYZogewTUM6dtpmGwEcdzbub/TX4bCzRhebDCRC3QzXgJsLRKB2V/Oof7HXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sort-keys-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz", + "integrity": "sha512-GRbEOUqCxemTAk/b32F2xa8wDTs+Z1QHOkbhJDQTvv/6G3ZkbJ+frYWsTcc7cBB3Fu4wy4XlLCuNtJuMn7Gsvw==", + "dev": true, + "license": "MIT", + "dependencies": { + "sort-keys": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "devOptional": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-loader": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-5.0.0.tgz", + "integrity": "sha512-k2Dur7CbSLcAH73sBcIkV5xjPV4SzqO1NJ7+XaQl8if3VODDUj3FNchNGpqgJSKbvUfJuhVdv8K2Eu8/TNl2eA==", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "^0.6.3", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.72.1" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.9.0.tgz", + "integrity": "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==", + "dev": true, + "license": "MIT" + }, + "node_modules/strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-replace-loader": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/string-replace-loader/-/string-replace-loader-3.2.0.tgz", + "integrity": "sha512-q7+F4DC6MAKkszF3ZQEuZ3dDH25wXPxFA0maTLk3TOTAYPLDgwqCeCKIvOd8xJhYYYl+EXusYRCyKIJliT/olg==", + "dev": true, + "license": "MIT", + "dependencies": { + "schema-utils": "^4" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "webpack": "^5" + } + }, + "node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-dirs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", + "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-natural-number": "^4.0.1" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-outer/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tapable": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.3.tgz", + "integrity": "sha512-ZL6DDuAlRlLGghwcfmSn9sK3Hr6ArtyudlSAiCqQ6IfE+b+HHbydbYDIG15IfS5do+7XQQBdBiubF/cV2dnDzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/terser": { + "version": "5.43.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz", + "integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.14.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.14", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz", + "integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.25", + "jest-worker": "^27.4.5", + "schema-utils": "^4.3.0", + "serialize-javascript": "^6.0.2", + "terser": "^5.31.1" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz", + "integrity": "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinypool": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.2.tgz", + "integrity": "sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/tinyrainbow": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", + "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", + "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tmp": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", + "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", + "license": "MIT", + "engines": { + "node": ">=14.14" + } + }, + "node_modules/to-buffer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.1.tgz", + "integrity": "sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/to-buffer/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/trim-repeated/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/ts-loader": { + "version": "9.5.4", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.4.tgz", + "integrity": "sha512-nCz0rEwunlTZiy6rXFByQU1kVVpCIgUpc/psFiKVrUwrizdnIbRFu8w7bxhUF0X613DYwT4XzrZHpVyMe758hQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4", + "source-map": "^0.7.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "typescript": "*", + "webpack": "^5.0.0" + } + }, + "node_modules/ts-loader/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ts-loader/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ts-loader/node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/tslog": { + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/tslog/-/tslog-4.9.3.tgz", + "integrity": "sha512-oDWuGVONxhVEBtschLf2cs/Jy8i7h1T+CpdkTNWQgdAF7DhRo2G8vMCgILKe7ojdEkLhICWgI1LYSSKaJsRgcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/fullstack-build/tslog?sponsor=1" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", + "license": "MIT", + "dependencies": { + "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "license": "MIT" + }, + "node_modules/uglify-js": { + "version": "3.19.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", + "license": "BSD-2-Clause", + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/underscore": { + "version": "1.13.7", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz", + "integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==", + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha512-NjFKA0DidqPa5ciFcSrXnAltTtzz84ogy+NebPvfEgAck0+TNg4UJ4IN+fB7zRZfbgUf0syOo9MDxFkDSMuFaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prepend-http": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/url-to-options": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", + "integrity": "sha512-0kQLIzG4fdk/G5NONku64rSH/x32NOA39LVQqlK8Le6lvTF6GGRJpqaQFGgU+CLwySIqBSMdwYM0sYcW9f6P4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/vite": { + "version": "6.3.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.4.tgz", + "integrity": "sha512-BiReIiMS2fyFqbqNT/Qqt4CVITDU9M9vE+DKcVAsB+ZV0wvTKd+3hMbkpxz1b+NmEDMegpVbisKiAZOnvO92Sw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.1.2.tgz", + "integrity": "sha512-/8iMryv46J3aK13iUXsei5G/A3CUlW4665THCPS+K8xAaqrVWiGB4RfXMQXCLjpK9P2eK//BczrVkn5JLAk6DA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.4.0", + "es-module-lexer": "^1.6.0", + "pathe": "^2.0.3", + "vite": "^5.0.0 || ^6.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite-node/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.1.2.tgz", + "integrity": "sha512-WaxpJe092ID1C0mr+LH9MmNrhfzi8I65EX/NRU/Ld016KqQNRgxSOlGNP1hHN+a/F8L15Mh8klwaF77zR3GeDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "3.1.2", + "@vitest/mocker": "3.1.2", + "@vitest/pretty-format": "^3.1.2", + "@vitest/runner": "3.1.2", + "@vitest/snapshot": "3.1.2", + "@vitest/spy": "3.1.2", + "@vitest/utils": "3.1.2", + "chai": "^5.2.0", + "debug": "^4.4.0", + "expect-type": "^1.2.1", + "magic-string": "^0.30.17", + "pathe": "^2.0.3", + "std-env": "^3.9.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.13", + "tinypool": "^1.0.2", + "tinyrainbow": "^2.0.0", + "vite": "^5.0.0 || ^6.0.0", + "vite-node": "3.1.2", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/debug": "^4.1.12", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@vitest/browser": "3.1.2", + "@vitest/ui": "3.1.2", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/debug": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/watchpack": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.4.tgz", + "integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dev": true, + "license": "MIT", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/webpack": { + "version": "5.101.3", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.101.3.tgz", + "integrity": "sha512-7b0dTKR3Ed//AD/6kkx/o7duS8H3f1a4w3BYpIriX4BzIhjkn4teo05cptsxvLesHFKK5KObnadmCHBwGc+51A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.8", + "@types/json-schema": "^7.0.15", + "@webassemblyjs/ast": "^1.14.1", + "@webassemblyjs/wasm-edit": "^1.14.1", + "@webassemblyjs/wasm-parser": "^1.14.1", + "acorn": "^8.15.0", + "acorn-import-phases": "^1.0.3", + "browserslist": "^4.24.0", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.17.3", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.11", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^4.3.2", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.3.11", + "watchpack": "^2.4.1", + "webpack-sources": "^3.3.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-6.0.1.tgz", + "integrity": "sha512-MfwFQ6SfwinsUVi0rNJm7rHZ31GyTcpVE5pgVA3hwFRb7COD4TzjUUwhGWKfO50+xdc2MQPuEBBJoqIMGt3JDw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@discoveryjs/json-ext": "^0.6.1", + "@webpack-cli/configtest": "^3.0.1", + "@webpack-cli/info": "^3.0.1", + "@webpack-cli/serve": "^3.0.1", + "colorette": "^2.0.14", + "commander": "^12.1.0", + "cross-spawn": "^7.0.3", + "envinfo": "^7.14.0", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^6.0.1" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.82.0" + }, + "peerDependenciesMeta": { + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/webpack-config-prefabs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/webpack-config-prefabs/-/webpack-config-prefabs-0.0.5.tgz", + "integrity": "sha512-A9F08XY1JkFqui6oTMwwr57xiMD/skKdd+A0MRKoDW26ShpLQnWdEPJbgY9IqS7N2l1rvPdkswlS4b6o0JliGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/webpack": "^4.4.34", + "find-up": "^4.1.0", + "lodash": "^4.17.11", + "source-map-loader": "*", + "string-replace-loader": "*", + "ts-loader": "*", + "tslib": "^2.0.1", + "typescript": "*", + "webpack": "*", + "webpack-cli": "*" + } + }, + "node_modules/webpack-merge": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-6.0.1.tgz", + "integrity": "sha512-hXXvrjtx2PLYx4qruKl+kyRSLc52V+cCvMxRjmKwoA+CBbbF5GfIBtR6kCvl0fYGqTUPKB+1ktVmTHqMOzgCBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz", + "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack/node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xmlcreate": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", + "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==", + "license": "Apache-2.0" + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/zip-stream": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.1.tgz", + "integrity": "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "archiver-utils": "^3.0.4", + "compress-commons": "^4.1.2", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/zip-stream/node_modules/archiver-utils": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-3.0.4.tgz", + "integrity": "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob": "^7.2.3", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + } + } +} diff --git a/cassandra-rc2/package.json b/cassandra-rc2/package.json new file mode 100644 index 00000000..ccd5c022 --- /dev/null +++ b/cassandra-rc2/package.json @@ -0,0 +1,113 @@ +{ + "name": "cassandra-rc2-firmware", + "private": true, + "version": "0.9.0", + "description": "Firmware for Cassandra RC2 project using PlatformIO", + "scripts": { + "build": "pio run -e waveshare", + "build:p4": "pio run -e esp32-p4-evboard", + "upload:p4": "pio run -e esp32-p4-evboard -t upload", + "monitor:p4": "pio device monitor --filter esp32_exception_decoder -e esp32-p4-evboard -b 115200", + "update:p4": "npm run build:p4 && npm run upload:p4", + "uploadfs:p4": "pio run -e esp32-p4-evboard -t uploadfs", + "build:p4:fs": "pio run -e esp32-p4-evboard -t uploadfs", + "build:dev": "cross-env DEV_IP_OVERRIDE_STA_IP=192.168.1.251 pio run -e waveshare", + "update:dev": "npm run build:dev && npm run upload", + "idf:build": "bash scripts/idf-build.sh", + "idf:flash": "bash scripts/idf-flash.sh", + "idf:monitor": "bash scripts/idf-monitor.sh", + "idf:setup": "python C:\\Espressif\\frameworks\\esp-idf-v5.3.1\\tools\\idf_tools.py install-python-env", + "build:clean": "pio run -t clean -v", + "build:proto": "npm run build:proto:c && npm run build:proto:js", + "build:proto:c": "python scripts/run_nanopb_generator.py", + "build:proto:js": "pm-config build-proto", + "build:release": "pio run -e waveshare-release", + "build:release-debug": "pio run -e waveshare-release-debug", + "build:release:fs": "pio run -e waveshare-release -t uploadfs", + "build:release-debug:fs": "pio run -e waveshare-release-debug -t uploadfs", + "build:run": "pio run && pio run -t upload && pio device monitor", + "build:waveshare": "pio run -e waveshare", + "serial:status": "python scripts/monitor_serial.py -c \"<<1;2;64;printRegisters:1:0>>\" -x", + "serial:reset": "python scripts/monitor_serial.py -c \"<<1;2;64;reset:1:0>>\"", + "upload:waveshare": "pio run -t upload -e waveshare && npm run", + "erase:fs": "pio run --target erase -v", + "monitor": "pio device monitor --filter esp32_exception_decoder", + "serial:send-cmd": "python scripts/send_serial_cmd.py \"<<1;2;64;printRegisters:1:0>>\"", + "serial:send": "python scripts/send_message.py", + "modbus:read:coil": "python scripts/modbus_read_coils.py", + "modbus:read:holding": "python scripts/modbus_read_registers.py", + "modbus:write:coil": "python scripts/modbus_write_coil.py", + "modbus:write:holding": "python scripts/modbus_write_register.py", + "test:serial:rate": "python scripts/rate_test_serial.py \"<<1;2;64;list:1:0>>\"", + "test:serial:counter:get": "python scripts/send_serial_cmd.py \"<<1;2;64;getCounter:1:0>>\"", + "test:transports": "vitest run", + "test:modbus-tcp:basic": "vitest run tests/read-registers.test.ts", + "test:modbus-tcp:sako": "vitest run tests/sako.test.ts", + "test:websocket:basic": "vitest run tests/read-ws.test.ts", + "test:serial:basic": "vitest run tests/list-serial.test.ts", + "test:api": "python scripts/test_api.py", + "test:api:ip": "python scripts/test_api.py --host 192.168.1.250", + "test:api:working": "python scripts/test_working_api.py", + "test:api:system-info": "python scripts/test_system_info.py", + "test:api:system-info:ip": "python scripts/test_system_info.py --host 192.168.1.250", + "web:dev": "cd ../web/packages/modbus-ui && npm run dev", + "web:sync": "sh ./scripts/web.sh", + "web:build-dist": "cd ../web/packages/modbus-ui && npm run build", + "web:uploadfs": "pio run -t uploadfs -e waveshare", + "web:uploadfs-release": "pio run -t uploadfs -e waveshare-release", + "web:uploadfs:p4": "pio run -t uploadfs -e esp32-p4-evboard", + "web:clean": "rm -rf data/*", + "web:update": "npm run web:clean && npm run web:build-dist && npm run web:sync && npm run web:uploadfs", + "web:update-release": "npm run web:clean && npm run web:build-dist && npm run web:sync && npm run web:uploadfs-release", + "test": "echo \"Error: no test specified\" && exit 1", + "docs:generate": "cd docs && doxygen Doxyfile", + "test:api:logs": "python scripts/test_logs_api.py", + "test:api:logs:ip": "python scripts/test_logs_api.py --host 192.168.1.250", + "debug:serial": "python scripts/fetch_logs.py", + "debug:boot-metrics": "python scripts/get_boot_metrics.py", + "upload:release": "pio run -t upload -e waveshare-release", + "upload:release-debug": "pio run -t upload -e waveshare-release-debug", + "upload": "pio run -t upload -e waveshare", + "update-test": "npm run build && npm run upload && npm run serial:status", + "update": "npm run build && npm run upload", + "update:master": "npm run build && pio run -t upload -e waveshare --upload-port COM3", + "update:slave": "npm run build && pio run -t upload -e waveshare --upload-port COM6", + "update-all": "npm run web:update && npm run update", + "update-all-release": "npm run web:update-release && npm run update-release", + "update-release": "pio run -e waveshare-release -t upload", + "update-release-debug": "pio run -e waveshare-release-debug -t upload", + "create-bundle": "sh ./scripts/create-bundle.sh", + "index": "platformio run -t compiledb", + "update:pio": "pio pkg update", + "list:ports": "pio device list" + }, + "keywords": [ + "esp32", + "platformio", + "firmware", + "iot" + ], + "author": "", + "license": "ISC", + "url": "https://polymech.info/en/resources/cassandra/", + "devDependencies": { + "@types/node": "^22.15.3", + "@types/serialport": "^8.0.5", + "@types/ws": "^8.18.1", + "cross-env": "^7.0.3", + "jsmodbus": "^4.0.10", + "nexe": "^5.0.0-beta.4", + "serialport": "^13.0.0", + "tslog": "^4.9.3", + "typescript": "^5.8.3", + "vitest": "^3.1.2", + "ws": "^8.18.1" + }, + "dependencies": { + "@polymech/fs": "file:../../polymech-mono/packages/fs", + "chalk": "^5.4.1", + "fs-extra": "^11.3.0", + "protobufjs-cli": "^1.1.3", + "simple-git": "^3.30.0" + } +} \ No newline at end of file diff --git a/platform.ini.md b/cassandra-rc2/platform.ini.md similarity index 100% rename from platform.ini.md rename to cassandra-rc2/platform.ini.md diff --git a/platformio-p4.ini b/cassandra-rc2/platformio-p4.ini similarity index 100% rename from platformio-p4.ini rename to cassandra-rc2/platformio-p4.ini diff --git a/platformio.ini b/cassandra-rc2/platformio.ini similarity index 100% rename from platformio.ini rename to cassandra-rc2/platformio.ini diff --git a/proto/registers.options b/cassandra-rc2/proto/registers.options similarity index 100% rename from proto/registers.options rename to cassandra-rc2/proto/registers.options diff --git a/proto/registers.proto b/cassandra-rc2/proto/registers.proto similarity index 100% rename from proto/registers.proto rename to cassandra-rc2/proto/registers.proto diff --git a/scripts/LittleFSBuilder.py b/cassandra-rc2/scripts/LittleFSBuilder.py similarity index 100% rename from scripts/LittleFSBuilder.py rename to cassandra-rc2/scripts/LittleFSBuilder.py diff --git a/scripts/README-upload.md b/cassandra-rc2/scripts/README-upload.md similarity index 100% rename from scripts/README-upload.md rename to cassandra-rc2/scripts/README-upload.md diff --git a/scripts/build-deps.sh b/cassandra-rc2/scripts/build-deps.sh similarity index 100% rename from scripts/build-deps.sh rename to cassandra-rc2/scripts/build-deps.sh diff --git a/scripts/bundle-fibereusetech.sh b/cassandra-rc2/scripts/bundle-fibereusetech.sh similarity index 100% rename from scripts/bundle-fibereusetech.sh rename to cassandra-rc2/scripts/bundle-fibereusetech.sh diff --git a/scripts/bundle-mesint-dev.sh b/cassandra-rc2/scripts/bundle-mesint-dev.sh similarity index 100% rename from scripts/bundle-mesint-dev.sh rename to cassandra-rc2/scripts/bundle-mesint-dev.sh diff --git a/scripts/bundle-mesint.sh b/cassandra-rc2/scripts/bundle-mesint.sh similarity index 100% rename from scripts/bundle-mesint.sh rename to cassandra-rc2/scripts/bundle-mesint.sh diff --git a/scripts/bundle-ph.sh b/cassandra-rc2/scripts/bundle-ph.sh similarity index 100% rename from scripts/bundle-ph.sh rename to cassandra-rc2/scripts/bundle-ph.sh diff --git a/scripts/bundle-plastiq.sh b/cassandra-rc2/scripts/bundle-plastiq.sh similarity index 100% rename from scripts/bundle-plastiq.sh rename to cassandra-rc2/scripts/bundle-plastiq.sh diff --git a/scripts/bundle-uploader.sh b/cassandra-rc2/scripts/bundle-uploader.sh similarity index 100% rename from scripts/bundle-uploader.sh rename to cassandra-rc2/scripts/bundle-uploader.sh diff --git a/scripts/check_endpoint.py b/cassandra-rc2/scripts/check_endpoint.py similarity index 100% rename from scripts/check_endpoint.py rename to cassandra-rc2/scripts/check_endpoint.py diff --git a/scripts/create-bundle.sh b/cassandra-rc2/scripts/create-bundle.sh similarity index 100% rename from scripts/create-bundle.sh rename to cassandra-rc2/scripts/create-bundle.sh diff --git a/scripts/debug_serial_logs.py b/cassandra-rc2/scripts/debug_serial_logs.py similarity index 100% rename from scripts/debug_serial_logs.py rename to cassandra-rc2/scripts/debug_serial_logs.py diff --git a/scripts/decode.sh b/cassandra-rc2/scripts/decode.sh similarity index 100% rename from scripts/decode.sh rename to cassandra-rc2/scripts/decode.sh diff --git a/scripts/deploy-mesint.sh b/cassandra-rc2/scripts/deploy-mesint.sh similarity index 100% rename from scripts/deploy-mesint.sh rename to cassandra-rc2/scripts/deploy-mesint.sh diff --git a/scripts/deploy-plastichub.sh b/cassandra-rc2/scripts/deploy-plastichub.sh similarity index 100% rename from scripts/deploy-plastichub.sh rename to cassandra-rc2/scripts/deploy-plastichub.sh diff --git a/scripts/deploy-plastiq.sh b/cassandra-rc2/scripts/deploy-plastiq.sh similarity index 100% rename from scripts/deploy-plastiq.sh rename to cassandra-rc2/scripts/deploy-plastiq.sh diff --git a/scripts/deploy.sh b/cassandra-rc2/scripts/deploy.sh similarity index 100% rename from scripts/deploy.sh rename to cassandra-rc2/scripts/deploy.sh diff --git a/scripts/diag.sh b/cassandra-rc2/scripts/diag.sh similarity index 100% rename from scripts/diag.sh rename to cassandra-rc2/scripts/diag.sh diff --git a/scripts/esptool.exe b/cassandra-rc2/scripts/esptool.exe similarity index 100% rename from scripts/esptool.exe rename to cassandra-rc2/scripts/esptool.exe diff --git a/scripts/file_to_header.py b/cassandra-rc2/scripts/file_to_header.py similarity index 100% rename from scripts/file_to_header.py rename to cassandra-rc2/scripts/file_to_header.py diff --git a/scripts/generate_rest_server.py b/cassandra-rc2/scripts/generate_rest_server.py similarity index 100% rename from scripts/generate_rest_server.py rename to cassandra-rc2/scripts/generate_rest_server.py diff --git a/scripts/get_boot_metrics.py b/cassandra-rc2/scripts/get_boot_metrics.py similarity index 100% rename from scripts/get_boot_metrics.py rename to cassandra-rc2/scripts/get_boot_metrics.py diff --git a/scripts/html_to_header.py b/cassandra-rc2/scripts/html_to_header.py similarity index 100% rename from scripts/html_to_header.py rename to cassandra-rc2/scripts/html_to_header.py diff --git a/scripts/idf-build.sh b/cassandra-rc2/scripts/idf-build.sh similarity index 100% rename from scripts/idf-build.sh rename to cassandra-rc2/scripts/idf-build.sh diff --git a/scripts/idf-flash.sh b/cassandra-rc2/scripts/idf-flash.sh similarity index 100% rename from scripts/idf-flash.sh rename to cassandra-rc2/scripts/idf-flash.sh diff --git a/scripts/idf-monitor.sh b/cassandra-rc2/scripts/idf-monitor.sh similarity index 100% rename from scripts/idf-monitor.sh rename to cassandra-rc2/scripts/idf-monitor.sh diff --git a/scripts/idf_cmd_init.bat b/cassandra-rc2/scripts/idf_cmd_init.bat similarity index 100% rename from scripts/idf_cmd_init.bat rename to cassandra-rc2/scripts/idf_cmd_init.bat diff --git a/scripts/mklittlefs.exe b/cassandra-rc2/scripts/mklittlefs.exe similarity index 100% rename from scripts/mklittlefs.exe rename to cassandra-rc2/scripts/mklittlefs.exe diff --git a/scripts/modbus_battle_test.py b/cassandra-rc2/scripts/modbus_battle_test.py similarity index 100% rename from scripts/modbus_battle_test.py rename to cassandra-rc2/scripts/modbus_battle_test.py diff --git a/scripts/modbus_read_coils.py b/cassandra-rc2/scripts/modbus_read_coils.py similarity index 100% rename from scripts/modbus_read_coils.py rename to cassandra-rc2/scripts/modbus_read_coils.py diff --git a/scripts/modbus_read_registers.py b/cassandra-rc2/scripts/modbus_read_registers.py similarity index 100% rename from scripts/modbus_read_registers.py rename to cassandra-rc2/scripts/modbus_read_registers.py diff --git a/scripts/modbus_write_coil.py b/cassandra-rc2/scripts/modbus_write_coil.py similarity index 100% rename from scripts/modbus_write_coil.py rename to cassandra-rc2/scripts/modbus_write_coil.py diff --git a/scripts/modbus_write_register.py b/cassandra-rc2/scripts/modbus_write_register.py similarity index 100% rename from scripts/modbus_write_register.py rename to cassandra-rc2/scripts/modbus_write_register.py diff --git a/scripts/monitor_serial.py b/cassandra-rc2/scripts/monitor_serial.py similarity index 100% rename from scripts/monitor_serial.py rename to cassandra-rc2/scripts/monitor_serial.py diff --git a/scripts/multi_client_test.py b/cassandra-rc2/scripts/multi_client_test.py similarity index 100% rename from scripts/multi_client_test.py rename to cassandra-rc2/scripts/multi_client_test.py diff --git a/scripts/patch-config-cassandra-fibereusetech.sh b/cassandra-rc2/scripts/patch-config-cassandra-fibereusetech.sh similarity index 100% rename from scripts/patch-config-cassandra-fibereusetech.sh rename to cassandra-rc2/scripts/patch-config-cassandra-fibereusetech.sh diff --git a/scripts/patch-config-cassandra.sh b/cassandra-rc2/scripts/patch-config-cassandra.sh similarity index 100% rename from scripts/patch-config-cassandra.sh rename to cassandra-rc2/scripts/patch-config-cassandra.sh diff --git a/scripts/patch-config-elena.sh b/cassandra-rc2/scripts/patch-config-elena.sh similarity index 100% rename from scripts/patch-config-elena.sh rename to cassandra-rc2/scripts/patch-config-elena.sh diff --git a/scripts/rate_test_serial.py b/cassandra-rc2/scripts/rate_test_serial.py similarity index 100% rename from scripts/rate_test_serial.py rename to cassandra-rc2/scripts/rate_test_serial.py diff --git a/scripts/read_battle_counter.py b/cassandra-rc2/scripts/read_battle_counter.py similarity index 100% rename from scripts/read_battle_counter.py rename to cassandra-rc2/scripts/read_battle_counter.py diff --git a/scripts/requirements.txt b/cassandra-rc2/scripts/requirements.txt similarity index 100% rename from scripts/requirements.txt rename to cassandra-rc2/scripts/requirements.txt diff --git a/scripts/run_nanopb_generator.py b/cassandra-rc2/scripts/run_nanopb_generator.py similarity index 100% rename from scripts/run_nanopb_generator.py rename to cassandra-rc2/scripts/run_nanopb_generator.py diff --git a/scripts/send_serial_cmd.py b/cassandra-rc2/scripts/send_serial_cmd.py similarity index 100% rename from scripts/send_serial_cmd.py rename to cassandra-rc2/scripts/send_serial_cmd.py diff --git a/scripts/setup_upload_tools.bat b/cassandra-rc2/scripts/setup_upload_tools.bat similarity index 100% rename from scripts/setup_upload_tools.bat rename to cassandra-rc2/scripts/setup_upload_tools.bat diff --git a/scripts/slave.sh b/cassandra-rc2/scripts/slave.sh similarity index 100% rename from scripts/slave.sh rename to cassandra-rc2/scripts/slave.sh diff --git a/scripts/stress_test_serial.py b/cassandra-rc2/scripts/stress_test_serial.py similarity index 100% rename from scripts/stress_test_serial.py rename to cassandra-rc2/scripts/stress_test_serial.py diff --git a/scripts/strip_elf.py b/cassandra-rc2/scripts/strip_elf.py similarity index 100% rename from scripts/strip_elf.py rename to cassandra-rc2/scripts/strip_elf.py diff --git a/scripts/test_api.py b/cassandra-rc2/scripts/test_api.py similarity index 100% rename from scripts/test_api.py rename to cassandra-rc2/scripts/test_api.py diff --git a/scripts/test_logs_api.py b/cassandra-rc2/scripts/test_logs_api.py similarity index 100% rename from scripts/test_logs_api.py rename to cassandra-rc2/scripts/test_logs_api.py diff --git a/scripts/test_modbus_long_poll.py b/cassandra-rc2/scripts/test_modbus_long_poll.py similarity index 100% rename from scripts/test_modbus_long_poll.py rename to cassandra-rc2/scripts/test_modbus_long_poll.py diff --git a/scripts/test_system_info.py b/cassandra-rc2/scripts/test_system_info.py similarity index 100% rename from scripts/test_system_info.py rename to cassandra-rc2/scripts/test_system_info.py diff --git a/scripts/test_upload.py b/cassandra-rc2/scripts/test_upload.py similarity index 100% rename from scripts/test_upload.py rename to cassandra-rc2/scripts/test_upload.py diff --git a/scripts/test_working_api.py b/cassandra-rc2/scripts/test_working_api.py similarity index 100% rename from scripts/test_working_api.py rename to cassandra-rc2/scripts/test_working_api.py diff --git a/scripts/ts-commons.md b/cassandra-rc2/scripts/ts-commons.md similarity index 100% rename from scripts/ts-commons.md rename to cassandra-rc2/scripts/ts-commons.md diff --git a/scripts/ts-commons.sh b/cassandra-rc2/scripts/ts-commons.sh similarity index 100% rename from scripts/ts-commons.sh rename to cassandra-rc2/scripts/ts-commons.sh diff --git a/scripts/ts.md b/cassandra-rc2/scripts/ts.md similarity index 100% rename from scripts/ts.md rename to cassandra-rc2/scripts/ts.md diff --git a/scripts/ts.sh b/cassandra-rc2/scripts/ts.sh similarity index 100% rename from scripts/ts.sh rename to cassandra-rc2/scripts/ts.sh diff --git a/scripts/upload-all.bat b/cassandra-rc2/scripts/upload-all.bat similarity index 100% rename from scripts/upload-all.bat rename to cassandra-rc2/scripts/upload-all.bat diff --git a/scripts/upload-all.sh b/cassandra-rc2/scripts/upload-all.sh similarity index 100% rename from scripts/upload-all.sh rename to cassandra-rc2/scripts/upload-all.sh diff --git a/scripts/upload-littlefs.bat b/cassandra-rc2/scripts/upload-littlefs.bat similarity index 100% rename from scripts/upload-littlefs.bat rename to cassandra-rc2/scripts/upload-littlefs.bat diff --git a/scripts/upload-littlefs.sh b/cassandra-rc2/scripts/upload-littlefs.sh similarity index 100% rename from scripts/upload-littlefs.sh rename to cassandra-rc2/scripts/upload-littlefs.sh diff --git a/scripts/upload.bat b/cassandra-rc2/scripts/upload.bat similarity index 100% rename from scripts/upload.bat rename to cassandra-rc2/scripts/upload.bat diff --git a/scripts/upload_firmware.py b/cassandra-rc2/scripts/upload_firmware.py similarity index 100% rename from scripts/upload_firmware.py rename to cassandra-rc2/scripts/upload_firmware.py diff --git a/scripts/upload_littlefs.py b/cassandra-rc2/scripts/upload_littlefs.py similarity index 100% rename from scripts/upload_littlefs.py rename to cassandra-rc2/scripts/upload_littlefs.py diff --git a/scripts/upload_web.bat b/cassandra-rc2/scripts/upload_web.bat similarity index 100% rename from scripts/upload_web.bat rename to cassandra-rc2/scripts/upload_web.bat diff --git a/scripts/version.js b/cassandra-rc2/scripts/version.js similarity index 100% rename from scripts/version.js rename to cassandra-rc2/scripts/version.js diff --git a/scripts/web.sh b/cassandra-rc2/scripts/web.sh similarity index 100% rename from scripts/web.sh rename to cassandra-rc2/scripts/web.sh diff --git a/src/temp-old.cpp b/cassandra-rc2/sdkconfig.defaults similarity index 100% rename from src/temp-old.cpp rename to cassandra-rc2/sdkconfig.defaults diff --git a/src/CMakeLists.txt b/cassandra-rc2/src/CMakeLists.txt similarity index 100% rename from src/CMakeLists.txt rename to cassandra-rc2/src/CMakeLists.txt diff --git a/src/PHApp-Modbus.cpp b/cassandra-rc2/src/PHApp-Modbus.cpp similarity index 100% rename from src/PHApp-Modbus.cpp rename to cassandra-rc2/src/PHApp-Modbus.cpp diff --git a/src/PHApp-Profiles.cpp b/cassandra-rc2/src/PHApp-Profiles.cpp similarity index 100% rename from src/PHApp-Profiles.cpp rename to cassandra-rc2/src/PHApp-Profiles.cpp diff --git a/src/PHApp.cpp b/cassandra-rc2/src/PHApp.cpp similarity index 100% rename from src/PHApp.cpp rename to cassandra-rc2/src/PHApp.cpp diff --git a/src/PHApp.h b/cassandra-rc2/src/PHApp.h similarity index 100% rename from src/PHApp.h rename to cassandra-rc2/src/PHApp.h diff --git a/src/PHAppCycle.cpp b/cassandra-rc2/src/PHAppCycle.cpp similarity index 100% rename from src/PHAppCycle.cpp rename to cassandra-rc2/src/PHAppCycle.cpp diff --git a/src/PHAppNetwork.cpp b/cassandra-rc2/src/PHAppNetwork.cpp similarity index 100% rename from src/PHAppNetwork.cpp rename to cassandra-rc2/src/PHAppNetwork.cpp diff --git a/src/PHAppState.cpp b/cassandra-rc2/src/PHAppState.cpp similarity index 100% rename from src/PHAppState.cpp rename to cassandra-rc2/src/PHAppState.cpp diff --git a/src/PHAppWeb.cpp b/cassandra-rc2/src/PHAppWeb.cpp similarity index 100% rename from src/PHAppWeb.cpp rename to cassandra-rc2/src/PHAppWeb.cpp diff --git a/src/RS485Devices.cpp b/cassandra-rc2/src/RS485Devices.cpp similarity index 100% rename from src/RS485Devices.cpp rename to cassandra-rc2/src/RS485Devices.cpp diff --git a/src/RS485Devices.h b/cassandra-rc2/src/RS485Devices.h similarity index 100% rename from src/RS485Devices.h rename to cassandra-rc2/src/RS485Devices.h diff --git a/src/RuntimeState.cpp b/cassandra-rc2/src/RuntimeState.cpp similarity index 100% rename from src/RuntimeState.cpp rename to cassandra-rc2/src/RuntimeState.cpp diff --git a/src/RuntimeState.h b/cassandra-rc2/src/RuntimeState.h similarity index 100% rename from src/RuntimeState.h rename to cassandra-rc2/src/RuntimeState.h diff --git a/src/Settings.cpp b/cassandra-rc2/src/Settings.cpp similarity index 100% rename from src/Settings.cpp rename to cassandra-rc2/src/Settings.cpp diff --git a/src/Settings.h b/cassandra-rc2/src/Settings.h similarity index 100% rename from src/Settings.h rename to cassandra-rc2/src/Settings.h diff --git a/src/app-logger.h b/cassandra-rc2/src/app-logger.h similarity index 100% rename from src/app-logger.h rename to cassandra-rc2/src/app-logger.h diff --git a/src/config-4-min.h b/cassandra-rc2/src/config-4-min.h similarity index 100% rename from src/config-4-min.h rename to cassandra-rc2/src/config-4-min.h diff --git a/src/config-dev.h b/cassandra-rc2/src/config-dev.h similarity index 100% rename from src/config-dev.h rename to cassandra-rc2/src/config-dev.h diff --git a/src/config-extensions.h b/cassandra-rc2/src/config-extensions.h similarity index 100% rename from src/config-extensions.h rename to cassandra-rc2/src/config-extensions.h diff --git a/src/config-extern.h b/cassandra-rc2/src/config-extern.h similarity index 100% rename from src/config-extern.h rename to cassandra-rc2/src/config-extern.h diff --git a/src/config-mesint.h b/cassandra-rc2/src/config-mesint.h similarity index 100% rename from src/config-mesint.h rename to cassandra-rc2/src/config-mesint.h diff --git a/src/config-modbus.h b/cassandra-rc2/src/config-modbus.h similarity index 100% rename from src/config-modbus.h rename to cassandra-rc2/src/config-modbus.h diff --git a/src/config-network.h b/cassandra-rc2/src/config-network.h similarity index 100% rename from src/config-network.h rename to cassandra-rc2/src/config-network.h diff --git a/src/config-override.h b/cassandra-rc2/src/config-override.h similarity index 100% rename from src/config-override.h rename to cassandra-rc2/src/config-override.h diff --git a/src/config-user-cs-pieter.h b/cassandra-rc2/src/config-user-cs-pieter.h similarity index 100% rename from src/config-user-cs-pieter.h rename to cassandra-rc2/src/config-user-cs-pieter.h diff --git a/src/config-user-mes-int.h b/cassandra-rc2/src/config-user-mes-int.h similarity index 100% rename from src/config-user-mes-int.h rename to cassandra-rc2/src/config-user-mes-int.h diff --git a/src/config-user-mesint.h b/cassandra-rc2/src/config-user-mesint.h similarity index 100% rename from src/config-user-mesint.h rename to cassandra-rc2/src/config-user-mesint.h diff --git a/src/config-user.h b/cassandra-rc2/src/config-user.h similarity index 100% rename from src/config-user.h rename to cassandra-rc2/src/config-user.h diff --git a/src/config-validate.h b/cassandra-rc2/src/config-validate.h similarity index 100% rename from src/config-validate.h rename to cassandra-rc2/src/config-validate.h diff --git a/src/config.h b/cassandra-rc2/src/config.h similarity index 100% rename from src/config.h rename to cassandra-rc2/src/config.h diff --git a/src/config_adv.h b/cassandra-rc2/src/config_adv.h similarity index 100% rename from src/config_adv.h rename to cassandra-rc2/src/config_adv.h diff --git a/src/features.h b/cassandra-rc2/src/features.h similarity index 100% rename from src/features.h rename to cassandra-rc2/src/features.h diff --git a/src/firmware.ino b/cassandra-rc2/src/firmware.ino similarity index 100% rename from src/firmware.ino rename to cassandra-rc2/src/firmware.ino diff --git a/src/pid/PIDController.cpp b/cassandra-rc2/src/pid/PIDController.cpp similarity index 100% rename from src/pid/PIDController.cpp rename to cassandra-rc2/src/pid/PIDController.cpp diff --git a/src/pid/PIDController.h b/cassandra-rc2/src/pid/PIDController.h similarity index 100% rename from src/pid/PIDController.h rename to cassandra-rc2/src/pid/PIDController.h diff --git a/src/proto/registers.pb.c b/cassandra-rc2/src/proto/registers.pb.c similarity index 100% rename from src/proto/registers.pb.c rename to cassandra-rc2/src/proto/registers.pb.c diff --git a/src/proto/registers.pb.h b/cassandra-rc2/src/proto/registers.pb.h similarity index 100% rename from src/proto/registers.pb.h rename to cassandra-rc2/src/proto/registers.pb.h diff --git a/cassandra-rc2/src/temp-old.cpp b/cassandra-rc2/src/temp-old.cpp new file mode 100644 index 00000000..e69de29b diff --git a/src/version.h b/cassandra-rc2/src/version.h similarity index 100% rename from src/version.h rename to cassandra-rc2/src/version.h diff --git a/sync-clients.json b/cassandra-rc2/sync-clients.json similarity index 100% rename from sync-clients.json rename to cassandra-rc2/sync-clients.json diff --git a/cassandra-rc2/tests/bundle.ts b/cassandra-rc2/tests/bundle.ts new file mode 100644 index 00000000..78753e6f --- /dev/null +++ b/cassandra-rc2/tests/bundle.ts @@ -0,0 +1,848 @@ +export interface Register { + address: number; + error?: number; + value?: number; + name?: string; + component?: string; + id?: number; + type?: number; + slaveId?: number; + flags?: number; + group?: string; +} + +export function encodeRegister(message: Register): Uint8Array { + let bb = popByteBuffer(); + _encodeRegister(message, bb); + return toUint8Array(bb); +} + +function _encodeRegister(message: Register, bb: ByteBuffer): void { + // required uint32 address = 1; + let $address = message.address; + if ($address !== undefined) { + writeVarint32(bb, 8); + writeVarint32(bb, $address); + } + + // optional sint32 error = 2; + let $error = message.error; + if ($error !== undefined) { + writeVarint32(bb, 16); + writeVarint32ZigZag(bb, $error); + } + + // optional uint32 value = 3; + let $value = message.value; + if ($value !== undefined) { + writeVarint32(bb, 24); + writeVarint32(bb, $value); + } + + // optional string name = 4; + let $name = message.name; + if ($name !== undefined) { + writeVarint32(bb, 34); + writeString(bb, $name); + } + + // optional string component = 5; + let $component = message.component; + if ($component !== undefined) { + writeVarint32(bb, 42); + writeString(bb, $component); + } + + // optional uint32 id = 6; + let $id = message.id; + if ($id !== undefined) { + writeVarint32(bb, 48); + writeVarint32(bb, $id); + } + + // optional uint32 type = 7; + let $type = message.type; + if ($type !== undefined) { + writeVarint32(bb, 56); + writeVarint32(bb, $type); + } + + // optional uint32 slaveId = 8; + let $slaveId = message.slaveId; + if ($slaveId !== undefined) { + writeVarint32(bb, 64); + writeVarint32(bb, $slaveId); + } + + // optional uint32 flags = 9; + let $flags = message.flags; + if ($flags !== undefined) { + writeVarint32(bb, 72); + writeVarint32(bb, $flags); + } + + // optional string group = 10; + let $group = message.group; + if ($group !== undefined) { + writeVarint32(bb, 82); + writeString(bb, $group); + } +} + +export function decodeRegister(binary: Uint8Array): Register { + return _decodeRegister(wrapByteBuffer(binary)); +} + +function _decodeRegister(bb: ByteBuffer): Register { + let message: Register = {} as any; + + end_of_message: while (!isAtEnd(bb)) { + let tag = readVarint32(bb); + + switch (tag >>> 3) { + case 0: + break end_of_message; + + // required uint32 address = 1; + case 1: { + message.address = readVarint32(bb) >>> 0; + break; + } + + // optional sint32 error = 2; + case 2: { + message.error = readVarint32ZigZag(bb); + break; + } + + // optional uint32 value = 3; + case 3: { + message.value = readVarint32(bb) >>> 0; + break; + } + + // optional string name = 4; + case 4: { + message.name = readString(bb, readVarint32(bb)); + break; + } + + // optional string component = 5; + case 5: { + message.component = readString(bb, readVarint32(bb)); + break; + } + + // optional uint32 id = 6; + case 6: { + message.id = readVarint32(bb) >>> 0; + break; + } + + // optional uint32 type = 7; + case 7: { + message.type = readVarint32(bb) >>> 0; + break; + } + + // optional uint32 slaveId = 8; + case 8: { + message.slaveId = readVarint32(bb) >>> 0; + break; + } + + // optional uint32 flags = 9; + case 9: { + message.flags = readVarint32(bb) >>> 0; + break; + } + + // optional string group = 10; + case 10: { + message.group = readString(bb, readVarint32(bb)); + break; + } + + default: + skipUnknownField(bb, tag & 7); + } + } + + if (message.address === undefined) + throw new Error("Missing required field: address"); + + return message; +} + +export interface RegistersResponseMetadata { + page: number; + pageSize: number; + totalRegisters: number; + totalPages: number; +} + +export function encodeRegistersResponseMetadata(message: RegistersResponseMetadata): Uint8Array { + let bb = popByteBuffer(); + _encodeRegistersResponseMetadata(message, bb); + return toUint8Array(bb); +} + +function _encodeRegistersResponseMetadata(message: RegistersResponseMetadata, bb: ByteBuffer): void { + // required uint32 page = 1; + let $page = message.page; + if ($page !== undefined) { + writeVarint32(bb, 8); + writeVarint32(bb, $page); + } + + // required uint32 pageSize = 2; + let $pageSize = message.pageSize; + if ($pageSize !== undefined) { + writeVarint32(bb, 16); + writeVarint32(bb, $pageSize); + } + + // required uint32 totalRegisters = 3; + let $totalRegisters = message.totalRegisters; + if ($totalRegisters !== undefined) { + writeVarint32(bb, 24); + writeVarint32(bb, $totalRegisters); + } + + // required uint32 totalPages = 4; + let $totalPages = message.totalPages; + if ($totalPages !== undefined) { + writeVarint32(bb, 32); + writeVarint32(bb, $totalPages); + } +} + +export function decodeRegistersResponseMetadata(binary: Uint8Array): RegistersResponseMetadata { + return _decodeRegistersResponseMetadata(wrapByteBuffer(binary)); +} + +function _decodeRegistersResponseMetadata(bb: ByteBuffer): RegistersResponseMetadata { + let message: RegistersResponseMetadata = {} as any; + + end_of_message: while (!isAtEnd(bb)) { + let tag = readVarint32(bb); + + switch (tag >>> 3) { + case 0: + break end_of_message; + + // required uint32 page = 1; + case 1: { + message.page = readVarint32(bb) >>> 0; + break; + } + + // required uint32 pageSize = 2; + case 2: { + message.pageSize = readVarint32(bb) >>> 0; + break; + } + + // required uint32 totalRegisters = 3; + case 3: { + message.totalRegisters = readVarint32(bb) >>> 0; + break; + } + + // required uint32 totalPages = 4; + case 4: { + message.totalPages = readVarint32(bb) >>> 0; + break; + } + + default: + skipUnknownField(bb, tag & 7); + } + } + + if (message.page === undefined) + throw new Error("Missing required field: page"); + + if (message.pageSize === undefined) + throw new Error("Missing required field: pageSize"); + + if (message.totalRegisters === undefined) + throw new Error("Missing required field: totalRegisters"); + + if (message.totalPages === undefined) + throw new Error("Missing required field: totalPages"); + + return message; +} + +export interface RegistersResponse { + meta: RegistersResponseMetadata; + data?: Register[]; +} + +export function encodeRegistersResponse(message: RegistersResponse): Uint8Array { + let bb = popByteBuffer(); + _encodeRegistersResponse(message, bb); + return toUint8Array(bb); +} + +function _encodeRegistersResponse(message: RegistersResponse, bb: ByteBuffer): void { + // required RegistersResponseMetadata meta = 1; + let $meta = message.meta; + if ($meta !== undefined) { + writeVarint32(bb, 10); + let nested = popByteBuffer(); + _encodeRegistersResponseMetadata($meta, nested); + writeVarint32(bb, nested.limit); + writeByteBuffer(bb, nested); + pushByteBuffer(nested); + } + + // repeated Register data = 2; + let array$data = message.data; + if (array$data !== undefined) { + for (let value of array$data) { + writeVarint32(bb, 18); + let nested = popByteBuffer(); + _encodeRegister(value, nested); + writeVarint32(bb, nested.limit); + writeByteBuffer(bb, nested); + pushByteBuffer(nested); + } + } +} + +export function decodeRegistersResponse(binary: Uint8Array): RegistersResponse { + return _decodeRegistersResponse(wrapByteBuffer(binary)); +} + +function _decodeRegistersResponse(bb: ByteBuffer): RegistersResponse { + let message: RegistersResponse = {} as any; + + end_of_message: while (!isAtEnd(bb)) { + let tag = readVarint32(bb); + + switch (tag >>> 3) { + case 0: + break end_of_message; + + // required RegistersResponseMetadata meta = 1; + case 1: { + let limit = pushTemporaryLength(bb); + message.meta = _decodeRegistersResponseMetadata(bb); + bb.limit = limit; + break; + } + + // repeated Register data = 2; + case 2: { + let limit = pushTemporaryLength(bb); + let values = message.data || (message.data = []); + values.push(_decodeRegister(bb)); + bb.limit = limit; + break; + } + + default: + skipUnknownField(bb, tag & 7); + } + } + + if (message.meta === undefined) + throw new Error("Missing required field: meta"); + + return message; +} + +export interface Long { + low: number; + high: number; + unsigned: boolean; +} + +interface ByteBuffer { + bytes: Uint8Array; + offset: number; + limit: number; +} + +function pushTemporaryLength(bb: ByteBuffer): number { + let length = readVarint32(bb); + let limit = bb.limit; + bb.limit = bb.offset + length; + return limit; +} + +function skipUnknownField(bb: ByteBuffer, type: number): void { + switch (type) { + case 0: while (readByte(bb) & 0x80) { } break; + case 2: skip(bb, readVarint32(bb)); break; + case 5: skip(bb, 4); break; + case 1: skip(bb, 8); break; + default: throw new Error("Unimplemented type: " + type); + } +} + +function stringToLong(value: string): Long { + return { + low: value.charCodeAt(0) | (value.charCodeAt(1) << 16), + high: value.charCodeAt(2) | (value.charCodeAt(3) << 16), + unsigned: false, + }; +} + +function longToString(value: Long): string { + let low = value.low; + let high = value.high; + return String.fromCharCode( + low & 0xFFFF, + low >>> 16, + high & 0xFFFF, + high >>> 16); +} + +// The code below was modified from https://github.com/protobufjs/bytebuffer.js +// which is under the Apache License 2.0. + +let f32 = new Float32Array(1); +let f32_u8 = new Uint8Array(f32.buffer); + +let f64 = new Float64Array(1); +let f64_u8 = new Uint8Array(f64.buffer); + +function intToLong(value: number): Long { + value |= 0; + return { + low: value, + high: value >> 31, + unsigned: value >= 0, + }; +} + +let bbStack: ByteBuffer[] = []; + +function popByteBuffer(): ByteBuffer { + const bb = bbStack.pop(); + if (!bb) return { bytes: new Uint8Array(64), offset: 0, limit: 0 }; + bb.offset = bb.limit = 0; + return bb; +} + +function pushByteBuffer(bb: ByteBuffer): void { + bbStack.push(bb); +} + +function wrapByteBuffer(bytes: Uint8Array): ByteBuffer { + return { bytes, offset: 0, limit: bytes.length }; +} + +function toUint8Array(bb: ByteBuffer): Uint8Array { + let bytes = bb.bytes; + let limit = bb.limit; + return bytes.length === limit ? bytes : bytes.subarray(0, limit); +} + +function skip(bb: ByteBuffer, offset: number): void { + if (bb.offset + offset > bb.limit) { + throw new Error('Skip past limit'); + } + bb.offset += offset; +} + +function isAtEnd(bb: ByteBuffer): boolean { + return bb.offset >= bb.limit; +} + +function grow(bb: ByteBuffer, count: number): number { + let bytes = bb.bytes; + let offset = bb.offset; + let limit = bb.limit; + let finalOffset = offset + count; + if (finalOffset > bytes.length) { + let newBytes = new Uint8Array(finalOffset * 2); + newBytes.set(bytes); + bb.bytes = newBytes; + } + bb.offset = finalOffset; + if (finalOffset > limit) { + bb.limit = finalOffset; + } + return offset; +} + +function advance(bb: ByteBuffer, count: number): number { + let offset = bb.offset; + if (offset + count > bb.limit) { + throw new Error('Read past limit'); + } + bb.offset += count; + return offset; +} + +function readBytes(bb: ByteBuffer, count: number): Uint8Array { + let offset = advance(bb, count); + return bb.bytes.subarray(offset, offset + count); +} + +function writeBytes(bb: ByteBuffer, buffer: Uint8Array): void { + let offset = grow(bb, buffer.length); + bb.bytes.set(buffer, offset); +} + +function readString(bb: ByteBuffer, count: number): string { + // Sadly a hand-coded UTF8 decoder is much faster than subarray+TextDecoder in V8 + let offset = advance(bb, count); + let fromCharCode = String.fromCharCode; + let bytes = bb.bytes; + let invalid = '\uFFFD'; + let text = ''; + + for (let i = 0; i < count; i++) { + let c1 = bytes[i + offset], c2: number, c3: number, c4: number, c: number; + + // 1 byte + if ((c1 & 0x80) === 0) { + text += fromCharCode(c1); + } + + // 2 bytes + else if ((c1 & 0xE0) === 0xC0) { + if (i + 1 >= count) text += invalid; + else { + c2 = bytes[i + offset + 1]; + if ((c2 & 0xC0) !== 0x80) text += invalid; + else { + c = ((c1 & 0x1F) << 6) | (c2 & 0x3F); + if (c < 0x80) text += invalid; + else { + text += fromCharCode(c); + i++; + } + } + } + } + + // 3 bytes + else if ((c1 & 0xF0) == 0xE0) { + if (i + 2 >= count) text += invalid; + else { + c2 = bytes[i + offset + 1]; + c3 = bytes[i + offset + 2]; + if (((c2 | (c3 << 8)) & 0xC0C0) !== 0x8080) text += invalid; + else { + c = ((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F); + if (c < 0x0800 || (c >= 0xD800 && c <= 0xDFFF)) text += invalid; + else { + text += fromCharCode(c); + i += 2; + } + } + } + } + + // 4 bytes + else if ((c1 & 0xF8) == 0xF0) { + if (i + 3 >= count) text += invalid; + else { + c2 = bytes[i + offset + 1]; + c3 = bytes[i + offset + 2]; + c4 = bytes[i + offset + 3]; + if (((c2 | (c3 << 8) | (c4 << 16)) & 0xC0C0C0) !== 0x808080) text += invalid; + else { + c = ((c1 & 0x07) << 0x12) | ((c2 & 0x3F) << 0x0C) | ((c3 & 0x3F) << 0x06) | (c4 & 0x3F); + if (c < 0x10000 || c > 0x10FFFF) text += invalid; + else { + c -= 0x10000; + text += fromCharCode((c >> 10) + 0xD800, (c & 0x3FF) + 0xDC00); + i += 3; + } + } + } + } + + else text += invalid; + } + + return text; +} + +function writeString(bb: ByteBuffer, text: string): void { + // Sadly a hand-coded UTF8 encoder is much faster than TextEncoder+set in V8 + let n = text.length; + let byteCount = 0; + + // Write the byte count first + for (let i = 0; i < n; i++) { + let c = text.charCodeAt(i); + if (c >= 0xD800 && c <= 0xDBFF && i + 1 < n) { + c = (c << 10) + text.charCodeAt(++i) - 0x35FDC00; + } + byteCount += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; + } + writeVarint32(bb, byteCount); + + let offset = grow(bb, byteCount); + let bytes = bb.bytes; + + // Then write the bytes + for (let i = 0; i < n; i++) { + let c = text.charCodeAt(i); + if (c >= 0xD800 && c <= 0xDBFF && i + 1 < n) { + c = (c << 10) + text.charCodeAt(++i) - 0x35FDC00; + } + if (c < 0x80) { + bytes[offset++] = c; + } else { + if (c < 0x800) { + bytes[offset++] = ((c >> 6) & 0x1F) | 0xC0; + } else { + if (c < 0x10000) { + bytes[offset++] = ((c >> 12) & 0x0F) | 0xE0; + } else { + bytes[offset++] = ((c >> 18) & 0x07) | 0xF0; + bytes[offset++] = ((c >> 12) & 0x3F) | 0x80; + } + bytes[offset++] = ((c >> 6) & 0x3F) | 0x80; + } + bytes[offset++] = (c & 0x3F) | 0x80; + } + } +} + +function writeByteBuffer(bb: ByteBuffer, buffer: ByteBuffer): void { + let offset = grow(bb, buffer.limit); + let from = bb.bytes; + let to = buffer.bytes; + + // This for loop is much faster than subarray+set on V8 + for (let i = 0, n = buffer.limit; i < n; i++) { + from[i + offset] = to[i]; + } +} + +function readByte(bb: ByteBuffer): number { + return bb.bytes[advance(bb, 1)]; +} + +function writeByte(bb: ByteBuffer, value: number): void { + let offset = grow(bb, 1); + bb.bytes[offset] = value; +} + +function readFloat(bb: ByteBuffer): number { + let offset = advance(bb, 4); + let bytes = bb.bytes; + + // Manual copying is much faster than subarray+set in V8 + f32_u8[0] = bytes[offset++]; + f32_u8[1] = bytes[offset++]; + f32_u8[2] = bytes[offset++]; + f32_u8[3] = bytes[offset++]; + return f32[0]; +} + +function writeFloat(bb: ByteBuffer, value: number): void { + let offset = grow(bb, 4); + let bytes = bb.bytes; + f32[0] = value; + + // Manual copying is much faster than subarray+set in V8 + bytes[offset++] = f32_u8[0]; + bytes[offset++] = f32_u8[1]; + bytes[offset++] = f32_u8[2]; + bytes[offset++] = f32_u8[3]; +} + +function readDouble(bb: ByteBuffer): number { + let offset = advance(bb, 8); + let bytes = bb.bytes; + + // Manual copying is much faster than subarray+set in V8 + f64_u8[0] = bytes[offset++]; + f64_u8[1] = bytes[offset++]; + f64_u8[2] = bytes[offset++]; + f64_u8[3] = bytes[offset++]; + f64_u8[4] = bytes[offset++]; + f64_u8[5] = bytes[offset++]; + f64_u8[6] = bytes[offset++]; + f64_u8[7] = bytes[offset++]; + return f64[0]; +} + +function writeDouble(bb: ByteBuffer, value: number): void { + let offset = grow(bb, 8); + let bytes = bb.bytes; + f64[0] = value; + + // Manual copying is much faster than subarray+set in V8 + bytes[offset++] = f64_u8[0]; + bytes[offset++] = f64_u8[1]; + bytes[offset++] = f64_u8[2]; + bytes[offset++] = f64_u8[3]; + bytes[offset++] = f64_u8[4]; + bytes[offset++] = f64_u8[5]; + bytes[offset++] = f64_u8[6]; + bytes[offset++] = f64_u8[7]; +} + +function readInt32(bb: ByteBuffer): number { + let offset = advance(bb, 4); + let bytes = bb.bytes; + return ( + bytes[offset] | + (bytes[offset + 1] << 8) | + (bytes[offset + 2] << 16) | + (bytes[offset + 3] << 24) + ); +} + +function writeInt32(bb: ByteBuffer, value: number): void { + let offset = grow(bb, 4); + let bytes = bb.bytes; + bytes[offset] = value; + bytes[offset + 1] = value >> 8; + bytes[offset + 2] = value >> 16; + bytes[offset + 3] = value >> 24; +} + +function readInt64(bb: ByteBuffer, unsigned: boolean): Long { + return { + low: readInt32(bb), + high: readInt32(bb), + unsigned, + }; +} + +function writeInt64(bb: ByteBuffer, value: Long): void { + writeInt32(bb, value.low); + writeInt32(bb, value.high); +} + +function readVarint32(bb: ByteBuffer): number { + let c = 0; + let value = 0; + let b: number; + do { + b = readByte(bb); + if (c < 32) value |= (b & 0x7F) << c; + c += 7; + } while (b & 0x80); + return value; +} + +function writeVarint32(bb: ByteBuffer, value: number): void { + value >>>= 0; + while (value >= 0x80) { + writeByte(bb, (value & 0x7f) | 0x80); + value >>>= 7; + } + writeByte(bb, value); +} + +function readVarint64(bb: ByteBuffer, unsigned: boolean): Long { + let part0 = 0; + let part1 = 0; + let part2 = 0; + let b: number; + + b = readByte(bb); part0 = (b & 0x7F); if (b & 0x80) { + b = readByte(bb); part0 |= (b & 0x7F) << 7; if (b & 0x80) { + b = readByte(bb); part0 |= (b & 0x7F) << 14; if (b & 0x80) { + b = readByte(bb); part0 |= (b & 0x7F) << 21; if (b & 0x80) { + + b = readByte(bb); part1 = (b & 0x7F); if (b & 0x80) { + b = readByte(bb); part1 |= (b & 0x7F) << 7; if (b & 0x80) { + b = readByte(bb); part1 |= (b & 0x7F) << 14; if (b & 0x80) { + b = readByte(bb); part1 |= (b & 0x7F) << 21; if (b & 0x80) { + + b = readByte(bb); part2 = (b & 0x7F); if (b & 0x80) { + b = readByte(bb); part2 |= (b & 0x7F) << 7; + } + } + } + } + } + } + } + } + } + + return { + low: part0 | (part1 << 28), + high: (part1 >>> 4) | (part2 << 24), + unsigned, + }; +} + +function writeVarint64(bb: ByteBuffer, value: Long): void { + let part0 = value.low >>> 0; + let part1 = ((value.low >>> 28) | (value.high << 4)) >>> 0; + let part2 = value.high >>> 24; + + // ref: src/google/protobuf/io/coded_stream.cc + let size = + part2 === 0 ? + part1 === 0 ? + part0 < 1 << 14 ? + part0 < 1 << 7 ? 1 : 2 : + part0 < 1 << 21 ? 3 : 4 : + part1 < 1 << 14 ? + part1 < 1 << 7 ? 5 : 6 : + part1 < 1 << 21 ? 7 : 8 : + part2 < 1 << 7 ? 9 : 10; + + let offset = grow(bb, size); + let bytes = bb.bytes; + + switch (size) { + case 10: bytes[offset + 9] = (part2 >>> 7) & 0x01; + case 9: bytes[offset + 8] = size !== 9 ? part2 | 0x80 : part2 & 0x7F; + case 8: bytes[offset + 7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F; + case 7: bytes[offset + 6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F; + case 6: bytes[offset + 5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F; + case 5: bytes[offset + 4] = size !== 5 ? part1 | 0x80 : part1 & 0x7F; + case 4: bytes[offset + 3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F; + case 3: bytes[offset + 2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F; + case 2: bytes[offset + 1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F; + case 1: bytes[offset] = size !== 1 ? part0 | 0x80 : part0 & 0x7F; + } +} + +function readVarint32ZigZag(bb: ByteBuffer): number { + let value = readVarint32(bb); + + // ref: src/google/protobuf/wire_format_lite.h + return (value >>> 1) ^ -(value & 1); +} + +function writeVarint32ZigZag(bb: ByteBuffer, value: number): void { + // ref: src/google/protobuf/wire_format_lite.h + writeVarint32(bb, (value << 1) ^ (value >> 31)); +} + +function readVarint64ZigZag(bb: ByteBuffer): Long { + let value = readVarint64(bb, /* unsigned */ false); + let low = value.low; + let high = value.high; + let flip = -(low & 1); + + // ref: src/google/protobuf/wire_format_lite.h + return { + low: ((low >>> 1) | (high << 31)) ^ flip, + high: (high >>> 1) ^ flip, + unsigned: false, + }; +} + +function writeVarint64ZigZag(bb: ByteBuffer, value: Long): void { + let low = value.low; + let high = value.high; + let flip = high >> 31; + + // ref: src/google/protobuf/wire_format_lite.h + writeVarint64(bb, { + low: (low << 1) ^ flip, + high: ((high << 1) | (low >>> 31)) ^ flip, + unsigned: false, + }); +} diff --git a/cassandra-rc2/tests/commons.ts b/cassandra-rc2/tests/commons.ts new file mode 100644 index 00000000..f5528517 --- /dev/null +++ b/cassandra-rc2/tests/commons.ts @@ -0,0 +1,344 @@ +import fs from 'fs'; +import path from 'path'; +import { client as ModbusClient } from 'jsmodbus'; +import net from 'net'; +import { fileURLToPath } from 'url'; +import { Logger, ILogObj } from "tslog"; +import WebSocket from 'ws'; +import { SerialPort } from 'serialport'; +import { ReadlineParser } from '@serialport/parser-readline'; + +// --- Logger Setup --- +const log: Logger = new Logger({ name: "ModbusTest" }); + +// --- Configuration --- +export const ESP32_IP = '192.168.1.250'; // Store IP as constant +export const MODBUS_PORT = 502; // Default Modbus TCP port +export const WEBSOCKET_PATH = '/ws'; // WebSocket path +export const WEBSOCKET_URL = `ws://${ESP32_IP}${WEBSOCKET_PATH}`; +export const SERIAL_BAUD_RATE = 115200; // Baud rate from Python script +export const SERIAL_PORT_MANUAL: string | undefined = 'COM14'; // Define specific port here if needed +export let SERIAL_PORT_PATH: string | undefined = undefined; // To be auto-detected +export const REPORTS_DIR = './tests/reports'; + +// Helper to resolve __dirname in ESM +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +// Ensure reports directory exists +const reportsPath = path.resolve(__dirname, '..', REPORTS_DIR); // Resolve relative to project root +if (!fs.existsSync(reportsPath)) { + fs.mkdirSync(reportsPath, { recursive: true }); + log.info(`Created reports directory: ${reportsPath}`); +} + +// --- Serial Port Auto-Detection --- +// Basic auto-detection based on common ESP identifiers +async function findSerialPort(): Promise { + log.info("Attempting to auto-detect serial port..."); + try { + const ports = await SerialPort.list(); + log.debug("Available ports:", ports.map(p => ({ path: p.path, manufacturer: p.manufacturer, pnpId: p.pnpId }))); + for (const port of ports) { + const pnpId = port.pnpId || ''; + const manufacturer = port.manufacturer || ''; + // Match common ESP patterns (add more if needed) + if (pnpId.includes('VID_10C4&PID_EA60') || // CP210x + pnpId.includes('VID_303A&PID_1001') || // ESP32-S3 Internal + manufacturer.toLowerCase().includes('espressif') || + manufacturer.toLowerCase().includes('silicon labs')) { + log.info(`Found potential ESP device: ${port.path}`); + return port.path; + } + } + log.warn("Could not automatically find ESP serial port."); + // Optionally fallback to manual port if detection fails + // return SERIAL_PORT_MANUAL; + return undefined; + } catch (error) { + log.error("Error listing serial ports:", error); + return undefined; + } +} + +// --- Serial Port Client Setup --- +export function createSerialClient(path: string): SerialPort { + log.info(`Creating SerialPort client for path: ${path}, Baud: ${SERIAL_BAUD_RATE}`); + // autoOpen: false means we call open() explicitly later + const port = new SerialPort({ path, baudRate: SERIAL_BAUD_RATE, autoOpen: false }); + return port; +} + +// Utility to connect Serial Port cleanly +export async function connectSerial(port: SerialPort): Promise { + log.info(`Attempting Serial connection to ${port.path}...`); + return new Promise((resolve, reject) => { + port.open((err) => { + if (err) { + log.error(`Serial connection error to ${port.path}:`, err); + reject(err); + } else { + log.info(`Serial port ${port.path} opened successfully.`); + resolve(); + } + }); + }); +} + +// Utility to send a command and wait for response data (potentially multi-line) +// Uses ReadlineParser to get lines like the Python script +export async function sendSerialCommandAndReceive(port: SerialPort, command: string, timeout: number = 5000): Promise { + if (!command.endsWith('\n')) { + command += '\n'; // Ensure newline termination + } + log.debug(`Sending Serial command: ${JSON.stringify(command)} to ${port.path}`); + + const parser = port.pipe(new ReadlineParser({ delimiter: '\n' })); + let receivedData = ''; + let responseResolver: (value: string | PromiseLike) => void; + let responseRejecter: (reason?: any) => void; + const responsePromise = new Promise((resolve, reject) => { + responseResolver = resolve; + responseRejecter = reject; + }); + + const timer = setTimeout(() => { + log.warn(`Serial response timeout (${timeout}ms) for command: ${JSON.stringify(command)}`); + parser.off('data', onData); + // Resolve with whatever data was received before timeout, or reject if empty? + // For now, resolve with potentially partial data, could be changed to reject. + responseResolver(receivedData); + }, timeout); + + const onData = (line: string) => { + const trimmedLine = line.trim(); + log.debug(`Received Serial line: ${trimmedLine}`); + receivedData += trimmedLine + '\n'; + // Simple approach: Keep collecting lines until timeout. + // More sophisticated logic could be added here to detect end-of-response. + }; + + parser.on('data', onData); + + // Send the command + port.write(command, (err) => { + if (err) { + log.error("Error writing to serial port:", err); + clearTimeout(timer); + parser.off('data', onData); + responseRejecter(err); + } else { + log.debug(`Command ${JSON.stringify(command)} sent successfully.`); + port.drain((drainErr) => { // Ensure data is sent before waiting for response + if (drainErr) { + log.error("Error draining serial port:", drainErr); + // Continue anyway, maybe it still worked + } + }); + } + }); + + return responsePromise; +} + + +// Utility to disconnect Serial Port cleanly +export function disconnectSerial(port: SerialPort) { + if (port && port.isOpen) { + log.info(`Closing Serial connection to ${port.path}`); + port.close((err) => { + if (err) { + log.error(`Error closing serial port ${port.path}:`, err); + } else { + log.info(`Serial port ${port.path} closed.`); + } + }); + } else { + log.warn(`Serial port ${port.path} is not open.`); + } +} + +// --- Modbus TCP Client Setup --- +export function createModbusClient() { + const socket = new net.Socket(); + // Use correct client factory for TCP + const client = new ModbusClient.TCP(socket); + + // Optional: Add error handling for the socket + socket.on('error', (err) => { + log.error("Socket Error:", err); + // Potentially close the socket or handle reconnection here + }); + + socket.on('close', () => { + log.info('Socket closed'); + }); + + return { socket, client }; +} + +// --- WebSocket Client Setup --- +export function createWebSocketClient(url: string = WEBSOCKET_URL): WebSocket { + log.info(`Creating WebSocket client for URL: ${url}`); + const ws = new WebSocket(url); + return ws; +} + +// --- Test Reporting --- +export function createReport(testName: string): fs.WriteStream { + const now = new Date(); + // Format: YYYYMMDD-HHMMSS - Using a more standard timestamp + const timestamp = now.toISOString().replace(/[:T.]/g, '-').split('-').slice(0, 3).join('') + '_' + now.toTimeString().split(' ')[0].replace(/:/g, ''); + const reportFileName = `${timestamp}-${testName.replace(/\s+/g, '_')}.md`; // Sanitize test name for filename + const reportPath = path.join(reportsPath, reportFileName); + + const reportStream = fs.createWriteStream(reportPath, { encoding: 'utf8' }); + + reportStream.write(`# Modbus E2E Test Report: ${testName} + +`); + reportStream.write(`* **Test:** ${testName} +`); + reportStream.write(`* **Timestamp:** ${now.toISOString()} +`); + // Distinguish target type in report + if (testName.toLowerCase().includes('websocket') || testName.toLowerCase().includes('ws')) { + reportStream.write(`* **Target URL:** ${WEBSOCKET_URL}\n`); + } else if (testName.toLowerCase().includes('serial')) { + // Report the port actually being used (could be auto or manual) + reportStream.write(`* **Target Port:** ${SERIAL_PORT_PATH || SERIAL_PORT_MANUAL || 'Not Found'} @ ${SERIAL_BAUD_RATE}\n`); + } else { // Default to Modbus TCP + reportStream.write(`* **Target IP:** ${ESP32_IP}:${MODBUS_PORT}\n`); + } + reportStream.write(`* **Report File:** ${reportFileName} + +`); + reportStream.write(`## Test Log\n\n`); + + log.info(`Created report file: ${reportPath}`); + return reportStream; +} + +export function logToReport(reportStream: fs.WriteStream, message: string, level: keyof Logger = 'info') { + const timestamp = new Date().toISOString(); + const logMessage = `[${timestamp}] ${message}`; + reportStream.write(logMessage + '\n'); + + if (typeof log[level] === 'function') { + (log[level] as (message: string) => void)(message); + } else { + log.info(message); + } +} + +export function closeReport(reportStream: fs.WriteStream) { + logToReport(reportStream, "Test finished.", 'info'); + reportStream.end(); +} + +// Utility to connect and disconnect cleanly +export async function connectModbus(socket: net.Socket, host: string, port: number): Promise { + return new Promise((resolve, reject) => { + socket.connect({ host, port }, () => { + log.info(`Connected to Modbus server ${host}:${port}`); + resolve(); + }); + socket.once('error', (err) => { + log.error(`Connection error to ${host}:${port}:`, err); + reject(err); + }); + }); +} + +export function disconnectModbus(socket: net.Socket) { + if (socket && !socket.destroyed) { + socket.destroy(); + log.info('Disconnected from Modbus server.'); + } +} + +// Utility to connect WebSocket cleanly +export async function connectWebSocket(ws: WebSocket): Promise { + log.info(`Attempting WebSocket connection to ${ws.url}...`); + return new Promise((resolve, reject) => { + const onOpen = () => { + log.info(`WebSocket connected to ${ws.url}`); + ws.off('error', onError); // Clean up error listener + resolve(); + }; + const onError = (err: Error) => { + log.error(`WebSocket connection error to ${ws.url}:`, err); + ws.off('open', onOpen); // Clean up open listener + reject(err); + }; + + ws.once('open', onOpen); + ws.once('error', onError); + }); +} + +// Utility to send a message and wait for a specific response type +export async function sendWsMessageAndReceive(ws: WebSocket, message: any, expectedResponseType: string | null = null, timeout: number = 5000): Promise { + const messageString = JSON.stringify(message); + log.debug(`Sending WebSocket message: ${messageString}`); + ws.send(messageString); + + return new Promise((resolve, reject) => { + const timer = setTimeout(() => { + log.error(`WebSocket response timeout (${timeout}ms) waiting for type '${expectedResponseType || 'any'}'`); + ws.off('message', onMessage); // Clean up listener on timeout + reject(new Error(`WebSocket response timeout after ${timeout}ms waiting for type '${expectedResponseType || 'any'}'`)); + }, timeout); + + const onMessage = (data: WebSocket.RawData) => { + let receivedData: any; + try { + receivedData = JSON.parse(data.toString()); + log.debug(`Received WebSocket message: ${JSON.stringify(receivedData, null, 2)}`); + } catch (err: any) { + // Ignore parsing errors? Or reject? For now, log and continue listening. + log.warn("Ignoring non-JSON WebSocket message:", data.toString(), err); + return; + } + + // Check if the message type matches the expected type, if provided + if (expectedResponseType === null || (receivedData && receivedData.type === expectedResponseType)) { + clearTimeout(timer); + ws.off('message', onMessage); // Clean up listener after finding the right message + log.debug(`Accepted message with type '${receivedData?.type || 'unknown'}'`); + resolve(receivedData); + } else { + // Log ignored messages if needed + log.debug(`Ignoring message with type '${receivedData?.type || 'unknown'}', waiting for '${expectedResponseType}'`); + // Keep listening for the correct message + } + }; + + // Use .on instead of .once to handle multiple incoming messages until the expected one arrives + ws.on('message', onMessage); + }); +} + +// Utility to disconnect WebSocket cleanly +export function disconnectWebSocket(ws: WebSocket) { + if (ws && ws.readyState === WebSocket.OPEN) { + log.info(`Closing WebSocket connection to ${ws.url}`); + ws.close(); + log.info(`WebSocket connection closed.`); + } + else if (ws && ws.readyState !== WebSocket.CLOSED) { + log.warn(`WebSocket connection to ${ws.url} is not open (state: ${ws.readyState}), terminating.`); + ws.terminate(); // Force close if not open/closed + } +} + +// --- Auto-detect Serial Port on startup --- +(async () => { + // Prioritize manual port if set, otherwise attempt auto-detection + if (SERIAL_PORT_MANUAL) { + log.info(`Using manually configured serial port: ${SERIAL_PORT_MANUAL}`); + SERIAL_PORT_PATH = SERIAL_PORT_MANUAL; + } else { + SERIAL_PORT_PATH = await findSerialPort(); + } +})(); \ No newline at end of file diff --git a/cassandra-rc2/tests/decode.tmp b/cassandra-rc2/tests/decode.tmp new file mode 100644 index 00000000..e69de29b diff --git a/cassandra-rc2/tests/di/features.json b/cassandra-rc2/tests/di/features.json new file mode 100644 index 00000000..d89f645f --- /dev/null +++ b/cassandra-rc2/tests/di/features.json @@ -0,0 +1,98 @@ +{ + "ENABLE_OPERATOR_SWITCH": { + "headerFile": "components/OperatorSwitch.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_RELAYS": { + "headerFile": "components/Relay.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_STATUS": { + "headerFile": "components/StatusLight.h", + "dependencies": [], + "settings": { + "STATUS_WARNING_PIN": "GPIO_PIN_CH6", + "STATUS_ERROR_PIN": "GPIO_PIN_CH5", + "STATUS_BLINK_INTERVAL": "800" + } + }, + "ENABLE_FEEDBACK_BUZZER": { + "headerFile": "components/FeedbackBuzzer.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_SAKO_VFD": { + "headerFile": "components/SAKO_VFD.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_AMPERAGE_BUDGET_MANAGER": { + "headerFile": "components/AmperageBudgetManager.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_PROFILE_TEMPERATURE": { + "headerFile": "profiles/TemperatureProfile.h", + "dependencies": [], + "settings": { + "PROFILE_TEMPERATURE_COUNT": "4" + } + }, + "ENABLE_PROFILE_SIGNAL_PLOT": { + "headerFile": "profiles/SignalPlot.h", + "dependencies": [], + "settings": { + "PROFILE_SIGNAL_PLOT_COUNT": "4" + } + }, + "ENABLE_MODBUS_TCP": { + "headerFile": "WiFi.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_RS485": { + "headerFile": "components/RS485.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_PROFILER": { + "headerFile": "esp_cpu.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_LOGGER": { + "headerFile": "components/Logger.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_RUNTIME_STATE": { + "headerFile": "RuntimeState.h", + "dependencies": [], + "settings": { + "RUNTIME_STATE_FILENAME": "\"/runtime.json\"", + "RUNTIME_STATE_SAVE_INTERVAL": "4000" + } + }, + "ENABLE_SETTINGS": { + "headerFile": "Settings.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_PLUNGER": { + "headerFile": "components/Plunger.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_REST_SERVER": { + "headerFile": "components/RestServer.h", + "dependencies": [], + "settings": {} + }, + "ENABLE_LITTLEFS": { + "headerFile": "LittleFS.h", + "dependencies": [], + "settings": {} + } +} \ No newline at end of file diff --git a/cassandra-rc2/tests/di/plunger.test.ts b/cassandra-rc2/tests/di/plunger.test.ts new file mode 100644 index 00000000..548592be --- /dev/null +++ b/cassandra-rc2/tests/di/plunger.test.ts @@ -0,0 +1,32 @@ +import { describe, it, expect } from 'vitest'; +import { findComponents, getComponentTree } from '../../src/lib/di'; +import * as path from 'path'; +import { Plunger } from '../../src/lib/components/plunger'; + +describe('DI Basic Tests', () => { + it('should correctly parse the component tree for Plunger', () => { + const di_config = "tests/di"; + const components = findComponents(di_config); + const plungerComponent = components.find(c => c.name === 'Plunger'); + expect(plungerComponent).toBeDefined(); + + if (plungerComponent) { + const plungerTree = getComponentTree(plungerComponent, components); + + // Basic checks for Plunger + expect(plungerTree.name).toBe('Plunger'); + expect(plungerTree.dependencies).toHaveLength(4); + + // Check dependency names + const dependencyNames = plungerTree.dependencies.map(d => d.name); + expect(dependencyNames).toContain('SAKO_VFD'); + expect(dependencyNames).toContain('Joystick'); + expect(dependencyNames).toContain('POT'); + expect(dependencyNames).toContain('Logger'); + + // Check for POT component details + const potDependency = plungerTree.dependencies.find(d => d.name === 'POT'); + expect(potDependency).toBeDefined(); + } + }); +}); \ No newline at end of file diff --git a/cassandra-rc2/tests/heaters/readme.md b/cassandra-rc2/tests/heaters/readme.md new file mode 100644 index 00000000..a588ebef --- /dev/null +++ b/cassandra-rc2/tests/heaters/readme.md @@ -0,0 +1,19 @@ +# Heater Tests + + +## Triangle - Test - A1 - 1150 (7:40) - 400V / 300 W + +- **Block Size** : 120x80x20 mm +- **Heater Size** : 11.35 mm +- **Groove Size** : 11.7 mm Nominal | 11.45 mm slide fit +- **T DT - 30 mins** : 80 degc +- **Cell Size** : 250 mm + +## Triangle - Test - A1 - 650 (8:30) - 220V / 250W + +- **Block Size** : 80x60x20 mm +- **Heater Size** : 11.45 mm +- **Groove Size** : 11.7 mm Nominal | 11.45 mm slide fit +- **T DT - 30 mins** : 80 degc +- **Cell Size** : 220 mm + diff --git a/cassandra-rc2/tests/list-serial.test.ts b/cassandra-rc2/tests/list-serial.test.ts new file mode 100644 index 00000000..eb6e2a02 --- /dev/null +++ b/cassandra-rc2/tests/list-serial.test.ts @@ -0,0 +1,92 @@ +import { describe, it, expect, beforeAll, afterAll } from 'vitest'; +import fs from 'fs'; +import { SerialPort } from 'serialport'; +import { + SERIAL_PORT_PATH, + createSerialClient, + connectSerial, + disconnectSerial, + sendSerialCommandAndReceive, + createReport, + logToReport, + closeReport +} from './commons'; + +// Test Configuration +const TEST_NAME = "Serial List Components"; +const COMMAND_PAYLOAD = "<<1;2;64;list:1:0>>"; // Newline added by helper +const RESPONSE_TIMEOUT = 8000; // Allow 3 seconds for the list command response + +describe(TEST_NAME, () => { + let port: SerialPort; + let reportStream: fs.WriteStream; + let serialPath: string; + + beforeAll(async () => { + reportStream = createReport(TEST_NAME); + logToReport(reportStream, "Starting test setup...", 'debug'); + + // Wait a moment for commons.ts async init (port detection/setting) + // Adjust if COM port isn't ready immediately after script starts. + if (!SERIAL_PORT_PATH) { + logToReport(reportStream, "Waiting a bit for serial port path initialization...", 'debug'); + await new Promise(resolve => setTimeout(resolve, 500)); + } + + serialPath = SERIAL_PORT_PATH || ''; // Use the path from commons.ts + + if (!serialPath) { + const errorMsg = "Serial port path (SERIAL_PORT_PATH) not initialized in commons.ts."; + logToReport(reportStream, errorMsg, 'error'); + throw new Error(errorMsg); + } + logToReport(reportStream, `Using serial port from commons: ${serialPath}`, 'info'); + + port = createSerialClient(serialPath); + logToReport(reportStream, "Serial client created.", 'debug'); + + try { + await connectSerial(port); + logToReport(reportStream, "Serial port connected successfully during setup.", 'info'); + // Keep a small delay just in case + logToReport(reportStream, "Waiting 1s for device stabilization...", 'debug'); + await new Promise(resolve => setTimeout(resolve, 1000)); + } catch (error) { + logToReport(reportStream, `Serial connection failed during setup: ${error}`, 'error'); + throw new Error('Serial connection failed during setup'); + } + logToReport(reportStream, "Test setup complete.", 'debug'); + }); + + afterAll(() => { + logToReport(reportStream, "Starting test teardown.", 'debug'); + disconnectSerial(port); + closeReport(reportStream); + }); + + it('should receive a non-empty component list', async () => { + logToReport(reportStream, `Sending command: ${COMMAND_PAYLOAD}`, 'info'); + + try { + const response = await sendSerialCommandAndReceive(port, COMMAND_PAYLOAD, RESPONSE_TIMEOUT); + logToReport(reportStream, `Received raw response:\n---\n${response}\n---`, 'debug'); + + // Basic assertion: Check if we received *something* + expect(response).toBeDefined(); + expect(response.trim().length).toBeGreaterThan(0); + + // Optional: Add more specific checks, e.g., check for known component names + // expect(response).toContain('System'); + // expect(response).toContain('RS485'); + + logToReport(reportStream, `Assertion passed: Received non-empty response (length: ${response.trim().length}).`, 'info'); + + } catch (error: any) { + logToReport(reportStream, `Error during serial communication: ${error.message || error}`, 'error'); + if (error.stack) { + logToReport(reportStream, `Stack trace: ${error.stack}`, 'debug'); + } + expect.fail(`Test failed due to serial communication error: ${error}`); + } + }, RESPONSE_TIMEOUT + 1000); // Vitest timeout slightly longer than response timeout +}); \ No newline at end of file diff --git a/cassandra-rc2/tests/read-registers.test.ts b/cassandra-rc2/tests/read-registers.test.ts new file mode 100644 index 00000000..44234979 --- /dev/null +++ b/cassandra-rc2/tests/read-registers.test.ts @@ -0,0 +1,76 @@ +import { describe, it, expect, beforeAll, afterAll } from 'vitest'; +import fs from 'fs'; +import { + ESP32_IP, + MODBUS_PORT, + createModbusClient, + connectModbus, + disconnectModbus, + createReport, + logToReport, + closeReport +} from './commons'; +import type { Socket } from 'net'; +import type ModbusTCPClient from 'jsmodbus/dist/modbus-tcp-client'; + +// Test Configuration +const TEST_NAME = "Read Holding Registers 0-9"; +const START_ADDRESS = 0; +const COUNT = 2; + +describe(TEST_NAME, () => { + let client: ModbusTCPClient; + let socket: Socket; + let reportStream: fs.WriteStream; + + beforeAll(() => { + reportStream = createReport(TEST_NAME); + const { socket: modbusSocket, client: modbusClient } = createModbusClient(); + socket = modbusSocket; + client = modbusClient; + logToReport(reportStream, "Test setup complete.", 'debug'); + }); + + afterAll(() => { + logToReport(reportStream, "Starting test teardown.", 'debug'); + disconnectModbus(socket); + closeReport(reportStream); + }); + + it('should connect to the Modbus server', async () => { + logToReport(reportStream, `Attempting connection to ${ESP32_IP}:${MODBUS_PORT}...`, 'info'); + await expect(connectModbus(socket, ESP32_IP, MODBUS_PORT)).resolves.toBeUndefined(); + logToReport(reportStream, "Connection successful.", 'info'); + }); + + it(`should read ${COUNT} holding registers starting from address ${START_ADDRESS}`, async () => { + logToReport(reportStream, `Attempting to read ${COUNT} registers from address ${START_ADDRESS}...`, 'info'); + + try { + const response = await client.readHoldingRegisters(START_ADDRESS, COUNT); + logToReport(reportStream, `Raw response:\n\`\`\`json\n${JSON.stringify(response, null, 2)}\n\`\`\``, 'debug'); + logToReport(reportStream, `Successfully read ${response.response.body.values.length} registers.`, 'info'); + + // Basic validation - Rely on byteCount and values.length + // expect(response.response.body.byteCount).toBe(COUNT * 2); // Temporarily commented out due to potential mismatch + expect(response.response.body.values.length).toBe(COUNT); + + // Log the read values + const values = response.response.body.values; + logToReport(reportStream, `Register values: [${values.join(', ')}]`, 'info'); + + // Assert that all read registers are 0 + expect(values.every(val => val === 0), 'Expected all registers to be 0').toBe(true); + logToReport(reportStream, "Assertion passed: All registers are 0.", 'info'); + + } catch (error: any) { + logToReport(reportStream, `Error reading registers: ${error.message || error}`, 'error'); + // Optionally log stack trace for debugging + if (error.stack) { + logToReport(reportStream, `Stack trace: ${error.stack}`, 'debug'); + } + // Force test failure + expect.fail(`Failed to read holding registers: ${error}`); + } + }); +}); \ No newline at end of file diff --git a/cassandra-rc2/tests/read-ws.test.ts b/cassandra-rc2/tests/read-ws.test.ts new file mode 100644 index 00000000..f1b934f7 --- /dev/null +++ b/cassandra-rc2/tests/read-ws.test.ts @@ -0,0 +1,70 @@ +import { describe, it, expect, beforeAll, afterAll } from 'vitest'; +import fs from 'fs'; +import WebSocket from 'ws'; +import { + WEBSOCKET_URL, + createWebSocketClient, + connectWebSocket, + disconnectWebSocket, + sendWsMessageAndReceive, + createReport, + logToReport, + closeReport +} from './commons'; + +// Test Configuration +const TEST_NAME = "WebSocket Read Registers"; +const COMMAND_PAYLOAD = { command: "get_registers", id: 0 }; + +describe(TEST_NAME, () => { + let ws: WebSocket; + let reportStream: fs.WriteStream; + + beforeAll(async () => { + reportStream = createReport(TEST_NAME); + logToReport(reportStream, "Creating WebSocket client...", 'debug'); + ws = createWebSocketClient(WEBSOCKET_URL); + logToReport(reportStream, "WebSocket client created.", 'debug'); + // Connect during setup to ensure availability for tests + try { + await connectWebSocket(ws); + logToReport(reportStream, "WebSocket connected successfully during setup.", 'info'); + } catch (error) { + logToReport(reportStream, `WebSocket connection failed during setup: ${error}`, 'error'); + // Optionally throw error to prevent tests from running if connection is critical + throw new Error('WebSocket connection failed during setup'); + } + logToReport(reportStream, "Test setup complete.", 'debug'); + }); + + afterAll(() => { + logToReport(reportStream, "Starting test teardown.", 'debug'); + disconnectWebSocket(ws); + closeReport(reportStream); + }); + + it('should receive a register list response', async () => { + logToReport(reportStream, `Sending command: ${JSON.stringify(COMMAND_PAYLOAD)}`, 'info'); + + try { + // Specify the expected response type + const response = await sendWsMessageAndReceive(ws, COMMAND_PAYLOAD, 'registers'); + logToReport(reportStream, `Received response: ${JSON.stringify(response, null, 2)}`, 'debug'); + + // Assert response structure + expect(response).toBeDefined(); + expect(response.type).toBe('registers'); + expect(response.data).toBeDefined(); + expect(Array.isArray(response.data), 'Expected response.data to be an array').toBe(true); + + logToReport(reportStream, `Assertion passed: Received response with type 'registers' and data array (length: ${response.data.length}).`, 'info'); + + } catch (error: any) { + logToReport(reportStream, `Error during WebSocket communication: ${error.message || error}`, 'error'); + if (error.stack) { + logToReport(reportStream, `Stack trace: ${error.stack}`, 'debug'); + } + expect.fail(`Test failed due to WebSocket communication error: ${error}`); + } + }); +}); \ No newline at end of file diff --git a/cassandra-rc2/tests/rtu-sync.md b/cassandra-rc2/tests/rtu-sync.md new file mode 100644 index 00000000..517c7f7f --- /dev/null +++ b/cassandra-rc2/tests/rtu-sync.md @@ -0,0 +1,11 @@ +INFO: RTU_Base::setOutputRegisterValue(slaveId: 13, address: 0x2601, value: 30) +INFO: RTU_Base::triggerRTUWrite(slaveId: 13) +INFO: RTU_Base::write(slaveId: 13) - Iterating 2 output registers. +INFO: [OmronE5[13]:633] RTU_Base::write(slaveId: 13) - Processing register index 0: address 0x2601, value 30 +INFO: RegisterState::writeToDevice(slaveId: 13, address: 0x2601, value: 30, force: false) +INFO: [ModbusRTU:100] ModbusRTU::writeRegister(slaveId: 13, address: 0x2601, value: 30, force: false) +INFO: [ModbusRTU:100] ModbusRTU::writeRegister - Value has changed or force=true. Queuing write. +INFO: [OmronE5[13]:633] RTU_ index 1: address 0x0000, value 0 +INFO: RegisterState::writeToDevice(slaveId: 13, address: 0x0000, value: 0, force: true) +INFO: [ModbusRTU:100] ModbusRTU::writeRegister(slaveId: 13, address: 0x0000, value: 0, force: true) +INFO: [ModbusRTU:100] ModbusRTU::wforce=true. Queuing write. diff --git a/cassandra-rc2/tests/sako.test.ts b/cassandra-rc2/tests/sako.test.ts new file mode 100644 index 00000000..38d84ad4 --- /dev/null +++ b/cassandra-rc2/tests/sako.test.ts @@ -0,0 +1,84 @@ +import { describe, it, expect, beforeAll, afterAll } from 'vitest'; +import fs from 'fs'; +import { + ESP32_IP, + MODBUS_PORT, + createModbusClient, + connectModbus, + disconnectModbus, + createReport, + logToReport, + closeReport +} from './commons'; +import type { Socket } from 'net'; +import type ModbusTCPClient from 'jsmodbus/dist/modbus-tcp-client'; + +// Test Configuration +const COMPONENT_KEY_SAKO_VFD = 750; // From enums.h +const SAKO_MB_TCP_OFFSET = COMPONENT_KEY_SAKO_VFD * 10; +const SAKO_VFD_TCP_REG_RANGE = 16; // From SAKO_VFD.h +const SAKO_SLAVE_ID_FOR_TEST = 0; // Assuming slaveId 0 for the base SAKO VFD TCP block + +const TEST_NAME = "SAKO VFD Read TCP Registers"; +// The SAKO VFD exposes its registers at SAKO_MB_TCP_OFFSET + (slaveId * SAKO_VFD_TCP_REG_RANGE). +// The readable offsets are 1 to SAKO_VFD_TCP_REG_RANGE. +// So, for slaveId 0, the first register is at SAKO_MB_TCP_OFFSET + 1. +const START_ADDRESS = SAKO_MB_TCP_OFFSET + (SAKO_SLAVE_ID_FOR_TEST * SAKO_VFD_TCP_REG_RANGE) + 1; +const COUNT = SAKO_VFD_TCP_REG_RANGE; // Read the entire range of registers for one SAKO instance + +describe(TEST_NAME, () => { + let client: ModbusTCPClient; + let socket: Socket; + let reportStream: fs.WriteStream; + + beforeAll(() => { + reportStream = createReport(TEST_NAME); + const { socket: modbusSocket, client: modbusClient } = createModbusClient(); + socket = modbusSocket; + client = modbusClient; + logToReport(reportStream, "Test setup complete.", 'debug'); + logToReport(reportStream, `Targeting SAKO VFD registers: START_ADDRESS=${START_ADDRESS}, COUNT=${COUNT}`, 'info'); + }); + + afterAll(() => { + logToReport(reportStream, "Starting test teardown.", 'debug'); + disconnectModbus(socket); + closeReport(reportStream); + }); + + it('should connect to the Modbus server', async () => { + logToReport(reportStream, `Attempting connection to ${ESP32_IP}:${MODBUS_PORT}...`, 'info'); + await expect(connectModbus(socket, ESP32_IP, MODBUS_PORT)).resolves.toBeUndefined(); + logToReport(reportStream, "Connection successful.", 'info'); + }); + + it(`should read ${COUNT} holding registers for SAKO VFD starting from address ${START_ADDRESS}`, async () => { + logToReport(reportStream, `Attempting to read ${COUNT} registers from address ${START_ADDRESS}...`, 'info'); + + try { + const response = await client.readHoldingRegisters(START_ADDRESS, COUNT); + logToReport(reportStream, `Raw response:\\n\`\`\`json\\n${JSON.stringify(response, null, 2)}\\n\`\`\``, 'debug'); + + expect(response.response.body.values.length).toBe(COUNT); + logToReport(reportStream, `Successfully read ${response.response.body.values.length} registers.`, 'info'); + + // Log the read values + const values = response.response.body.values; + logToReport(reportStream, `Register values: [${values.join(', ')}]`, 'info'); + + // TODO: Add more specific assertions based on expected SAKO VFD values if possible. + // For now, we are just checking if the read was successful and the count is correct. + // The default assertion "expect(values.every(val => val === 0)).toBe(true)" is removed + // as SAKO VFD registers will likely not all be zero. + + logToReport(reportStream, "Assertion passed: Correct number of registers read.", 'info'); + + } catch (error: any) { + logToReport(reportStream, `Error reading SAKO VFD registers: ${error.message || error}`, 'error'); + if (error.stack) { + logToReport(reportStream, `Stack trace: ${error.stack}`, 'debug'); + } + expect.fail(`Failed to read SAKO VFD holding registers: ${error}`); + } + }); +}); \ No newline at end of file diff --git a/cassandra-rc2/tests/vendor/sako/Overload-Tests.mbp b/cassandra-rc2/tests/vendor/sako/Overload-Tests.mbp new file mode 100644 index 00000000..e0672fe0 Binary files /dev/null and b/cassandra-rc2/tests/vendor/sako/Overload-Tests.mbp differ diff --git a/cassandra-rc2/tests/vendor/sako/t-test-10-65.png b/cassandra-rc2/tests/vendor/sako/t-test-10-65.png new file mode 100644 index 00000000..eb3da212 Binary files /dev/null and b/cassandra-rc2/tests/vendor/sako/t-test-10-65.png differ diff --git a/cassandra-rc2/tests/vendor/sako/t-test-5-10.png b/cassandra-rc2/tests/vendor/sako/t-test-5-10.png new file mode 100644 index 00000000..57dd4210 Binary files /dev/null and b/cassandra-rc2/tests/vendor/sako/t-test-5-10.png differ diff --git a/vitest.config.ts b/cassandra-rc2/vitest.config.ts similarity index 100% rename from vitest.config.ts rename to cassandra-rc2/vitest.config.ts diff --git a/cli-ts/.gitignore b/cli-ts/.gitignore new file mode 100644 index 00000000..4508516d --- /dev/null +++ b/cli-ts/.gitignore @@ -0,0 +1,2 @@ +dist +node_modules diff --git a/cli-ts/amperage_budget.json b/cli-ts/amperage_budget.json new file mode 100644 index 00000000..59733e5f --- /dev/null +++ b/cli-ts/amperage_budget.json @@ -0,0 +1,9 @@ +{ + "minHeatingDurationMs": 3000, + "maxHeatingDurationMs": 5000, + "maxSimultaneousHeating": 1, + "windowOffset": 1, + "enabled": false, + "startIndex": 0, + "endIndex": 7 +} \ No newline at end of file diff --git a/cli-ts/ast/AmperageBudgetManager.json b/cli-ts/ast/AmperageBudgetManager.json new file mode 100644 index 00000000..02a92c19 --- /dev/null +++ b/cli-ts/ast/AmperageBudgetManager.json @@ -0,0 +1,4674 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "AMPERAGE_BUDGET_MANAGER_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "AMPERAGE_BUDGET_MANAGER_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "components/OmronE5.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Default values\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MIN_HEATING_DURATION_S" + }, + { + "type": "preproc_arg", + "text": "3 // 3 seconds\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MAX_HEATING_DURATION_S" + }, + { + "type": "preproc_arg", + "text": "5 // 5 seconds\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "DEFAULT_MAX_SIMULTANEOUS_HEATING" + }, + { + "type": "preproc_arg", + "text": "2 // Default number of devices that can heat simultaneously\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "DEFAULT_WINDOW_OFFSET" + }, + { + "type": "preproc_arg", + "text": "1 // Default window offset\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "DEFAULT_START_INDEX" + }, + { + "type": "preproc_arg", + "text": "0 // Default start index for cycling\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "DEFAULT_END_INDEX" + }, + { + "type": "preproc_arg", + "text": "(MAX_MANAGED_DEVICES - 1) // Default end index for cycling\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "DEFAULT_MAX_HEATING_OSCILLATING_S" + }, + { + "type": "preproc_arg", + "text": "15 // 60 seconds\r" + } + ] + }, + { + "type": "comment", + "text": "// Modbus write boundaries\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MB_MAX_TIME_MIN_S" + }, + { + "type": "preproc_arg", + "text": "1 // Minimum max time: 1s\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MB_MAX_TIME_MAX_S" + }, + { + "type": "preproc_arg", + "text": "(120 * 60) // Maximum max time: 2 hours\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MB_MIN_TIME_MIN_S" + }, + { + "type": "preproc_arg", + "text": "1 // Minimum min time: 1s\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MB_MIN_TIME_MAX_S" + }, + { + "type": "preproc_arg", + "text": "60 // Maximum min time: 60s\r" + } + ] + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "E_AMPERAGE_MODE" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_AM_CYCLE_ALL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Cycle through all devices\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_AM_CYCLE_SP" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Cycle through partitions (REG_OFFSET_MAX_SIM), advance when SP - DEADBAND is reached\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_AM_CYCLE_SP_ANY" + } + ] + }, + { + "type": "comment", + "text": "// Heat any N devices that require it\r" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "AmperageBudgetManager" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "E_MB_OFFSETS" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_ENABLE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_INFO" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_MIN_TIME" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_MAX_TIME" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_MAX_SIM" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_OFFSET" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_START_INDEX" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_END_INDEX" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_MODE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_MAX_TIME_OSCILLATING" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_POST_HEATUP_MODE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REG_OFFSET_COUNT" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "AmperageBudgetManager" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "baseAddress" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "MB_ADDR_AMPERAGE_BUDGET_BASE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "AmperageBudgetManager" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "addManagedDevice" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "OmronE5" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "device" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val1" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "reset" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onCycleStart" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "std" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "vector" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "OmronE5" + }, + { + "type": "abstract_pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "activeDevices" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onCycleEnd" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "std" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "vector" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "OmronE5" + }, + { + "type": "abstract_pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "activeDevices" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onHeatupComplete" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Max simultaneous heating control\r" + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getMaxSimultaneousHeating" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "_maxSimultaneousHeating" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setMaxSimultaneousHeating" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MAX_MANAGED_DEVICES" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_maxSimultaneousHeating" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Modbus interface\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_base_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Persistence methods\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "toJson" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonDocument" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "doc" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fromJson" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "JsonObject" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "json" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "load" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "path" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "save" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "path" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "print" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "protected", + "text": "protected" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "notifyStateChange" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Override to handle device stopping\r" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_baseAddress" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "MAX_MANAGED_DEVICES" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "NUM_OMRON_DEVICES" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "OmronE5" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_devices" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_MANAGED_DEVICES" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "_numDevices" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "_currentIndex" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Current device index in the round-robin\r" + }, + { + "type": "comment", + "text": "// Configurable parameters\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "_minHeatingDurationS" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "_maxHeatingDurationS" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "_maxHeatingDurationOscillatingS" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "_maxSimultaneousHeating" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "_windowOffset" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_AMPERAGE_MODE" + }, + { + "type": "field_identifier", + "text": "_mode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_AMPERAGE_MODE" + }, + { + "type": "field_identifier", + "text": "_postHeatupMode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_AMPERAGE_MODE" + }, + { + "type": "field_identifier", + "text": "_initialMode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "_startIndex" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Index of the first device in the round-robin cycle\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "_endIndex" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Index of the last device in the round-robin cycle\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_deviceStartTimes" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_MANAGED_DEVICES" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_deviceHeating" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_MANAGED_DEVICES" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_deviceInHeatup" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_MANAGED_DEVICES" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_heatupPhaseComplete" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "field_identifier", + "text": "_name" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "_lastLoopTime" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "std" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "vector" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "OmronE5" + }, + { + "type": "abstract_pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_activeDevices" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_checkHeatup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "OmronE5" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "device" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_stopAllDevices" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_checkAllDevicesForHeatupCompletion" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_loopCycleAll" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_loopCycleSp" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_loopCycleSpAny" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Modbus blocks\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_enable" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_info" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_min_time" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_max_time" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_max_sim" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_offset" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_start_index" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_end_index" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_mode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_max_time_oscillating" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "field_identifier", + "text": "m_modbus_block_post_heatup_mode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "mutable", + "text": "mutable" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "m_modbus_view" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Validation methods\r" + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_validateMaxTime" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "MB_MAX_TIME_MIN_S" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MB_MAX_TIME_MAX_S" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_validateMinTime" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "MB_MIN_TIME_MIN_S" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MB_MIN_TIME_MAX_S" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_validateMaxTimeOscillating" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "number_literal", + "text": "3600" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 1s to 1hr\r" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_validateMaxSim" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MAX_MANAGED_DEVICES" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_validateOffset" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MAX_MANAGED_DEVICES" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_validateStartIndex" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_MANAGED_DEVICES" + } + ] + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "_endIndex" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_validateEndIndex" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_MANAGED_DEVICES" + } + ] + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "_startIndex" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_enableComponent" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enable" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "_stopAllDevices" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_currentIndex" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "_startIndex" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_disableComponent" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "_stopAllDevices" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "disable" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/AnalogLevelSwitch.json b/cli-ts/ast/AnalogLevelSwitch.json new file mode 100644 index 00000000..97ef6b14 --- /dev/null +++ b/cli-ts/ast/AnalogLevelSwitch.json @@ -0,0 +1,2373 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "comment", + "text": "/**\r\n * @file AnalogLevelSwitch.h\r\n * @brief Component to read an analog input as a multi-position switch.\r\n *\r\n * --- Resistor Selection for Voltage Divider Setup ---\r\n *\r\n * This component is designed to interpret an analog voltage as a discrete position or slot.\r\n * It allows for an initial ADC offset (adcValueOffset), meaning the first slot does not\r\n * necessarily start at an ADC reading of 0.\r\n *\r\n * Principle:\r\n * A common way to achieve this is with a voltage divider. You'll have one analog input pin.\r\n * The circuit typically involves one fixed resistor (R_fixed) and a set of switched resistors\r\n * (R_sw0, R_sw1, ..., R_swN-1), one for each of the N slots.\r\n *\r\n * Example Case:\r\n * - Number of slots (numLevels): 4\r\n * - ADC Value Offset (adcValueOffset): 200 (e.g., readings 0-199 are effectively below the first slot)\r\n * - Slot Width (levelStep): 800 ADC counts per slot.\r\n * - System Voltage (V_in): 5V\r\n * - ADC Range: 0-4095 (0V -> 0, 5V -> 4095)\r\n *\r\n * Component Constructor Parameters:\r\n * - numLevels: 4\r\n * - levelStep: 800\r\n * - adcValueOffset: 200\r\n *\r\n * This means the ADC windows for slots are:\r\n * - Slot 0: ADC readings from 200 to (200 + 800 - 1) = 999\r\n * - Slot 1: ADC readings from (200 + 800) = 1000 to (200 + 2*800 - 1) = 1799\r\n * - Slot 2: ADC readings from (200 + 2*800) = 1800 to (200 + 3*800 - 1) = 2599\r\n * - Slot 3: ADC readings from (200 + 3*800) = 2600 to (200 + 4*800 - 1) = 3399\r\n * The highest ADC value mapped to a slot is 3399. Readings above this (e.g. > 3399)\r\n * will be clamped to the last slot (Slot 3). Readings below the offset (e.g. < 200)\r\n * will be clamped to the first slot (Slot 0) by the component's logic.\r\n *\r\n * Circuit Configuration Example:\r\n * - R_fixed is connected from the Analog Input Pin to Ground (GND).\r\n * - For each slot, a different resistor (R_sw0, R_sw1, etc.) is connected from the\r\n * Analog Input Pin to V_in (5V).\r\n * - The voltage at the Analog Input Pin (V_out) is given by:\r\n * V_out = V_in * (R_fixed / (R_sw_current + R_fixed)) (if R_sw to V_in, R_fixed to GND)\r\n * Alternatively, if R_fixed to V_in and R_sw to GND (less common for increasing voltage with switch):\r\n * V_out = V_in * (R_sw_current / (R_fixed + R_sw_current))\r\n * - Assuming the first configuration (R_fixed to GND, R_sw to V_in):\r\n * The ADC reading is: ADC_value = (V_out / V_in) * 4095 (for this example's V_in and ADC range)\r\n *\r\n * Target ADC Values & Resistor Calculation (Adjusted for offset):\r\n * Target midpoints for ADC windows:\r\n * - Slot 0 (200-999): Midpoint ~ (200+999)/2 = 599 => V_out = (599/4095)*5V ~ 0.731V\r\n * - Slot 1 (1000-1799): Midpoint ~ (1000+1799)/2 = 1399 => V_out = (1399/4095)*5V ~ 1.708V\r\n * - Slot 2 (1800-2599): Midpoint ~ (1800+2599)/2 = 2199 => V_out = (2199/4095)*5V ~ 2.685V\r\n * - Slot 3 (2600-3399): Midpoint ~ (2600+3399)/2 = 2999 => V_out = (2999/4095)*5V ~ 3.662V\r\n *\r\n * Let R_fixed = 10 kOhm (to GND). R_sw_current connects Analog Pin to 5V.\r\n * V_out / V_in = R_fixed / (R_sw_current + R_fixed) => This formula gives decreasing V_out for increasing R_sw.\r\n * For increasing V_out with slots, it's usually R_fixed to VCC and R_sw_current to GND for each slot,\r\n * where V_out = VCC * (R_sw_current / (R_fixed + R_sw_current)).\r\n * Or, a ladder network. The example below assumes R_fixed to GND, and R_sw to V_in, which creates HIGHER voltages for LOWER R_sw.\r\n * This means R_sw needs to DECREASE to get higher voltages / higher slot numbers.\r\n * V_out = V_in * R_fixed / (R_sw + R_fixed) is not what we want if R_sw is the switched part to V_in for *increasing* voltage steps.\r\n * Let's re-evaluate the voltage divider formula application for this common use case:\r\n *\r\n * Corrected Circuit Configuration for Increasing Voltage with Slot Index:\r\n * A simple way is multiple resistors (R0, R1, R2, R3) connected via a rotary switch to the analog pin.\r\n * The other end of these resistors goes to V_in (5V). A single resistor R_pull_down goes from analog pin to GND.\r\n * V_out = V_in * (R_pull_down / (R_current_switched_to_Vin + R_pull_down)).\r\n * This means R_current_switched_to_Vin must DECREASE for V_out to INCREASE.\r\n * Example Values (R_pull_down = 10k Ohm from Analog Pin to GND):\r\n *\r\n * - Slot 0 (V_out ~ 0.731V -> R_sw0 to 5V should be large):\r\n * 0.731V = 5V * (10k / (R_sw0 + 10k)) => R_sw0 + 10k = 5V/0.731V * 10k = 68.4k => R_sw0 ~ 58.4 kOhm. (Std: 56k)\r\n * Using 56k: V_out = 5V * (10k / (56k+10k)) ~ 0.757V; ADC ~ 620. (Slot 0: 200-999)\r\n *\r\n * - Slot 1 (V_out ~ 1.708V -> R_sw1 to 5V should be smaller):\r\n * 1.708V = 5V * (10k / (R_sw1 + 10k)) => R_sw1 + 10k = 5V/1.708V * 10k = 29.27k => R_sw1 ~ 19.27 kOhm. (Std: 20k or 18k)\r\n * Using 20k: V_out = 5V * (10k / (20k+10k)) ~ 1.667V; ADC ~ 1365. (Slot 1: 1000-1799)\r\n *\r\n * - Slot 2 (V_out ~ 2.685V -> R_sw2 to 5V should be smaller still):\r\n * 2.685V = 5V * (10k / (R_sw2 + 10k)) => R_sw2 + 10k = 5V/2.685V * 10k = 18.62k => R_sw2 ~ 8.62 kOhm. (Std: 8.2k)\r\n * Using 8.2k: V_out = 5V * (10k / (8.2k+10k)) ~ 2.747V; ADC ~ 2250. (Slot 2: 1800-2599)\r\n *\r\n * - Slot 3 (V_out ~ 3.662V -> R_sw3 to 5V should be smallest):\r\n * 3.662V = 5V * (10k / (R_sw3 + 10k)) => R_sw3 + 10k = 5V/3.662V * 10k = 13.65k => R_sw3 ~ 3.65 kOhm. (Std: 3.6k)\r\n * Using 3.6k: V_out = 5V * (10k / (3.6k+10k)) ~ 3.676V; ADC ~ 3011. (Slot 3: 2600-3399)\r\n *\r\n * Summary of example resistor values (R_pull_down = 10k to GND, V_in=5V, ADC Offset=200, Step=800):\r\n * Each R_swX is connected between 5V and the Analog Input pin when its slot is active.\r\n * - Slot 0: R_sw0 = 56k\r\n * - Slot 1: R_sw1 = 20k\r\n * - Slot 2: R_sw2 = 8.2k\r\n * - Slot 3: R_sw3 = 3.6k\r\n *\r\n * Important Considerations:\r\n * - Resistor Tolerances: Use 1% or better resistors if possible, or account for tolerances\r\n * to ensure ADC readings for different slots don't overlap.\r\n * - ADC Linearity & Noise: Real-world ADCs have non-linearities and noise. Provide sufficient\r\n * margin between the target ADC values for each slot.\r\n * - ADC Input Impedance: Ensure the equivalent resistance of the voltage divider is not too high,\r\n * as it can affect ADC reading accuracy due to the ADC's input impedance and sample/hold capacitor charging.\r\n * Typically, values in the 1k to 100k range for the overall divider are fine for many MCUs.\r\n * - Debouncing: If the switch is mechanical, you might need software or hardware debouncing,\r\n * though this component reads periodically based on ANALOG_SWITCH_READ_INTERVAL.\r\n */" + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "ANALOG_LEVEL_SWITCH_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "ANALOG_LEVEL_SWITCH_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "comment", + "text": "// For ANALOG_SWITCH_READ_INTERVAL if not overridden by ALS_READ_INTERVAL_MS\r" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + }, + { + "type": "comment", + "text": "// For uint16_t, uint32_t\r" + } + ] + }, + { + "type": "comment", + "text": "// ─────────────────────────────────────────────────────────────────────────────\r" + }, + { + "type": "comment", + "text": "// Compile‑time configuration (moved from .cpp)\r" + }, + { + "type": "comment", + "text": "// ─────────────────────────────────────────────────────────────────────────────\r" + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "ANALOG_LVL_SLOTS_MAX" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "ANALOG_LVL_SLOTS_MAX" + }, + { + "type": "preproc_arg", + "text": "32 // upper bound enforced at runtime\r" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "ALS_SMOOTHING_SIZE" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "ALS_SMOOTHING_SIZE" + }, + { + "type": "preproc_arg", + "text": "8 // samples in moving‑average buffer\r" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "ALS_DEBOUNCE_COUNT" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "ALS_DEBOUNCE_COUNT" + }, + { + "type": "preproc_arg", + "text": "3 // identical detections before commit\r" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "ALS_HYSTERESIS_CODES" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "ALS_HYSTERESIS_CODES" + }, + { + "type": "preproc_arg", + "text": "4 // ±ADC codes guard‑band\r" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "ALS_READ_INTERVAL_MS" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "ALS_READ_INTERVAL_MS" + }, + { + "type": "preproc_arg", + "text": "25 // Override for ANALOG_SWITCH_READ_INTERVAL\r" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "ALS_USE_EMA" + }, + { + "type": "comment", + "text": "// undef to keep simple moving average\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "ALS_USE_EMA" + }, + { + "type": "preproc_arg", + "text": "0 // 0 = MA, 1 = EMA(α = 1/ALS_SMOOTHING_SIZE)\r" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// ─────────────────────────────────────────────────────────────────────────────\r" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Bridge" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "AnalogLevelSwitch" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "comment", + "text": "// Removed old static const members, replaced by defines above\r" + }, + { + "type": "comment", + "text": "// static const short SMOOTHING_ARRAY_SIZE = 10; \r" + }, + { + "type": "comment", + "text": "// static const short MAX_ANALOG_LEVELS = 16;\r" + }, + { + "type": "comment", + "text": "// static const short DEBOUNCE_CONFIRMATIONS_COUNT = 3;\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "AnalogLevelRegOffset" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Changed underlying type to uint16_t\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "DETECTED_LEVEL" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "RAW_ANALOG_VALUE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "LEVEL_STATE_START" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "m_pin" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_slotCount" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_adcStepPerSlot" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Changed from int\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_adcOffset" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Changed from int\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_modbusAddr" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_activeSlot" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_adcRaw" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Smoothing data (fixed array)\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "m_adcBuffer" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "ALS_SMOOTHING_SIZE" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Use new define\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_bufferIdx" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "m_bufferSum" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Changed from long to uint32_t for consistency\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_adcSmoothed" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Debouncing data\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_proposedSlot" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_confirmCount" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Modbus definitions \r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "m_modbusBlocks" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "number_literal", + "text": "2" + }, + { + "type": "+", + "text": "+" + }, + { + "type": "identifier", + "text": "ANALOG_LVL_SLOTS_MAX" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Use new define\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "m_modbusBlockCount" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "m_modbusView" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Private helpers\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "buildModbusBlocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Added declaration\r" + }, + { + "type": "comment", + "text": "// Updated signature for determineSlotFromValue\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "determineSlotFromValue" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "adcVal" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "currentSlot" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "UINT16_MAX" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "AnalogLevelSwitch" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_analogPin" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "_numLevels" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Changed from ushort/short\r" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "_levelStep" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Changed from int\r" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "_adcValueOffset" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Changed from int\r" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "_modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Changed from ushort\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val0" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val1" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "debug" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "info" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Return types adjusted\r" + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getActiveSlot" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "m_activeSlot" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Changed from ushort\r" + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getRawAdc" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "m_adcRaw" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Changed from ushort\r" + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getSmoothedAdc" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "m_adcSmoothed" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Changed from ushort\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "protected", + "text": "protected" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "notifyStateChange" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "m_lastReadMs" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// ANALOG_LEVEL_SWITCH_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/Extruder.json b/cli-ts/ast/Extruder.json new file mode 100644 index 00000000..379a25c2 --- /dev/null +++ b/cli-ts/ast/Extruder.json @@ -0,0 +1,2786 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "PLUNGER_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "./SAKO_VFD.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "./3PosAnalog.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "./POT.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "enums.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "comment", + "text": "// Component Constants\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_COMPONENT_ID" + }, + { + "type": "preproc_arg", + "text": "760\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_COMPONENT_NAME" + }, + { + "type": "preproc_arg", + "text": "\"Extruder\"\r" + } + ] + }, + { + "type": "comment", + "text": "// Speed Presets (in 0.01 Hz units for SAKO_VFD)\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_SPEED_SLOW_HZ" + }, + { + "type": "preproc_arg", + "text": "10 // 10.00 Hz\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_SPEED_MEDIUM_HZ" + }, + { + "type": "preproc_arg", + "text": "25 // 25.00 Hz\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_SPEED_FAST_HZ" + }, + { + "type": "preproc_arg", + "text": "50 // 50.00 Hz (currently unused, but defined)\r" + } + ] + }, + { + "type": "comment", + "text": "// Speed POT Configuration for Extruding (multiplier for MEDIUM speed)\r" + }, + { + "type": "comment", + "text": "// POT value 0-100. Example: 0 maps to 0.5x, 50 maps to 1.0x, 100 maps to 1.5x MEDIUM speed.\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_SPEED_POT_MIN_MULTIPLIER" + }, + { + "type": "preproc_arg", + "text": "0.5f\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_SPEED_POT_MAX_MULTIPLIER" + }, + { + "type": "preproc_arg", + "text": "1.5f\r" + } + ] + }, + { + "type": "comment", + "text": "// Overload POT Configuration and Jamming (using VFD Torque %)\r" + }, + { + "type": "comment", + "text": "// POT value 0-100. Maps to a torque threshold in percent (0-100).\r" + }, + { + "type": "comment", + "text": "// SAKO_VFD component now provides getTorque() returning 0-100.\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_OVERLOAD_POT_MIN_TORQUE_PERCENT" + }, + { + "type": "preproc_arg", + "text": "50 // Example: 50% Torque\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_OVERLOAD_POT_MAX_TORQUE_PERCENT" + }, + { + "type": "preproc_arg", + "text": "95 // Example: 95% Torque\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_JAMMED_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "2000 // Time torque must be above threshold to be JAMMED\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_VFD_READ_INTERVAL_MS" + }, + { + "type": "preproc_arg", + "text": "200 // How often to check VFD torque for jamming\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_AUTO_MODE_HOLD_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "2000 // Time joystick must be held for auto mode\r" + } + ] + }, + { + "type": "comment", + "text": "// Modbus Configuration\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_MB_BASE_ADDRESS" + }, + { + "type": "preproc_arg", + "text": "EXTRUDER_COMPONENT_ID // Using component ID as base\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_MB_STATE_OFFSET" + }, + { + "type": "preproc_arg", + "text": "0\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_MB_COMMAND_OFFSET" + }, + { + "type": "preproc_arg", + "text": "1\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_MB_BLOCK_COUNT" + }, + { + "type": "preproc_arg", + "text": "2\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "EXTRUDER_MAX_RUN_TIME_MEDIUM_SPEED_MS" + }, + { + "type": "preproc_arg", + "text": "15000 // Max runtime at medium speed\r" + } + ] + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "ExtruderModbusCommand" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "NO_COMMAND" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_EXTRUDE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_STOP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_INFO" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "// Extruder States\r" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "ExtruderState" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "IDLE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "EXTRUDING_MANUAL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Joystick held UP, VFD forwarding, monitoring for auto-mode hold time\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "EXTRUDING_AUTO" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Auto-extruding after joystick hold, VFD forwarding\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STOPPING" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Transition state to stop VFD\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "JAMMED" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "RESETTING_JAM" + } + ] + }, + { + "type": "comment", + "text": "// State to handle reset after jam\r" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Extruder" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "Extruder" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "SAKO_VFD" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "vfd" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Pos3Analog" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "joystick" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "POT" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "speedPot" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "POT" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "overloadPot" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "Extruder" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "debug" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "b" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "init" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "reset" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Modbus TCP Interface\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "mgr" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Public commands for serial/external control\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_extrude" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_stop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "SAKO_VFD" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_vfd" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Pos3Analog" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_joystick" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "POT" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_speedPot" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "POT" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_overloadPot" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ExtruderState" + }, + { + "type": "field_identifier", + "text": "_currentState" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Pos3Analog" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "type_identifier", + "text": "E_POS3_DIRECTION" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastJoystickDirection" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentSpeedPotValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 0-100, defaults to 100 if pot is null\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentOverloadPotValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 0-100, defaults to 100 if pot is null\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "float" + }, + { + "type": "field_identifier", + "text": "_calculatedExtrudingSpeedHz" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Calculated speed for extruding (0.01Hz units)\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "_calculatedOverloadThresholdPercent" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Calculated torque threshold (0-100%)\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastStateChangeTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_jammedStartTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastVfdReadTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_joystickHoldStartTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timer for joystick hold duration\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "_modbusCommandRegisterValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Holds the current value of the Modbus command register\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_operationStartTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Start time of current extrude operation\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_currentMaxOperationTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Calculated max duration for current operation\r" + }, + { + "type": "comment", + "text": "// Helper methods\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleIdleState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleExtrudingManualState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleExtrudingAutoState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleStoppingState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleJammedState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleResettingJamState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_updatePotValues" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_checkVfdForJam" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_transitionToState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ExtruderState" + }, + { + "type": "identifier", + "text": "newState" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// VFD interaction wrappers\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_vfdStartForward" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "frequencyCentiHz" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_vfdStartReverse" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "frequencyCentiHz" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_vfdStop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_vfdResetJam" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// PLUNGER_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/Feedback3C.json b/cli-ts/ast/Feedback3C.json new file mode 100644 index 00000000..d62e583a --- /dev/null +++ b/cli-ts/ast/Feedback3C.json @@ -0,0 +1,13497 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "FEEDBACK_3C_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "FEEDBACK_3C_H" + } + ] + }, + { + "type": "comment", + "text": "// Relay output mode\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "RELAY_MODE_NO" + }, + { + "type": "preproc_arg", + "text": "0 // Normally Open: HIGH = ON\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "RELAY_MODE_NC" + }, + { + "type": "preproc_arg", + "text": "1 // Normally Closed: LOW = ON\r" + } + ] + }, + { + "type": "comment", + "text": "// Select the mode for the Feedback3C component\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "FEEDBACK_3C_RELAY_MODE" + }, + { + "type": "preproc_arg", + "text": "RELAY_MODE_NO\r" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "ValueWrapper.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Bridge" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Feedback3C" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "MAX_LEDS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "E_MB_Offset" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_0" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_1" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_2" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_0" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_1" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_2" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_CMD" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "6" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "7" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "8" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COUNT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "9" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "Mode" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_MANUAL" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_STARTUP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_STANDBY" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_RUNNING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_WAITING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_FINISHED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_WARNING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "6" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_HEATING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "7" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_ERROR" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "8" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Mode" + }, + { + "type": "field_identifier", + "text": "_currentMode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "LedState" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "LED_ON" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "LED_BLINK" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "struct_specifier", + "children": [ + { + "type": "struct", + "text": "struct" + }, + { + "type": "type_identifier", + "text": "ModeConfig" + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LedState" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "led_states" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ModeConfig" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getModeConfig" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Mode" + }, + { + "type": "identifier", + "text": "mode" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ModeConfig" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "array_declarator", + "children": [ + { + "type": "identifier", + "text": "configs" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "/* MODE_MANUAL */" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "/* MODE_STARTUP */" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_ON" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_ON" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_ON" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "/* MODE_STANDBY */" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_ON" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_ON" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "/* MODE_RUNNING */" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_ON" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_ON" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "/* MODE_WAITING */" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_BLINK" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_BLINK" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "/* MODE_FINISHED*/" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_ON" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_ON" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "/* MODE_WARNING */" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_BLINK" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "/* MODE_HEATING */" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_BLINK" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "/* MODE_ERROR */" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LedState" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LED_BLINK" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "configs" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "mode" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getPinState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "identifier", + "text": "led_on" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "preproc_if", + "children": [ + { + "type": "#if", + "text": "#if" + }, + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "FEEDBACK_3C_RELAY_MODE" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "RELAY_MODE_NO" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "\n", + "text": "\n" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "identifier", + "text": "led_on" + }, + { + "type": "?", + "text": "?" + }, + { + "type": "identifier", + "text": "HIGH" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "identifier", + "text": "LOW" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "preproc_else", + "children": [ + { + "type": "#else", + "text": "#else" + }, + { + "type": "comment", + "text": "// RELAY_MODE_NC\r" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "identifier", + "text": "led_on" + }, + { + "type": "?", + "text": "?" + }, + { + "type": "identifier", + "text": "LOW" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "identifier", + "text": "HIGH" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "m_modbus_block" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_COUNT" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "mutable", + "text": "mutable" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "m_modbus_view" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// for blinking\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "lastToggleTime" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "leds" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "ledFrequencies" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "Mode" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "mode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setMode" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Mode" + }, + { + "type": "identifier", + "text": "newMode" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enabled" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "||", + "text": "||" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "newMode" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "_currentMode" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_currentMode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "newMode" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "setValueWithoutNotification" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "newMode" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "newMode" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MODE_MANUAL" + } + ] + }, + { + "type": "||", + "text": "||" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "newMode" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "identifier", + "text": "MODE_ERROR" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// 1. Get the configuration for the requested mode.\r" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ModeConfig" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "config" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "getModeConfig" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "newMode" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Reset all LEDs and frequencies first to ensure a clean state.\r" + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "setValueWithoutNotification" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// 2. Iterate through each LED and apply the state from the fetched ModeConfig.\r" + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "switch_statement", + "children": [ + { + "type": "switch", + "text": "switch" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "config" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "led_states" + } + ] + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "case_statement", + "children": [ + { + "type": "case", + "text": "case" + }, + { + "type": "identifier", + "text": "LED_OFF" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "break_statement", + "children": [ + { + "type": "break", + "text": "break" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "case_statement", + "children": [ + { + "type": "case", + "text": "case" + }, + { + "type": "identifier", + "text": "LED_ON" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "true", + "text": "true" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "break_statement", + "children": [ + { + "type": "break", + "text": "break" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "case_statement", + "children": [ + { + "type": "case", + "text": "case" + }, + { + "type": "identifier", + "text": "LED_BLINK" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "comment", + "text": "// For blinking, set the initial state and frequency.\r" + }, + { + "type": "comment", + "text": "// The loop() function will handle the actual toggling.\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "true", + "text": "true" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Start with LED on for immediate feedback\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "setValueWithoutNotification" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Default 1s blink rate\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "break_statement", + "children": [ + { + "type": "break", + "text": "break" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "pins" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "Command" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ALL_OFF" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ALL_ON" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ALL_BLINK" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "Feedback3C" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "pin0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "pin1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "pin2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "field_initializer_list", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "Component" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "_id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "COMPONENT_DEFAULT" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "owner" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "pins" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "identifier", + "text": "pin0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "pin1" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "pin2" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "_modbusAddress" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setNetCapability" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "OBJECT_NET_CAPS" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "E_NCAPS_MODBUS" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_currentMode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "MODE_STARTUP" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "lambda_expression", + "children": [ + { + "type": "lambda_capture_specifier", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "this", + "text": "this" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "abstract_function_declarator", + "children": [ + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "trailing_return_type", + "children": [ + { + "type": "->", + "text": "->" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_0" + }, + { + "type": "+", + "text": "+" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "slaveId" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "false", + "text": "false" + }, + { + "type": ",", + "text": "," + }, + { + "type": "true", + "text": "true" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "::", + "text": "::" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "ThresholdMode" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "DIFFERENCE" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "lambda_expression", + "children": [ + { + "type": "lambda_capture_specifier", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "abstract_function_declarator", + "children": [ + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "oldValue" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "pins" + } + ] + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "getPinState" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "newValue" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "lambda_expression", + "children": [ + { + "type": "lambda_capture_specifier", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "this", + "text": "this" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "abstract_function_declarator", + "children": [ + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "trailing_return_type", + "children": [ + { + "type": "->", + "text": "->" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_0" + }, + { + "type": "+", + "text": "+" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_HOLD_REGISTER" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "slaveId" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "::", + "text": "::" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "ThresholdMode" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "DIFFERENCE" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "Mode" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "lambda_expression", + "children": [ + { + "type": "lambda_capture_specifier", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "this", + "text": "this" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "abstract_function_declarator", + "children": [ + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "trailing_return_type", + "children": [ + { + "type": "->", + "text": "->" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_HOLD_REGISTER" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "slaveId" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MODE_STARTUP" + }, + { + "type": ",", + "text": "," + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "Mode" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "Mode" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "::", + "text": "::" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "ThresholdMode" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "DIFFERENCE" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + }, + { + "type": "comment", + "text": "// setMode is called manually after update\r" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "MODE_STARTUP" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 3 Coils for LEDs\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_0" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "LED 0" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_1" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_1" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "LED 1" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_2" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_2" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "LED 2" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 3 HRs for Blink Frequency\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_0" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_HOLD_REGISTER" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "LED 0 Freq" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_1" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_1" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_HOLD_REGISTER" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "LED 1 Freq" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_2" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_2" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_HOLD_REGISTER" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "LED 2 Freq" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 1 HR for Command\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_CMD" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_HR_CMD" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_HOLD_REGISTER" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_WRITE_ONLY" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Command (0:All Off, 1:All On, 2:All Blink)" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_HOLD_REGISTER" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Mode (0:Manual, 1:Startup, 2:Standby, 3:Running, 4:Waiting, 5:Finished, 6:Warning, 7:Heating, 8:Error)" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Enabled" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_view" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "data" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "m_modbus_block" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_view" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "count" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "MB_OFS_COUNT" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "setup" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "pinMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "pins" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "OUTPUT" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "pins" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "getPinState" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enabled" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "_currentMode" + }, + { + "type": "!=", + "text": "!=" + }, + { + "type": "identifier", + "text": "MODE_MANUAL" + } + ] + }, + { + "type": "||", + "text": "||" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "||", + "text": "||" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "||", + "text": "||" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "2" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "MODE_MANUAL" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_currentMode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "MODE_MANUAL" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "loop" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "currentMillis" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// 3. If a blink frequency is set, toggle the LED state periodically.\r" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "currentMillis" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + } + ] + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "*", + "text": "*" + }, + { + "type": "number_literal", + "text": "1000" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "currentMillis" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "newState" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "newState" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Any direct write to an LED coil/freq or a command sets the mode to MANUAL\r" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "MODE_MANUAL" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_0" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_2" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Coil write\r" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "index" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_0" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "index" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// manual override stops blinking\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "index" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_0" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_2" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Freq write\r" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "index" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_0" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "index" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "index" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "index" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_CMD" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Command write\r" + }, + { + "type": "switch_statement", + "children": [ + { + "type": "switch", + "text": "switch" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "case_statement", + "children": [ + { + "type": "case", + "text": "case" + }, + { + "type": "identifier", + "text": "ALL_OFF" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "break_statement", + "children": [ + { + "type": "break", + "text": "break" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "case_statement", + "children": [ + { + "type": "case", + "text": "case" + }, + { + "type": "identifier", + "text": "ALL_ON" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "true", + "text": "true" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "break_statement", + "children": [ + { + "type": "break", + "text": "break" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "case_statement", + "children": [ + { + "type": "case", + "text": "case" + }, + { + "type": "identifier", + "text": "ALL_BLINK" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "MAX_LEDS" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "==", + "text": "==" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// default 1s\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "break_statement", + "children": [ + { + "type": "break", + "text": "break" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "case_statement", + "children": [ + { + "type": "default", + "text": "default" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_INVALID_PARAMETER" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "MODE_MANUAL" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MODE_ERROR" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "Mode" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "newMode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "Mode" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "newMode" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_INVALID_PARAMETER" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "conditional_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enable" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "disable" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_INVALID_PARAMETER" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_0" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_2" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Coil read\r" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "leds" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_LED_0" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_0" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_2" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Freq read\r" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "ledFrequencies" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_FREQ_LED_0" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_CMD" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Command read - write only\r" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enabled" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_write" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "reg" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "startAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_read" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "reg" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "startAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "blocksView" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "thiz" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "const_cast" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "Feedback3C" + }, + { + "type": "abstract_pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "this", + "text": "this" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "blocksView" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "count" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "info" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "blocksView" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "data" + } + ] + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "manager" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "registerModbus" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "thiz" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "info" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "pointer_expression", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "m_modbus_view" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "serial_register" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "bridge" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/FeedbackBuzzer.json b/cli-ts/ast/FeedbackBuzzer.json new file mode 100644 index 00000000..c2aaca38 --- /dev/null +++ b/cli-ts/ast/FeedbackBuzzer.json @@ -0,0 +1,7582 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "FEEDBACK_BUZZER_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "FEEDBACK_BUZZER_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "ValueWrapper.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Feedback3C.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "FEEDBACK_BUZZER_MAX_PLAY_TIME_MS" + }, + { + "type": "preproc_arg", + "text": "2500" + } + ] + }, + { + "type": "struct_specifier", + "children": [ + { + "type": "struct", + "text": "struct" + }, + { + "type": "type_identifier", + "text": "BuzzerPattern" + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "on_ms" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "off_ms" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "FeedbackBuzzer" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "E_BuzzerMode" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_SOLID" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_SLOW_BLINK" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// 1s on, 1s off" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_FAST_BLINK" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// 250ms on, 250ms off" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_LONG_BEEP_SHORT_PAUSE" + } + ] + }, + { + "type": "comment", + "text": "// 1s on, 250ms off" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "E_MB_Offset" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COIL_STATE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COUNT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "pin" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "m_modbus_block" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_COUNT" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "mutable", + "text": "mutable" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "m_modbus_view" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "lastToggleTime" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "pattern_step" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "_start_time_ms" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "_max_play_time_ms" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "state" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "mode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 0 for solid on, >0 for blinking in seconds" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "BuzzerPattern" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "patterns" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "3" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "number_literal", + "text": "1000" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "1000" + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// SLOW_BLINK" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "number_literal", + "text": "250" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "250" + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// FAST_BLINK" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "number_literal", + "text": "1000" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "250" + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// LONG_BEEP_SHORT_PAUSE" + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "function_definition", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "FeedbackBuzzer" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_pin" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "field_initializer_list", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "Component" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "FeedbackBuzzer" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "_id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "COMPONENT_DEFAULT" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "owner" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "pin" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "_pin" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "_modbusAddress" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setNetCapability" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "OBJECT_NET_CAPS" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "E_NCAPS_MODBUS" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "pattern_step" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_start_time_ms" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_max_play_time_ms" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "state" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "lambda_expression", + "children": [ + { + "type": "lambda_capture_specifier", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "this", + "text": "this" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "abstract_function_declarator", + "children": [ + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "trailing_return_type", + "children": [ + { + "type": "->", + "text": "->" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_STATE" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "slaveId" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "false", + "text": "false" + }, + { + "type": ",", + "text": "," + }, + { + "type": "true", + "text": "true" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "::", + "text": "::" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "ThresholdMode" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "DIFFERENCE" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "lambda_expression", + "children": [ + { + "type": "lambda_capture_specifier", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "this", + "text": "this" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "abstract_function_declarator", + "children": [ + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "oldValue" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "pin" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "identifier", + "text": "newValue" + }, + { + "type": "?", + "text": "?" + }, + { + "type": "identifier", + "text": "HIGH" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "identifier", + "text": "LOW" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "lambda_expression", + "children": [ + { + "type": "lambda_capture_specifier", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "this", + "text": "this" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "abstract_function_declarator", + "children": [ + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "trailing_return_type", + "children": [ + { + "type": "->", + "text": "->" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_HOLD_REGISTER" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "slaveId" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "identifier", + "text": "MODE_OFF" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "::", + "text": "::" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "ThresholdMode" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "DIFFERENCE" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "lambda_expression", + "children": [ + { + "type": "lambda_capture_specifier", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "this", + "text": "this" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "abstract_function_declarator", + "children": [ + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "oldValue" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "setMode" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "E_BuzzerMode" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_STATE" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_STATE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Buzzer State" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "FeedbackBuzzer" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_HOLD_REGISTER" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Buzzer Mode" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "FeedbackBuzzer" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Buzzer Enabled" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "FeedbackBuzzer" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_view" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "data" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "m_modbus_block" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_view" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "count" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "MB_OFS_COUNT" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "on" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "MODE_SOLID" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "off" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "MODE_OFF" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setMode" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_BuzzerMode" + }, + { + "type": "identifier", + "text": "newMode" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "identifier", + "text": "max_play_time_ms" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "FEEDBACK_BUZZER_MAX_PLAY_TIME_MS" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enabled" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// If a timed sound is currently playing, do not allow it to be overridden" + }, + { + "type": "comment", + "text": "// by a new sound. The only exception is explicitly turning it OFF." + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "_start_time_ms" + } + ] + }, + { + "type": "<", + "text": "<" + }, + { + "type": "identifier", + "text": "_max_play_time_ms" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "newMode" + }, + { + "type": "!=", + "text": "!=" + }, + { + "type": "identifier", + "text": "MODE_OFF" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "newMode" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_start_time_ms" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "pattern_step" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "newMode" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MODE_OFF" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_max_play_time_ms" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "state" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "max_play_time_ms" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": "||", + "text": "||" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "max_play_time_ms" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "identifier", + "text": "FEEDBACK_BUZZER_MAX_PLAY_TIME_MS" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_max_play_time_ms" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "FEEDBACK_BUZZER_MAX_PLAY_TIME_MS" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_max_play_time_ms" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "max_play_time_ms" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "state" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "true", + "text": "true" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "setup" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "pinMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "OUTPUT" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "state" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "identifier", + "text": "HIGH" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "identifier", + "text": "LOW" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enabled" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "E_BuzzerMode" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "!=", + "text": "!=" + }, + { + "type": "identifier", + "text": "MODE_OFF" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "off" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Ensure it's off if disabled" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "loop" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_BuzzerMode" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "currentMode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "E_BuzzerMode" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// If the timed duration has elapsed, turn the buzzer off." + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "_max_play_time_ms" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "_start_time_ms" + } + ] + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "_max_play_time_ms" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "off" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "currentMode" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "identifier", + "text": "MODE_SOLID" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "BuzzerPattern" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "pattern" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "patterns" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "currentMode" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "MODE_SLOW_BLINK" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "currentMillis" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "duration" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "pattern_step" + }, + { + "type": "%", + "text": "%" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": "==", + "text": "==" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "pattern" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "on_ms" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "pattern" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "off_ms" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "currentMillis" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "lastToggleTime" + } + ] + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "duration" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "currentMillis" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "state" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "update" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "state" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "update_expression", + "children": [ + { + "type": "identifier", + "text": "pattern_step" + }, + { + "type": "++", + "text": "++" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_STATE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Coil write" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "identifier", + "text": "MODE_SOLID" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "identifier", + "text": "MODE_OFF" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Mode write" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": "<=", + "text": "<=" + }, + { + "type": "identifier", + "text": "MODE_LONG_BEEP_SHORT_PAUSE" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "E_BuzzerMode" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_INVALID_PARAMETER" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "conditional_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enable" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "disable" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_INVALID_PARAMETER" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_STATE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "state" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "offset" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enabled" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_write" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "reg" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "startAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_read" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "reg" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "startAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "blocksView" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "thiz" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "const_cast" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "FeedbackBuzzer" + }, + { + "type": "abstract_pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "this", + "text": "this" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "blocksView" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "count" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "info" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "blocksView" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "data" + } + ] + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "manager" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "registerModbus" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "thiz" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "info" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "pointer_expression", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "m_modbus_view" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// FEEDBACK_BUZZER_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/Joystick.json b/cli-ts/ast/Joystick.json new file mode 100644 index 00000000..8a61fa98 --- /dev/null +++ b/cli-ts/ast/Joystick.json @@ -0,0 +1,2835 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "JOYSTICK_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "JOYSTICK_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Bridge" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Joystick" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_POSITION" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CENTER" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "UP" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "DOWN" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "LEFT" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "RIGHT" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "UNKNOWN" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_MODE" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "LOCAL" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REMOTE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_REGISTER" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "POSITION" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "OVERRIDE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "pinUp" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "pinDown" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "pinLeft" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "pinRight" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "modbusAddr" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_POSITION" + }, + { + "type": "field_identifier", + "text": "currentPosition" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_POSITION" + }, + { + "type": "field_identifier", + "text": "lastPosition" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_MODE" + }, + { + "type": "field_identifier", + "text": "mode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_POSITION" + }, + { + "type": "field_identifier", + "text": "overridePosition" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Position timing\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "positionStartMs" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Debouncing data\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "lastReadMs" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_POSITION" + }, + { + "type": "field_identifier", + "text": "proposedPosition" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_POSITION" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "CENTER" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "confirmCount" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "useDebouncing" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "true", + "text": "true" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Modbus definitions\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "modbusBlocks" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "3" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "modbusBlockCount" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "modbusView" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Private helpers\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_POSITION" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "readPinsPosition" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "Joystick" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_pinUp" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_pinDown" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_pinLeft" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_pinRight" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_modbusAddress" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "100" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "reset" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val0" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val1" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "debug" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "info" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "E_POSITION" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getPosition" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_MODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "LOCAL" + } + ] + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "identifier", + "text": "currentPosition" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "identifier", + "text": "overridePosition" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getValue" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "static_cast" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "getPosition" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "E_POSITION" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getLastPosition" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "lastPosition" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getHoldingTime" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "now" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "positionStartMs" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "E_MODE" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getMode" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "mode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setMode" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_MODE" + }, + { + "type": "identifier", + "text": "_mode" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "_mode" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "notifyStateChange" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setOverridePosition" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_POSITION" + }, + { + "type": "identifier", + "text": "pos" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "overridePosition" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "pos" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "mode" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_MODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "REMOTE" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "notifyStateChange" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "protected", + "text": "protected" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "notifyStateChange" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Configuration\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "constexpr", + "text": "constexpr" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "DEBOUNCE_COUNT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "constexpr", + "text": "constexpr" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "READ_INTERVAL_MS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "25" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// JOYSTICK_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/LEDFeedback.json b/cli-ts/ast/LEDFeedback.json new file mode 100644 index 00000000..78573e3e --- /dev/null +++ b/cli-ts/ast/LEDFeedback.json @@ -0,0 +1,2352 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "LED_FEEDBACK_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "LED_FEEDBACK_H" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_LED_FEEDBACK" + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "comment", + "text": "// For LED_UPDATE_INTERVAL_MS potentially\r" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + }, + { + "type": "comment", + "text": "// If needed by Component or others\r" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + }, + { + "type": "comment", + "text": "// NeoPixel library\r" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + }, + { + "type": "comment", + "text": "// For Modbus interaction base\r" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "comment", + "text": "// For Modbus addresses/constants\r" + } + ] + }, + { + "type": "comment", + "text": "// Forward declare if necessary\r" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Bridge" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "// Define max registers needed (Mode + potential future params like Brightness)\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MAX_LED_FEEDBACK_REGISTERS" + }, + { + "type": "preproc_arg", + "text": "3\r" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "LEDFeedback" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "comment", + "text": "// Define modes for the LED strip\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "LEDMode" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "OFF" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "FADE_R_B" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Fade Red <-> Blue\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "RANGE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Display a level 0-100\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TRI_COLOR_BLINK" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": "comment", + "text": "// Three sections blinking\r" + }, + { + "type": "comment", + "text": "// Add more modes later, e.g., SOLID_COLOR, RAINBOW\r" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Define Modbus register offsets relative to base address\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "LEDRegOffset" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "LEVEL" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// For RANGE mode level (0-100)\r" + }, + { + "type": "comment", + "text": "// BRIGHTNESS = 2 // Add later if needed\r" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "comment", + "text": "// General Configuration & State\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "m_pin" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// NeoPixel data pin\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "m_pixelCount" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Number of pixels in the strip\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "m_modbusAddr" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Base Modbus address\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Adafruit_NeoPixel" + }, + { + "type": "field_identifier", + "text": "m_strip" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// NeoPixel Object\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LEDMode" + }, + { + "type": "field_identifier", + "text": "m_mode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "LEDMode" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "OFF" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Current active mode\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "m_lastUpdateMs" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timestamp of the last general LED update\r" + }, + { + "type": "comment", + "text": "// Modbus Definitions\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "m_modbusBlocks" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_LED_FEEDBACK_REGISTERS" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "m_modbusBlockCount" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "m_modbusView" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- LEDMode::FADE_R_B ---\r" + }, + { + "type": "comment", + "text": "// State\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "float" + }, + { + "type": "field_identifier", + "text": "m_fadeProgress" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0.0f" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 0.0 to 1.0 for fade\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "m_fadingUp" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Direction of fade (false = C1->C2, true = C2->C1)\r" + }, + { + "type": "comment", + "text": "// Colors (could be made configurable later)\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "m_color1" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Adafruit_NeoPixel" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "Color" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "255" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Red\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "m_color2" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Adafruit_NeoPixel" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "Color" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "255" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Blue\r" + }, + { + "type": "comment", + "text": "// Helper\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "calculateFadeColor" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "handleModeFadeRB" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- LEDMode::RANGE ---\r" + }, + { + "type": "comment", + "text": "// State\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "m_rangeLevel" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Level for RANGE mode (0-100)\r" + }, + { + "type": "comment", + "text": "// Helper\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "handleModeRange" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- LEDMode::TRI_COLOR_BLINK ---\r" + }, + { + "type": "comment", + "text": "// State\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "m_triColorBlinkStateOn" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "true", + "text": "true" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "m_lastBlinkToggleMs" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Helper\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "handleModeTriColorBlink" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// General Private Helpers\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "handleModeOff" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Handles LEDMode::OFF\r" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "LEDFeedback" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_pin" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_pixelCount" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "LEDFeedback" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Default destructor is likely fine\r" + }, + { + "type": "comment", + "text": "// Component Lifecycle\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val0" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val1" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "debug" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "info" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Mode Control (optional direct methods)\r" + }, + { + "type": "comment", + "text": "// void setMode(LEDMode newMode);\r" + }, + { + "type": "comment", + "text": "// LEDMode getMode() const { return m_mode; }\r" + }, + { + "type": "comment", + "text": "// Modbus Interface\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Serial Interface\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "protected", + "text": "protected" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "notifyStateChange" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Override if mode change notification is useful\r" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// LED_FEEDBACK_H \r" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// ENABLE_LED_FEEDBACK" + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/Loadcell.json b/cli-ts/ast/Loadcell.json new file mode 100644 index 00000000..0fb2d779 --- /dev/null +++ b/cli-ts/ast/Loadcell.json @@ -0,0 +1,1658 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "LOADCELL_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "LOADCELL_H" + } + ] + }, + { + "type": "comment", + "text": "// RS485 - Loadcell amplifier : https://qlsensor.com/products/load-cell-amplifier-weighing-sensor-transmitter-output-0-5v-0-10v-0-20ma\r" + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_LOADCELL" + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_LoadcellTcpOffset" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "PV" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STABLE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ENABLED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "COMMAND" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Loadcell" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "RTU_Base" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "constexpr", + "text": "constexpr" + } + ] + }, + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "field_identifier", + "text": "LOADCELL_TCP_BLOCK_COUNT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "Loadcell" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "identifier", + "text": "slaveId" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "identifier", + "text": "readInterval" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1000" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "Loadcell" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onRegisterUpdate" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getWeight" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getStableValueHold" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_base_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_offset_for_rtu_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "rtuAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onError" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "errorCode" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "errorMessage" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "_readInterval" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_mode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_weightValid" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_weightLow" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_weightHigh" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_weightWrapper" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_stableWeightValid" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_stableValueHoldLow" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_stableValueHoldHigh" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_stableWeightWrapper" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_modbusBlocks" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "LOADCELL_TCP_BLOCK_COUNT" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "_modbusBlockView" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// ENABLE_LOADCELL\r" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// LOADCELL_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/Logger.json b/cli-ts/ast/Logger.json new file mode 100644 index 00000000..8d7067b2 --- /dev/null +++ b/cli-ts/ast/Logger.json @@ -0,0 +1,7698 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "LOGGER_COMPONENT_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "LOGGER_COMPONENT_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "L_SILENT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "L_FATAL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "L_ERROR" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "L_WARNING" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "L_LEVEL_INFO" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "L_TRACE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "L_VERBOSE" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "LogTargetType" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TARGET_TYPE_PRINT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TARGET_TYPE_WEBSOCKET" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TARGET_TYPE_FILE" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "LogTargetMask" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TARGET_MASK_PRINT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "__BV" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "TARGET_TYPE_PRINT" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TARGET_MASK_WEBSOCKET" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "__BV" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "TARGET_TYPE_WEBSOCKET" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TARGET_MASK_FILE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "__BV" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "TARGET_TYPE_FILE" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TARGET_MASK_ALL" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "TARGET_MASK_PRINT" + }, + { + "type": "|", + "text": "|" + }, + { + "type": "identifier", + "text": "TARGET_MASK_WEBSOCKET" + } + ] + }, + { + "type": "|", + "text": "|" + }, + { + "type": "identifier", + "text": "TARGET_MASK_FILE" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_Logger_MB_Offset" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_LOG_LEVEL" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "COIL_TARGET_PRINT" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "COIL_TARGET_WEBSOCKET" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "COIL_TARGET_FILE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "COUNT" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "ILogTarget" + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "function_definition", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "ILogTarget" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "log" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "identifier", + "text": "level" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "message" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setLevel" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "identifier", + "text": "level" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_level" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "level" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getLevel" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "_level" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "type_identifier", + "text": "LogTargetType" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getType" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "protected", + "text": "protected" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "field_identifier", + "text": "_level" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "L_VERBOSE" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "RESTServer" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "// Forward declaration" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "WebSocketTarget" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "// Forward declaration" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "FileTarget" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "// Forward declaration" + }, + { + "type": "comment", + "text": "// -----------------------------------------------------------------------------" + }, + { + "type": "comment", + "text": "// Configuration macros ---------------------------------------------------------" + }, + { + "type": "comment", + "text": "// -----------------------------------------------------------------------------" + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "LOG_BUFFER_LINES" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "LOG_BUFFER_LINES" + }, + { + "type": "preproc_arg", + "text": "100" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "LOG_BUFFER_LINE_LENGTH" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "LOG_BUFFER_LINE_LENGTH" + }, + { + "type": "preproc_arg", + "text": "120" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "LOG_BUFFER_THREAD_SAFE" + }, + { + "type": "comment", + "text": "// #define LOG_BUFFER_THREAD_SAFE 1" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "alias_declaration", + "children": [ + { + "type": "using", + "text": "using" + }, + { + "type": "type_identifier", + "text": "LogRingBuffer" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "abstract_array_declarator", + "children": [ + { + "type": "abstract_array_declarator", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "LOG_BUFFER_LINES" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "LOG_BUFFER_LINE_LENGTH" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Logger" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": ",", + "text": "," + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Print" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "Logger" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "componentId" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "Logger" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Component Overrides (Optional) ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Modbus Overrides ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_base_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Logging ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setLevel" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "identifier", + "text": "level" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setTargetMask" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "identifier", + "text": "mask" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getTargetMask" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "addTarget" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ILogTarget" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "target" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "addPrintTarget" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Print" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "output" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "addWebSocketTarget" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "RESTServer" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "server" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "addFileTarget" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "log" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "identifier", + "text": "level" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "log" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "identifier", + "text": "level" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fatal" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fatal" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "error" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "error" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "warn" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "warn" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "trace" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "trace" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "verbose" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "verbose" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Overloads for String" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "log" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "identifier", + "text": "level" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fatal" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "error" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "warn" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "trace" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "verbose" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Overloads without sender context" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fatal" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fatal" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "error" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "error" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "warn" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "warn" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "trace" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "trace" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "verbose" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "verbose" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "__FlashStringHelper" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Overloads without sender context for String" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fatal" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "error" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "warn" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "trace" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "verbose" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "format" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "...", + "text": "..." + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Ring Buffer ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setOutput" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Print" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "out" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "clear" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getLine" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "size_t" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "size_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "lines" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "attachToEspLog" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "size_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "identifier", + "text": "c" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "size_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "data" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "size_t" + }, + { + "type": "identifier", + "text": "size" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "comment", + "text": "// --- Ring Buffer ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "appendChar" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "identifier", + "text": "c" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "commitLine" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "size_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "writeByte" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "identifier", + "text": "c" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "vprintfShim" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "fmt" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "va_list" + }, + { + "type": "identifier", + "text": "args" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_identifier", + "text": "Logger" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "s_esp_log_instance" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- New logging system ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "dispatch" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "identifier", + "text": "level" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "message" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "dispatch" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "identifier", + "text": "level" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "message" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "parseLevelFromPrefix" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "message" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "prefixLen" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_logInterval" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "50" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Rate limit interval in ms" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastLogTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "_targetMask" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "TARGET_MASK_ALL" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogLevel" + }, + { + "type": "field_identifier", + "text": "_level" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "L_VERBOSE" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "MAX_TARGETS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ILogTarget" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_targets" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_TARGETS" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "_numTargets" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "LogRingBuffer" + }, + { + "type": "field_identifier", + "text": "_buf" + }, + { + "type": "initializer_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "size_t" + }, + { + "type": "field_identifier", + "text": "_head" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0U" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "size_t" + }, + { + "type": "field_identifier", + "text": "_filled" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0U" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_line" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "LOG_BUFFER_LINE_LENGTH" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "size_t" + }, + { + "type": "field_identifier", + "text": "_idx" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0U" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "preproc_if", + "children": [ + { + "type": "#if", + "text": "#if" + }, + { + "type": "identifier", + "text": "LOG_BUFFER_THREAD_SAFE" + }, + { + "type": "\n", + "text": "\n" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "portMUX_TYPE" + }, + { + "type": "field_identifier", + "text": "_mux" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "portMUX_INITIALIZER_UNLOCKED" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "WebSocketTarget" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_webSocketTarget" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "FileTarget" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_fileTarget" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "m_modbus_block" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_Logger_MB_Offset" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "COUNT" + } + ] + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "mutable", + "text": "mutable" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "m_modbus_view" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "modbusTCP" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/ModbusMirror.json b/cli-ts/ast/ModbusMirror.json new file mode 100644 index 00000000..35eec729 --- /dev/null +++ b/cli-ts/ast/ModbusMirror.json @@ -0,0 +1,928 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "MODBUS_MIRROR_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MODBUS_MIRROR_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_MODBUS_MIRROR" + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "PHApp" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "ModbusMirror" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "ModbusMirror" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PHApp" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "id" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "ModbusMirror" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusClientTCPasync" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getClient" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "friend_declaration", + "children": [ + { + "type": "friend", + "text": "friend" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "onData" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusMessage" + }, + { + "type": "identifier", + "text": "response" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "identifier", + "text": "token" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "friend_declaration", + "children": [ + { + "type": "friend", + "text": "friend" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "onError" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Error" + }, + { + "type": "identifier", + "text": "error" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "identifier", + "text": "token" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "connect" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onData" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusMessage" + }, + { + "type": "identifier", + "text": "response" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "identifier", + "text": "token" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onError" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Error" + }, + { + "type": "identifier", + "text": "error" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "identifier", + "text": "token" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "IPAddress" + }, + { + "type": "field_identifier", + "text": "_serverIP" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_serverPort" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusClientTCPasync" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_mbClient" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_isConnected" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastConnectionAttempt" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_initialConnectionAttempt" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// ENABLE_MODBUS_MIRROR\r" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// MODBUS_MIRROR_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/NetworkValueTest.json b/cli-ts/ast/NetworkValueTest.json new file mode 100644 index 00000000..39d782b9 --- /dev/null +++ b/cli-ts/ast/NetworkValueTest.json @@ -0,0 +1,1476 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "NETWORK_VALUE_TEST_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "NETWORK_VALUE_TEST_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "ModbusTCP" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "// Define a type alias for the specific compositions we need.\r" + }, + { + "type": "alias_declaration", + "children": [ + { + "type": "using", + "text": "using" + }, + { + "type": "type_identifier", + "text": "BoolNetValue" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "NetworkValue" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "alias_declaration", + "children": [ + { + "type": "using", + "text": "using" + }, + { + "type": "type_identifier", + "text": "IntNetValue" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "NetworkValue" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "alias_declaration", + "children": [ + { + "type": "using", + "text": "using" + }, + { + "type": "type_identifier", + "text": "IntArrayNetValue" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "NetworkValue" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "std" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "array" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "5" + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "NUM_NV_TEST_VALUES" + }, + { + "type": "preproc_arg", + "text": "3\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "NETWORK_VALUE_TEST_NC" + }, + { + "type": "preproc_arg", + "text": "1\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "NV_TEST_ARRAY_SIZE" + }, + { + "type": "preproc_arg", + "text": "5\r" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "NetworkValueTest" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "maybe" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "NETWORK_VALUE_TEST_NC" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "NetworkComponent" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "number_literal", + "text": "3" + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "NetworkValueTest" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "modbusBaseAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "NetworkValueTest" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "init" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Modbus\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_base_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onMessage" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_CALLS" + }, + { + "type": "identifier", + "text": "verb" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_MessageFlags" + }, + { + "type": "identifier", + "text": "flags" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "user" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "src" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "BoolNetValue" + }, + { + "type": "field_identifier", + "text": "m_boolValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "IntNetValue" + }, + { + "type": "field_identifier", + "text": "m_intValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "IntArrayNetValue" + }, + { + "type": "field_identifier", + "text": "m_arrayValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "m_lastToggleMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "m_modbusBaseAddress" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "mutable", + "text": "mutable" + } + ] + }, + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "m_modbusBlocks" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "NUM_NV_TEST_VALUES" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "mutable", + "text": "mutable" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "m_modbusBlockView" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// NETWORK_VALUE_TEST_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/OmronE5.json b/cli-ts/ast/OmronE5.json new file mode 100644 index 00000000..532410ad --- /dev/null +++ b/cli-ts/ast/OmronE5.json @@ -0,0 +1,3803 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "OMRON_E5_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "OMRON_E5_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_RS485" + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "components/OmronE5Types.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "alias_declaration", + "children": [ + { + "type": "using", + "text": "using" + }, + { + "type": "type_identifier", + "text": "BoolNetValue" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "NetworkValue" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "OMRON_E5_READ_BLOCK_START_ADDR" + }, + { + "type": "preproc_arg", + "text": "0x0000" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "OMRON_E5_READ_BLOCK_REG_COUNT" + }, + { + "type": "preproc_arg", + "text": "6" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "OMRON_E5_READ_BLOCK_INTERVAL" + }, + { + "type": "preproc_arg", + "text": "1000" + } + ] + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_ExecuteCommands" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "INFO" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "RESET_STATS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_ERROR_OMRON_E5" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_OMRON_ERROR_NONE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_OMRON_ERROR_INVALID_PV" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_OMRON_ERROR_MB_ERROR" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_OmronTcpOffset" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "PV" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATUS_HIGH" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATUS_LOW" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "SP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "HEAT_RATE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "6" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TOTAL_COST_CENTS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "10" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Estimated total cost in Euro Cents" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "LONGEST_HEAT_60S" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "15" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Longest heating duration in last 60s (seconds)" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_SP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "11" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_STOP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "12" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_EXECUTE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "13" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Write 1 for info, 2 for reset stats" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "IS_HEATING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "14" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Read-only status: 1 if heating, 0 otherwise" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "IS_HEATUP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "16" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Read-only status: 1 if PV < SP - Deadband" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_EXECUTE_INFO" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "17" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ENABLED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "18" + } + ] + }, + { + "type": "comment", + "text": "// R/W Coil to enable/disable the component" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "OmronE5" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "RTU_Base" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "comment", + "text": "// Calculate the number of TCP blocks based on conditional compilation" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "constexpr", + "text": "constexpr" + } + ] + }, + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "field_identifier", + "text": "OMRON_TCP_BLOCK_COUNT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "13" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Constructor" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "OmronE5" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "identifier", + "text": "slaveId" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "identifier", + "text": "readInterval" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "OMRON_E5_READ_BLOCK_INTERVAL" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "OmronE5" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// --- Component Interface ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Modbus Register Update Notification ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onRegisterUpdate" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Override base method" + }, + { + "type": "comment", + "text": "// --- Getters for Specific Values ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getPV" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getSP" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getStatusLow" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getStatusHigh" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "isRunning" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "isHeating" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "isCooling" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "isAutoTuning" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "isHeatup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "float" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getHeatRate" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getTotalWh" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getTotalCostCents" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getLongestHeatDuration60s" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Getter returns seconds" + }, + { + "type": "comment", + "text": "// --- Setters (Optional - Implement if needed) ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setSP" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "run" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "stop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getConsumption" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_COOLING" + }, + { + "type": "comment", + "text": "// --- Cooling Specific Getters --- " + }, + { + "type": "comment", + "text": "// Requires ENABLE_COOLING define in OmronE5.cpp and manual Omron device setup for cooling." + }, + { + "type": "comment", + "text": "/**\n * @brief Gets the raw 32-bit value of the Cooling Manipulated Variable (MV) monitor.\n * Requires reading registers 0x2005 (Low) and 0x2006 (High).\n * @param value Reference to store the combined 32-bit value.\n * @return True if the value is valid (has been successfully read), false otherwise.\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getCoolingMVRaw" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Cooling State (Requires ENABLE_COOLING in .cpp & manual device setup) ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentCoolingMVLow" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentCoolingMVHigh" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_coolingMvValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// --- Modbus Block Definitions ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Modbus TCP Mapping Overrides ---" + }, + { + "type": "comment", + "text": "/**\n * @brief Gets the base Modbus TCP address allocated for this RTU device instance.\n * @return The base TCP address for this device instance.\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_base_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\n * @brief Calculates the Modbus TCP offset corresponding to a given RTU address update.\n * @param rtuAddress The RTU register address that was updated.\n * @return The corresponding TCP offset (relative to mb_tcp_base_address), or 0 if no direct mapping exists for broadcast.\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_offset_for_rtu_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "rtuAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\n * @brief Gets the current error state of the Omron E5 device.\n * @return The current error state.\n */" + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "E_ERROR_OMRON_E5" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getError" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "_error" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "/**\n * @brief Checks if the Omron E5 device has an error.\n * @return True if the device has an error, false otherwise.\n */" + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "hasError" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "_error" + }, + { + "type": "!=", + "text": "!=" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_ERROR_OMRON_E5" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "E_OMRON_ERROR_NONE" + } + ] + } + ] + }, + { + "type": "||", + "text": "||" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "errorCount" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onError" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "errorCode" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "errorMessage" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_error" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "_readInterval" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Local State Storage ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_ERROR_OMRON_E5" + }, + { + "type": "field_identifier", + "text": "_error" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentPV" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentSP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentStatusLow" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentStatusHigh" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_pvValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_spValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_statusValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Combined flag for low/high status pair" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_initialSpSet" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "_consumption" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2700" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Added consumption member (Watts) with default value" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_runStateWrapper" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Wrapper for Run/Stop state" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_enabledStateWrapper" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Wrapper for Enabled/Disabled state" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Statistic" + }, + { + "type": "field_identifier", + "text": "_heatingIntervalStats" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_wasHeating" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "_heatOnStartTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "_totalWs" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "_lastHeatingLoopTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timestamp for continuous Wh calculation" + }, + { + "type": "comment", + "text": "// Longest Heating Duration Tracking (60s window)" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "_currentHeatStartTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Start time of the current continuous heating period" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "_windowStartTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Start time of the 60-second tracking window" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_maxHeatDurationInWindowSecs" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Longest duration (seconds) found in the current window" + }, + { + "type": "comment", + "text": "/**\n * @brief Resets all runtime statistics and timestamps used by the truth collector.\n * Triggered by writing 2 to the CMD_EXECUTE register.\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_resetRuntimeStats" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// NOTE: Size updated to match OMRON_TCP_BLOCK_COUNT" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_modbusBlocks" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "OMRON_TCP_BLOCK_COUNT" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "_modbusBlockView" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "BoolNetValue" + }, + { + "type": "field_identifier", + "text": "_runStateValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// ENABLE_RS485" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// OMRON_E5_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/OperatorSwitch.json b/cli-ts/ast/OperatorSwitch.json new file mode 100644 index 00000000..105be126 --- /dev/null +++ b/cli-ts/ast/OperatorSwitch.json @@ -0,0 +1,2474 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "OPERATOR_SWITCH_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "OPERATOR_SWITCH_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "ValueWrapper.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Bridge" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "OperatorSwitch" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "State" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "IDLE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STOP_PRESSED" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CYCLE_PRESSED" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BOTH_PRESSED" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STOP_HELD" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CYCLE_HELD" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BOTH_HELD" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "UNKNOWN" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_MB_Offset" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "COIL_STOP" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "COIL_CYCLE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "COUNT" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "pinStop" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "pinCycle" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "modbusAddr" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "stateOverride" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "stopCoil" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "cycleCoil" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "State" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "stateWrapper" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timing for hold detection\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "pressStartTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "holdEventTriggered" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "State" + }, + { + "type": "field_identifier", + "text": "pendingState" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "State" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "IDLE" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "pendingStateStartTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Modbus definitions\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "modbusBlocks" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_MB_Offset" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "COUNT" + } + ] + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "modbusView" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Private helpers\r" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "OperatorSwitch" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_pinStop" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_pinCycle" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "_modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val0" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val1" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "debug" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "info" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "State" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "stateWrapper" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "get" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getValue" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "static_cast" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "getState" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getPressDuration" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_base_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onMessage" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_CALLS" + }, + { + "type": "identifier", + "text": "verb" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_MessageFlags" + }, + { + "type": "identifier", + "text": "flags" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "user" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "src" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "protected", + "text": "protected" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "notifyStateChange" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Configuration\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "constexpr", + "text": "constexpr" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "PRESS_TIME_MS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "150" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "constexpr", + "text": "constexpr" + } + ] + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "HOLD_TIME_MS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2000" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// OPERATOR_SWITCH_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/PIDController.json b/cli-ts/ast/PIDController.json new file mode 100644 index 00000000..ab4642a1 --- /dev/null +++ b/cli-ts/ast/PIDController.json @@ -0,0 +1,1670 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "PIDCONTROLLER_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PIDCONTROLLER_H" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_PID" + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + }, + { + "type": "comment", + "text": "// From br3ttb/PID library\r" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + }, + { + "type": "comment", + "text": "// From br3ttb/PID Autotune Library\r" + } + ] + }, + { + "type": "comment", + "text": "// Define Autotune Status Enum (aligned with Modbus register)\r" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "AutotuneStatus" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "AUTOTUNE_OFF" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "AUTOTUNE_RUNNING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "AUTOTUNE_FINISHED_OK" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "AUTOTUNE_FAILED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "PIDController" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "PIDController" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "name" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int8_t" + }, + { + "type": "identifier", + "text": "thermoDO" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int8_t" + }, + { + "type": "identifier", + "text": "thermoCS" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int8_t" + }, + { + "type": "identifier", + "text": "thermoCLK" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int8_t" + }, + { + "type": "identifier", + "text": "outputPin" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "PIDController" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "comment", + "text": "// MAX6675 Thermocouple Sensor\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MAX6675" + }, + { + "type": "field_identifier", + "text": "thermocouple" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int8_t" + }, + { + "type": "field_identifier", + "text": "_thermoDO" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_identifier", + "text": "_thermoCS" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_identifier", + "text": "_thermoCLK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// PID Controller\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "double" + }, + { + "type": "field_identifier", + "text": "_setpoint" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_identifier", + "text": "_input" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_identifier", + "text": "_output" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "double" + }, + { + "type": "field_identifier", + "text": "_kp" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_identifier", + "text": "_ki" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_identifier", + "text": "_kd" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PID" + }, + { + "type": "field_identifier", + "text": "_pid" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// PID Autotune\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PID_ATune" + }, + { + "type": "field_identifier", + "text": "_aTune" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_autotuning" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AutotuneStatus" + }, + { + "type": "field_identifier", + "text": "_autotuneStatus" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "double" + }, + { + "type": "field_identifier", + "text": "_aTuneStartValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Where the output was when AT started\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "double" + }, + { + "type": "field_identifier", + "text": "_aTuneNoiseBand" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "primitive_type", + "text": "int" + } + ] + }, + { + "type": "field_identifier", + "text": "_aTuneLookbackSec" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "double" + }, + { + "type": "field_identifier", + "text": "_lastKp" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_identifier", + "text": "_lastKi" + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_identifier", + "text": "_lastKd" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Store results from autotune\r" + }, + { + "type": "comment", + "text": "// Output Control\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int8_t" + }, + { + "type": "field_identifier", + "text": "_outputPin" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_windowStartTime" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_windowSize" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1000" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// PID cycle time (e.g., 1 second)\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_pidModeAuto" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// true = AUTO, false = MANUAL\r" + }, + { + "type": "comment", + "text": "// Helper methods\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "updateTemperature" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "runAutotune" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "applyOutput" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setPIDMode" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "identifier", + "text": "autoMode" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "startAutotune" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cancelAutotune" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "finishAutotune" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "identifier", + "text": "success" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "double" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "scalePIDParam" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "modbusValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "unscalePIDParam" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "double" + }, + { + "type": "identifier", + "text": "pidValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Error handling\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_sensorError" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// ENABLE_PID\r" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// PIDCONTROLLER_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/Plunger.json b/cli-ts/ast/Plunger.json new file mode 100644 index 00000000..b2d58745 --- /dev/null +++ b/cli-ts/ast/Plunger.json @@ -0,0 +1,5562 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "PLUNGER_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "components/SAKO_VFD.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "components/Joystick.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "components/POT.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "enums.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "PlungerSettings.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Forward declaration for the debug flag" + }, + { + "type": "declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "extern", + "text": "extern" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "identifier", + "text": "debug_states" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Component Constants" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_COMPONENT_ID" + }, + { + "type": "preproc_arg", + "text": "760" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_COMPONENT_NAME" + }, + { + "type": "preproc_arg", + "text": "\"Plunger\"" + } + ] + }, + { + "type": "comment", + "text": "// Speed Presets (in 0.01 Hz units for SAKO_VFD)" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_SPEED_SLOW_HZ" + }, + { + "type": "preproc_arg", + "text": "20 // 10.00 Hz" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_SPEED_MEDIUM_HZ" + }, + { + "type": "preproc_arg", + "text": "25 // 25.00 Hz" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_SPEED_FAST_HZ" + }, + { + "type": "preproc_arg", + "text": "50 " + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_SPEED_MAX_HZ" + }, + { + "type": "preproc_arg", + "text": "75 " + } + ] + }, + { + "type": "comment", + "text": "// Post-flow settings" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_POST_FLOW_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "1000 // Duration of active post-flow (pressing)" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_POST_FLOW_SPEED_HZ" + }, + { + "type": "preproc_arg", + "text": "5 // Speed during post-flow pressing" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_CURRENT_POST_FLOW_MA" + }, + { + "type": "preproc_arg", + "text": "1200 // Current at or above this value indicates post-flow jam" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_POST_FLOW_STOPPING_WAIT_MS" + }, + { + "type": "preproc_arg", + "text": "1500 // Wait time after initial stop before starting post-flow press" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_POST_FLOW_COMPLETE_WAIT_MS" + }, + { + "type": "preproc_arg", + "text": "1500 // Wait time after post-flow press before returning to IDLE" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_DEFAULT_ENABLE_POST_FLOW" + }, + { + "type": "preproc_arg", + "text": "true // Added for clarity if PlungerSettings uses it" + } + ] + }, + { + "type": "comment", + "text": "// New constants for Filling" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_FILL_JOYSTICK_HOLD_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "2500 // Time to hold joystick LEFT to start fill" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_SPEED_FILL_PLUNGE_HZ" + }, + { + "type": "preproc_arg", + "text": "PLUNGER_SPEED_MEDIUM_HZ // Speed for plunging phase of filling" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_SPEED_FILL_HOME_HZ" + }, + { + "type": "preproc_arg", + "text": "PLUNGER_SPEED_SLOW_HZ // Speed for homing phase of filling" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_FILL_PLUNGED_WAIT_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "1000 // Wait duration after plunging" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_FILL_HOMED_WAIT_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "1500 // Wait duration after homing" + } + ] + }, + { + "type": "comment", + "text": "// Speed POT Configuration for Plunging (multiplier for MEDIUM speed)" + }, + { + "type": "comment", + "text": "// POT value 0-100. Example: 0 maps to 0.5x, 50 maps to 1.0x, 100 maps to 1.5x MEDIUM speed." + }, + { + "type": "comment", + "text": "// Fixed Current Thresholds (mA)" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_CURRENT_IDLE_LOWER_MA" + }, + { + "type": "preproc_arg", + "text": "300" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_CURRENT_IDLE_UPPER_MA" + }, + { + "type": "preproc_arg", + "text": "500" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_CURRENT_PLUNGING_LOWER_MA" + }, + { + "type": "preproc_arg", + "text": "500" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_CURRENT_PLUNGING_UPPER_MA" + }, + { + "type": "preproc_arg", + "text": "700" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_CURRENT_JAM_THRESHOLD_MA" + }, + { + "type": "preproc_arg", + "text": "700 // Current at or above this value indicates a jam" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_JAMMED_DURATION_HOMING_MS" + }, + { + "type": "preproc_arg", + "text": "10" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_JAMMED_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "1400 " + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_VFD_READ_INTERVAL_MS" + }, + { + "type": "preproc_arg", + "text": "200 " + } + ] + }, + { + "type": "comment", + "text": "// #define ENABLE_AUTO 1 // Set to 0 to disable joystick-activated auto homing/plunging -- REMOVED" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_AUTO_MODE_HOLD_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "2000 // Time joystick must be held for auto mode" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_MAX_UNIVERSAL_JAM_TIME_MS" + }, + { + "type": "preproc_arg", + "text": "5000 // Max time current can be high before a universal jam" + } + ] + }, + { + "type": "comment", + "text": "// New constants for Record/Replay" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_RECORD_HOLD_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "2000 // Min time joystick must be held RIGHT to enter RECORD mode" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_MAX_RECORD_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "20000 // Max duration for the plunging phase of recording" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_DEFAULT_REPLAY_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "4500 // Default duration for replay if not recorded/set" + } + ] + }, + { + "type": "comment", + "text": "// New constant for default max operation time" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_DEFAULT_MAX_OPERATION_DURATION_MS" + }, + { + "type": "preproc_arg", + "text": "60*1000*1 // 1 minute" + } + ] + }, + { + "type": "comment", + "text": "// Modbus Configuration" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_MB_BASE_ADDRESS" + }, + { + "type": "preproc_arg", + "text": "COMPONENT_KEY_PLUNGER // Using component ID as base" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_MB_STATE_OFFSET" + }, + { + "type": "preproc_arg", + "text": "0" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_MB_COMMAND_OFFSET" + }, + { + "type": "preproc_arg", + "text": "1" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_MB_BLOCK_COUNT" + }, + { + "type": "preproc_arg", + "text": "2 // Will need to update if CMD_FILL Modbus register is separate, for now assume it uses existing command offset" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PLUNGER_MAX_RUN_TIME_MEDIUM_SPEED_MS" + }, + { + "type": "preproc_arg", + "text": "15000 // Max runtime at medium speed" + } + ] + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_PlungerCommand" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "NO_COMMAND" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_HOME" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_PLUNGE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_STOP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_INFO" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_FILL" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_REPLAY" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "6" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "// Plunger States" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "PlungerState" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "IDLE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "HOMING_MANUAL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Joystick held DOWN, VFD reversing, monitoring for auto-mode hold time" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "HOMING_AUTO" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Auto-homing after joystick hold, VFD reversing" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "PLUNGING_MANUAL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Joystick held UP, VFD forwarding, monitoring for auto-mode hold time" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "PLUNGING_AUTO" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Auto-plunging after joystick hold, VFD forwarding" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STOPPING" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Transition state to stop VFD" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "JAMMED" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "RESETTING_JAM" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// State to handle reset after jam" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "RECORD" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// New state for recording plunge duration" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REPLAY" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// New state for replaying recorded plunge" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "FILLING" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "POST_FLOW" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "FillState" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "NONE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "PLUNGING" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Actively plunging down" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "PLUNGED" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Plunge event (jam/max_duration) occurred, waiting for min plunge time" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "HOMING" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Actively homing up" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "HOMED" + } + ] + }, + { + "type": "comment", + "text": "// Homing complete" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "PostFlowState" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "NONE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "POST_FLOW_STOPPING" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Stopping VFD, and wait at least 1500ms" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "POST_FLOW_STARTING" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Starting VFD, set post-flow speed, and run for post-flow duration" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "POST_FLOW_COMPLETE" + } + ] + }, + { + "type": "comment", + "text": "// Stop VFD, and wait before resuming normal operation (e.g. IDLE)" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Plunger" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "Plunger" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "SAKO_VFD" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "vfd" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Joystick" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "joystick" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "POT" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "speedPot" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "POT" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "torquePot" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "Plunger" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "debug" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "b" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "init" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "reset" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Modbus TCP Interface" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "mgr" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Public commands for serial/external control" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_plunge" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_home" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_stop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_fill" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_save_settings" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_load_default_settings" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_replay" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Auto mode control" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setAutoModeEnabled" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "identifier", + "text": "enabled" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "isAutoModeEnabled" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_enableAutoMode" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "cmd_disableAutoMode" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Persistence related methods (now for REST exposure)" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getSettingsJson" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonDocument" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "doc" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "updateSettingsFromJson" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "JsonObject" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "json" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loadDefaultSettings" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "defaultPath" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "/plunger_default.json" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "operationalPath" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "/plunger.json" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "SAKO_VFD" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_vfd" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Joystick" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_joystick" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "POT" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_speedPot" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "POT" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_torquePot" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PlungerState" + }, + { + "type": "field_identifier", + "text": "_currentState" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "FillState" + }, + { + "type": "field_identifier", + "text": "_currentFillState" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Re-added" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PostFlowState" + }, + { + "type": "field_identifier", + "text": "_currentPostFlowState" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// For managing sub-states of POST_FLOW" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Joystick" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "type_identifier", + "text": "E_POSITION" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastJoystickDirection" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentSpeedPotValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 0-100" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentTorquePotValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 0-100, for torque/jam sensitivity" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "float" + }, + { + "type": "field_identifier", + "text": "_calculatedPlungingSpeedHz" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Calculated speed for plunging (0.01Hz units)" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastStateChangeTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_jammedStartTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastVfdReadTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_joystickHoldStartTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timer for joystick hold duration" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "_modbusCommandRegisterValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Holds the current value of the Modbus command register" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_operationStartTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Start time of current plunge/home operation (used for fill plunge phase)" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_currentMaxOperationTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Calculated max duration for current operation (used for fill plunge phase)" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastDiagnosticLogTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timer for the 5-second diagnostic log in _checkVfdForJam" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastImmediateStopCheckTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timer for the 1-second immediate high-current stop check" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_joystickReleasedSinceAutoStart" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// True if joystick released to center after auto mode started" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_autoModeEnabled" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// True if joystick/command auto modes are enabled" + }, + { + "type": "comment", + "text": "// Record and Replay members" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Ticker" + }, + { + "type": "field_identifier", + "text": "_joystickRecordHoldTimer" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Ticker" + }, + { + "type": "field_identifier", + "text": "_replayPlungeTimer" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Ticker" + }, + { + "type": "field_identifier", + "text": "_joystickFillHoldTimer" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timer for joystick LEFT hold to start filling" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_recordedPlungeDurationMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_recordModeStartTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// To time the actual plunge during recording" + }, + { + "type": "comment", + "text": "// Filling members" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Ticker" + }, + { + "type": "field_identifier", + "text": "_fillSubStateTimer" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timer for fill sub-state durations" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_fillOperationStartTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Start time of the overall fill operation" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_postFlowStartTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Start time of the active post-flow pressing phase" + }, + { + "type": "comment", + "text": "// Post-flow sub-state timer" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Ticker" + }, + { + "type": "field_identifier", + "text": "_postFlowSubStateTimer" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Settings" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PlungerSettings" + }, + { + "type": "field_identifier", + "text": "_settings" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timer for state logging" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "_lastStateLogTimeMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Helper methods" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleIdleState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleHomingManualState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleHomingAutoState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handlePlungingManualState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handlePlungingAutoState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleStoppingState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleJammedState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleResettingJamState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleRecordState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleReplayState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handleFillingState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_handlePostFlowState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Declaration for the new state handler" + }, + { + "type": "comment", + "text": "// Static relay callbacks for Ticker" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_joystickRecordHoldTimerRelay" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Plunger" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "pThis" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_replayPlungeTimerRelay" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Plunger" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "pThis" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_fillSubStateTimerRelay" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Plunger" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "pThis" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Added for fill timer" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_joystickFillHoldTimerRelay" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Plunger" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "pThis" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Relay for fill joystick hold" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_postFlowSubStateTimerRelay" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Plunger" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "pThis" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Relay for post-flow sub-state timer" + }, + { + "type": "comment", + "text": "// Actual timer event handlers" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_onJoystickRecordHoldTimeout" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_onReplayPlungeTimeout" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_onFillSubStateTimeout" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Added for fill timer" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_onJoystickFillHoldTimeout" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Handler for fill joystick hold" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_onPostFlowSubStateTimeout" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Handler for post-flow sub-state timer" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_updatePotValues" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_checkVfdForJam" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_transitionToState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PlungerState" + }, + { + "type": "identifier", + "text": "newState" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// VFD interaction wrappers" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_vfdStartForward" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "frequencyCentiHz" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_vfdStartReverse" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "frequencyCentiHz" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_vfdStop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_vfdResetJam" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "_plungerStateToString" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PlungerState" + }, + { + "type": "identifier", + "text": "state" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "_fillStateToString" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "FillState" + }, + { + "type": "identifier", + "text": "state" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Ensure this declaration is present" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "_postFlowStateToString" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PostFlowState" + }, + { + "type": "identifier", + "text": "state" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Declaration for PostFlowState to string" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// PLUNGER_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/PressCylinder.json b/cli-ts/ast/PressCylinder.json new file mode 100644 index 00000000..c256a7e6 --- /dev/null +++ b/cli-ts/ast/PressCylinder.json @@ -0,0 +1,2766 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "PRESS_CYLINDER_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PRESS_CYLINDER_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_PRESS_CYLINDER" + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "components/Loadcell.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "components/Solenoid.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "components/Joystick.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Default pressure thresholds for states\r" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PRESS_CYLINDER_DEFAULT_HOMING_THRESHOLD" + }, + { + "type": "preproc_arg", + "text": "10\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PRESS_CYLINDER_DEFAULT_PRESSING_THRESHOLD" + }, + { + "type": "preproc_arg", + "text": "50\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PRESS_CYLINDER_DEFAULT_HIGHLOAD_THRESHOLD" + }, + { + "type": "preproc_arg", + "text": "600\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "PRESS_CYLINDER_DEFAULT_MAXLOAD_THRESHOLD" + }, + { + "type": "preproc_arg", + "text": "900\r" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "PressCylinder" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "E_MB_Offset" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_TARGET_SP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COIL_ENABLED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_MODE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_PV" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_STATE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_HR_CMD" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_OFS_COUNT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "6" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "E_Mode" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_MANUAL" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MODE_AUTO" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "E_State" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE_IDLE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE_HOMING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE_PRESSING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE_HIGHLOAD" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE_MAXLOAD" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "struct_specifier", + "children": [ + { + "type": "struct", + "text": "struct" + }, + { + "type": "type_identifier", + "text": "Settings" + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "homing_threshold" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "pressing_threshold" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "highload_threshold" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "maxload_threshold" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fromJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "JsonVariant" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "doc" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "homing_threshold" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "doc" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "homing_threshold" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "|", + "text": "|" + }, + { + "type": "identifier", + "text": "PRESS_CYLINDER_DEFAULT_HOMING_THRESHOLD" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "pressing_threshold" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "doc" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "pressing_threshold" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "|", + "text": "|" + }, + { + "type": "identifier", + "text": "PRESS_CYLINDER_DEFAULT_PRESSING_THRESHOLD" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "highload_threshold" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "doc" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "highload_threshold" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "|", + "text": "|" + }, + { + "type": "identifier", + "text": "PRESS_CYLINDER_DEFAULT_HIGHLOAD_THRESHOLD" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "maxload_threshold" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "doc" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "maxload_threshold" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "|", + "text": "|" + }, + { + "type": "identifier", + "text": "PRESS_CYLINDER_DEFAULT_MAXLOAD_THRESHOLD" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "toJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonVariant" + }, + { + "type": "identifier", + "text": "doc" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "doc" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "homing_threshold" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "homing_threshold" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "doc" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "pressing_threshold" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "pressing_threshold" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "doc" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "highload_threshold" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "highload_threshold" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "doc" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "maxload_threshold" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "maxload_threshold" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Loadcell" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_loadcell" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Solenoid" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_solenoid" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Joystick" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "_joystick" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "targetSP" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "mode" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "state" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Settings" + }, + { + "type": "field_identifier", + "text": "_settings" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "m_modbus_block" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MB_OFS_COUNT" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "mutable", + "text": "mutable" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "m_modbus_view" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "PressCylinder" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "mbAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Loadcell" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "loadcell" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Solenoid" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "solenoid" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Joystick" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "joystick" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "PressCylinder" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loadSettings" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "filename" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "/press_cylinder.json" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "saveSettings" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "filename" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "/press_cylinder.json" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// ENABLE_PRESS_CYLINDER\r" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// PRESS_CYLINDER_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/RS485.json b/cli-ts/ast/RS485.json new file mode 100644 index 00000000..15681e34 --- /dev/null +++ b/cli-ts/ast/RS485.json @@ -0,0 +1,1386 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "RS485_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "RS485_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "comment", + "text": "// application modbus config\r" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "ModbusTCP" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "RS485" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "RS485" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "RS485" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onMessage" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "identifier", + "text": "originId" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_CALLS" + }, + { + "type": "identifier", + "text": "reason" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_MessageFlags" + }, + { + "type": "identifier", + "text": "flags" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "data" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "sender" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_error" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusRTU" + }, + { + "type": "field_identifier", + "text": "modbus" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// RTU Master instance\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Manager" + }, + { + "type": "field_identifier", + "text": "deviceManager" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Manages RTU slave devices\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "manager" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_identifier", + "text": "RS485" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "instance" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "staticRtuRegisterChangeCallback" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusOperation" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "op" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "oldValue" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "handleRtuRegisterChange" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusOperation" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "op" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "oldValue" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "lastLoopTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// RS485_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/Relay.json b/cli-ts/ast/Relay.json new file mode 100644 index 00000000..f70a4fe5 --- /dev/null +++ b/cli-ts/ast/Relay.json @@ -0,0 +1,4917 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "RELAY_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "RELAY_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": "comment", + "text": "// application-specific modbus configuration\r" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Bridge" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Relay" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "comment", + "text": "// Keep address private, provide via getModbusInfo\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Store Modbus address internally\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "m_modbus_block" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "2" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// m_modbus_view needs to be mutable to be returned as ModbusBlockView* from a const method.\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "mutable", + "text": "mutable" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "m_modbus_view" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// for blinking\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "onOffFrequency" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// in seconds\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "lastToggleTime" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "function_definition", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "Relay" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_pin" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "field_initializer_list", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "Component" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Relay" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "_id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "COMPONENT_DEFAULT" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "owner" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "pin" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "_pin" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "_modbusAddress" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "value" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "onOffFrequency" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "lastToggleTime" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setNetCapability" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "OBJECT_NET_CAPS" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "E_NCAPS_MODBUS" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Initialize instance-specific Modbus block.\r" + }, + { + "type": "comment", + "text": "// The modbusAddress is the actual start address for the Relay's single coil.\r" + }, + { + "type": "comment", + "text": "// So, the offset passed to the macro is 0.\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Base address for this component's block\r" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Offset for this specific register\r" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Function code\r" + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Access type\r" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Relay" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Name\r" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + }, + { + "type": "comment", + "text": "// Group (nullptr if not applicable)\r" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Base address for this component's block\r" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Offset for the frequency register\r" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_HOLD_REGISTER" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Function code\r" + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Access type\r" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Relay On/Off Freq (secs)" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Name\r" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + }, + { + "type": "comment", + "text": "// Group (nullptr if not applicable)\r" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Initialize the view to point to this instance-specific block\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_view" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "data" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "m_modbus_block" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Point to the array of blocks\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_view" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "count" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "flags" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "Log" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "verboseln" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Relay::info - ID: %d, Pin: %d, Modbus Addr: %d, Value: %d, Freq: %lu, NetCaps: %d" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "modbusAddress" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "value" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "onOffFrequency" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "nFlags" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "debug" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "info" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "setup" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Call base class setup (important if it does network registration)\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "pinMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "OUTPUT" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "value" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Ensure pin state matches initial value\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "Log" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "verboseln" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Relay::setup - ID %d, Pin %d, Initial Value: %d, Modbus Addr: %d" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "value" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "modbusAddress" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setValue" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "!=", + "text": "!=" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "identifier", + "text": "newValue" + }, + { + "type": "?", + "text": "?" + }, + { + "type": "identifier", + "text": "HIGH" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "identifier", + "text": "LOW" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "notifyStateChange" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setValueCmd" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "arg1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "arg2" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "onOffFrequency" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// manual override\r" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setValue" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "arg1" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getValue" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "value" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "/**\r\n * @brief Handles writes coming from the network (e.g., Modbus write coil/register).\r\n * @param reg The Modbus register being written to.\r\n * @param networkValue The value received from the network.\r\n * @return E_OK if the address matches and the value is set, E_INVALID_PARAMETER otherwise.\r\n */" + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_write" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "reg" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "startAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "/**\r\n * @brief Handles writes coming from the network (e.g., Modbus write coil/register).\r\n * @param address The Modbus address being written to (should match component's address).\r\n * @param networkValue The value received from the network.\r\n * @return E_OK if the address matches and the value is set, E_INVALID_PARAMETER otherwise.\r\n */" + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "comment", + "text": "// Use internal member\r" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "onOffFrequency" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Manual control stops blinking\r" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setValue" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "modbusAddress" + }, + { + "type": "+", + "text": "+" + }, + { + "type": "number_literal", + "text": "1" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "onOffFrequency" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "onOffFrequency" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_INVALID_PARAMETER" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "/**\r\n * @brief Handles reads requests from the network (e.g., Modbus read coil/register).\r\n * @param address The Modbus address being read (should match component's address).\r\n * @return The current state (1 for ON, 0 for OFF) if the address matches, 0 otherwise.\r\n */" + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "comment", + "text": "// Use internal member\r" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "?", + "text": "?" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "modbusAddress" + }, + { + "type": "+", + "text": "+" + }, + { + "type": "number_literal", + "text": "1" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "onOffFrequency" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Default for mismatched addresses\r" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Log.traceln(F(\"Relay::mb_tcp_read (Reg Context) - TCP Addr: %d, Type: %d\"), reg->startAddress, reg->type);\r" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_read" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "reg" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "startAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "blocksView" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "thiz" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "const_cast" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "Relay" + }, + { + "type": "abstract_pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "this", + "text": "this" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "blocksView" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "count" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "info" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "blocksView" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "data" + } + ] + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "manager" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "registerModbus" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "thiz" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "info" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Return the instance-specific Modbus block view\r" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "pointer_expression", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "m_modbus_view" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "serial_register" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "bridge" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "bridge" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "registerMemberFunction" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "C_STR" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "setValue" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "binary_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "ComponentFnPtr" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "&", + "text": "&" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Relay" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "setValueCmd" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "bridge" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "registerMemberFunction" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "C_STR" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "info" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "binary_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "ComponentFnPtr" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "&", + "text": "&" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Relay" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "info" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "loop" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "onOffFrequency" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "currentMillis" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "currentMillis" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "lastToggleTime" + } + ] + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "onOffFrequency" + }, + { + "type": "*", + "text": "*" + }, + { + "type": "number_literal", + "text": "1000" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "lastToggleTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "currentMillis" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setValue" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// --- Member Variables ---\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "pin" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "value" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/RestServer.json b/cli-ts/ast/RestServer.json new file mode 100644 index 00000000..b89d7f3e --- /dev/null +++ b/cli-ts/ast/RestServer.json @@ -0,0 +1,2662 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "REST_SERVER_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "REST_SERVER_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "MessageQueue.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_WEBSOCKET" + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MAX_JSON_DOCUMENT_SIZE" + }, + { + "type": "preproc_arg", + "text": "1024" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "WS_BROADCAST_RATE_LIMIT_MS" + }, + { + "type": "preproc_arg", + "text": "50" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MAX_WEBSOCKET_MESSAGE_SIZE" + }, + { + "type": "preproc_arg", + "text": "4096 * 3" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "DEFAULT_WS_COMMAND_HANDLER_CAPACITY" + }, + { + "type": "preproc_arg", + "text": "10" + } + ] + }, + { + "type": "comment", + "text": "// Define BroadcastMessageType enum here" + }, + { + "type": "type_definition", + "children": [ + { + "type": "typedef", + "text": "typedef" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BROADCAST_UNKNOWN" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BROADCAST_COIL_UPDATE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BROADCAST_REGISTER_UPDATE" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BROADCAST_LOG_ENTRY" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BROADCAST_SYSTEM_STATUS" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BROADCAST_USER_DEFINED" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BROADCAST_USER_MESSAGE" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "type_identifier", + "text": "BroadcastMessageType" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "ModbusTCP" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "/**\n * @brief RESTful API server generated from Swagger spec.\n * This class implements a RESTful API server that interfaces with the Modbus system.\n */" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "RESTServer" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Inherit from Component" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_WEBSOCKET" + }, + { + "type": "alias_declaration", + "children": [ + { + "type": "using", + "text": "using" + }, + { + "type": "type_identifier", + "text": "WsCommandHandler" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "std" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "function" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "abstract_function_declarator", + "children": [ + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebSocketClient" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "client" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonVariant" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "json" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServer" + }, + { + "type": "field_identifier", + "text": "server" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "modbusManager" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_WEBSOCKET" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebSocket" + }, + { + "type": "field_identifier", + "text": "ws" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setupWebSocket" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Initialize WebSocket handlers" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "handleWebSocketMessage" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebSocketClient" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "client" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "arg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "data" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "size_t" + }, + { + "type": "identifier", + "text": "len" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getConnectedClientsCount" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Get number of connected WebSocket clients" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "lastBroadcastTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "registerWsCommandHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "command" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "WsCommandHandler" + }, + { + "type": "identifier", + "text": "handler" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// Handler methods " + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getSystemInfoHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getCoilsHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getCoilHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setCoilQueryHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getRegistersHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getRegisterHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getLogLevelHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setLogLevelHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getRtuOperationQueueHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getMappingsHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "listFsHandler" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "AsyncWebServerRequest" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "request" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setupRoutes" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onRun" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\n * @brief Construct a new RESTServer object\n * \n * @param port The port to run the server on\n * @param manager Pointer to the ModbusManager instance.\n * @param app Pointer to the PHApp instance.\n */" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "RESTServer" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "IPAddress" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "ip" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "port" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\n * @brief Destroy the RESTServer object\n */" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "RESTServer" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\n * @brief Run periodically to handle server tasks\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\n * @brief Setup the RESTServer\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\n * @brief Handles incoming messages (e.g., from PHApp for broadcasts).\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onMessage" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_CALLS" + }, + { + "type": "identifier", + "text": "verb" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_MessageFlags" + }, + { + "type": "identifier", + "text": "flags" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "user" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "src" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_WEBSOCKET" + }, + { + "type": "comment", + "text": "/**\n * @brief Broadcast a message to all connected WebSocket clients.\n * \n * @param type The type of message to send.\n * @param data The data to send with the message.\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "broadcast" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "BroadcastMessageType" + }, + { + "type": "identifier", + "text": "type" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "JsonDocument" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "data" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// New broadcast method" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_WEBSOCKET" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "std" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "vector" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "std" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "pair" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "String" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "WsCommandHandler" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "wsCommandHandlers" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// Message History" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MessageQueue" + }, + { + "type": "field_identifier", + "text": "userMessageHistory" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_buildRegistersJson" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonArray" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "registersArray" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "identifier", + "text": "specificAddress" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "-1" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mountLittleFS" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// REST_SERVER_H" + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/RuntimeState.json b/cli-ts/ast/RuntimeState.json new file mode 100644 index 00000000..f7e6d9fd --- /dev/null +++ b/cli-ts/ast/RuntimeState.json @@ -0,0 +1,1152 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "RUNTIME_STATE_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "RUNTIME_STATE_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "RUNTIME_STATE_TOTAL_HEATING_TIME_PID_COUNT" + }, + { + "type": "preproc_arg", + "text": "8\r" + } + ] + }, + { + "type": "struct_specifier", + "children": [ + { + "type": "struct", + "text": "struct" + }, + { + "type": "type_identifier", + "text": "TempProfileRuntime" + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "elapsedSec" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "enabled" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "true", + "text": "true" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "running" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fromJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonObjectConst" + }, + { + "type": "identifier", + "text": "jsonObj" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "toJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonObject" + }, + { + "type": "identifier", + "text": "jsonObj" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "struct_specifier", + "children": [ + { + "type": "struct", + "text": "struct" + }, + { + "type": "type_identifier", + "text": "OmronRuntime" + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "slaveId" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "enabled" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "true", + "text": "true" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fromJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonObjectConst" + }, + { + "type": "identifier", + "text": "jsonObj" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "toJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonObject" + }, + { + "type": "identifier", + "text": "jsonObj" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "RuntimeState" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "RuntimeState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "parent" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "identifier", + "text": "id" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "COMPONENT_KEY_RUNTIME_STATE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "TempProfileRuntime" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "tempProfiles" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "PROFILE_TEMPERATURE_COUNT" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "OmronRuntime" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "omronPids" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "NUM_OMRON_DEVICES" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "totalKwh" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "totalCents" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "totalRuntimeHours" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "totalHeatingTimeS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "totalHeatingTimePidS" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "RUNTIME_STATE_TOTAL_HEATING_TIME_PID_COUNT" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "totalCycleCount" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fromJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonVariantConst" + }, + { + "type": "identifier", + "text": "json" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "toJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonVariant" + }, + { + "type": "identifier", + "text": "json" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "load" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "filename" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "RUNTIME_STATE_FILENAME" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "save" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "filename" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "RUNTIME_STATE_FILENAME" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// RUNTIME_STATE_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/SAKO_VFD.json b/cli-ts/ast/SAKO_VFD.json new file mode 100644 index 00000000..acbd3edf --- /dev/null +++ b/cli-ts/ast/SAKO_VFD.json @@ -0,0 +1,3669 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "SAKO_VFD_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "SAKO_VFD_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifdef", + "text": "#ifdef" + }, + { + "type": "identifier", + "text": "ENABLE_RS485" + }, + { + "type": "comment", + "text": "// Assuming this VFD also uses RS485" + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "SAKO_VFD_DEFAULT_READ_INTERVAL" + }, + { + "type": "preproc_arg", + "text": "100" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "SAKO_VFD_TCP_REG_RANGE" + }, + { + "type": "preproc_arg", + "text": "16" + } + ] + }, + { + "type": "comment", + "text": "// Enum for Retract State Machine" + }, + { + "type": "type_definition", + "children": [ + { + "type": "typedef", + "text": "typedef" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_RETRACT_STATE_NONE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_RETRACT_STATE_BRAKING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_RETRACT_STATE_STOPPED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_RETRACT_STATE_REVERSING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_RETRACT_STATE_BRAKE_REVERSING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_RETRACT_STATE_RETRACTED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "type_identifier", + "text": "E_VFD_RETRACT_STATE" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Enum for VFD Operational State" + }, + { + "type": "type_definition", + "children": [ + { + "type": "typedef", + "text": "typedef" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_STATE_STOPPED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_STATE_DECELERATING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_STATE_RUNNING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_STATE_ACCELERATING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "E_VFD_STATE_ERROR" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "8" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "type_identifier", + "text": "E_VFD_STATE" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_SakoTcpOffset" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "RUNNING_FREQUENCY" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Corresponds to U0-00" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "SET_FREQUENCY" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Corresponds to U0-01" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "OUTPUT_CURRENT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Corresponds to U0-04" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "OUTPUT_POWER_KW" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Corresponds to U0-05" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "OUTPUT_TORQUE_PERCENT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Corresponds to U0-06" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "FAULT_CODE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "6" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Corresponds to U0-62" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "IS_RUNNING" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "7" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Derived from U0-61" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "HAS_FAULT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "8" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Derived from U0-62" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "9" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// E_VFD_STATE" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_FREQ" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "10" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Write Frequency (Uses SAKO_REG_SET_FREQ)" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_DIRECTION" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "11" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Write Direction/Control (Uses E_SAKO_REGISTERS_SET_DIR)" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CMD_COMMAND" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "12" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Internal command" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TARGET_REGISTER" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "13" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Write target register address" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "TARGET_VALUE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "14" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Write value to target register" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "SAKO_VFD" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "RTU_Base" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "storage_class_specifier", + "children": [ + { + "type": "static", + "text": "static" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "constexpr", + "text": "constexpr" + } + ] + }, + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "field_identifier", + "text": "SAKO_TCP_BLOCK_COUNT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "14" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Constructor" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "SAKO_VFD" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "identifier", + "text": "slaveId" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "identifier", + "text": "readInterval" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "SAKO_VFD_DEFAULT_READ_INTERVAL" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "SAKO_VFD" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// --- Component Interface ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "reset" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getTorque" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Modbus Register Update Notification ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onRegisterUpdate" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onError" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "errorCode" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "errorMessage" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Getters for Specific VFD Values ---" + }, + { + "type": "comment", + "text": "// Add getters relevant to a VFD, e.g., Frequency, Speed, Status, Fault codes" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getFrequency" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Returns frequency in 0.01 Hz units" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getSpeed" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Example: speed might be integer RPM" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "isRunning" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "hasFault" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getFaultCode" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_VFD_STATE" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getVfdState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getOutputPowerKW" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getOutputTorquePercent" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getOutputCurrent" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "value" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Setters for VFD Control ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setFrequency" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Expects frequency in 0.01 Hz units" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "run" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "reverse" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "stop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "resetFault" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "retract" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Modbus Block Definitions ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_error" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Modbus TCP Mapping Overrides ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_base_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_offset_for_rtu_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "rtuAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "_readInterval" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Local State Storage ---" + }, + { + "type": "comment", + "text": "// Store relevant VFD parameters and their validity flags" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentFrequency" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 0.01 Hz units" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentSpeed" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_setFrequency" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 0.01 Hz units" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_currentCurrent" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_statusRegister" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Example status register" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_faultCode" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_outputPowerKW" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_outputTorquePercent" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_frequencyValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_speedValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_setFrequencyValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_currentValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_statusValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_faultValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_outputPowerKWValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_outputTorquePercentValid" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "field_identifier", + "text": "_tcpTargetRegister" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Stores the value written to TARGET_REGISTER offset" + }, + { + "type": "comment", + "text": "// Retract State" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_VFD_RETRACT_STATE" + }, + { + "type": "field_identifier", + "text": "_retractState" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "E_VFD_RETRACT_STATE_NONE" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Operational State" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_VFD_STATE" + }, + { + "type": "field_identifier", + "text": "_vfdState" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "E_VFD_STATE_STOPPED" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_stateWrapper" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Statistics" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Statistic" + }, + { + "type": "field_identifier", + "text": "_ampStats" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_modbusBlocks" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "SAKO_TCP_BLOCK_COUNT" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "mutable", + "text": "mutable" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "_modbusBlockView" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "_modbusBlocksInitialized" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Added for on-demand initialization" + }, + { + "type": "comment", + "text": "// Add internal helper methods if needed" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_updateStatusFromRegister" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "statusReg" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_updateVfdState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setupVFD" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// ENABLE_RS485" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// SAKO_VFD_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/Settings.json b/cli-ts/ast/Settings.json new file mode 100644 index 00000000..f0c6c26a --- /dev/null +++ b/cli-ts/ast/Settings.json @@ -0,0 +1,1119 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "SETTINGS_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "SETTINGS_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MAX_CONTROLLERS_PER_PARTITION" + }, + { + "type": "preproc_arg", + "text": "16\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MAX_PARTITIONS" + }, + { + "type": "preproc_arg", + "text": "4\r" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MAX_SLAVES" + }, + { + "type": "preproc_arg", + "text": "3\r" + } + ] + }, + { + "type": "struct_specifier", + "children": [ + { + "type": "struct", + "text": "struct" + }, + { + "type": "type_identifier", + "text": "ControllerConfig" + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "slaveId" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "field_identifier", + "text": "name" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "enabled" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "true", + "text": "true" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fromJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonObjectConst" + }, + { + "type": "identifier", + "text": "jsonObj" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "toJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonObject" + }, + { + "type": "identifier", + "text": "jsonObj" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "struct_specifier", + "children": [ + { + "type": "struct", + "text": "struct" + }, + { + "type": "type_identifier", + "text": "PartitionConfig" + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "field_identifier", + "text": "name" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ControllerConfig" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "controllers" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_CONTROLLERS_PER_PARTITION" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "controllerCount" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// For auto-generation from UI, if needed\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "startSlaveId" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "numControllers" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fromJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonObjectConst" + }, + { + "type": "identifier", + "text": "jsonObj" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "toJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonObject" + }, + { + "type": "identifier", + "text": "jsonObj" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Settings" + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PartitionConfig" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "partitions" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_PARTITIONS" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "partitionCount" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "field_identifier", + "text": "Master" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "Slaves" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_SLAVES" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "slaveCount" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "Settings" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "fromJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonVariantConst" + }, + { + "type": "identifier", + "text": "json" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "toJSON" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "JsonVariant" + }, + { + "type": "identifier", + "text": "json" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "load" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "filename" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "/partitions.json" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "save" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "char" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "filename" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "/partitions.json" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "applyDefaults" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// SETTINGS_H" + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/SignalPlot.json b/cli-ts/ast/SignalPlot.json new file mode 100644 index 00000000..ed289a4b --- /dev/null +++ b/cli-ts/ast/SignalPlot.json @@ -0,0 +1,3779 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "SIGNAL_PLOT_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "SIGNAL_PLOT_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "PlotBase.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "MAX_SIGNAL_POINTS" + }, + { + "type": "preproc_arg", + "text": "20\r" + } + ] + }, + { + "type": "alias_declaration", + "children": [ + { + "type": "using", + "text": "using" + }, + { + "type": "type_identifier", + "text": "ElapsedValue" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "NetworkValue" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Modbus Register Definitions ---\r" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "SignalPlotRegisterOffset" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATUS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "DURATION_LW" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "DURATION_HW" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "COMMAND" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ENABLE_CMD" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ELAPSED_LW" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "_COUNT" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "SIGNAL_PLOT_REGISTER_COUNT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "static_cast" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "SignalPlotRegisterOffset" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "_COUNT" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "SignalPlotCommand" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "NONE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "START" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STOP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "PAUSE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "RESUME" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_SIGNAL_TYPE" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "int16_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "NONE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_WRITE_COIL" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "MB_WRITE_HOLDING_REGISTER" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CALL_METHOD" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CALL_FUNCTION" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CALL_REST" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "5" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "GPIO_WRITE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "6" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "DISPLAY_MESSAGE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "7" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "USER_DEFINED" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "8" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "PAUSE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "9" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STOP_PIDS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "10" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "START_PIDS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "11" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BUZZER_OFF" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "12" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BUZZER_SOLID" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "13" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BUZZER_SLOW_BLINK" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "14" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BUZZER_FAST_BLINK" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "15" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BUZZER_LONG_BEEP_SHORT_PAUSE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "16" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "IFTTT_WEBHOOK" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "17" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "// New enum for GPIO Write Modes\r" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_GpioWriteMode" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "int16_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "DIGITAL" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ANALOG_PWM" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": "comment", + "text": "// Add other modes like TONE, SERVO if ever needed\r" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "E_SIGNAL_STATE" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "int16_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE_NONE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// not hit yet\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE_ERROR" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// error\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE_ON" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// on - has been hit\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE_OFF" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// off - disabled by user\r" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATE_CUSTOM_1" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "100" + } + ] + }, + { + "type": "comment", + "text": "// custom\r" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "struct_specifier", + "children": [ + { + "type": "struct", + "text": "struct" + }, + { + "type": "type_identifier", + "text": "S_SignalControlPoint" + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "id" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "time" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_SIGNAL_STATE" + }, + { + "type": "field_identifier", + "text": "state" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_SIGNAL_TYPE" + }, + { + "type": "field_identifier", + "text": "type" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "field_identifier", + "text": "name" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "String" + }, + { + "type": "field_identifier", + "text": "description" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\r\n * @brief Argument 0, meaning depends on E_SIGNAL_TYPE.\r\n * - MB_WRITE_COIL: Modbus coil address (uint16_t).\r\n * - MB_WRITE_HOLDING_REGISTER: Modbus register address (uint16_t).\r\n * - GPIO_WRITE: GPIO pin number (uint8_t).\r\n * - CALL_METHOD: Component ID (ushort) // TODO: not implemented yet\r\n * - CALL_FUNCTION: Function ID (ushort) // TODO: not implemented yet\r\n * - CALL_REST: Not used directly, path/params likely in name/description or separate storage. // TODO: not implemented yet\r\n * - USER_DEFINED: User-specific. // TODO: not implemented yet\r\n * - DISPLAY_MESSAGE: Not currently used.\r\n * - PAUSE: Not used.\r\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int16_t" + }, + { + "type": "field_identifier", + "text": "arg_0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\r\n * @brief Argument 1, meaning depends on E_SIGNAL_TYPE.\r\n * - MB_WRITE_COIL: Coil value (0 for OFF, 1 for ON).\r\n * - MB_WRITE_HOLDING_REGISTER: Value to write to register (int16_t).\r\n * - GPIO_WRITE: Write mode (see E_GpioWriteMode: DIGITAL = 0, ANALOG_PWM = 1).\r\n * - CALL_METHOD: Method index/ID. // TODO: not implemented yet\r\n * - CALL_FUNCTION: Not used typically, or first param. // TODO: not implemented yet\r\n * - USER_DEFINED: User-specific. // TODO: not implemented yet\r\n * - DISPLAY_MESSAGE: Not currently used.\r\n * - PAUSE: Not used.\r\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int16_t" + }, + { + "type": "field_identifier", + "text": "arg_1" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\r\n * @brief Argument 2, meaning depends on E_SIGNAL_TYPE.\r\n * - GPIO_WRITE: Value to write (e.g., 0/1 for digital; 0-255 for analog/PWM).\r\n * - CALL_METHOD: First method parameter (if any). // TODO: not implemented yet\r\n * - CALL_FUNCTION: Second param / etc. // TODO: not implemented yet\r\n * - USER_DEFINED: User-specific. // TODO: not implemented yet\r\n * - DISPLAY_MESSAGE: Not currently used.\r\n * - PAUSE: Not used.\r\n * - Others: Not used (typically).\r\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int16_t" + }, + { + "type": "field_identifier", + "text": "arg_2" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\r\n * @brief User pointer. For CALL_METHOD type, stores a command string (e.g. \"<<1;2;64;reset:0:0>>\").\r\n * For other types, usage is type-specific.\r\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "user" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "S_SignalControlPoint" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "field_initializer_list", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "id" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "time" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "state" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_SIGNAL_STATE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "STATE_NONE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "type" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_SIGNAL_TYPE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "NONE" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "user" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "arg_0" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "arg_1" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "arg_2" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "name" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "description" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "/**\r\n * @brief Represents a single signal with discrete state changes plotted over time.\r\n * Inherits from PlotBase.\r\n * Assumes control points in the source JSON are sorted chronologically by 'time'.\r\n */" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "SignalPlot" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "PlotBase" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "SignalPlot" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "slot" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "componentId" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "SignalPlot" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// --- Component Overrides (Optional) ---\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "start" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Profile Specific Methods ---\r" + }, + { + "type": "comment", + "text": "/**\r\n * @brief Gets the active state for the signal at the current elapsed time.\r\n *\r\n * Finds the latest control point that occurred at or before\r\n * the current time and returns its state.\r\n *\r\n * @param defaultState The state to return if the plot isn't running or no point has occurred yet.\r\n * @return The determined state (SignalState).\r\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_SIGNAL_STATE" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getState" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_SIGNAL_STATE" + }, + { + "type": "identifier", + "text": "defaultState" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_SIGNAL_STATE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "STATE_OFF" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\r\n * @brief Gets the user-defined integer associated with the active state at the current time.\r\n *\r\n * Finds the latest control point that occurred at or before\r\n * the current time and returns its associated user value.\r\n *\r\n * @param defaultValue The value to return if the plot isn't running or no point has occurred yet.\r\n * @return The determined user value (int16_t).\r\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getUserValue" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int16_t" + }, + { + "type": "identifier", + "text": "defaultValue" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- PlotBase Overrides ---\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getCurrentControlPointInfo" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "outId" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "outTimeMs" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "outValue" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int16_t" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "outUser" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\r\n * @brief Loads the controlPoints array (discrete state changes) from the JSON config.\r\n * Called by PlotBase::from.\r\n * Assumes points are sorted chronologically by 'time' in the JSON.\r\n * Expected JSON format within the config object:\r\n * \"controlPoints\": [\r\n * { \"id\": , \"time\": , \"state\": , \"user\": },\r\n * ...\r\n * ]\r\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "load" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "JsonObject" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "config" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Modbus Overrides ---\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_base_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Getters for control points ---\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "S_SignalControlPoint" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getControlPoints" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getNumControlPoints" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "protected", + "text": "protected" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onStart" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onStop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onPause" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onResume" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- SignalPlot Slot ---\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "S_SignalControlPoint" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_controlPoints" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "MAX_SIGNAL_POINTS" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "field_identifier", + "text": "_numControlPoints" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ElapsedValue" + }, + { + "type": "field_identifier", + "text": "_elapsedValue" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Helper to find the applicable control point\r" + }, + { + "type": "comment", + "text": "// Returns nullptr if no point is applicable yet\r" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "S_SignalControlPoint" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "findActivePoint" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "identifier", + "text": "elapsedMs" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onMessage" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "identifier", + "text": "id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_CALLS" + }, + { + "type": "identifier", + "text": "verb" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "E_MessageFlags" + }, + { + "type": "identifier", + "text": "flags" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "user" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "src" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "executeControlPointAction" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "identifier", + "text": "cpIndex" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "modbusTCP" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_modbusBlocks" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "SIGNAL_PLOT_REGISTER_COUNT" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "_modbusBlockView" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "_lastLogMs" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// SIGNAL_PLOT_H" + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/Solenoid.json b/cli-ts/ast/Solenoid.json new file mode 100644 index 00000000..e11bdca3 --- /dev/null +++ b/cli-ts/ast/Solenoid.json @@ -0,0 +1,4533 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "SOLENOID_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "SOLENOID_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Bridge" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "Solenoid" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "m_modbus_block" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "2" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "mutable", + "text": "mutable" + } + ] + }, + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "m_modbus_view" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "lastOnTime" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "field_identifier", + "text": "lastOffTime" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "lastOnDurationS" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "lastOffDurationS" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "pin" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "value" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "Solenoid" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_pin" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_id" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "field_initializer_list", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "Component" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Solenoid" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "_id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "COMPONENT_DEFAULT" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "owner" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "pin" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "_pin" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "_modbusAddress" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "value" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "lastOnTime" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "lastOffTime" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "lastOnDurationS" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "lastOffDurationS" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setNetCapability" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "OBJECT_NET_CAPS" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "E_NCAPS_MODBUS" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Solenoid State" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_block" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "INIT_MODBUS_BLOCK_TCP" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "this", + "text": "this" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "FN_WRITE_COIL" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "MB_ACCESS_READ_WRITE" + }, + { + "type": ",", + "text": "," + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "Enabled" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "null", + "children": [ + { + "type": "nullptr", + "text": "nullptr" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_view" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "data" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "m_modbus_block" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "m_modbus_view" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "count" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "setup" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "pinMode" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "OUTPUT" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "value" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setValue" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "!=", + "text": "!=" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "newValue" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "?", + "text": "?" + }, + { + "type": "identifier", + "text": "HIGH" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "identifier", + "text": "LOW" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "value" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Turned ON\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "lastOnTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "lastOffDurationS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "lastOnTime" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "lastOffTime" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "/", + "text": "/" + }, + { + "type": "number_literal", + "text": "1000" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Turned OFF\r" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "lastOffTime" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "lastOnDurationS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "lastOffTime" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "lastOnTime" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "/", + "text": "/" + }, + { + "type": "number_literal", + "text": "1000" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "notifyStateChange" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setValueCmd" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "arg1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "arg2" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setValue" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "arg1" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getValue" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "value" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getLastOnDurationS" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "lastOnDurationS" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getLastOffDurationS" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "lastOffDurationS" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setValue" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "modbusAddress" + }, + { + "type": "+", + "text": "+" + }, + { + "type": "number_literal", + "text": "1" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "conditional_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ">", + "text": ">" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enable" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "disable" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_INVALID_PARAMETER" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "identifier", + "text": "value" + }, + { + "type": "?", + "text": "?" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "modbusAddress" + }, + { + "type": "+", + "text": "+" + }, + { + "type": "number_literal", + "text": "1" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enabled" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "networkValue" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_write" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "reg" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "startAddress" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "networkValue" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_read" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "reg" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "startAddress" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "blocksView" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "thiz" + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "const_cast" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "Solenoid" + }, + { + "type": "abstract_pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + } + ] + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "this", + "text": "this" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "int" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "blocksView" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "count" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "++", + "text": "++" + }, + { + "type": "identifier", + "text": "i" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "info" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "blocksView" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "data" + } + ] + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "manager" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "registerModbus" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "thiz" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "info" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "pointer_expression", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "m_modbus_view" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "serial_register" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "bridge" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "bridge" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "registerMemberFunction" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "C_STR" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "setValue" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "binary_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "ComponentFnPtr" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "&", + "text": "&" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Solenoid" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "setValueCmd" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "loop" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "enabled" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setValue" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/StatusLight.json b/cli-ts/ast/StatusLight.json new file mode 100644 index 00000000..bc5d6ce3 --- /dev/null +++ b/cli-ts/ast/StatusLight.json @@ -0,0 +1,4425 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "STATUS_LIGHT_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "STATUS_LIGHT_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "config-modbus.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "comment", + "text": "// class ModbusTCP; // Removed forward declaration" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "type_identifier", + "text": "STATUS_LIGHT_STATE" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "OFF" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ON" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "BLINK" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "StatusLight" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "Component" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "comment", + "text": "// --- Moved Member Variables Here ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "pin" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "status_blink_TS" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "doBlink" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "field_identifier", + "text": "last_blink" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "blink_start_ts" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "millis_t" + }, + { + "type": "field_identifier", + "text": "max_blink_time" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "STATUS_LIGHT_STATE" + }, + { + "type": "field_identifier", + "text": "state" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- End Moved Member Variables ---" + }, + { + "type": "function_definition", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "StatusLight" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_ledPin" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_key" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "_addr" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "field_initializer_list", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "last_blink" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "status_blink_TS" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "doBlink" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "pin" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "_ledPin" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "modbusAddress" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "_addr" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "Component" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "String" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "STATUS_LIGHT_" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "+", + "text": "+" + }, + { + "type": "identifier", + "text": "_key" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "_key" + }, + { + "type": ",", + "text": "," + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "Component" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "COMPONENT_DEFAULT" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "owner" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "field_initializer", + "children": [ + { + "type": "field_identifier", + "text": "state" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "STATUS_LIGHT_STATE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "OFF" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "doBlink" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "false", + "text": "false" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "status_blink_TS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "last_blink" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalRead" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Determine address based on key and set capability" + }, + { + "type": "declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "determinedAddress" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "-1" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "switch_statement", + "children": [ + { + "type": "switch", + "text": "switch" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "_key" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "case_statement", + "children": [ + { + "type": "case", + "text": "case" + }, + { + "type": "identifier", + "text": "COMPONENT_KEY_FEEDBACK_0" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "determinedAddress" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "MB_MONITORING_STATUS_FEEDBACK_0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "break_statement", + "children": [ + { + "type": "break", + "text": "break" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "case_statement", + "children": [ + { + "type": "case", + "text": "case" + }, + { + "type": "identifier", + "text": "COMPONENT_KEY_FEEDBACK_1" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "determinedAddress" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "MB_MONITORING_STATUS_FEEDBACK_1" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "break_statement", + "children": [ + { + "type": "break", + "text": "break" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// Add other cases if needed" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "determinedAddress" + }, + { + "type": "!=", + "text": "!=" + }, + { + "type": "number_literal", + "text": "-1" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "modbusAddress" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "determinedAddress" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Assign determined address" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "setNetCapability" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "OBJECT_NET_CAPS" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "E_NCAPS_MODBUS" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "L_ERROR" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "StatusLight Constructor: Cannot determine Modbus address for unknown key: %d" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "_key" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setBlink" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "identifier", + "text": "blink" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Uses the current 'state' as the base for blinking or steady state." + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "status_blink" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "blink" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "on" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "set" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "off" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "set" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "doBlink" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "unsigned", + "text": "unsigned" + }, + { + "type": "long", + "text": "long" + } + ] + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "currentMillis" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "currentMillis" + }, + { + "type": "-", + "text": "-" + }, + { + "type": "identifier", + "text": "status_blink_TS" + } + ] + }, + { + "type": ">=", + "text": ">=" + }, + { + "type": "identifier", + "text": "STATUS_BLINK_INTERVAL" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "last_blink" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "identifier", + "text": "last_blink" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "last_blink" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "status_blink_TS" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "currentMillis" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Maybe set pin based on 'state' if not blinking?" + }, + { + "type": "comment", + "text": "// digitalWrite(pin, (state == ON) ? HIGH : LOW); // Example" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "set" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "optional_parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "val1" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// val0: base state (0=OFF, 1=ON), val1: blink control (0=disable, 1=enable)" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// 1. Update the internal base state based on val0" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "state" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "val0" + }, + { + "type": "!=", + "text": "!=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "STATUS_LIGHT_STATE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "ON" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "STATUS_LIGHT_STATE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "OFF" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 2. Set blinking status based on val1" + }, + { + "type": "comment", + "text": "// status_blink will handle setting the pin if blinking is stopped." + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "status_blink" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "val1" + }, + { + "type": "!=", + "text": "!=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// 3. If not blinking, ensure the pin reflects the 'state' and notify." + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "identifier", + "text": "doBlink" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// This explicit digitalWrite is necessary if blinking was already off " + }, + { + "type": "comment", + "text": "// and val1 keeps it off, as status_blink might not have transitioned." + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "state" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "STATUS_LIGHT_STATE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "ON" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "identifier", + "text": "HIGH" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "identifier", + "text": "LOW" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "hasNetCapability" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "OBJECT_NET_CAPS" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "E_NCAPS_MODBUS" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "notifyStateChange" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "debug" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "info" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "info" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "Log" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "verboseln" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "StatusLight::info - Key=%d | Pin=%d | State=%d | Value=%d" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "cast_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "int" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "identifier", + "text": "state" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalRead" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "status_blink" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "identifier", + "text": "newBlinkState" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "oldBlinkState" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "doBlink" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "identifier", + "text": "oldBlinkState" + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "identifier", + "text": "newBlinkState" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "comment", + "text": "// Transition: OFF -> ON (Starting to blink)" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "blink_start_ts" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "millis" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Record when blinking period starts" + }, + { + "type": "comment", + "text": "// status_blink_TS for individual blinks is handled by loop()" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "doBlink" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "newBlinkState" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Apply the new blink state" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "oldBlinkState" + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "unary_expression", + "children": [ + { + "type": "!", + "text": "!" + }, + { + "type": "identifier", + "text": "newBlinkState" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "comment", + "text": "// Transition: ON -> OFF (Stopping blinking)" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Set the pin to reflect the current underlying 'state'" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalWrite" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ",", + "text": "," + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "state" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "STATUS_LIGHT_STATE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "ON" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "identifier", + "text": "HIGH" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "identifier", + "text": "LOW" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "bridge" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "registerMemberFunction" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "C_STR" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "set" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "binary_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "ComponentFnPtr" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "&", + "text": "&" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "StatusLight" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "set" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "bridge" + }, + { + "type": "->", + "text": "->" + }, + { + "type": "field_identifier", + "text": "registerMemberFunction" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "id" + }, + { + "type": ",", + "text": "," + }, + { + "type": "this", + "text": "this" + }, + { + "type": ",", + "text": "," + }, + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "C_STR" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "info" + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "binary_expression", + "children": [ + { + "type": "parenthesized_expression", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "ComponentFnPtr" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "&", + "text": "&" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "StatusLight" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "info" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// --- Network Interface --- " + }, + { + "type": "comment", + "text": "// StatusLight likely only needs read access via Modbus?" + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "hasNetCapability" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "OBJECT_NET_CAPS" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "E_NCAPS_MODBUS" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "comment", + "text": "// Return 1 if ON or BLINKING, 0 if OFF?" + }, + { + "type": "comment", + "text": "// Or return state enum value?" + }, + { + "type": "comment", + "text": "// Let's return 1 if pin is currently HIGH (covers ON and blinking phases)" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "conditional_expression", + "children": [ + { + "type": "binary_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "digitalRead" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "pin" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "HIGH" + } + ] + }, + { + "type": "?", + "text": "?" + }, + { + "type": "number_literal", + "text": "1" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Default for wrong address or capability disabled" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// mb_tcp_write might not be needed, or could control state/blink?" + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "address" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "hasNetCapability" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "OBJECT_NET_CAPS" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "E_NCAPS_MODBUS" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "&&", + "text": "&&" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "address" + }, + { + "type": "==", + "text": "==" + }, + { + "type": "identifier", + "text": "modbusAddress" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "status_blink" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "false", + "text": "false" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Stop blinking if written externally" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "identifier", + "text": "set" + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "identifier", + "text": "value" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Use internal set method" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_OK" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "E_INVALID_PARAMETER" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Wrong address or capability disabled" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// --- Member variables were moved above ---" + }, + { + "type": "comment", + "text": "// short pin; " + }, + { + "type": "comment", + "text": "// millis_t status_blink_TS;" + }, + { + "type": "comment", + "text": "// bool doBlink;" + }, + { + "type": "comment", + "text": "// bool last_blink;" + }, + { + "type": "comment", + "text": "// millis_t blink_start_ts;" + }, + { + "type": "comment", + "text": "// millis_t max_blink_time;" + }, + { + "type": "comment", + "text": "// STATUS_LIGHT_STATE state;" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + } + ] +} \ No newline at end of file diff --git a/cli-ts/ast/TemperatureProfile.json b/cli-ts/ast/TemperatureProfile.json new file mode 100644 index 00000000..661fc98e --- /dev/null +++ b/cli-ts/ast/TemperatureProfile.json @@ -0,0 +1,3885 @@ +{ + "type": "translation_unit", + "children": [ + { + "type": "preproc_ifdef", + "children": [ + { + "type": "#ifndef", + "text": "#ifndef" + }, + { + "type": "identifier", + "text": "TEMPERATURE_PROFILE_H" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "TEMPERATURE_PROFILE_H" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "PlotBase.h" + }, + { + "type": "\"", + "text": "\"" + } + ] + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + }, + { + "type": "comment", + "text": "// Include for ModbusManager type" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + }, + { + "type": "comment", + "text": "// Include for error codes (like E_OK)" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + }, + { + "type": "comment", + "text": "// Include for LOW_WORD/HIGH_WORD (if defined there)" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "preproc_include", + "children": [ + { + "type": "#include", + "text": "#include" + }, + { + "type": "system_lib_string", + "text": "" + } + ] + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "ModbusTCP" + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "TEMPERATURE_PROFILE_LOOP_INTERVAL_MS" + }, + { + "type": "preproc_arg", + "text": "150" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "TEMP_PROFILE_ID_BASE" + }, + { + "type": "preproc_arg", + "text": "2000" + } + ] + }, + { + "type": "preproc_def", + "children": [ + { + "type": "#define", + "text": "#define" + }, + { + "type": "identifier", + "text": "TEMP_REGISTER_NAME_PREFIX" + }, + { + "type": "preproc_arg", + "text": "\"TProf\"" + } + ] + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "TemperatureProfileRegisterOffset" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STATUS" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "CURRENT_TEMP" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "DURATION" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ELAPSED_LW" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ELAPSED_HW" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "REMAINING" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "COMMAND" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "ENABLE_CMD" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "_COUNT" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "enum_specifier", + "children": [ + { + "type": "enum", + "text": "enum" + }, + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "TemperatureProfileCommand" + }, + { + "type": ":", + "text": ":" + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "enumerator_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "NONE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "comment", + "text": "// Or IDLE, or some other default" + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "START" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "1" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "STOP" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "2" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "PAUSE" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "3" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "enumerator", + "children": [ + { + "type": "identifier", + "text": "RESUME" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "4" + } + ] + }, + { + "type": "comment", + "text": "// Add other commands as needed" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "comment", + "text": "// Calculate the number of registers per profile instance based on the enum" + }, + { + "type": "declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "TEMP_PROFILE_REGISTER_COUNT" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "call_expression", + "children": [ + { + "type": "template_function", + "children": [ + { + "type": "identifier", + "text": "static_cast" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "TemperatureProfileRegisterOffset" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "identifier", + "text": "_COUNT" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\n * @brief Represents a temperature profile using interpolated segments.\n * Inherits from PlotBase.\n */" + }, + { + "type": "class_specifier", + "children": [ + { + "type": "class", + "text": "class" + }, + { + "type": "type_identifier", + "text": "TemperatureProfile" + }, + { + "type": "base_class_clause", + "children": [ + { + "type": ":", + "text": ":" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": "type_identifier", + "text": "PlotBase" + } + ] + }, + { + "type": "field_declaration_list", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "public", + "text": "public" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "TemperatureProfile" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Component" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "owner" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "slot" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "identifier", + "text": "componentId" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "virtual", + "text": "virtual" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "destructor_name", + "children": [ + { + "type": "~", + "text": "~" + }, + { + "type": "identifier", + "text": "TemperatureProfile" + } + ] + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "default_method_clause", + "children": [ + { + "type": "=", + "text": "=" + }, + { + "type": "default", + "text": "default" + }, + { + "type": ";", + "text": ";" + } + ] + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setup" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "loop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "start" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "enable" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "identifier", + "text": "enabled" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "disable" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\n * @brief Populates the profile with sample data for testing/defaults.\n * Overwrites any existing control points.\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "sample" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- PlotBase / Component Overrides ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "manager" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_blocks" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_read" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_write" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "reg" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "serial_register" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "Bridge" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "identifier", + "text": "bridge" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "mb_tcp_base_address" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "/**\n * @brief Loads temperature profile specific data (controlPoints) from JSON.\n * Called by PlotBase::loadFromJsonObject.\n */" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "bool" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "load" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "type_identifier", + "text": "JsonObject" + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "identifier", + "text": "config" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Target Registers ---" + }, + { + "type": "function_definition", + "children": [ + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "std" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "vector" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": "reference_declarator", + "children": [ + { + "type": "&", + "text": "&" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getTargetRegisters" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "_targetRegisters" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getTargetRegisterCount" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "_targetRegisters" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "size" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getTargetRegister" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "identifier", + "text": "index" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "index" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "_targetRegisters" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "size" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "_targetRegisters" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "index" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "Log" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "errorln" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "TemperatureProfile::getTargetRegister - Index %d out of bounds (size: %d). Returning 0." + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "index" + }, + { + "type": ",", + "text": "," + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "_targetRegisters" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "size" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "number_literal", + "text": "0" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Or some other indicator of an error/invalid value" + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setTargetRegister" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "identifier", + "text": "index" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "if_statement", + "children": [ + { + "type": "if", + "text": "if" + }, + { + "type": "condition_clause", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "index" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "_targetRegisters" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "size" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "_targetRegisters" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "index" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "value" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + }, + { + "type": "else_clause", + "children": [ + { + "type": "else", + "text": "else" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "Log" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "errorln" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "string_literal", + "children": [ + { + "type": "\"", + "text": "\"" + }, + { + "type": "string_content", + "text": "TemperatureProfile::setTargetRegister - Index %d out of bounds (size: %d). Cannot set value %d." + }, + { + "type": "\"", + "text": "\"" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "index" + }, + { + "type": ",", + "text": "," + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "_targetRegisters" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "size" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "identifier", + "text": "value" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "clearTargetRegisters" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "for_statement", + "children": [ + { + "type": "for", + "text": "for" + }, + { + "type": "(", + "text": "(" + }, + { + "type": "declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint8_t" + }, + { + "type": "init_declarator", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "binary_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "<", + "text": "<" + }, + { + "type": "call_expression", + "children": [ + { + "type": "field_expression", + "children": [ + { + "type": "identifier", + "text": "_targetRegisters" + }, + { + "type": ".", + "text": "." + }, + { + "type": "field_identifier", + "text": "size" + } + ] + }, + { + "type": "argument_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "update_expression", + "children": [ + { + "type": "identifier", + "text": "i" + }, + { + "type": "++", + "text": "++" + } + ] + }, + { + "type": ")", + "text": ")" + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "subscript_expression", + "children": [ + { + "type": "identifier", + "text": "_targetRegisters" + }, + { + "type": "subscript_argument_list", + "children": [ + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "i" + }, + { + "type": "]", + "text": "]" + } + ] + } + ] + }, + { + "type": "=", + "text": "=" + }, + { + "type": "number_literal", + "text": "0" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "comment", + "text": "// --- Associated Signal Plot ---" + }, + { + "type": "function_definition", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "getSignalPlotSlotId" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "type_qualifier", + "children": [ + { + "type": "const", + "text": "const" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "return_statement", + "children": [ + { + "type": "return", + "text": "return" + }, + { + "type": "identifier", + "text": "_signalPlotSlotId" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "function_definition", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "setSignalPlotSlotId" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "identifier", + "text": "slotId" + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": "compound_statement", + "children": [ + { + "type": "{", + "text": "{" + }, + { + "type": "expression_statement", + "children": [ + { + "type": "assignment_expression", + "children": [ + { + "type": "identifier", + "text": "_signalPlotSlotId" + }, + { + "type": "=", + "text": "=" + }, + { + "type": "identifier", + "text": "slotId" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": "access_specifier", + "children": [ + { + "type": "protected", + "text": "protected" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onStart" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onStop" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onPause" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onResume" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "void" + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "onFinished" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + }, + { + "type": "virtual_specifier", + "children": [ + { + "type": "override", + "text": "override" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "function_declarator", + "children": [ + { + "type": "field_identifier", + "text": "status" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// --- Profile Data ---" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ushort" + }, + { + "type": "field_identifier", + "text": "slaveId" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Modbus Slave ID" + }, + { + "type": "access_specifier", + "children": [ + { + "type": "private", + "text": "private" + } + ] + }, + { + "type": ":", + "text": ":" + }, + { + "type": "comment", + "text": "// Vector to hold the specific target Modbus register addresses" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "std" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "vector" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_targetRegisters" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "declaration", + "children": [ + { + "type": "function_declarator", + "children": [ + { + "type": "identifier", + "text": "MB_WVAR_H" + }, + { + "type": "parameter_list", + "children": [ + { + "type": "(", + "text": "(" + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "_statusWrapper" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PlotStatus" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "TemperatureProfileRegisterOffset" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "STATUS" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "E_FN_CODE" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "type_identifier", + "text": "FN_READ_HOLD_REGISTER" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "type_identifier", + "text": "TEMP_REGISTER_NAME_PREFIX" + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "PlotStatus" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "type_identifier", + "text": "IDLE" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "PlotStatus" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "type_identifier", + "text": "RUNNING" + } + ] + } + ] + }, + { + "type": ",", + "text": "," + }, + { + "type": "parameter_declaration", + "children": [ + { + "type": "qualified_identifier", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "type_identifier", + "text": "PlotStatus" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "::", + "text": "::" + }, + { + "type": "qualified_identifier", + "children": [ + { + "type": "namespace_identifier", + "text": "ThresholdMode" + }, + { + "type": "::", + "text": "::" + }, + { + "type": "type_identifier", + "text": "DIFFERENCE" + } + ] + } + ] + } + ] + }, + { + "type": ")", + "text": ")" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "int16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_currentTemperatureWrapper" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "bool" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_enabledStateWrapper" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_elapsedTimeWrapper" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "template_type", + "children": [ + { + "type": "type_identifier", + "text": "ValueWrapper" + }, + { + "type": "template_argument_list", + "children": [ + { + "type": "<", + "text": "<" + }, + { + "type": "type_descriptor", + "children": [ + { + "type": "primitive_type", + "text": "uint16_t" + } + ] + }, + { + "type": ">", + "text": ">" + } + ] + } + ] + }, + { + "type": "field_identifier", + "text": "_elapsedTimeHwWrapper" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Modbus block definitions (instance-specific)" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "MB_Registers" + }, + { + "type": "array_declarator", + "children": [ + { + "type": "field_identifier", + "text": "_modbusBlocks" + }, + { + "type": "[", + "text": "[" + }, + { + "type": "identifier", + "text": "TEMP_PROFILE_REGISTER_COUNT" + }, + { + "type": "]", + "text": "]" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusBlockView" + }, + { + "type": "field_identifier", + "text": "_modbusBlockView" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Pointer to the Modbus manager (set during registration)" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "ModbusTCP" + }, + { + "type": "pointer_declarator", + "children": [ + { + "type": "*", + "text": "*" + }, + { + "type": "field_identifier", + "text": "modbusTCP" + } + ] + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timestamp of the last loop execution" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "_lastLoopExecutionMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "primitive_type", + "text": "uint32_t" + }, + { + "type": "field_identifier", + "text": "_lastLogMs" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "comment", + "text": "// Timestamp for logging" + }, + { + "type": "comment", + "text": "// Associated Signal Plot Slot ID" + }, + { + "type": "field_declaration", + "children": [ + { + "type": "sized_type_specifier", + "children": [ + { + "type": "short", + "text": "short" + } + ] + }, + { + "type": "field_identifier", + "text": "_signalPlotSlotId" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "field_declaration", + "children": [ + { + "type": "type_identifier", + "text": "PlotStatus" + }, + { + "type": "field_identifier", + "text": "_previousStatus" + }, + { + "type": ";", + "text": ";" + } + ] + }, + { + "type": "}", + "text": "}" + } + ] + } + ] + }, + { + "type": ";", + "text": ";" + }, + { + "type": "#endif", + "text": "#endif" + } + ] + }, + { + "type": "comment", + "text": "// TEMPERATURE_PROFILE_H " + } + ] +} \ No newline at end of file diff --git a/cli-ts/data/index.html b/cli-ts/data/index.html new file mode 100644 index 00000000..70bdefb3 --- /dev/null +++ b/cli-ts/data/index.html @@ -0,0 +1,147 @@ + + + + Cassandra RC2 + + + + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/cli-ts/dist-in/commands/build-proto.js b/cli-ts/dist-in/commands/build-proto.js new file mode 100644 index 00000000..f4762800 --- /dev/null +++ b/cli-ts/dist-in/commands/build-proto.js @@ -0,0 +1,35 @@ +import path from "path"; +import fs from "fs/promises"; +import { log } from "../lib/logger.js"; +export const command = "build-proto"; +export const desc = "Copies .proto files to the client app for dynamic loading."; +const REPO_ROOT = path.join(path.resolve("./")); +// --- Configuration --- +const CLIENT_PROTO_DEST_DIR = path.resolve(REPO_ROOT, "../web/packages/modbus-ui/src/proto"); +const PROTO_SRC_DIR = path.join(REPO_ROOT, "proto"); +console.log("REPO_ROOT", REPO_ROOT); +console.log("CLIENT_PROTO_DEST_DIR", CLIENT_PROTO_DEST_DIR); +const cmd = `pbjs -t static-module -w commonjs -o ${CLIENT_PROTO_DEST_DIR}/bundle.js ${PROTO_SRC_DIR}/bundle.proto`; +export const handler = async () => { + try { + log.info(`Converting .proto files from '${PROTO_SRC_DIR}' to '${CLIENT_PROTO_DEST_DIR}'`); + await fs.mkdir(CLIENT_PROTO_DEST_DIR, { recursive: true }); + const protoFiles = (await fs.readdir(PROTO_SRC_DIR)).filter(f => f.endsWith(".proto")); + if (protoFiles.length === 0) { + log.warn("No .proto files found to copy."); + return; + } + for (const file of protoFiles) { + const srcPath = path.join(PROTO_SRC_DIR, file); + const destPath = path.join(CLIENT_PROTO_DEST_DIR, file); + console.log("srcPath", srcPath); + console.log("destPath", destPath); + } + log.info("\nSuccessfully copied all .proto files to the client!"); + } + catch (error) { + log.error("\nFailed to convert .proto files.", error); + process.exit(1); + } +}; +//# sourceMappingURL=build-proto.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/build-proto.js.map b/cli-ts/dist-in/commands/build-proto.js.map new file mode 100644 index 00000000..185ea922 --- /dev/null +++ b/cli-ts/dist-in/commands/build-proto.js.map @@ -0,0 +1 @@ +{"version":3,"file":"build-proto.js","sourceRoot":"","sources":["../../src/commands/build-proto.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC;AACrC,MAAM,CAAC,MAAM,IAAI,GAAG,4DAA4D,CAAC;AAEjF,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAEhD,wBAAwB;AACxB,MAAM,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,qCAAqC,CAAC,CAAC;AAC7F,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAEpD,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AACpC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC5D,MAAM,GAAG,GAAG,wCAAwC,qBAAqB,cAAc,aAAa,eAAe,CAAC;AACpH,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,IAAmB,EAAE;IAC/C,IAAI,CAAC;QACH,GAAG,CAAC,IAAI,CAAC,iCAAiC,aAAa,SAAS,qBAAqB,GAAG,CAAC,CAAC;QAE1F,MAAM,EAAE,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE3D,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvF,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,GAAG,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QACpC,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/dump.js b/cli-ts/dist-in/commands/dump.js new file mode 100644 index 00000000..31021d5f --- /dev/null +++ b/cli-ts/dist-in/commands/dump.js @@ -0,0 +1,143 @@ +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; +import { sync as write } from "@polymech/fs/write"; +import modbusApiService from "@polymech/client-ts/modbusApiService"; +import { resolve } from "@polymech/commons/variables"; +async function dumpModbusData(targetDir) { + try { + log.info(`Fetching all registers...`); + const registers = await modbusApiService.getRegisters(); + const filePath = path.resolve(resolve("${POLYMECH_ROOT}/site2/src/content/resources/cassandra/registers.json")); + await write(filePath, JSON.stringify(registers, null, 2)); + log.info(`Saved registers.json to ${filePath}`); + } + catch (error) { + if (error instanceof Error) { + log.error(`Failed to dump registers: ${error.message}`); + } + else { + log.error(`Failed to dump registers:`, error); + } + } + try { + log.info(`Fetching all coils...`); + const coils = await modbusApiService.getCoils(); + const filePath = path.resolve(resolve("${POLYMECH_ROOT}/site2/src/content/resources/cassandra/coils.json")); + await write(filePath, JSON.stringify(coils, null, 2)); + log.info(`Saved coils.json to ${filePath}`); + } + catch (error) { + if (error instanceof Error) { + log.error(`Failed to dump coils: ${error.message}`); + } + else { + log.error(`Failed to dump coils:`, error); + } + } +} +export const command = "dump"; +export const describe = "Dumps JSON data from API endpoints to files."; +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + directory: { + describe: "Target directory to save JSON files", + default: "../cassandra-rc2/templates/cassandra/", + type: "string", + }, +}; +const endpoints = [ + { path: "/v1/profiles", filename: "default_profiles.json" }, + { path: "/v1/settings", filename: "settings.json" }, + { path: "/v1/signalplots", filename: "signals_plots.json" }, + { path: "/v1/fs?file=layout.json", filename: "layout.json" }, + { path: "/v1/network/settings", filename: "network.json" }, + { path: "/v1/state", filename: "state.json" }, + { path: "/v1/pressure-profiles", filename: "pressure_profiles.json" }, +]; +async function fetchEndpoint(baseUrl, endpoint) { + const url = `${baseUrl}${endpoint}`; + const response = await fetch(url, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + }); + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } + catch (e) { + // Ignore + } + throw new Error(`Failed to fetch ${endpoint}: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } + return await response.json(); +} +async function testConnection(baseUrl) { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } + catch (error) { + return false; + } +} +export async function handler(argv) { + log.info(`Dumping data from host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + try { + modbusApiService.setBaseUrl(baseUrl); + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + const targetDir = path.resolve(process.cwd(), argv.directory); + try { + await fs.mkdir(targetDir, { recursive: true }); + } + catch (error) { + // Directory might already exist + } + for (const endpoint of endpoints) { + try { + log.info(`Fetching ${endpoint.path}...`); + const data = await fetchEndpoint(baseUrl, endpoint.path); + const filePath = path.join(targetDir, endpoint.filename); + await write(filePath, JSON.stringify(data, null, 2)); + log.info(`Saved ${endpoint.filename} to ${filePath}`); + } + catch (error) { + if (error instanceof Error) { + log.error(`Failed to dump ${endpoint.path}: ${error.message}`); + } + else { + log.error(`Failed to dump ${endpoint.path}:`, error); + } + } + } + await dumpModbusData(targetDir); + log.info("Dump completed."); + } + catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } + else { + log.error("An unknown error occurred.", error); + } + } +} +//# sourceMappingURL=dump.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/dump.js.map b/cli-ts/dist-in/commands/dump.js.map new file mode 100644 index 00000000..388d4db7 --- /dev/null +++ b/cli-ts/dist-in/commands/dump.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dump.js","sourceRoot":"","sources":["../../src/commands/dump.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,KAAK,UAAU,cAAc,CAAC,SAAiB;IAC3C,IAAI,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACtC,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,YAAY,EAAE,CAAC;QACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,uEAAuE,CAAC,CAAC,CAAA;QAC/G,MAAM,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1D,GAAG,CAAC,IAAI,CAAC,2BAA2B,QAAQ,EAAE,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,KAAK,CAAC,6BAA6B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5D,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;QAClD,CAAC;IACL,CAAC;IAED,IAAI,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,mEAAmE,CAAC,CAAC,CAAA;QAC3G,MAAM,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,uBAAuB,QAAQ,EAAE,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,KAAK,CAAC,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC;AAC9B,MAAM,CAAC,MAAM,QAAQ,GAAG,8CAA8C,CAAC;AAEvE,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,UAAU,EAAE;QACR,QAAQ,EAAE,8CAA8C;QACxD,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,sBAAsB;KAClC;IACD,SAAS,EAAE;QACP,QAAQ,EAAE,qCAAqC;QAC/C,OAAO,EAAE,uCAAuC;QAChD,IAAI,EAAE,QAAQ;KACjB;CACK,CAAC;AAEX,MAAM,SAAS,GAAG;IACd,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,uBAAuB,EAAE;IAC3D,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe,EAAE;IACnD,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,oBAAoB,EAAE;IAC3D,EAAE,IAAI,EAAE,yBAAyB,EAAE,QAAQ,EAAE,aAAa,EAAE;IAC5D,EAAE,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,cAAc,EAAE;IAC1D,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE;IAC7C,EAAE,IAAI,EAAE,uBAAuB,EAAE,QAAQ,EAAE,wBAAwB,EAAE;CACxE,CAAC;AAEF,KAAK,UAAU,aAAa,CAAC,OAAe,EAAE,QAAgB;IAC1D,MAAM,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC9B,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACL,cAAc,EAAE,kBAAkB;SACrC;KACJ,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC;YACD,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,SAAS;QACb,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,KAAK,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChH,CAAC;IAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,OAAe;IACzC,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,iBAAiB,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAmE;IAE7F,GAAG,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAEvD,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;IAC9B,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,GAAG,OAAO,MAAM,CAAC;IAC/B,CAAC;IAED,IAAI,CAAC;QACD,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,UAAU,yDAAyD,CAAC,CAAC;YAC5G,OAAO;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,6BAA6B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAE1D,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAE9D,IAAI,CAAC;YACD,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,gCAAgC;QACpC,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YAC/B,IAAI,CAAC;gBACD,GAAG,CAAC,IAAI,CAAC,YAAY,QAAQ,CAAC,IAAI,KAAK,CAAC,CAAC;gBACzC,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;gBACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACzD,MAAM,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBACrD,GAAG,CAAC,IAAI,CAAC,SAAS,QAAQ,CAAC,QAAQ,OAAO,QAAQ,EAAE,CAAC,CAAC;YAC1D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;oBACzB,GAAG,CAAC,KAAK,CAAC,kBAAkB,QAAQ,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBACnE,CAAC;qBAAM,CAAC;oBACJ,GAAG,CAAC,KAAK,CAAC,kBAAkB,QAAQ,CAAC,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC;gBACzD,CAAC;YACL,CAAC;QACL,CAAC;QAED,MAAM,cAAc,CAAC,SAAS,CAAC,CAAC;QAChC,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/mb.js b/cli-ts/dist-in/commands/mb.js new file mode 100644 index 00000000..18e714c8 --- /dev/null +++ b/cli-ts/dist-in/commands/mb.js @@ -0,0 +1,108 @@ +import { log } from "../lib/logger.js"; +import { ModbusClient, E_FN_CODE } from "../lib/modbus-client.js"; +export const command = "mb"; +export const describe = "Modbus TCP client"; +export const builder = { + host: { + describe: "The target host", + demandOption: false, + type: "string", + default: "192.168.1.250", + }, + port: { + describe: "The target port", + demandOption: false, + type: "number", + default: 502, + }, + fn: { + describe: "Function code", + demandOption: true, + type: "number", + }, + reg: { + describe: "Register address", + demandOption: true, + type: "number", + }, + value: { + describe: "Value to write", + demandOption: false, + type: "number", + }, + count: { + describe: "Number of registers/coils to read", + demandOption: false, + type: "number", + default: 1, + }, + "slave-id": { + describe: "Modbus slave/unit ID", + demandOption: false, + type: "number", + default: 1, + } +}; +export async function handler(argv) { + log.info(`Connecting to ${argv.host}:${argv.port}`); + const client = new ModbusClient(argv.host, argv.port); + log.info(`Function code: ${argv.fn}`); + log.info(`Register address: ${argv.reg}`); + log.info(`Value: ${argv.value}`); + log.info(`Count: ${argv.count}`); + log.info(`Slave ID: ${argv["slave-id"]}`); + try { + await client.connect(); + if (argv.value !== undefined) { // Write operation + switch (argv.fn) { + case E_FN_CODE.FN_WRITE_HOLD_REGISTER: + log.info(`Writing holding register ${argv.reg} with value ${argv.value} to slave ${argv["slave-id"]}`); + if (argv.reg !== 100) { + await client.writeHoldingRegister(argv.reg, argv.value, argv["slave-id"]); + } + else { + client.writeHoldingRegister(argv.reg, argv.value, argv["slave-id"]); + process.exit(0); + } + break; + case E_FN_CODE.FN_WRITE_COIL: + log.info(`Writing coil ${argv.reg} with value ${argv.value} to slave ${argv["slave-id"]}`); + await client.writeCoil(argv.reg, argv.value > 0, argv["slave-id"]); + log.info(`Write successful.`); + break; + default: + log.error(`Function code ${argv.fn} not supported for write operation.`); + } + } + else { // Read operation + switch (argv.fn) { + case E_FN_CODE.FN_READ_HOLD_REGISTER: { + log.info(`Reading ${argv.count} holding register(s) from address ${argv.reg} on slave ${argv["slave-id"]}`); + const values = await client.readHoldingRegisters(argv.reg, argv.count, argv["slave-id"]); + process.stdout.write(JSON.stringify(values) + '\n'); + break; + } + case E_FN_CODE.FN_READ_COIL: { + log.info(`Reading ${argv.count} coil(s) from address ${argv.reg} on slave ${argv["slave-id"]}`); + const values = await client.readCoils(argv.reg, argv.count, argv["slave-id"]); + process.stdout.write(JSON.stringify(values) + '\n'); + break; + } + default: + log.error(`Function code ${argv.fn} not supported for read operation.`); + } + } + } + catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } + else { + log.error("An unknown error occurred.", error); + } + } + finally { + client.disconnect(); + } +} +//# sourceMappingURL=mb.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/mb.js.map b/cli-ts/dist-in/commands/mb.js.map new file mode 100644 index 00000000..3ab2ad72 --- /dev/null +++ b/cli-ts/dist-in/commands/mb.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mb.js","sourceRoot":"","sources":["../../src/commands/mb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAElE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC;AAC5B,MAAM,CAAC,MAAM,QAAQ,GAAG,mBAAmB,CAAC;AAE5C,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,IAAI,EAAE;QACF,QAAQ,EAAE,iBAAiB;QAC3B,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,eAAe;KAC3B;IACD,IAAI,EAAE;QACF,QAAQ,EAAE,iBAAiB;QAC3B,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,GAAG;KACf;IACD,EAAE,EAAE;QACA,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,QAAQ;KACjB;IACD,GAAG,EAAE;QACD,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,QAAQ;KACjB;IACD,KAAK,EAAE;QACH,QAAQ,EAAE,gBAAgB;QAC1B,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,QAAQ;KACjB;IACD,KAAK,EAAE;QACH,QAAQ,EAAE,mCAAmC;QAC7C,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC;KACb;IACD,UAAU,EAAE;QACR,QAAQ,EAAE,sBAAsB;QAChC,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC;KACb;CACK,CAAC;AAEX,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAmI;IAE7J,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEtD,GAAG,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACtC,GAAG,CAAC,IAAI,CAAC,qBAAqB,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1C,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACjC,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACjC,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAE1C,IAAI,CAAC;QACD,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QAEvB,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC,CAAC,kBAAkB;YAC9C,QAAQ,IAAI,CAAC,EAAE,EAAE,CAAC;gBACd,KAAK,SAAS,CAAC,sBAAsB;oBACjC,GAAG,CAAC,IAAI,CAAC,4BAA4B,IAAI,CAAC,GAAG,eAAe,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oBACvG,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;wBACnB,MAAM,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;oBAC9E,CAAC;yBAAM,CAAC;wBACJ,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;wBACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBACpB,CAAC;oBACD,MAAM;gBACV,KAAK,SAAS,CAAC,aAAa;oBACxB,GAAG,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,GAAG,eAAe,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oBAC3F,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;oBACnE,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;oBAC9B,MAAM;gBACV;oBACI,GAAG,CAAC,KAAK,CAAC,iBAAiB,IAAI,CAAC,EAAE,qCAAqC,CAAC,CAAC;YACjF,CAAC;QACL,CAAC;aAAM,CAAC,CAAC,iBAAiB;YACtB,QAAQ,IAAI,CAAC,EAAE,EAAE,CAAC;gBACd,KAAK,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC;oBACnC,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,KAAK,qCAAqC,IAAI,CAAC,GAAG,aAAa,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oBAC5G,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;oBACzF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;oBACpD,MAAM;gBACV,CAAC;gBACD,KAAK,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;oBAC1B,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,KAAK,yBAAyB,IAAI,CAAC,GAAG,aAAa,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oBAChG,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;oBAC9E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;oBACpD,MAAM;gBACV,CAAC;gBACD;oBACI,GAAG,CAAC,KAAK,CAAC,iBAAiB,IAAI,CAAC,EAAE,oCAAoC,CAAC,CAAC;YAChF,CAAC;QACL,CAAC;IAEL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;YAAS,CAAC;QACP,MAAM,CAAC,UAAU,EAAE,CAAC;IACxB,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/patch-app.js b/cli-ts/dist-in/commands/patch-app.js new file mode 100644 index 00000000..a01bee98 --- /dev/null +++ b/cli-ts/dist-in/commands/patch-app.js @@ -0,0 +1,240 @@ +import { promises as fs } from 'fs'; +import path from 'path'; +import * as cheerio from 'cheerio'; +export const command = 'patch-app'; +export const desc = 'Patch app by changing asset loading to be sequential.'; +export const builder = (yargs) => yargs.options({ + src: { + describe: 'Path to source index.html', + default: './data/index.html', + }, + dst: { + describe: 'Path to destination index.html', + default: './data/index.html', + }, +}); +const createLoaderScript = (assets) => { + const assetsJson = JSON.stringify(assets, null, 2); + return ` +(function() { + const assets = ${assetsJson}; + const DEFAULT_RETRIES = 5; + const RETRY_DELAY_MS = 1500; + const SCRIPT_SUCCESS_DELAY_MS = 800; + const NEXT_ASSET_DELAY_MS = 1500; + + let assetIndex = 0; + let allAssetsLoaded = false; + let appIsReady = false; + const splashText = document.getElementById('loading-splash-text'); + + function updateSplash(text) { + if (splashText) { + splashText.textContent = text; + } + } + + function hideSplash() { + const splash = document.getElementById('loading-splash'); + if (splash) { + splash.style.opacity = '0'; + setTimeout(() => splash.remove(), 500); // fade out + } + } + + function checkAndHideSplash() { + if (allAssetsLoaded && appIsReady) { + hideSplash(); + } + } + + window.markAppAsReady = function() { + console.log('markAppAsReady called.'); + appIsReady = true; + checkAndHideSplash(); + }; + + function onAllAssetsLoaded() { + console.log('All assets loaded sequentially.'); + window.dispatchEvent(new CustomEvent('allAssetsLoaded')); + allAssetsLoaded = true; + checkAndHideSplash(); + } + + function loadNextAsset() { + if (assetIndex >= assets.length) { + onAllAssetsLoaded(); + return; + } + + const asset = assets[assetIndex]; + const assetUrl = asset.attrs.href || asset.attrs.src; + const isCss = assetUrl && assetUrl.endsWith('.css'); + + updateSplash('Loading: ' + (assetUrl || 'asset...')); + + if (!assetUrl) { + console.error('Asset has no href or src', asset); + assetIndex++; + const delay = appIsReady ? 1500 : NEXT_ASSET_DELAY_MS; + setTimeout(loadNextAsset, delay); + return; + } + + if (isCss) { + // Use fetch to inline CSS + function fetchWithRetry(url, retries = DEFAULT_RETRIES, retryDelay = RETRY_DELAY_MS) { + updateSplash('Fetching: ' + url); + fetch(url) + .then(response => { + if (response.ok) return response.text(); + if (response.status === 503 && retries > 0) { + updateSplash('Error 503, retrying: ' + url + ' (' + (retries - 1) + ' left)'); + console.warn('Request for ' + url + ' failed with 503. Retrying in ' + retryDelay + 'ms... (' + retries + ' retries left)'); + setTimeout(() => fetchWithRetry(url, retries - 1, retryDelay), retryDelay); + return null; + } + throw new Error('Request failed with status ' + response.status); + }) + .then(text => { + if (text === null) return; // Retry in progress + + updateSplash('Inlining CSS: ' + url); + console.log('Successfully inlined CSS from:', url); + const style = document.createElement('style'); + style.textContent = text; + document.head.appendChild(style); + + assetIndex++; + const delay = appIsReady ? 0 : NEXT_ASSET_DELAY_MS; + setTimeout(loadNextAsset, delay); + }) + .catch(err => { + updateSplash('Failed to load CSS: ' + url); + console.error('Failed to load CSS asset ' + url + ' after retries:', err); + assetIndex++; + const delay = appIsReady ? 0 : NEXT_ASSET_DELAY_MS; + setTimeout(loadNextAsset, delay); + }); + } + fetchWithRetry(assetUrl); + } else { + // Use tag-based loading for JS + let retries = DEFAULT_RETRIES; + const retryDelay = RETRY_DELAY_MS; + + function attemptLoad() { + updateSplash('Loading script: ' + (assetUrl || '...')); + const element = document.createElement(asset.tagName); + for (const attr in asset.attrs) { + element.setAttribute(attr, asset.attrs[attr]); + } + + element.onload = () => { + updateSplash('Loaded script: ' + assetUrl); + console.log('Successfully loaded asset:', assetUrl); + assetIndex++; + const delay = appIsReady ? 0 : SCRIPT_SUCCESS_DELAY_MS; + setTimeout(loadNextAsset, delay); + }; + + element.onerror = () => { + element.remove(); + console.warn('Failed to load asset:', assetUrl); + if (retries > 0) { + retries--; + updateSplash('Retrying script: ' + assetUrl + ' (' + retries + ' left)'); + console.log('Retrying... (' + retries + ' retries left)'); + setTimeout(attemptLoad, retryDelay); + } else { + updateSplash('Failed to load script: ' + assetUrl); + console.error('Failed to load asset after multiple retries:', assetUrl); + assetIndex++; + const delay = appIsReady ? 0 : NEXT_ASSET_DELAY_MS; + setTimeout(loadNextAsset, delay); + } + }; + + document.head.appendChild(element); + } + attemptLoad(); + } + } + + loadNextAsset(); +})(); +`; +}; +export const handler = async (argv) => { + const { src, dst } = argv; + try { + const srcPath = path.resolve(src); + const dstPath = path.resolve(dst); + console.log(`Patching ${srcPath} for sequential asset loading...`); + const html = await fs.readFile(srcPath, 'utf-8'); + const $ = cheerio.load(html); + const splashCss = ` +#loading-splash { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: #222; + color: #eee; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + z-index: 9999; + font-family: "Courier New", Courier, monospace; + font-size: 1em; + text-align: center; + transition: opacity 0.5s ease-out; +} +#loading-splash-text { + margin-top: 20px; + min-height: 1.2em; +} +`; + const splashHtml = ` +
+

Cassandra RC2

+

Initializing Application...

+
+
+`; + $('head').append(``); + $('body').prepend(splashHtml); + const assetsToLoad = []; + $('head link[href^="/assets/"], head script[src^="/assets/"]').each(function () { + const el = $(this); + const tagName = el.prop('tagName'); + if (!tagName) + return; + const attrs = el.attr(); + if (attrs && (attrs.src || attrs.href)) { + assetsToLoad.push({ + tagName: tagName.toLowerCase(), + attrs, + }); + el.remove(); + } + }); + if (assetsToLoad.length > 0) { + const loaderScriptContent = createLoaderScript(assetsToLoad); + $('body').append(``); + console.log(`Injected sequential asset loader script with ${assetsToLoad.length} assets.`); + } + else { + console.log('No assets found to patch in .'); + } + await fs.writeFile(dstPath, $.html()); + console.log(`Successfully patched and saved to ${dstPath}`); + } + catch (error) { + console.error('Error patching app:', error); + process.exit(1); + } +}; +//# sourceMappingURL=patch-app.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/patch-app.js.map b/cli-ts/dist-in/commands/patch-app.js.map new file mode 100644 index 00000000..a03d899e --- /dev/null +++ b/cli-ts/dist-in/commands/patch-app.js.map @@ -0,0 +1 @@ +{"version":3,"file":"patch-app.js","sourceRoot":"","sources":["../../src/commands/patch-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC;AACnC,MAAM,CAAC,MAAM,IAAI,GAAG,uDAAuD,CAAC;AAE5E,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE,CAC/B,KAAK,CAAC,OAAO,CAAC;IACZ,GAAG,EAAE;QACH,QAAQ,EAAE,2BAA2B;QACrC,OAAO,EAAE,mBAAmB;KAC7B;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,gCAAgC;QAC1C,OAAO,EAAE,mBAAmB;KAC7B;CACF,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,EAAE;IACpC,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACnD,OAAO;;mBAEQ,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkJ5B,CAAC;AACA,CAAC,CAAC;AAGJ,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE;IACpC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE1B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAElC,OAAO,CAAC,GAAG,CAAC,YAAY,OAAO,kCAAkC,CAAC,CAAC;QAEnE,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjD,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7B,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBrB,CAAC;QACE,MAAM,UAAU,GAAG;;;;;;CAMtB,CAAC;QAEE,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,UAAU,SAAS,UAAU,CAAC,CAAC;QAChD,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE9B,MAAM,YAAY,GAA8D,EAAE,CAAC;QAEnF,CAAC,CAAC,2DAA2D,CAAC,CAAC,IAAI,CAAC;YAClE,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;YACnB,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACnC,IAAI,CAAC,OAAO;gBAAE,OAAO;YAErB,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;YAExB,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvC,YAAY,CAAC,IAAI,CAAC;oBAChB,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE;oBAC9B,KAAK;iBACN,CAAC,CAAC;gBACH,EAAE,CAAC,MAAM,EAAE,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;YAC7D,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,mBAAmB,WAAW,CAAC,CAAC;YAC5D,OAAO,CAAC,GAAG,CAAC,gDAAgD,YAAY,CAAC,MAAM,UAAU,CAAC,CAAC;QAC7F,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACrD,CAAC;QAED,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,qCAAqC,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/patch-config.js b/cli-ts/dist-in/commands/patch-config.js new file mode 100644 index 00000000..3c228a32 --- /dev/null +++ b/cli-ts/dist-in/commands/patch-config.js @@ -0,0 +1,37 @@ +import path from 'path'; +import fs from 'fs/promises'; +import { patchConfig } from '../lib/config.js'; +export const command = 'patch-config'; +export const describe = 'Create a configuration overlay file from a JSON patch.'; +export const builder = { + patch: { + describe: 'Path to the JSON patch file', + type: 'string', + demandOption: true, + }, + dst: { + default: 'src/config-user.h', + describe: 'Path to the destination configuration file', + type: 'string', + } +}; +export const handler = async (argv) => { + try { + const patchPath = path.resolve(argv.patch); + //const srcPath = path.resolve(argv.src); + const dstPath = path.resolve(argv.dst); + const patchContent = await fs.readFile(patchPath, 'utf-8'); + const patch = JSON.parse(patchContent); + await patchConfig(dstPath, patch); + console.log(`Successfully created overlay file at ${dstPath}`); + } + catch (error) { + if (error instanceof Error) { + console.error(`Error applying patch: ${error.message}`); + } + else { + console.error('An unknown error occurred while applying the patch.'); + } + } +}; +//# sourceMappingURL=patch-config.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/patch-config.js.map b/cli-ts/dist-in/commands/patch-config.js.map new file mode 100644 index 00000000..e3563331 --- /dev/null +++ b/cli-ts/dist-in/commands/patch-config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"patch-config.js","sourceRoot":"","sources":["../../src/commands/patch-config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC;AACtC,MAAM,CAAC,MAAM,QAAQ,GAAG,wDAAwD,CAAC;AAEjF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,KAAK,EAAE;QACL,QAAQ,EAAE,6BAA6B;QACvC,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,IAAI;KACnB;IACD,GAAG,EAAE;QACH,OAAO,EAAE,mBAAmB;QAC5B,QAAQ,EAAE,4CAA4C;QACtD,IAAI,EAAE,QAAQ;KACf;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,IAAiD,EAAE,EAAE;IACjF,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,yCAAyC;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEvC,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAEvC,MAAM,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,wCAAwC,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5D,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/restore.js b/cli-ts/dist-in/commands/restore.js new file mode 100644 index 00000000..3cae91c8 --- /dev/null +++ b/cli-ts/dist-in/commands/restore.js @@ -0,0 +1,121 @@ +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; +import modbusApiService from "@polymech/client-ts/modbusApiService"; +export const command = "restore"; +export const describe = "Restores JSON data from files to API endpoints via filesystem upload."; +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + directory: { + describe: "Source directory to read JSON files", + default: "./data", + type: "string", + }, +}; +const endpoints = [ + { local: "default_profiles.json", remote: "profile_defaults.json" }, + { local: "settings.json", remote: "settings.json" }, + { local: "signals_plots.json", remote: "signal_plots.json" }, + { local: "layout.json", remote: "layout.json" }, + { local: "network.json", remote: "network.json" }, + { local: "state.json", remote: "state.json" }, + { local: "pressure_profiles.json", remote: "pressure_profiles.json" }, +]; +async function uploadFile(baseUrl, filename, content) { + const url = `${baseUrl}/v1/fs`; + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + filename: filename, + content: content + }), + }); + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } + catch (e) { + // Ignore + } + throw new Error(`Failed to upload ${filename}: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } +} +async function testConnection(baseUrl) { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } + catch (error) { + return false; + } +} +export async function handler(argv) { + log.info(`Restoring data to host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + try { + modbusApiService.setBaseUrl(baseUrl); + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + const sourceDir = path.resolve(process.cwd(), argv.directory); + log.info(`Reading files from: ${sourceDir}`); + try { + await fs.access(sourceDir); + } + catch (error) { + log.error(`Source directory does not exist: ${sourceDir}`); + return; + } + for (const endpoint of endpoints) { + try { + const filePath = path.join(sourceDir, endpoint.local); + log.info(`Reading ${endpoint.local}...`); + let fileContent; + try { + fileContent = await fs.readFile(filePath, 'utf-8'); + } + catch (e) { + log.warn(`Skipping ${endpoint.local}: File not found.`); + continue; + } + log.info(`Uploading to /${endpoint.remote}...`); + const uploadResult = await uploadFile(baseUrl, endpoint.remote, fileContent); + log.info(`Successfully restored ${endpoint.local} as /${endpoint.remote}`); + } + catch (error) { + if (error instanceof Error) { + log.error(`Failed to restore ${endpoint.local}: ${error.message}`); + } + else { + log.error(`Failed to restore ${endpoint.local}:`, error); + } + } + } + log.info("Restore completed."); + } + catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } + else { + log.error("An unknown error occurred.", error); + } + } +} +//# sourceMappingURL=restore.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/restore.js.map b/cli-ts/dist-in/commands/restore.js.map new file mode 100644 index 00000000..6330a7ef --- /dev/null +++ b/cli-ts/dist-in/commands/restore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"restore.js","sourceRoot":"","sources":["../../src/commands/restore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAEpE,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,QAAQ,GAAG,uEAAuE,CAAC;AAEhG,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,UAAU,EAAE;QACR,QAAQ,EAAE,8CAA8C;QACxD,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,sBAAsB;KAClC;IACD,SAAS,EAAE;QACP,QAAQ,EAAE,qCAAqC;QAC/C,OAAO,EAAE,QAAQ;QACjB,IAAI,EAAE,QAAQ;KACjB;CACK,CAAC;AAEX,MAAM,SAAS,GAAG;IACd,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,EAAE,uBAAuB,EAAE;IACnE,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE;IACnD,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,mBAAmB,EAAE;IAC5D,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE;IAC/C,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE;IACjD,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE;IAC7C,EAAE,KAAK,EAAE,wBAAwB,EAAE,MAAM,EAAE,wBAAwB,EAAE;CACxE,CAAC;AAEF,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,QAAgB,EAAE,OAAe;IACxE,MAAM,GAAG,GAAG,GAAG,OAAO,QAAQ,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC9B,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACL,cAAc,EAAE,kBAAkB;SACrC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACjB,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,OAAO;SACnB,CAAC;KACL,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC;YACD,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,SAAS;QACb,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,QAAQ,KAAK,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjH,CAAC;AACL,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,OAAe;IACzC,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,iBAAiB,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAmE;IAC7F,GAAG,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACvD,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;IAC9B,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,GAAG,OAAO,MAAM,CAAC;IAC/B,CAAC;IAED,IAAI,CAAC;QACD,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,UAAU,yDAAyD,CAAC,CAAC;YAC5G,OAAO;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,6BAA6B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAE1D,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9D,GAAG,CAAC,IAAI,CAAC,uBAAuB,SAAS,EAAE,CAAC,CAAC;QAE7C,IAAI,CAAC;YACD,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,GAAG,CAAC,KAAK,CAAC,oCAAoC,SAAS,EAAE,CAAC,CAAC;YAC3D,OAAO;QACX,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YAC/B,IAAI,CAAC;gBACD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACtD,GAAG,CAAC,IAAI,CAAC,WAAW,QAAQ,CAAC,KAAK,KAAK,CAAC,CAAC;gBAEzC,IAAI,WAAmB,CAAC;gBACxB,IAAI,CAAC;oBACD,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBACvD,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACT,GAAG,CAAC,IAAI,CAAC,YAAY,QAAQ,CAAC,KAAK,mBAAmB,CAAC,CAAC;oBACxD,SAAS;gBACb,CAAC;gBAED,GAAG,CAAC,IAAI,CAAC,iBAAiB,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC;gBAChD,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;gBAC7E,GAAG,CAAC,IAAI,CAAC,yBAAyB,QAAQ,CAAC,KAAK,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAE/E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;oBACzB,GAAG,CAAC,KAAK,CAAC,qBAAqB,QAAQ,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBACvE,CAAC;qBAAM,CAAC;oBACJ,GAAG,CAAC,KAAK,CAAC,qBAAqB,QAAQ,CAAC,KAAK,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC7D,CAAC;YACL,CAAC;QACL,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAEnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/setup-network.js b/cli-ts/dist-in/commands/setup-network.js new file mode 100644 index 00000000..e320a2cb --- /dev/null +++ b/cli-ts/dist-in/commands/setup-network.js @@ -0,0 +1,108 @@ +import { networkSettingsSchema } from "../schemas/network-schema.js"; +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; +export const command = "setup-network"; +export const describe = "Sets up network settings for a target host."; +const networkOptions = Object.keys(networkSettingsSchema.shape).reduce((acc, key) => { + acc[key] = { + describe: `Overrides ${key} from the settings file`, + type: 'string', + demandOption: false, + }; + return acc; +}, {}); +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + file: { + describe: "Path to the network settings file", + default: "network.json", + type: "string", + }, + ...networkOptions, +}; +async function setNetworkSettings(baseUrl, settings) { + const url = `${baseUrl}/v1/network/settings`; + log.info(`Setting network settings to ${url}`); + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(settings), + }); + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } + catch (e) { + // Ignore + } + throw new Error(`Failed to set network settings: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } + try { + return await response.json(); + } + catch (e) { + return { success: true, message: 'Network settings updated.' }; + } +} +async function testConnection(baseUrl) { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } + catch (error) { + return false; + } +} +export async function handler(argv) { + log.info(`Setting up network for host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + try { + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + const filePath = path.resolve(process.cwd(), argv.file); + const fileContent = await fs.readFile(filePath, "utf-8"); + const settingsFromFile = JSON.parse(fileContent); + const cliOverrides = Object.keys(networkSettingsSchema.shape).reduce((acc, key) => { + if (argv[key] !== undefined && argv[key] !== null) { + acc[key] = argv[key]; + } + return acc; + }, {}); + const settings = { ...settingsFromFile, ...cliOverrides }; + log.info("Validating network settings...", cliOverrides); + const validationResult = networkSettingsSchema.safeParse(settings); + if (!validationResult.success) { + log.error("Invalid network settings:", validationResult.error.flatten()); + return; + } + log.info(`Validation successful. Applying settings to ${baseUrl}`); + const res = await setNetworkSettings(baseUrl, validationResult.data); + log.info(`Network settings applied successfully: \n\n`, { message: res.message }); + } + catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } + else { + log.error("An unknown error occurred.", error); + } + } +} +//# sourceMappingURL=setup-network.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/setup-network.js.map b/cli-ts/dist-in/commands/setup-network.js.map new file mode 100644 index 00000000..ce0a6616 --- /dev/null +++ b/cli-ts/dist-in/commands/setup-network.js.map @@ -0,0 +1 @@ +{"version":3,"file":"setup-network.js","sourceRoot":"","sources":["../../src/commands/setup-network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AACvC,MAAM,CAAC,MAAM,QAAQ,GAAG,6CAA6C,CAAC;AAEtE,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAChF,GAAG,CAAC,GAAG,CAAC,GAAG;QACP,QAAQ,EAAE,aAAa,GAAG,yBAAyB;QACnD,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,KAAK;KACtB,CAAC;IACF,OAAO,GAAG,CAAC;AACf,CAAC,EAAE,EAAkF,CAAC,CAAC;AAGvF,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,UAAU,EAAE;QACR,QAAQ,EAAE,8CAA8C;QACxD,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,sBAAsB;KAClC;IACD,IAAI,EAAE;QACF,QAAQ,EAAE,mCAAmC;QAC7C,OAAO,EAAE,cAAc;QACvB,IAAI,EAAE,QAAQ;KACjB;IACD,GAAG,cAAc;CACX,CAAC;AAEX,KAAK,UAAU,kBAAkB,CAAC,OAAe,EAAE,QAAsC;IACrF,MAAM,GAAG,GAAG,GAAG,OAAO,sBAAsB,CAAC;IAC7C,GAAG,CAAC,IAAI,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC9B,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACL,cAAc,EAAE,kBAAkB;SACrC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;KACjC,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC;YACD,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,SAAS;QACb,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACnH,CAAC;IACD,IAAI,CAAC;QACD,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACnE,CAAC;AACL,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,OAAe;IACzC,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,iBAAiB,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAGD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAA6D;IACvF,GAAG,CAAC,IAAI,CAAC,gCAAgC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC5D,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;IAC9B,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,GAAG,OAAO,MAAM,CAAC;IAC/B,CAAC;IAED,IAAI,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,UAAU,yDAAyD,CAAC,CAAC;YAC5G,OAAO;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,6BAA6B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAE1D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACxD,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,gBAAgB,GAAiC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE/E,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC9E,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;gBAChD,GAAG,CAAC,GAAyC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC/D,CAAC;YACD,OAAO,GAAG,CAAC;QACf,CAAC,EAAE,EAA2C,CAAC,CAAC;QAEhD,MAAM,QAAQ,GAAG,EAAE,GAAG,gBAAgB,EAAE,GAAG,YAAY,EAAE,CAAC;QAE1D,GAAG,CAAC,IAAI,CAAC,gCAAgC,EAAE,YAAY,CAAC,CAAC;QACzD,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAEnE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC5B,GAAG,CAAC,KAAK,CAAC,2BAA2B,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACzE,OAAO;QACX,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,+CAA+C,OAAO,EAAE,CAAC,CAAC;QACnE,MAAM,GAAG,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,6CAA6C,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAEtF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/setup-profiles.js b/cli-ts/dist-in/commands/setup-profiles.js new file mode 100644 index 00000000..d41c8ac8 --- /dev/null +++ b/cli-ts/dist-in/commands/setup-profiles.js @@ -0,0 +1,91 @@ +import { profilesSchema } from "../schemas/profiles-schema.js"; +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; +export const command = "setup-profiles"; +export const describe = "Sets up profiles for a target host."; +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + file: { + describe: "Path to the profiles file", + default: "profile_defaults.json", + type: "string", + }, +}; +async function setProfiles(baseUrl, settings) { + const url = `${baseUrl}/v1/profiles`; + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(settings), + }); + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } + catch (e) { + // Ignore + } + throw new Error(`Failed to set profiles: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } + try { + return await response.json(); + } + catch (e) { + return { success: true, message: 'Profiles updated.' }; + } +} +async function testConnection(baseUrl) { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } + catch (error) { + return false; + } +} +export async function handler(argv) { + log.info(`Setting up profiles for host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + try { + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + const filePath = path.resolve(process.cwd(), argv.file); + const fileContent = await fs.readFile(filePath, "utf-8"); + const settings = JSON.parse(fileContent); + log.info("Validating profiles..."); + const validationResult = profilesSchema.parse(settings); + if (!validationResult) { + log.error("Invalid profiles:", validationResult); + return; + } + log.info(`Validation successful. Applying profiles to ${baseUrl}`); + const res = await setProfiles(baseUrl, validationResult); + log.info(`Profiles applied successfully: \n\n`, { message: res.message }); + } + catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } + else { + log.error("An unknown error occurred.", error); + } + } +} +//# sourceMappingURL=setup-profiles.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/setup-profiles.js.map b/cli-ts/dist-in/commands/setup-profiles.js.map new file mode 100644 index 00000000..0425394e --- /dev/null +++ b/cli-ts/dist-in/commands/setup-profiles.js.map @@ -0,0 +1 @@ +{"version":3,"file":"setup-profiles.js","sourceRoot":"","sources":["../../src/commands/setup-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AACxC,MAAM,CAAC,MAAM,QAAQ,GAAG,qCAAqC,CAAC;AAE9D,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,UAAU,EAAE;QACV,QAAQ,EAAE,8CAA8C;QACxD,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,sBAAsB;KAChC;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,2BAA2B;QACrC,OAAO,EAAE,uBAAuB;QAChC,IAAI,EAAE,QAAQ;KACf;CACO,CAAC;AAEX,KAAK,UAAU,WAAW,CAAC,OAAe,EAAE,QAA+B;IACzE,MAAM,GAAG,GAAG,GAAG,OAAO,cAAc,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;KAC/B,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC;YACH,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,SAAS;QACX,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,2BAA2B,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzG,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IACzD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,OAAe;IAC3C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,iBAAiB,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAGD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAA8D;IAC1F,GAAG,CAAC,IAAI,CAAC,iCAAiC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC7D,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;IAC9B,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,OAAO,GAAG,GAAG,OAAO,MAAM,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,GAAG,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,UAAU,yDAAyD,CAAC,CAAC;YAC5G,OAAO;QACT,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,6BAA6B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAE1D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACxD,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,QAAQ,GAA0B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAEhE,GAAG,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACnC,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAExD,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,GAAG,CAAC,KAAK,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;YACjD,OAAO;QACT,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,+CAA+C,OAAO,EAAE,CAAC,CAAC;QACnE,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QACzD,GAAG,CAAC,IAAI,CAAC,qCAAqC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAE5E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,GAAG,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/setup-settings.js b/cli-ts/dist-in/commands/setup-settings.js new file mode 100644 index 00000000..a451fe2b --- /dev/null +++ b/cli-ts/dist-in/commands/setup-settings.js @@ -0,0 +1,91 @@ +import { settingsSchema } from "../schemas/settings-schema.js"; +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; +export const command = "setup-settings"; +export const describe = "Sets up settings for a target host."; +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + file: { + describe: "Path to the settings file", + default: "settings.json", + type: "string", + }, +}; +async function setSettings(baseUrl, settings) { + const url = `${baseUrl}/v1/settings`; + const response = await fetch(url, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(settings), + }); + if (!response.ok) { + let errorBody = ""; + try { + errorBody = await response.text(); + } + catch (e) { + // Ignore + } + throw new Error(`Failed to set settings: ${response.statusText} ${errorBody ? `- ${errorBody}` : ""}`); + } + try { + return await response.json(); + } + catch (e) { + return { success: true, message: "Settings updated." }; + } +} +async function testConnection(baseUrl) { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } + catch (error) { + return false; + } +} +export async function handler(argv) { + log.info(`Setting up settings for host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith("/api")) { + baseUrl = `${baseUrl}/api`; + } + try { + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + const filePath = path.resolve(process.cwd(), argv.file); + const fileContent = await fs.readFile(filePath, "utf-8"); + const settings = JSON.parse(fileContent); + log.info("Validating settings..."); + const validationResult = settingsSchema.safeParse(settings); + if (!validationResult.success) { + log.error("Invalid settings:", validationResult.error.flatten()); + return; + } + log.info(`Validation successful. Applying settings to ${baseUrl}`); + const res = await setSettings(baseUrl, validationResult.data); + log.info(`Settings applied successfully: \n\n`, { message: res.message }); + } + catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } + else { + log.error("An unknown error occurred.", error); + } + } +} +//# sourceMappingURL=setup-settings.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/setup-settings.js.map b/cli-ts/dist-in/commands/setup-settings.js.map new file mode 100644 index 00000000..15d0e5c4 --- /dev/null +++ b/cli-ts/dist-in/commands/setup-settings.js.map @@ -0,0 +1 @@ +{"version":3,"file":"setup-settings.js","sourceRoot":"","sources":["../../src/commands/setup-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAG7B,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AACxC,MAAM,CAAC,MAAM,QAAQ,GAAG,qCAAqC,CAAC;AAE9D,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,UAAU,EAAE;QACV,QAAQ,EAAE,8CAA8C;QACxD,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,sBAAsB;KAChC;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,2BAA2B;QACrC,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,QAAQ;KACf;CACO,CAAC;AAEX,KAAK,UAAU,WAAW,CACxB,OAAe,EACf,QAA+B;IAE/B,MAAM,GAAG,GAAG,GAAG,OAAO,cAAc,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;KAC/B,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC;YACH,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,SAAS;QACX,CAAC;QACD,MAAM,IAAI,KAAK,CACb,2BAA2B,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC,CAAC,EACjF,EAAE,CACH,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IACzD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,OAAe;IAC3C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,iBAAiB,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAA6D;IACzF,GAAG,CAAC,IAAI,CAAC,iCAAiC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC7D,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;IAC9B,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,OAAO,GAAG,GAAG,OAAO,MAAM,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,GAAG,CAAC,KAAK,CACP,wBAAwB,IAAI,CAAC,UAAU,yDAAyD,CACjG,CAAC;YACF,OAAO;QACT,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,6BAA6B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAE1D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACxD,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,QAAQ,GAA0B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAEhE,GAAG,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACnC,MAAM,gBAAgB,GAAG,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE5D,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC9B,GAAG,CAAC,KAAK,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,+CAA+C,OAAO,EAAE,CAAC,CAAC;QACnE,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC9D,GAAG,CAAC,IAAI,CAAC,qCAAqC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,GAAG,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/setup-signals.js b/cli-ts/dist-in/commands/setup-signals.js new file mode 100644 index 00000000..d1a72b22 --- /dev/null +++ b/cli-ts/dist-in/commands/setup-signals.js @@ -0,0 +1,91 @@ +import { signalPlotsSchema } from "../schemas/signal-plots-schema.js"; +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; +export const command = "setup-signals"; +export const describe = "Sets up signal plots for a target host."; +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + file: { + describe: "Path to the signal plots file", + default: "signal_plots.json", + type: "string", + }, +}; +async function setSignalPlots(baseUrl, settings) { + const url = `${baseUrl}/v1/signalplots`; + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(settings), + }); + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } + catch (e) { + // Ignore + } + throw new Error(`Failed to set signal plots: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } + try { + return await response.json(); + } + catch (e) { + return { success: true, message: 'Signal plots updated.' }; + } +} +async function testConnection(baseUrl) { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } + catch (error) { + return false; + } +} +export async function handler(argv) { + log.info(`Setting up signal plots for host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + try { + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + const filePath = path.resolve(process.cwd(), argv.file); + const fileContent = await fs.readFile(filePath, "utf-8"); + const settings = JSON.parse(fileContent); + log.info("Validating signal plots..."); + const validationResult = signalPlotsSchema.safeParse(settings); + if (!validationResult.success) { + log.error("Invalid signal plots:", validationResult.error.flatten()); + return; + } + log.info(`Validation successful. Applying signal plots to ${baseUrl}`); + const res = await setSignalPlots(baseUrl, validationResult.data); + log.info(`Signal plots applied successfully: \n\n`, { message: res.message }); + } + catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } + else { + log.error("An unknown error occurred.", error); + } + } +} +//# sourceMappingURL=setup-signals.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/setup-signals.js.map b/cli-ts/dist-in/commands/setup-signals.js.map new file mode 100644 index 00000000..f980f516 --- /dev/null +++ b/cli-ts/dist-in/commands/setup-signals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"setup-signals.js","sourceRoot":"","sources":["../../src/commands/setup-signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AACvC,MAAM,CAAC,MAAM,QAAQ,GAAG,yCAAyC,CAAC;AAElE,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,UAAU,EAAE;QACV,QAAQ,EAAE,8CAA8C;QACxD,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,sBAAsB;KAChC;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,+BAA+B;QACzC,OAAO,EAAE,mBAAmB;QAC5B,IAAI,EAAE,QAAQ;KACf;CACO,CAAC;AAEX,KAAK,UAAU,cAAc,CAAC,OAAe,EAAE,QAAkC;IAC/E,MAAM,GAAG,GAAG,GAAG,OAAO,iBAAiB,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;KAC/B,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC;YACH,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,SAAS;QACX,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7G,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC;IAC7D,CAAC;AACH,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,OAAe;IAC3C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,iBAAiB,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAGD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAA8D;IAC1F,GAAG,CAAC,IAAI,CAAC,qCAAqC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACjE,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;IAC9B,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,OAAO,GAAG,GAAG,OAAO,MAAM,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,GAAG,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,UAAU,yDAAyD,CAAC,CAAC;YAC5G,OAAO;QACT,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,6BAA6B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAE1D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACxD,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,QAAQ,GAA6B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAEnE,GAAG,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACvC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE/D,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC9B,GAAG,CAAC,KAAK,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACrE,OAAO;QACT,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,mDAAmD,OAAO,EAAE,CAAC,CAAC;QACvE,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACjE,GAAG,CAAC,IAAI,CAAC,yCAAyC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAEhF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,GAAG,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/test-web.js b/cli-ts/dist-in/commands/test-web.js new file mode 100644 index 00000000..10cb54ec --- /dev/null +++ b/cli-ts/dist-in/commands/test-web.js @@ -0,0 +1,137 @@ +import WebSocket from 'ws'; +import { performance } from 'perf_hooks'; +export const command = 'test-web'; +export const describe = 'Simulates the web app behavior: connects to WebSocket and fetches registers via REST.'; +export const builder = (yargs) => yargs + .option('wsUrl', { + alias: 'w', + type: 'string', + description: 'WebSocket URL to connect to', + default: 'ws://192.168.1.250/ws', +}) + .option('apiUrl', { + alias: 'a', + type: 'string', + description: 'Base API URL', + default: 'http://192.168.1.250/api', +}) + .option('interval', { + alias: 'i', + type: 'number', + description: 'Interval between register fetches in ms', + default: 30, +}) + .option('payloadTest', { + type: 'boolean', + description: 'Run WebSocket payload size test', + default: true, +}) + .option('payloadSize', { + type: 'number', + description: 'Size of payload to request in bytes', + default: 1024, +}) + .option('period', { + alias: 'p', + type: 'number', + description: 'Period between payload requests in ms', + default: 150, +}); +export const handler = async (argv) => { + const { wsUrl, apiUrl, interval, payloadTest, payloadSize, period } = argv; + console.log(`Starting test-web...`); + console.log(`WebSocket URL: ${wsUrl}`); + console.log(`API URL: ${apiUrl}`); + // 1. Connect to WebSocket + const ws = new WebSocket(wsUrl); + ws.on('open', () => { + console.log('WebSocket connected.'); + }); + ws.on('message', (data) => { + // Just consume messages to keep the connection active and simulate traffic processing + // console.log('WS Message received:', data.toString().length, 'bytes'); + if (payloadTest) { + try { + const msg = JSON.parse(data.toString()); + if (msg.type === 'test_payload') { + console.log(`Received test payload: ${msg.data.size} bytes requested, payload length: ${msg.data.payload.length}`); + } + } + catch (e) { + // ignore + } + } + }); + ws.on('close', (code, reason) => { + console.log(`WebSocket disconnected. Code: ${code}, Reason: ${reason.toString()}`); + process.exit(0); + }); + ws.on('error', (error) => { + console.error('WebSocket error:', error.message); + console.error('WebSocket readyState:', ws.readyState); + }); + ws.on('ping', (data) => { + console.log('WS received ping:', data.toString()); + }); + ws.on('pong', (data) => { + console.log('WS received pong:', data.toString()); + }); + // 2. Fetch Registers via REST (simulating modbusApiService.ts) + const fetchRegisters = async () => { + console.log('Starting register fetch...'); + let currentPage = 0; + let totalPages = 1; + const pageSize = 10; + let totalRegisters = 0; + while (currentPage < totalPages) { + const startTime = performance.now(); + try { + const response = await fetch(`${apiUrl}/v1/registers?page=${currentPage}&pageSize=${pageSize}`); + if (!response.ok) { + throw new Error(`HTTP error ${response.status}: ${response.statusText}`); + } + const data = await response.json(); + if (data.registers) { + totalRegisters += data.registers.length; + } + if (data.meta) { + totalPages = data.meta.totalPages; + } + else { + break; + } + const duration = performance.now() - startTime; + console.log(`Fetched page ${currentPage}/${totalPages} in ${duration.toFixed(2)}ms`); + } + catch (error) { + console.error(`Failed to fetch page ${currentPage}:`, error); + } + currentPage++; + if (interval > 0) { + await new Promise(resolve => setTimeout(resolve, interval)); + } + } + console.log(`Finished fetching ${totalRegisters} registers.`); + }; + // await fetchRegisters(); + if (payloadTest) { + ws.on('open', () => { + console.log(`Starting periodic payload test (size: ${payloadSize}, period: ${period}ms)...`); + setInterval(() => { + if (ws.readyState === WebSocket.OPEN) { + console.log('Sending payload test... ' + payloadSize + ' bytes'); + ws.send(JSON.stringify({ command: 'test_payload', size: payloadSize })); + } + else { + console.log('WebSocket is not open. Payload test skipped.'); + } + }, period); + }); + } + else { + // Start fetching registers immediately + } + // Keep process alive + process.stdin.resume(); +}; +//# sourceMappingURL=test-web.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/test-web.js.map b/cli-ts/dist-in/commands/test-web.js.map new file mode 100644 index 00000000..3e11c1b4 --- /dev/null +++ b/cli-ts/dist-in/commands/test-web.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-web.js","sourceRoot":"","sources":["../../src/commands/test-web.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAG,uFAAuF,CAAC;AAWhH,MAAM,CAAC,MAAM,OAAO,GAAqC,CAAC,KAAK,EAAE,EAAE,CAC/D,KAAK;KACA,MAAM,CAAC,OAAO,EAAE;IACb,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,6BAA6B;IAC1C,OAAO,EAAE,uBAAuB;CACnC,CAAC;KACD,MAAM,CAAC,QAAQ,EAAE;IACd,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,cAAc;IAC3B,OAAO,EAAE,0BAA0B;CACtC,CAAC;KACD,MAAM,CAAC,UAAU,EAAE;IAChB,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,yCAAyC;IACtD,OAAO,EAAE,EAAE;CACd,CAAC;KACD,MAAM,CAAC,aAAa,EAAE;IACnB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,iCAAiC;IAC9C,OAAO,EAAE,IAAI;CAChB,CAAC;KACD,MAAM,CAAC,aAAa,EAAE;IACnB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,qCAAqC;IAClD,OAAO,EAAE,IAAI;CAChB,CAAC;KACD,MAAM,CAAC,QAAQ,EAAE;IACd,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,uCAAuC;IACpD,OAAO,EAAE,GAAG;CACf,CAAC,CAAC;AAEX,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,IAAwB,EAAiB,EAAE;IAErE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAE3E,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,EAAE,CAAC,CAAC;IAElC,0BAA0B;IAC1B,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;IAEhC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACf,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,IAAoB,EAAE,EAAE;QACtC,sFAAsF;QACtF,wEAAwE;QACxE,IAAI,WAAW,EAAE,CAAC;YACd,IAAI,CAAC;gBACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;gBACxC,IAAI,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;oBAC9B,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,CAAC,IAAI,CAAC,IAAI,qCAAqC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;gBACvH,CAAC;YACL,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,SAAS;YACb,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAY,EAAE,MAAc,EAAE,EAAE;QAC5C,OAAO,CAAC,GAAG,CAAC,iCAAiC,IAAI,aAAa,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACnF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;QAC5B,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACjD,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;QAC3B,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;QAC3B,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,+DAA+D;IAC/D,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE;QAC9B,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QAC1C,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,IAAI,cAAc,GAAG,CAAC,CAAC;QAEvB,OAAO,WAAW,GAAG,UAAU,EAAE,CAAC;YAC9B,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;YACpC,IAAI,CAAC;gBACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,sBAAsB,WAAW,aAAa,QAAQ,EAAE,CAAC,CAAC;gBAChG,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CAAC,cAAc,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC7E,CAAC;gBACD,MAAM,IAAI,GAAQ,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAExC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;oBACjB,cAAc,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;gBAC5C,CAAC;gBAED,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBACZ,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;gBACtC,CAAC;qBAAM,CAAC;oBACJ,MAAM;gBACV,CAAC;gBAED,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;gBAC/C,OAAO,CAAC,GAAG,CAAC,gBAAgB,WAAW,IAAI,UAAU,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAEzF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,wBAAwB,WAAW,GAAG,EAAE,KAAK,CAAC,CAAC;YACjE,CAAC;YAED,WAAW,EAAE,CAAC;YACd,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;gBACf,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;YAChE,CAAC;QACL,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,qBAAqB,cAAc,aAAa,CAAC,CAAC;IAClE,CAAC,CAAC;IAEF,0BAA0B;IAE1B,IAAI,WAAW,EAAE,CAAC;QACd,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACf,OAAO,CAAC,GAAG,CAAC,yCAAyC,WAAW,aAAa,MAAM,QAAQ,CAAC,CAAC;YAC7F,WAAW,CAAC,GAAG,EAAE;gBACb,IAAI,EAAE,CAAC,UAAU,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;oBACnC,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,WAAW,GAAG,QAAQ,CAAC,CAAC;oBACjE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;gBAC5E,CAAC;qBAAM,CAAC;oBACJ,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;gBAChE,CAAC;YACL,CAAC,EAAE,MAAM,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;SAAM,CAAC;QACJ,uCAAuC;IAC3C,CAAC;IAED,qBAAqB;IACrB,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;AAC3B,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/write.js b/cli-ts/dist-in/commands/write.js new file mode 100644 index 00000000..14e38356 --- /dev/null +++ b/cli-ts/dist-in/commands/write.js @@ -0,0 +1,110 @@ +import { Logger } from "tslog"; +import path from "path"; +import fs from "fs/promises"; +const log = new Logger(); +export const command = "write"; +export const describe = "Writes a JSON file to the device filesystem using the /fs API."; +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + file: { + describe: "Path to the local JSON file to write", + demandOption: true, + type: "string", + }, + filename: { + describe: "Target filename on the device (defaults to basename of file)", + type: "string", + }, +}; +async function writeFileToDevice(baseUrl, filename, content) { + const url = `${baseUrl}/v1/fs`; + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + filename: filename, + content: content + }), + }); + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } + catch (e) { + // Ignore + } + throw new Error(`Failed to write file: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } + return await response.json(); +} +async function testConnection(baseUrl) { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } + catch (error) { + return false; + } +} +export async function handler(argv) { + log.info(`Writing file to device: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + try { + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + const filePath = path.resolve(process.cwd(), argv.file); + try { + await fs.access(filePath); + } + catch (error) { + log.error(`File not found: ${filePath}`); + return; + } + const fileContent = await fs.readFile(filePath, "utf-8"); + log.info(`Read file content (${fileContent.length} bytes)`); + let parsedJson; + try { + parsedJson = JSON.parse(fileContent); + log.info(`JSON parsed successfully. Keys: ${Object.keys(parsedJson).join(', ')}`); + } + catch (error) { + log.error(`Invalid JSON file: ${filePath}. Error: ${error}`); + return; + } + const targetFilename = argv.filename || path.basename(argv.file); + log.info(`Writing ${targetFilename} to device...`); + log.info(`Payload preview: ${JSON.stringify({ filename: targetFilename, content: fileContent.substring(0, 200) + '...' })}`); + const result = await writeFileToDevice(baseUrl, targetFilename, fileContent); + if (result.success) { + log.info(`File written successfully: ${result.message}`); + } + else { + log.error(`Failed to write file: ${result.error}`); + } + } + catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } + else { + log.error("An unknown error occurred.", error); + } + } +} +//# sourceMappingURL=write.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/write.js.map b/cli-ts/dist-in/commands/write.js.map new file mode 100644 index 00000000..2134e113 --- /dev/null +++ b/cli-ts/dist-in/commands/write.js.map @@ -0,0 +1 @@ +{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/commands/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,MAAM,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC;AAEzB,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,gEAAgE,CAAC;AAEzF,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,UAAU,EAAE;QACR,QAAQ,EAAE,8CAA8C;QACxD,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,sBAAsB;KAClC;IACD,IAAI,EAAE;QACF,QAAQ,EAAE,sCAAsC;QAChD,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,QAAQ;KACjB;IACD,QAAQ,EAAE;QACN,QAAQ,EAAE,8DAA8D;QACxE,IAAI,EAAE,QAAQ;KACjB;CACK,CAAC;AAEX,KAAK,UAAU,iBAAiB,CAAC,OAAe,EAAE,QAAgB,EAAE,OAAe;IAC/E,MAAM,GAAG,GAAG,GAAG,OAAO,QAAQ,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC9B,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACL,cAAc,EAAE,kBAAkB;SACrC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACjB,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,OAAO;SACnB,CAAC;KACL,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC;YACD,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,SAAS;QACb,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzG,CAAC;IAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,OAAe;IACzC,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,iBAAiB,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAiF;IAC3G,GAAG,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACvD,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;IAC9B,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,GAAG,OAAO,MAAM,CAAC;IAC/B,CAAC;IAED,IAAI,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,UAAU,yDAAyD,CAAC,CAAC;YAC5G,OAAO;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,6BAA6B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAE1D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAExD,IAAI,CAAC;YACD,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,GAAG,CAAC,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;YACzC,OAAO;QACX,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzD,GAAG,CAAC,IAAI,CAAC,sBAAsB,WAAW,CAAC,MAAM,SAAS,CAAC,CAAC;QAE5D,IAAI,UAAU,CAAC;QACf,IAAI,CAAC;YACD,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACrC,GAAG,CAAC,IAAI,CAAC,mCAAmC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,GAAG,CAAC,KAAK,CAAC,sBAAsB,QAAQ,YAAY,KAAK,EAAE,CAAC,CAAC;YAC7D,OAAO;QACX,CAAC;QAED,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjE,GAAG,CAAC,IAAI,CAAC,WAAW,cAAc,eAAe,CAAC,CAAC;QACnD,GAAG,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,EAAC,CAAC,EAAE,CAAC,CAAC;QAC3H,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;QAE7E,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,GAAG,CAAC,IAAI,CAAC,8BAA8B,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,KAAK,CAAC,yBAAyB,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACvD,CAAC;IAEL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/commands/ws-client.js b/cli-ts/dist-in/commands/ws-client.js new file mode 100644 index 00000000..aa361278 --- /dev/null +++ b/cli-ts/dist-in/commands/ws-client.js @@ -0,0 +1,148 @@ +import WebSocket from 'ws'; +import { performance } from 'perf_hooks'; +import { decodeNetworkValue } from '../lib/pb-decoder.js'; +import * as fs from 'fs'; +import * as path from 'path'; +import { JSONPath } from 'jsonpath-plus'; +export const command = 'ws-client'; +export const describe = 'Connects to the device WebSocket server.'; +const queryPresets = { + coils: '$[?(@.type=="coil_update")]', + registers: '$[?(@.type=="register_update")]', +}; +export const builder = (yargs) => yargs + .option('url', { + alias: 'u', + type: 'string', + description: 'WebSocket URL to connect to', + default: 'ws://192.168.1.250/ws', +}) + .option('timeout', { + alias: 't', + type: 'number', + description: 'Disconnect after N seconds. 0 for no timeout.', + default: 0, +}) + .option('dest', { + alias: 'd', + type: 'string', + description: 'Path to a JSON file to save messages to.', + default: './last-ws.json' +}) + .option('query', { + alias: 'q', + type: 'string', + description: 'JSONPath query to filter messages. Presets: coils, registers.', + coerce: (arg) => queryPresets[arg] || arg, +}) + .option('verbose', { + alias: 'v', + type: 'boolean', + description: 'Show full message payloads in the console.', + default: false, +}) + .example('$0 ws-client -q coils', 'Show only coil update messages.') + .example('$0 ws-client -q \'$[?(@.address==1003)]\'', '') + .example('$0 ws-client -q \'$[?(@.data.address==1002)]\'', '') + .example('$0 ws-client -q \'$[?(@.type=="register_update" && @.data.address==1002)]\'', ''); +export const handler = (argv) => { + const { url, timeout, dest, query, verbose } = argv; + const destPath = path.resolve(dest); + let messages = []; + // Load existing messages if the file exists and is valid JSON + try { + if (fs.existsSync(destPath)) { + const fileContent = fs.readFileSync(destPath, 'utf-8'); + const existingData = JSON.parse(fileContent); + if (Array.isArray(existingData)) { + messages = existingData; + console.log(`Loaded ${messages.length} existing messages from ${destPath}`); + } + } + } + catch (e) { + console.log(`Could not parse existing destination file ${destPath}. Starting fresh.`); + messages = []; + } + const saveAndExit = () => { + try { + fs.writeFileSync(destPath, JSON.stringify(messages, null, 2)); + console.log(`\nMessages saved to ${destPath}`); + } + catch (error) { + console.error(`\nFailed to write messages to ${destPath}:`, error); + } + process.exit(0); + }; + const connect = () => { + console.log(`Connecting to ${url}...`); + const ws = new WebSocket(url); + if (timeout > 0) { + console.log(`Will disconnect in ${timeout} seconds.`); + setTimeout(() => { + console.log('Timeout reached. Disconnecting.'); + ws.close(); + }, timeout * 1000); + } + ws.on('open', () => { + console.log('Connected to WebSocket server.'); + }); + ws.on('message', (data, isBinary) => { + let messageData; + if (isBinary) { + const buffer = data; + const startTime = performance.now(); + const decoded = decodeNetworkValue(buffer); + const endTime = performance.now(); + const duration = (endTime - startTime) * 1000; + messageData = decoded; + } + else { + const jsonStr = data.toString(); + try { + const message = JSON.parse(jsonStr); + if (message.type === 'welcome') { + console.log(`Successfully connected. Client ID: ${message.clientId}`); + return; // Don't process welcome message further + } + messageData = message; + } + catch (e) { + messageData = { type: 'raw', payload: jsonStr }; + } + } + if (messageData) { + messages.push(messageData); + if (query) { + try { + const result = JSONPath({ path: query, json: [messageData] }); + if (result.length > 0) { + if (verbose) + console.log(JSON.stringify(result[0], null, 2)); + } + } + catch (e) { + // Ignore errors for messages that don't match the query structure + } + } + else { + if (verbose) + console.log(JSON.stringify(messageData, null, 2)); + } + } + }); + ws.on('close', () => { + console.log('Disconnected.'); + saveAndExit(); + }); + ws.on('error', (error) => { + console.error('WebSocket error:', error.message); + ws.close(); + }); + }; + // Ensure file is saved on exit signals + process.on('SIGINT', saveAndExit); + process.on('SIGTERM', saveAndExit); + connect(); +}; +//# sourceMappingURL=ws-client.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/commands/ws-client.js.map b/cli-ts/dist-in/commands/ws-client.js.map new file mode 100644 index 00000000..71f912c2 --- /dev/null +++ b/cli-ts/dist-in/commands/ws-client.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ws-client.js","sourceRoot":"","sources":["../../src/commands/ws-client.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC;AACnC,MAAM,CAAC,MAAM,QAAQ,GAAG,0CAA0C,CAAC;AAEnE,MAAM,YAAY,GAAG;IACnB,KAAK,EAAE,6BAA6B;IACpC,SAAS,EAAE,iCAAiC;CAC7C,CAAC;AAUF,MAAM,CAAC,MAAM,OAAO,GAAqC,CAAC,KAAK,EAAE,EAAE,CACjE,KAAK;KACF,MAAM,CAAC,KAAK,EAAE;IACb,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,6BAA6B;IAC1C,OAAO,EAAE,uBAAuB;CACjC,CAAC;KACD,MAAM,CAAC,SAAS,EAAE;IACjB,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,+CAA+C;IAC5D,OAAO,EAAE,CAAC;CACX,CAAC;KACD,MAAM,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,0CAA0C;IACvD,OAAO,EAAE,gBAAgB;CAC1B,CAAC;KACD,MAAM,CAAC,OAAO,EAAE;IACb,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,+DAA+D;IAC5E,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAgC,CAAC,IAAI,GAAG;CACzE,CAAC;KACD,MAAM,CAAC,SAAS,EAAE;IACf,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,4CAA4C;IACzD,OAAO,EAAE,KAAK;CACjB,CAAC;KACD,OAAO,CAAC,uBAAuB,EAAE,iCAAiC,CAAC;KACnE,OAAO,CAAC,2CAA2C,EAAC,EAAE,CAAC;KACvD,OAAO,CAAC,gDAAgD,EAAE,EAAE,CAAC;KAC7D,OAAO,CAAC,6EAA6E,EAAE,EAAE,CAAC,CAAC;AAEhG,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAwB,EAAQ,EAAE;IACxD,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,QAAQ,GAAU,EAAE,CAAC;IAEzB,8DAA8D;IAC9D,IAAI,CAAC;QACH,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACvD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,QAAQ,GAAG,YAAY,CAAC;gBACxB,OAAO,CAAC,GAAG,CAAC,UAAU,QAAQ,CAAC,MAAM,2BAA2B,QAAQ,EAAE,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,6CAA6C,QAAQ,mBAAmB,CAAC,CAAC;QACtF,QAAQ,GAAG,EAAE,CAAC;IAChB,CAAC;IAED,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,CAAC;YACD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC9D,OAAO,CAAC,GAAG,CAAC,uBAAuB,QAAQ,EAAE,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,iCAAiC,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;QACvC,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;QAE9B,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,sBAAsB,OAAO,WAAW,CAAC,CAAC;YACtD,UAAU,CAAC,GAAG,EAAE;gBACd,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;gBAC/C,EAAE,CAAC,KAAK,EAAE,CAAC;YACb,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC;QACrB,CAAC;QAED,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACjB,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,IAAoB,EAAE,QAAiB,EAAE,EAAE;YAC3D,IAAI,WAAgB,CAAC;YAErB,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,MAAM,GAAG,IAAc,CAAC;gBAC9B,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;gBACpC,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;gBAC3C,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;gBAClC,MAAM,QAAQ,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC;gBAC9C,WAAW,GAAG,OAAO,CAAC;YACxB,CAAC;iBAAM,CAAC;gBACN,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChC,IAAI,CAAC;oBACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oBACpC,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;wBAC/B,OAAO,CAAC,GAAG,CAAC,sCAAsC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;wBACtE,OAAO,CAAC,wCAAwC;oBAClD,CAAC;oBACD,WAAW,GAAG,OAAO,CAAC;gBACxB,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,WAAW,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;gBAClD,CAAC;YACH,CAAC;YAED,IAAI,WAAW,EAAE,CAAC;gBAChB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAE3B,IAAI,KAAK,EAAE,CAAC;oBACR,IAAI,CAAC;wBACD,MAAM,MAAM,GAAG,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;wBAC9D,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;4BACpB,IAAI,OAAO;gCAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;wBACjE,CAAC;oBACL,CAAC;oBAAC,OAAO,CAAC,EAAE,CAAC;wBACT,kEAAkE;oBACtE,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACH,IAAI,OAAO;wBAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBACpE,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAClB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;YAC7B,WAAW,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;YAC9B,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACjD,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,uCAAuC;IACvC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAEnC,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/index.js b/cli-ts/dist-in/index.js new file mode 100644 index 00000000..b1e909f2 --- /dev/null +++ b/cli-ts/dist-in/index.js @@ -0,0 +1,36 @@ +#!/usr/bin/env node +import yargs from "yargs"; +import { hideBin } from "yargs/helpers"; +import * as setupNetworkCommand from "./commands/setup-network.js"; +import * as setupSettingsCommand from "./commands/setup-settings.js"; +import * as setupProfilesCommand from "./commands/setup-profiles.js"; +import * as setupSignalsCommand from "./commands/setup-signals.js"; +//import * as menuCommand from "./commands/menu.js"; +import * as patchConfigCommand from "./commands/patch-config.js"; +// import * as buildProtoCommand from "./commands/build-proto.js"; +import * as wsClientCommand from "./commands/ws-client.js"; +import * as mbCommand from "./commands/mb.js"; +import * as patchAppCommand from "./commands/patch-app.js"; +import * as dumpCommand from "./commands/dump.js"; +import * as restoreCommand from "./commands/restore.js"; +import * as testWebCommand from "./commands/test-web.js"; +// import * as writeCommand from "./commands/write.js"; +yargs(hideBin(process.argv)) + .command(setupNetworkCommand) + .command(setupSettingsCommand) + .command(setupProfilesCommand) + .command(setupSignalsCommand) + //.command(menuCommand as any) + .command(patchConfigCommand) + //.command(buildProtoCommand as any) + .command(wsClientCommand) + .command(mbCommand) + .command(patchAppCommand) + .command(dumpCommand) + .command(restoreCommand) + .command(testWebCommand) + // .command(writeCommand as any) + .demandCommand(1, "You need at least one command before moving on") + .help() + .argv; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/index.js.map b/cli-ts/dist-in/index.js.map new file mode 100644 index 00000000..3d940df7 --- /dev/null +++ b/cli-ts/dist-in/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AACnE,oDAAoD;AACpD,OAAO,KAAK,kBAAkB,MAAM,4BAA4B,CAAC;AACjE,kEAAkE;AAClE,OAAO,KAAK,eAAe,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,eAAe,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAC;AACzD,uDAAuD;AAEvD,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACzB,OAAO,CAAC,mBAA0B,CAAC;KACnC,OAAO,CAAC,oBAA2B,CAAC;KACpC,OAAO,CAAC,oBAA2B,CAAC;KACpC,OAAO,CAAC,mBAA0B,CAAC;IACpC,8BAA8B;KAC7B,OAAO,CAAC,kBAAyB,CAAC;IACnC,qCAAqC;KACpC,OAAO,CAAC,eAAsB,CAAC;KAC/B,OAAO,CAAC,SAAgB,CAAC;KACzB,OAAO,CAAC,eAAsB,CAAC;KAC/B,OAAO,CAAC,WAAkB,CAAC;KAC3B,OAAO,CAAC,cAAqB,CAAC;KAC9B,OAAO,CAAC,cAAqB,CAAC;IAC/B,gCAAgC;KAC/B,aAAa,CAAC,CAAC,EAAE,gDAAgD,CAAC;KAClE,IAAI,EAAE;KACN,IAAI,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/lib/config.js b/cli-ts/dist-in/lib/config.js new file mode 100644 index 00000000..6177d6d4 --- /dev/null +++ b/cli-ts/dist-in/lib/config.js @@ -0,0 +1,31 @@ +import fs from 'fs/promises'; +export async function patchConfig(dst, patch) { + const newLines = [ + '#ifndef CONFIG_USER_H', + '#define CONFIG_USER_H', + '' + ]; + if (patch.features) { + for (const [name, enabled] of Object.entries(patch.features)) { + if (enabled) { + newLines.push(`#define ${name}`); + } + else { + newLines.push(`#undef ${name}`); + } + } + } + if (patch.settings && Object.keys(patch.settings).length > 0) { + newLines.push(''); + for (const [name, value] of Object.entries(patch.settings)) { + const valueFormatted = typeof value === 'string' ? `"${value}"` : String(value); + // Undefine the original before defining the new one to avoid compiler warnings. + newLines.push(`#undef ${name}`); + newLines.push(`#define ${name} ${valueFormatted}`); + } + } + newLines.push(''); + newLines.push('#endif // CONFIG_USER_H'); + await fs.writeFile(dst, newLines.join('\n')); +} +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/lib/config.js.map b/cli-ts/dist-in/lib/config.js.map new file mode 100644 index 00000000..2a55ba72 --- /dev/null +++ b/cli-ts/dist-in/lib/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAO7B,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW,EAAE,KAAkB;IAC/D,MAAM,QAAQ,GAAG;QACf,uBAAuB;QACvB,uBAAuB;QACvB,EAAE;KACH,CAAC;IAEF,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnB,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7D,IAAI,OAAO,EAAE,CAAC;gBACZ,QAAQ,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7D,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3D,MAAM,cAAc,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAChF,gFAAgF;YAChF,QAAQ,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;YAChC,QAAQ,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,cAAc,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAEzC,MAAM,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/C,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/lib/di.js b/cli-ts/dist-in/lib/di.js new file mode 100644 index 00000000..c78a01c1 --- /dev/null +++ b/cli-ts/dist-in/lib/di.js @@ -0,0 +1,315 @@ +import fs from 'fs/promises'; +import { log } from "./logger.js"; +import path from "path"; +import Parser from 'tree-sitter'; +import Cpp from 'tree-sitter-cpp'; +const parser = new Parser(); +parser.setLanguage(Cpp); +// 1. Parse a C++ file and extract all defines (commented and uncommented) +function parseDefines(fileContent) { + const defines = new Map(); + const tree = parser.parse(fileContent); + function traverse(node) { + if (node.type === 'preproc_def') { + const nameNode = node.childForFieldName('name'); + const valueNode = node.childForFieldName('value'); + if (nameNode) { + defines.set(nameNode.text, { + value: valueNode?.text.trim() ?? null, + isComment: false + }); + } + } + else if (node.type === 'comment' && node.text.includes('#define')) { + const match = node.text.match(/#define\s+(\S+)\s*(.*)/); + if (match) { + defines.set(match[1], { + value: match[2].trim() || null, + isComment: true + }); + } + } + else { + for (const child of node.children) { + traverse(child); + } + } + } + traverse(tree.rootNode); + return defines; +} +// 2. Build a map of all possible features from features.h (Feature -> Header) +export async function buildFeatureCatalog(projectRoot) { + const catalog = new Map(); + const featuresPath = path.join(projectRoot, 'src', 'features.h'); + log.silly(`Building feature catalog from: ${featuresPath}`); + const featuresContent = await fs.readFile(featuresPath, 'utf-8'); + const tree = parser.parse(featuresContent); + function findIfdefs(node) { + if (node.type === 'preproc_ifdef') { + const featureName = node.childForFieldName('name')?.text; + const includePath = node.descendantsOfType('preproc_include')[0]?.childForFieldName('path')?.text.replace(/["<>]/g, ''); + if (featureName && includePath) { + catalog.set(featureName, includePath); + } + } + for (const child of node.children) { + findIfdefs(child); + } + } + findIfdefs(tree.rootNode); + log.silly(`Found ${catalog.size} potential features in catalog.`); + return catalog; +} +// 3. Create a map of ClassName -> FeatureFlag for all components +export async function buildClassNameToFeatureMap(featureCatalog, includeDirs) { + const map = new Map(); + // --- AST DUMP LOGIC --- + const astDir = path.join(process.cwd(), 'ast'); + await fs.mkdir(astDir, { recursive: true }); + function serializeNode(node) { + const children = node.children.map(serializeNode); + const result = { type: node.type }; + if (children.length > 0) { + result.children = children; + } + else { + result.text = node.text; + } + return result; + } + // --- END AST DUMP LOGIC --- + for (const [featureFlag, headerFile] of featureCatalog.entries()) { + let absolutePath = null; + for (const dir of includeDirs) { + const testPath = path.join(dir, headerFile); + try { + await fs.stat(testPath); + absolutePath = testPath; + break; + } + catch (e) { /* continue */ } + } + if (absolutePath) { + const content = await fs.readFile(absolutePath, 'utf-8'); + const tree = parser.parse(content); + const className = findClassName(tree.rootNode); + if (className) { + map.set(className, featureFlag); + // --- AST DUMP FOR THIS COMPONENT --- + const astJson = JSON.stringify(serializeNode(tree.rootNode), null, 2); + const componentName = path.basename(headerFile, '.h'); + await fs.writeFile(path.join(astDir, `${componentName}.json`), astJson); + log.info(`[DEBUG] AST for ${componentName} written to ${astDir}`); + // --- END AST DUMP --- + } + } + } + log.silly(`Mapped ${map.size} class names to feature flags by parsing headers.`); + return map; +} +// 4. For a given component header, find its dependencies +export async function analyzeComponentDependencies(headerPath, includeDirs, classNameToFeatureMap) { + const dependencies = new Set(); + let absolutePath = null; + for (const dir of includeDirs) { + const testPath = path.join(dir, headerPath); + try { + await fs.stat(testPath); + absolutePath = testPath; + break; + } + catch (e) { /* continue */ } + } + if (!absolutePath) { + log.warn(`Could not find header file: ${headerPath}`); + return []; + } + log.silly(`Analyzing dependencies for: ${absolutePath}`); + const content = await fs.readFile(absolutePath, 'utf-8'); + const tree = parser.parse(content); + // Find dependencies from constructor + const className = findClassName(tree.rootNode); + if (!className) + return []; + const constructorDeclarations = tree.rootNode.descendantsOfType('constructor_or_destructor_declaration'); + for (const declaration of constructorDeclarations) { + const functionName = declaration.childForFieldName('name')?.text; + if (functionName !== className) + continue; // It's a destructor, skip it + const declarators = declaration.descendantsOfType('function_declarator'); + for (const declarator of declarators) { + const params = declarator.descendantsOfType('parameter_declaration'); + for (const param of params) { + const typeNode = param.descendantsOfType('type_identifier')[0]; + const typeName = typeNode?.text; + if (typeName && classNameToFeatureMap.has(typeName)) { + dependencies.add(classNameToFeatureMap.get(typeName)); + } + } + } + } + return Array.from(dependencies); +} +function findClassName(rootNode) { + const classSpecifier = rootNode.descendantsOfType('class_specifier')[0]; + return classSpecifier?.childForFieldName('name')?.text ?? null; +} +// Main orchestration function +export async function generateFeatureTree(projectRoot) { + // Load and parse config.h + const configPath = path.join(projectRoot, 'src', 'config.h'); + log.silly(`Loading config from: ${configPath}`); + const configContent = await fs.readFile(configPath, 'utf-8'); + const allDefines = parseDefines(configContent); + // Filter for active features + const enabledFeatures = []; + for (const [name, { isComment }] of allDefines.entries()) { + if (name.startsWith('ENABLE_') && !isComment) { + enabledFeatures.push(name); + } + } + log.info(`Found ${enabledFeatures.length} enabled features.`); + // Build the catalog of all possible features + const featureCatalog = await buildFeatureCatalog(projectRoot); + const includeDirs = [ + path.join(projectRoot, 'src'), + path.join(projectRoot, 'lib/polymech-base/src') + ]; + const classNameToFeatureMap = await buildClassNameToFeatureMap(featureCatalog, includeDirs); + const finalTree = {}; + for (const feature of enabledFeatures) { + const headerFile = featureCatalog.get(feature); + if (!headerFile) { + log.warn(`Enabled feature "${feature}" not found in features.h catalog.`); + continue; + } + const dependencies = await analyzeComponentDependencies(headerFile, includeDirs, classNameToFeatureMap); + const settings = {}; + const baseName = feature.replace('ENABLE_', ''); + for (const [define, { value, isComment }] of allDefines.entries()) { + if (!isComment && define.startsWith(baseName + '_') && value) { + settings[define] = value; + } + } + finalTree[feature] = { + headerFile, + dependencies, + settings + }; + } + return finalTree; +} +async function* getFiles(dir) { + const dirents = await fs.readdir(dir, { withFileTypes: true }); + for (const dirent of dirents) { + const res = path.resolve(dir, dirent.name); + if (dirent.isDirectory()) { + yield* getFiles(res); + } + else if (res.endsWith('.h')) { + yield res; + } + } +} +export async function findComponents(includeDirs) { + const componentMap = new Map(); + const parser = new Parser(); + parser.setLanguage(Cpp); + const childByType = (node, type) => { + for (const child of node.children) { + if (child.grammarType === type) { + return child; + } + } + }; + const childrenByType = (node, type) => { + const children = []; + for (const child of node.children) { + if (child.grammarType === type) { + children.push(child); + } + } + }; + for (const dir of includeDirs) { + for await (const f of getFiles(dir)) { + try { + const content = await fs.readFile(f, 'utf-8'); + if (!content) + continue; + const tree = parser.parse(content); + const classNodes = tree.rootNode.descendantsOfType('class_specifier'); + const classNode = classNodes[0]; + if (!classNode) + continue; + const nameNode = childByType(classNode, 'type_identifier'); + if (!nameNode) + continue; + // componentMap.set(nameNode.text, f); + for (const classNode of classNodes) { + const baseClauseNode = childByType(classNode, 'base_class_clause'); + if (!baseClauseNode) + continue; + const nameNode = childByType(baseClauseNode, 'identifier'); + if (!nameNode) + continue; + if (nameNode.text === 'Component') { + const nameNode = childByType(baseClauseNode, 'identifier'); + if (!nameNode) + continue; + componentMap.set(nameNode.text, f); + } + } + } + catch (error) { + log.warn(`Skipping file: ${f}`, error instanceof Error ? error.message : error); + } + } + } + log.info(`Discovered ${componentMap.size} components inheriting from 'Component'.`); + return componentMap; +} +async function getDependencies(classNode, className, componentMap) { + const dependencies = []; + const constructorNode = classNode.descendantsOfType('declaration').find(decl => decl.childForFieldName('declarator')?.childForFieldName('declarator')?.text === className); + if (constructorNode) { + const params = constructorNode.descendantsOfType('parameter_declaration'); + for (const param of params) { + const typeNode = param.childForFieldName('type'); + const typeName = typeNode?.text.replace('*', '').trim(); + if (typeName && componentMap.has(typeName)) { + const headerFile = componentMap.get(typeName); + const depTree = await getComponentTree(typeName, componentMap); + if (depTree) + dependencies.push(depTree); + } + } + } + return Array.from(new Map(dependencies.map(item => [item.name, item])).values()); +} +export async function getComponentTree(targetComponentName, allComponents) { + const headerFile = allComponents.get(targetComponentName); + if (!headerFile) { + log.warn(`Component "${targetComponentName}" not found in component map.`); + return null; + } + const parser = new Parser(); + parser.setLanguage(Cpp); + const content = await fs.readFile(headerFile, 'utf-8'); + const tree = parser.parse(content); + const classNode = tree.rootNode.descendantsOfType('class_specifier') + .find(node => node.childForFieldName('name')?.text === targetComponentName); + if (!classNode) { + log.warn(`Could not find class specifier for "${targetComponentName}" in ${headerFile}`); + return null; + } + const baseComponent = classNode.childForFieldName('base')?.text.replace('public', '').trim() ?? null; + const dependencies = await getDependencies(classNode, targetComponentName, allComponents); + return { + name: targetComponentName, + headerFile: path.relative(path.resolve(headerFile, '..', '..', '..'), headerFile).replace(/\\/g, '/'), + baseComponent, + dependencies + }; +} +//# sourceMappingURL=di.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/lib/di.js.map b/cli-ts/dist-in/lib/di.js.map new file mode 100644 index 00000000..198fbd8c --- /dev/null +++ b/cli-ts/dist-in/lib/di.js.map @@ -0,0 +1 @@ +{"version":3,"file":"di.js","sourceRoot":"","sources":["../../src/lib/di.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAElC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;AAC5B,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAiBxB,0EAA0E;AAC1E,SAAS,YAAY,CAAC,WAAmB;IACrC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAwD,CAAC;IAChF,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAEvC,SAAS,QAAQ,CAAC,IAAuB;QACrC,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAChD,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;YAClD,IAAI,QAAQ,EAAE,CAAC;gBACX,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE;oBACvB,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI;oBACrC,SAAS,EAAE,KAAK;iBACnB,CAAC,CAAC;YACP,CAAC;QACL,CAAC;aAAM,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAClE,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;YACxD,IAAI,KAAK,EAAE,CAAC;gBACR,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;oBAClB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI;oBAC9B,SAAS,EAAE,IAAI;iBAClB,CAAC,CAAC;YACP,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;QACL,CAAC;IACL,CAAC;IACD,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,8EAA8E;AAC9E,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,WAAmB;IACzD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IACjE,GAAG,CAAC,KAAK,CAAC,kCAAkC,YAAY,EAAE,CAAC,CAAC;IAC5D,MAAM,eAAe,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAE3C,SAAS,UAAU,CAAC,IAAuB;QACvC,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YAChC,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC;YACzD,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YACxH,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;gBAC7B,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAC1C,CAAC;QACL,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChC,UAAU,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACL,CAAC;IAED,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,GAAG,CAAC,KAAK,CAAC,SAAS,OAAO,CAAC,IAAI,iCAAiC,CAAC,CAAC;IAClE,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,iEAAiE;AACjE,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,cAAmC,EAAE,WAAqB;IACvG,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEtC,yBAAyB;IACzB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;IAC/C,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,SAAS,aAAa,CAAC,IAAuB;QAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAClD,MAAM,MAAM,GAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QACxC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC5B,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,6BAA6B;IAE7B,KAAK,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC;QAC/D,IAAI,YAAY,GAAkB,IAAI,CAAC;QACvC,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YAC5C,IAAI,CAAC;gBACD,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACxB,YAAY,GAAG,QAAQ,CAAC;gBACxB,MAAM;YACV,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,YAAY,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YACzD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACnC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC/C,IAAI,SAAS,EAAE,CAAC;gBACZ,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;gBAEhC,sCAAsC;gBACtC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;gBACtE,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;gBACtD,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,aAAa,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;gBACxE,GAAG,CAAC,IAAI,CAAC,mBAAmB,aAAa,eAAe,MAAM,EAAE,CAAC,CAAC;gBAClE,uBAAuB;YAC3B,CAAC;QACL,CAAC;IACL,CAAC;IACD,GAAG,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,IAAI,mDAAmD,CAAC,CAAC;IACjF,OAAO,GAAG,CAAC;AACf,CAAC;AAED,yDAAyD;AACzD,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,UAAkB,EAAE,WAAqB,EAAE,qBAA0C;IACpI,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,IAAI,YAAY,GAAkB,IAAI,CAAC;IAEvC,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC;YACD,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxB,YAAY,GAAG,QAAQ,CAAC;YACxB,MAAM;QACV,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,GAAG,CAAC,IAAI,CAAC,+BAA+B,UAAU,EAAE,CAAC,CAAC;QACtD,OAAO,EAAE,CAAC;IACd,CAAC;IAED,GAAG,CAAC,KAAK,CAAC,+BAA+B,YAAY,EAAE,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEnC,qCAAqC;IACrC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/C,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAE1B,MAAM,uBAAuB,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,uCAAuC,CAAC,CAAC;IAEzG,KAAK,MAAM,WAAW,IAAI,uBAAuB,EAAE,CAAC;QAChD,MAAM,YAAY,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC;QACjE,IAAI,YAAY,KAAK,SAAS;YAAE,SAAS,CAAC,6BAA6B;QAEvE,MAAM,WAAW,GAAG,WAAW,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;QAEzE,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACnC,MAAM,MAAM,GAAG,UAAU,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,CAAC;YACrE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBACzB,MAAM,QAAQ,GAAG,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/D,MAAM,QAAQ,GAAG,QAAQ,EAAE,IAAI,CAAC;gBAChC,IAAI,QAAQ,IAAI,qBAAqB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAClD,YAAY,CAAC,GAAG,CAAC,qBAAqB,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC,CAAC;gBAC3D,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,aAAa,CAAC,QAA2B;IAC9C,MAAM,cAAc,GAAG,QAAQ,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,cAAc,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC;AACnE,CAAC;AAED,8BAA8B;AAC9B,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,WAAmB;IAEzD,0BAA0B;IAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAC7D,GAAG,CAAC,KAAK,CAAC,wBAAwB,UAAU,EAAE,CAAC,CAAC;IAChD,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;IAE/C,6BAA6B;IAC7B,MAAM,eAAe,GAAa,EAAE,CAAC;IACrC,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;QACvD,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAC3C,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,SAAS,eAAe,CAAC,MAAM,oBAAoB,CAAC,CAAC;IAE9D,6CAA6C;IAC7C,MAAM,cAAc,GAAG,MAAM,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC9D,MAAM,WAAW,GAAG;QAChB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,uBAAuB,CAAC;KAClD,CAAC;IAEF,MAAM,qBAAqB,GAAG,MAAM,0BAA0B,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAC5F,MAAM,SAAS,GAAmC,EAAE,CAAC;IAErD,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;QACpC,MAAM,UAAU,GAAG,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,GAAG,CAAC,IAAI,CAAC,oBAAoB,OAAO,oCAAoC,CAAC,CAAC;YAC1E,SAAS;QACb,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,4BAA4B,CAAC,UAAU,EAAE,WAAW,EAAE,qBAAqB,CAAC,CAAC;QAExG,MAAM,QAAQ,GAA2B,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAChD,KAAK,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;YAChE,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,GAAG,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC;gBAC3D,QAAQ,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;YAC7B,CAAC;QACL,CAAC;QAED,SAAS,CAAC,OAAO,CAAC,GAAG;YACjB,UAAU;YACV,YAAY;YACZ,QAAQ;SACX,CAAC;IACN,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,KAAK,SAAS,CAAC,CAAC,QAAQ,CAAC,GAAW;IAChC,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;aAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,MAAM,GAAG,CAAC;QACd,CAAC;IACL,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,WAAqB;IACtD,MAAM,YAAY,GAAiB,IAAI,GAAG,EAAE,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAC5B,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAExB,MAAM,WAAW,GAAG,CAAC,IAAuB,EAAE,IAAY,EAAE,EAAE;QAC1D,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChC,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;gBAC7B,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;IACL,CAAC,CAAA;IAED,MAAM,cAAc,GAAG,CAAC,IAAuB,EAAE,IAAY,EAAE,EAAE;QAC7D,MAAM,QAAQ,GAAwB,EAAE,CAAC;QACzC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChC,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;gBAC7B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;QACL,CAAC;IACL,CAAC,CAAA;IAED,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC5B,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,IAAI,CAAC;gBACD,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;gBAC9C,IAAI,CAAC,OAAO;oBAAE,SAAS;gBAEvB,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACnC,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;gBACtE,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;gBAChC,IAAI,CAAC,SAAS;oBAAE,SAAS;gBACzB,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;gBAC3D,IAAI,CAAC,QAAQ;oBAAE,SAAS;gBACxB,sCAAsC;gBAEtC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;oBACjC,MAAM,cAAc,GAAG,WAAW,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;oBACnE,IAAI,CAAC,cAAc;wBAAE,SAAS;oBAC9B,MAAM,QAAQ,GAAG,WAAW,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;oBAC3D,IAAI,CAAC,QAAQ;wBAAE,SAAS;oBAExB,IAAI,QAAQ,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;wBAChC,MAAM,QAAQ,GAAG,WAAW,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;wBAC3D,IAAI,CAAC,QAAQ;4BAAE,SAAS;wBAExB,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;oBACvC,CAAC;gBACL,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACpF,CAAC;QACL,CAAC;IACL,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,cAAc,YAAY,CAAC,IAAI,0CAA0C,CAAC,CAAC;IACpF,OAAO,YAAY,CAAC;AACxB,CAAC;AAED,KAAK,UAAU,eAAe,CAC1B,SAA4B,EAC5B,SAAiB,EACjB,YAA0B;IAE1B,MAAM,YAAY,GAAoB,EAAE,CAAC;IACzC,MAAM,eAAe,GAAG,SAAS,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3E,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,EAAE,IAAI,KAAK,SAAS,CAC5F,CAAC;IAEF,IAAI,eAAe,EAAE,CAAC;QAClB,MAAM,MAAM,GAAG,eAAe,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,CAAC;QAC1E,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM,QAAQ,GAAG,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YAExD,IAAI,QAAQ,IAAI,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACzC,MAAM,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;gBAC/C,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;gBAC/D,IAAI,OAAO;oBAAE,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5C,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,mBAA2B,EAC3B,aAA2B;IAE3B,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAC1D,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,GAAG,CAAC,IAAI,CAAC,cAAc,mBAAmB,+BAA+B,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAC5B,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACxB,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEnC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,iBAAiB,CAAC;SAC/D,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,KAAK,mBAAmB,CAAC,CAAC;IAEhF,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,GAAG,CAAC,IAAI,CAAC,uCAAuC,mBAAmB,QAAQ,UAAU,EAAE,CAAC,CAAC;QACzF,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,aAAa,GAAG,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IACrG,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,SAAS,EAAE,mBAAmB,EAAE,aAAa,CAAC,CAAC;IAE1F,OAAO;QACH,IAAI,EAAE,mBAAmB;QACzB,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACrG,aAAa;QACb,YAAY;KACf,CAAC;AACN,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/lib/logger.js b/cli-ts/dist-in/lib/logger.js new file mode 100644 index 00000000..e53661bc --- /dev/null +++ b/cli-ts/dist-in/lib/logger.js @@ -0,0 +1,9 @@ +import { Logger } from "tslog"; +// Create a shared logger instance with custom configuration +// "we dont need the script path nor linenumbers" +export const log = new Logger({ + prettyLogTemplate: "{{yyyy}}-{{mm}}-{{dd}} {{hh}}:{{MM}}:{{ss}}\t{{logLevelName}}\t", +}); +// Optionally export a factory if we need creating separate named instances later, +// but for now a singleton `log` is sufficient for the user requirement. +//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/lib/logger.js.map b/cli-ts/dist-in/lib/logger.js.map new file mode 100644 index 00000000..5f858c60 --- /dev/null +++ b/cli-ts/dist-in/lib/logger.js.map @@ -0,0 +1 @@ +{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,4DAA4D;AAC5D,iDAAiD;AACjD,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC;IAC1B,iBAAiB,EAAE,iEAAiE;CACvF,CAAC,CAAC;AAEH,kFAAkF;AAClF,wEAAwE"} \ No newline at end of file diff --git a/cli-ts/dist-in/lib/modbus-client.js b/cli-ts/dist-in/lib/modbus-client.js new file mode 100644 index 00000000..b2bc4d15 --- /dev/null +++ b/cli-ts/dist-in/lib/modbus-client.js @@ -0,0 +1,146 @@ +import { log } from "./logger.js"; +import net from "net"; +export var E_FN_CODE; +(function (E_FN_CODE) { + E_FN_CODE[E_FN_CODE["FN_ANY_FUNCTION_CODE"] = 0] = "FN_ANY_FUNCTION_CODE"; + E_FN_CODE[E_FN_CODE["FN_READ_COIL"] = 1] = "FN_READ_COIL"; + E_FN_CODE[E_FN_CODE["FN_READ_DISCR_INPUT"] = 2] = "FN_READ_DISCR_INPUT"; + E_FN_CODE[E_FN_CODE["FN_READ_HOLD_REGISTER"] = 3] = "FN_READ_HOLD_REGISTER"; + E_FN_CODE[E_FN_CODE["FN_READ_INPUT_REGISTER"] = 4] = "FN_READ_INPUT_REGISTER"; + E_FN_CODE[E_FN_CODE["FN_WRITE_COIL"] = 5] = "FN_WRITE_COIL"; + E_FN_CODE[E_FN_CODE["FN_WRITE_HOLD_REGISTER"] = 6] = "FN_WRITE_HOLD_REGISTER"; + E_FN_CODE[E_FN_CODE["FN_READ_EXCEPTION_SERIAL"] = 7] = "FN_READ_EXCEPTION_SERIAL"; + E_FN_CODE[E_FN_CODE["FN_DIAGNOSTICS_SERIAL"] = 8] = "FN_DIAGNOSTICS_SERIAL"; + E_FN_CODE[E_FN_CODE["FN_READ_COMM_CNT_SERIAL"] = 11] = "FN_READ_COMM_CNT_SERIAL"; + E_FN_CODE[E_FN_CODE["FN_READ_COMM_LOG_SERIAL"] = 12] = "FN_READ_COMM_LOG_SERIAL"; + E_FN_CODE[E_FN_CODE["FN_WRITE_MULT_COILS"] = 15] = "FN_WRITE_MULT_COILS"; + E_FN_CODE[E_FN_CODE["FN_WRITE_MULT_REGISTERS"] = 16] = "FN_WRITE_MULT_REGISTERS"; + E_FN_CODE[E_FN_CODE["FN_REPORT_SERVER_ID_SERIAL"] = 17] = "FN_REPORT_SERVER_ID_SERIAL"; + E_FN_CODE[E_FN_CODE["FN_READ_FILE_RECORD"] = 20] = "FN_READ_FILE_RECORD"; + E_FN_CODE[E_FN_CODE["FN_WRITE_FILE_RECORD"] = 21] = "FN_WRITE_FILE_RECORD"; + E_FN_CODE[E_FN_CODE["FN_MASK_WRITE_REGISTER"] = 22] = "FN_MASK_WRITE_REGISTER"; + E_FN_CODE[E_FN_CODE["FN_R_W_MULT_REGISTERS"] = 23] = "FN_R_W_MULT_REGISTERS"; + E_FN_CODE[E_FN_CODE["FN_READ_FIFO_QUEUE"] = 24] = "FN_READ_FIFO_QUEUE"; + E_FN_CODE[E_FN_CODE["FN_ENCAPSULATED_INTERFACE"] = 43] = "FN_ENCAPSULATED_INTERFACE"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_41"] = 65] = "FN_USER_DEFINED_41"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_42"] = 66] = "FN_USER_DEFINED_42"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_43"] = 67] = "FN_USER_DEFINED_43"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_44"] = 68] = "FN_USER_DEFINED_44"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_45"] = 69] = "FN_USER_DEFINED_45"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_46"] = 70] = "FN_USER_DEFINED_46"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_47"] = 71] = "FN_USER_DEFINED_47"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_48"] = 72] = "FN_USER_DEFINED_48"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_64"] = 100] = "FN_USER_DEFINED_64"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_65"] = 101] = "FN_USER_DEFINED_65"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_66"] = 102] = "FN_USER_DEFINED_66"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_67"] = 103] = "FN_USER_DEFINED_67"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_68"] = 104] = "FN_USER_DEFINED_68"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_69"] = 105] = "FN_USER_DEFINED_69"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_6A"] = 106] = "FN_USER_DEFINED_6A"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_6B"] = 107] = "FN_USER_DEFINED_6B"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_6C"] = 108] = "FN_USER_DEFINED_6C"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_6D"] = 109] = "FN_USER_DEFINED_6D"; + E_FN_CODE[E_FN_CODE["FN_USER_DEFINED_6E"] = 110] = "FN_USER_DEFINED_6E"; + E_FN_CODE[E_FN_CODE["FN_NONE"] = 255] = "FN_NONE"; +})(E_FN_CODE || (E_FN_CODE = {})); +export var E_ModbusAccess; +(function (E_ModbusAccess) { + E_ModbusAccess[E_ModbusAccess["MB_ACCESS_NONE"] = 0] = "MB_ACCESS_NONE"; + E_ModbusAccess[E_ModbusAccess["MB_ACCESS_READ_ONLY"] = 1] = "MB_ACCESS_READ_ONLY"; + E_ModbusAccess[E_ModbusAccess["MB_ACCESS_WRITE_ONLY"] = 2] = "MB_ACCESS_WRITE_ONLY"; + E_ModbusAccess[E_ModbusAccess["MB_ACCESS_READ_WRITE"] = 3] = "MB_ACCESS_READ_WRITE"; +})(E_ModbusAccess || (E_ModbusAccess = {})); +export class ModbusClient { + host; + port; + client; + constructor(host, port) { + this.host = host; + this.port = port; + this.client = new net.Socket(); + } + connect() { + return new Promise((resolve, reject) => { + this.client.connect(this.port, this.host, () => { + log.info("Connected to Modbus server"); + resolve(); + }); + this.client.on('error', (err) => { + log.error("Connection error:", err); + reject(err); + }); + }); + } + disconnect() { + this.client.end(); + log.info("Disconnected from Modbus server"); + } + sendRequest(unitId, functionCode, data) { + return new Promise((resolve, reject) => { + const transactionId = Math.floor(Math.random() * 65535); + const protocolId = 0; // Modbus protocol + const pdu = Buffer.concat([Buffer.from([functionCode]), data]); + const length = 1 + pdu.length; + const header = Buffer.alloc(7); + header.writeUInt16BE(transactionId, 0); + header.writeUInt16BE(protocolId, 2); + header.writeUInt16BE(length, 4); + header.writeUInt8(unitId, 6); + const request = Buffer.concat([header, pdu]); + this.client.once('data', (response) => { + const responseTransactionId = response.readUInt16BE(0); + if (responseTransactionId !== transactionId) { + return reject(new Error("Transaction ID mismatch")); + } + const responseFunctionCode = response.readUInt8(7); + if (responseFunctionCode > 0x80) { + const errorCode = response.readUInt8(8); + return reject(new Error(`Modbus Exception (FC: ${functionCode}): ${errorCode}`)); + } + resolve(response.subarray(8)); + }); + this.client.write(request); + }); + } + async writeHoldingRegister(address, value, unitId = 1) { + const data = Buffer.alloc(4); + data.writeUInt16BE(address, 0); + data.writeUInt16BE(value, 2); + await this.sendRequest(unitId, E_FN_CODE.FN_WRITE_HOLD_REGISTER, data); + } + async writeCoil(address, value, unitId = 1) { + const data = Buffer.alloc(4); + data.writeUInt16BE(address, 0); + data.writeUInt16BE(value ? 0xFF00 : 0x0000, 2); + await this.sendRequest(unitId, E_FN_CODE.FN_WRITE_COIL, data); + } + async readHoldingRegisters(address, count, unitId = 1) { + const data = Buffer.alloc(4); + data.writeUInt16BE(address, 0); + data.writeUInt16BE(count, 2); + const response = await this.sendRequest(unitId, E_FN_CODE.FN_READ_HOLD_REGISTER, data); + const byteCount = response[0]; + const values = []; + for (let i = 0; i < byteCount / 2; i++) { + values.push(response.readUInt16BE(1 + i * 2)); + } + return values; + } + async readCoils(address, count, unitId = 1) { + const data = Buffer.alloc(4); + data.writeUInt16BE(address, 0); + data.writeUInt16BE(count, 2); + const response = await this.sendRequest(unitId, E_FN_CODE.FN_READ_COIL, data); + const byteCount = response[0]; + const values = []; + for (let i = 0; i < byteCount; i++) { + for (let j = 0; j < 8; j++) { + if (values.length < count) { + values.push((response[1 + i] & (1 << j)) !== 0); + } + } + } + return values; + } +} +//# sourceMappingURL=modbus-client.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/lib/modbus-client.js.map b/cli-ts/dist-in/lib/modbus-client.js.map new file mode 100644 index 00000000..386d3ed8 --- /dev/null +++ b/cli-ts/dist-in/lib/modbus-client.js.map @@ -0,0 +1 @@ +{"version":3,"file":"modbus-client.js","sourceRoot":"","sources":["../../src/lib/modbus-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,MAAM,CAAN,IAAY,SAyCX;AAzCD,WAAY,SAAS;IACjB,yEAA2B,CAAA;IAC3B,yDAAmB,CAAA;IACnB,uEAA0B,CAAA;IAC1B,2EAA4B,CAAA;IAC5B,6EAA6B,CAAA;IAC7B,2DAAoB,CAAA;IACpB,6EAA6B,CAAA;IAC7B,iFAA+B,CAAA;IAC/B,2EAA4B,CAAA;IAC5B,gFAA8B,CAAA;IAC9B,gFAA8B,CAAA;IAC9B,wEAA0B,CAAA;IAC1B,gFAA8B,CAAA;IAC9B,sFAAiC,CAAA;IACjC,wEAA0B,CAAA;IAC1B,0EAA2B,CAAA;IAC3B,8EAA6B,CAAA;IAC7B,4EAA4B,CAAA;IAC5B,sEAAyB,CAAA;IACzB,oFAAgC,CAAA;IAChC,sEAAyB,CAAA;IACzB,sEAAyB,CAAA;IACzB,sEAAyB,CAAA;IACzB,sEAAyB,CAAA;IACzB,sEAAyB,CAAA;IACzB,sEAAyB,CAAA;IACzB,sEAAyB,CAAA;IACzB,sEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,uEAAyB,CAAA;IACzB,iDAAc,CAAA;AAClB,CAAC,EAzCW,SAAS,KAAT,SAAS,QAyCpB;AACD,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACtB,uEAAkB,CAAA;IAClB,iFAAuB,CAAA;IACvB,mFAAwB,CAAA;IACxB,mFAAwB,CAAA;AAC5B,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAwBD,MAAM,OAAO,YAAY;IACb,IAAI,CAAS;IACb,IAAI,CAAS;IACb,MAAM,CAAa;IAE3B,YAAY,IAAY,EAAE,IAAY;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;IACnC,CAAC;IAED,OAAO;QACH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE;gBAC3C,GAAG,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;gBACvC,OAAO,EAAE,CAAC;YACd,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;gBAC5B,GAAG,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;gBACpC,MAAM,CAAC,GAAG,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED,UAAU;QACN,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAClB,GAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAChD,CAAC;IAEO,WAAW,CAAC,MAAc,EAAE,YAAoB,EAAE,IAAY;QAClE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC;YACxD,MAAM,UAAU,GAAG,CAAC,CAAC,CAAC,kBAAkB;YAExC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;YAC/D,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;YAE9B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/B,MAAM,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;YACvC,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;YACpC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YAChC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YAE7B,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;YAE7C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAClC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBACvD,IAAI,qBAAqB,KAAK,aAAa,EAAE,CAAC;oBAC1C,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC;gBACxD,CAAC;gBACD,MAAM,oBAAoB,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;gBACnD,IAAI,oBAAoB,GAAG,IAAI,EAAE,CAAC;oBAC9B,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;oBACxC,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,YAAY,MAAM,SAAS,EAAE,CAAC,CAAC,CAAC;gBACrF,CAAC;gBACD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,OAAe,EAAE,KAAa,EAAE,SAAiB,CAAC;QACzE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC7B,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAe,EAAE,KAAc,EAAE,SAAiB,CAAC;QAC/D,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC/C,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,OAAe,EAAE,KAAa,EAAE,SAAiB,CAAC;QACzE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC7B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;QAEvF,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAe,EAAE,KAAa,EAAE,SAAiB,CAAC;QAC9D,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC7B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAE9E,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAc,EAAE,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;YACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBACzB,IAAI,MAAM,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;oBACxB,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACpD,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"} \ No newline at end of file diff --git a/cli-ts/dist-in/lib/pb-decoder.js b/cli-ts/dist-in/lib/pb-decoder.js new file mode 100644 index 00000000..41293081 --- /dev/null +++ b/cli-ts/dist-in/lib/pb-decoder.js @@ -0,0 +1,62 @@ +import pkg from 'protobufjs'; +const { Reader } = pkg; +/** + * Decodes a NetworkValue update from a Protobuf binary buffer. + * This is a manual implementation based on the schema defined in the documentation, + * as we are not using .proto files on the client. + * @param buffer The binary buffer received from the WebSocket. + * @returns A structured object with the decoded data. + */ +export function decodeNetworkValue(buffer) { + const reader = Reader.create(buffer); + const result = {}; + let value = null; + while (reader.pos < reader.len) { + const tag = reader.uint32(); + // The field number is the upper 3 bits of the tag. + const fieldNumber = tag >>> 3; + // The wire type is the lower 3 bits of the tag. + const wireType = tag & 7; + switch (fieldNumber) { + case 1: // address + result.address = reader.uint32(); + break; + case 2: // timestamp + // Timestamps are uint64. JS numbers can lose precision for very large values, + // but for millis() this is safe for a very long time. + result.timestamp = reader.uint64(); + break; + case 3: // sint_value + value = reader.sint64(); + break; + case 4: // bool_value + value = reader.bool(); + break; + case 5: // float_value + value = reader.float(); + break; + case 6: // bytes_value + const bytes = Buffer.from(reader.bytes()); + // Assuming bytes are an array of 32-bit signed integers (4 bytes each) + if (bytes.length > 0 && bytes.length % 4 === 0) { + const numbers = []; + for (let i = 0; i < bytes.length; i += 4) { + numbers.push(bytes.readInt32LE(i)); + } + value = numbers; + } + else { + // If not a multiple of 4, treat as a raw buffer + value = bytes; + } + break; + default: + // Skip unknown fields to maintain forward compatibility. + reader.skipType(wireType); + break; + } + } + result.value = value; + return result; +} +//# sourceMappingURL=pb-decoder.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/lib/pb-decoder.js.map b/cli-ts/dist-in/lib/pb-decoder.js.map new file mode 100644 index 00000000..58ebc36e --- /dev/null +++ b/cli-ts/dist-in/lib/pb-decoder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pb-decoder.js","sourceRoot":"","sources":["../../src/lib/pb-decoder.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;AAQvB;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,MAAM,GAAuB,EAAE,CAAC;IACtC,IAAI,KAAK,GAAQ,IAAI,CAAC;IAEtB,OAAO,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5B,mDAAmD;QACnD,MAAM,WAAW,GAAG,GAAG,KAAK,CAAC,CAAC;QAC9B,gDAAgD;QAChD,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC;QAEzB,QAAQ,WAAW,EAAE,CAAC;YACpB,KAAK,CAAC,EAAE,UAAU;gBAChB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;gBACjC,MAAM;YACR,KAAK,CAAC,EAAE,YAAY;gBAClB,8EAA8E;gBAC9E,sDAAsD;gBACtD,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAuB,CAAC;gBACxD,MAAM;YACR,KAAK,CAAC,EAAE,aAAa;gBACnB,KAAK,GAAG,MAAM,CAAC,MAAM,EAAuB,CAAC;gBAC7C,MAAM;YACR,KAAK,CAAC,EAAE,aAAa;gBACnB,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;gBACtB,MAAM;YACR,KAAK,CAAC,EAAE,cAAc;gBACpB,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;gBACvB,MAAM;YACR,KAAK,CAAC,EAAE,cAAc;gBACpB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;gBAC1C,uEAAuE;gBACvE,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC7C,MAAM,OAAO,GAAa,EAAE,CAAC;oBAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;wBACvC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;oBACvC,CAAC;oBACD,KAAK,GAAG,OAAO,CAAC;gBACpB,CAAC;qBAAM,CAAC;oBACJ,gDAAgD;oBAChD,KAAK,GAAG,KAAK,CAAC;gBAClB,CAAC;gBACD,MAAM;YACR;gBACE,yDAAyD;gBACzD,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAC1B,MAAM;QACV,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IAErB,OAAO,MAAmB,CAAC;AAC7B,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/schemas/network-schema.js b/cli-ts/dist-in/schemas/network-schema.js new file mode 100644 index 00000000..49306cd9 --- /dev/null +++ b/cli-ts/dist-in/schemas/network-schema.js @@ -0,0 +1,17 @@ +import { z } from 'zod'; +export const networkSettingsSchema = z.object({ + sta_ssid: z.string().optional(), + sta_password: z.string().optional(), + sta_local_ip: z.string().ip({ version: 'v4' }).optional(), + sta_gateway: z.string().ip({ version: 'v4' }).optional(), + sta_subnet: z.string().ip({ version: 'v4' }).optional(), + sta_primary_dns: z.string().ip({ version: 'v4' }).optional(), + sta_secondary_dns: z.string().ip({ version: 'v4' }).optional(), + ap_ssid: z.string().optional(), + ap_password: z.string().optional(), + ap_config_ip: z.string().ip({ version: 'v4' }).optional(), + ap_config_gateway: z.string().ip({ version: 'v4' }).optional(), + ap_config_subnet: z.string().ip({ version: 'v4' }).optional(), + hostname: z.string().optional(), +}); +//# sourceMappingURL=network-schema.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/schemas/network-schema.js.map b/cli-ts/dist-in/schemas/network-schema.js.map new file mode 100644 index 00000000..f56264ad --- /dev/null +++ b/cli-ts/dist-in/schemas/network-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"network-schema.js","sourceRoot":"","sources":["../../src/schemas/network-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;IACzD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;IACvD,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5D,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC9D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;IACzD,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC9D,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC7D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/schemas/profiles-schema.js b/cli-ts/dist-in/schemas/profiles-schema.js new file mode 100644 index 00000000..5fae14f5 --- /dev/null +++ b/cli-ts/dist-in/schemas/profiles-schema.js @@ -0,0 +1,18 @@ +import { z } from "zod"; +export const controlPointSchema = z.object({ + x: z.number(), + y: z.number(), +}); +export const profileSchema = z.object({ + slot: z.number(), + duration: z.number(), + name: z.string(), + max: z.number(), + enabled: z.boolean(), + signalPlot: z.number(), + description: z.string(), + controlPoints: z.array(controlPointSchema).optional(), + targetRegisters: z.array(z.number()).optional(), +}); +export const profilesSchema = profileSchema; +//# sourceMappingURL=profiles-schema.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/schemas/profiles-schema.js.map b/cli-ts/dist-in/schemas/profiles-schema.js.map new file mode 100644 index 00000000..d3fa4eb7 --- /dev/null +++ b/cli-ts/dist-in/schemas/profiles-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"profiles-schema.js","sourceRoot":"","sources":["../../src/schemas/profiles-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;IACb,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;IACrD,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAA"} \ No newline at end of file diff --git a/cli-ts/dist-in/schemas/settings-schema.js b/cli-ts/dist-in/schemas/settings-schema.js new file mode 100644 index 00000000..e5adfa6e --- /dev/null +++ b/cli-ts/dist-in/schemas/settings-schema.js @@ -0,0 +1,30 @@ +import { z } from "zod"; +const settingValueSchema = z.union([z.string(), z.number(), z.boolean()]); +const settingSchema = z.object({ + enabled: z.boolean(), + id: z.number(), + name: z.string(), + group: z.string(), + flags: z.number(), + parent: z.number(), + type: z.string(), + value: settingValueSchema, +}); +const controllerSchema = z.object({ + slaveid: z.number(), + name: z.string(), + enabled: z.boolean(), +}); +const partitionSchema = z.object({ + name: z.string(), + controllers: z.array(controllerSchema), + startslaveid: z.number().optional(), + numcontrollers: z.number().optional(), +}); +export const settingsSchema = z.object({ + master: z.string(), + slaves: z.array(z.string()), + partitions: z.array(partitionSchema), + settings: z.array(settingSchema), +}); +//# sourceMappingURL=settings-schema.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/schemas/settings-schema.js.map b/cli-ts/dist-in/schemas/settings-schema.js.map new file mode 100644 index 00000000..169587fb --- /dev/null +++ b/cli-ts/dist-in/schemas/settings-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"settings-schema.js","sourceRoot":"","sources":["../../src/schemas/settings-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAE1E,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,kBAAkB;CAC1B,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IACtC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3B,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;CACjC,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/schemas/signal-plots-schema.js b/cli-ts/dist-in/schemas/signal-plots-schema.js new file mode 100644 index 00000000..83fcad48 --- /dev/null +++ b/cli-ts/dist-in/schemas/signal-plots-schema.js @@ -0,0 +1,40 @@ +import { z } from "zod"; +export const signalTypeEnum = z.enum([ + "NONE", + "MB_WRITE_COIL", + "MB_WRITE_HOLDING_REGISTER", + "CALL_METHOD", + "CALL_FUNCTION", + "CALL_REST", + "GPIO_WRITE", + "DISPLAY_MESSAGE", + "USER_DEFINED", + "PAUSE_PROFILE", +]); +export const signalStateEnum = z.enum([ + "STATE_NONE", + "STATE_ERROR", + "STATE_ON", + "STATE_OFF", + "STATE_CUSTOM_1", +]); +export const signalControlPointSchema = z.object({ + id: z.number(), + time: z.number(), + state: z.number(), + type: z.number(), + arg_0: z.number(), + arg_1: z.number(), + arg_2: z.number().optional(), + user: z.any().optional(), + name: z.string().optional(), + description: z.string().optional(), +}); +export const signalPlotSchema = z.object({ + name: z.string(), + duration: z.number(), + slot: z.number(), + controlPoints: z.array(signalControlPointSchema), +}); +export const signalPlotsSchema = z.array(signalPlotSchema); +//# sourceMappingURL=signal-plots-schema.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/schemas/signal-plots-schema.js.map b/cli-ts/dist-in/schemas/signal-plots-schema.js.map new file mode 100644 index 00000000..9ba14357 --- /dev/null +++ b/cli-ts/dist-in/schemas/signal-plots-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signal-plots-schema.js","sourceRoot":"","sources":["../../src/schemas/signal-plots-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;IACnC,MAAM;IACN,eAAe;IACf,2BAA2B;IAC3B,aAAa;IACb,eAAe;IACf,WAAW;IACX,YAAY;IACZ,iBAAiB;IACjB,cAAc;IACd,eAAe;CAChB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,YAAY;IACZ,aAAa;IACb,UAAU;IACV,WAAW;IACX,gBAAgB;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC;CACjD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/dist-in/types.js b/cli-ts/dist-in/types.js new file mode 100644 index 00000000..718fd38a --- /dev/null +++ b/cli-ts/dist-in/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/cli-ts/dist-in/types.js.map b/cli-ts/dist-in/types.js.map new file mode 100644 index 00000000..c768b790 --- /dev/null +++ b/cli-ts/dist-in/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/cli-ts/network-piq-master.json b/cli-ts/network-piq-master.json new file mode 100644 index 00000000..2081f7e8 --- /dev/null +++ b/cli-ts/network-piq-master.json @@ -0,0 +1,15 @@ +{ + "sta_ssid": "Plastiq", + "sta_password": "4GFFvS5u29", + "sta_local_ip": "100.10.100.250", + "sta_gateway": "10.10.100.1", + "sta_subnet": "255.255.255.0", + "sta_primary_dns": "100.10.100.1", + "sta_secondary_dns": "100.10.100.1", + "ap_ssid": "PolyMechAP", + "ap_password": "poly1234", + "ap_config_ip": "192.168.4.1", + "ap_config_gateway": "192.168.4.1", + "ap_config_subnet": "255.255.255.240", + "hostname": "cassandra-master-cat" +} \ No newline at end of file diff --git a/cli-ts/network-piq-slave.json b/cli-ts/network-piq-slave.json new file mode 100644 index 00000000..6436c7f6 --- /dev/null +++ b/cli-ts/network-piq-slave.json @@ -0,0 +1,15 @@ +{ + "sta_ssid": "Plastiq", + "sta_password": "4GFFvS5u29", + "sta_local_ip": "100.10.100.251", + "sta_gateway": "10.10.100.1", + "sta_subnet": "255.255.255.0", + "sta_primary_dns": "100.10.100.1", + "sta_secondary_dns": "100.10.100.1", + "ap_ssid": "PolyMechAP", + "ap_password": "poly1234", + "ap_config_ip": "192.168.4.1", + "ap_config_gateway": "192.168.4.1", + "ap_config_subnet": "255.255.255.240", + "hostname": "cassandra-master-cat" +} \ No newline at end of file diff --git a/cli-ts/network.json b/cli-ts/network.json new file mode 100644 index 00000000..af877b45 --- /dev/null +++ b/cli-ts/network.json @@ -0,0 +1,15 @@ +{ + "sta_ssid": "Livebox6-EBCD", + "sta_password": "c4RK35h4PZNS", + "sta_local_ip": "192.168.1.252", + "sta_gateway": "192.168.1.1", + "sta_subnet": "255.255.0.0", + "sta_primary_dns": "8.8.8.8", + "sta_secondary_dns": "8.8.4.4", + "ap_ssid": "PolyMechAP", + "ap_password": "poly1234", + "ap_config_ip": "192.168.4.1", + "ap_config_gateway": "192.168.4.1", + "ap_config_subnet": "255.255.255.240", + "hostname": "cassandra-master-cat" +} \ No newline at end of file diff --git a/cli-ts/package-lock.json b/cli-ts/package-lock.json new file mode 100644 index 00000000..a249c430 --- /dev/null +++ b/cli-ts/package-lock.json @@ -0,0 +1,8225 @@ +{ + "name": "pm-config", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "pm-config", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@polymech/client-ts": "file:../web/packages/client", + "@polymech/commons": "file:../../polymech-mono/packages/commons", + "@polymech/fs": "file:../../polymech-mono/packages/fs", + "@types/jsonpath-plus": "^5.0.5", + "@types/unist": "^3.0.3", + "cheerio": "^1.1.0", + "env-var": "^7.5.0", + "ink": "^6.0.1", + "jsmodbus": "^4.0.6", + "jsonpath-plus": "^10.3.0", + "nexe": "^5.0.0-beta.4", + "protobufjs": "^7.5.3", + "tree-sitter": "^0.21.1", + "tree-sitter-cpp": "^0.23.4", + "ts-node": "^10.9.2", + "tslog": "^4.9.3", + "utf-8-validate": "^6.0.5", + "ws": "^8.18.0", + "yargs": "^17.7.2", + "zod": "^3.22.4" + }, + "bin": { + "pm-config": "dist-in/index.js" + }, + "devDependencies": { + "@types/node": "^20.19.11", + "@types/ws": "^8.5.11", + "@types/yargs": "^17.0.32", + "typescript": "^5.3.3", + "vitest": "^1.6.0", + "webpack": "^5.101.3", + "webpack-cli": "^6.0.1", + "webpack-visualizer-plugin2": "^2.0.0" + } + }, + "../../polymech-mono/packages/commons": { + "name": "@polymech/commons", + "version": "0.2.6", + "license": "BSD", + "dependencies": { + "@polymech/core": "file:../core", + "@polymech/fs": "file:../fs", + "@repo/typescript-config": "file:../typescript-config", + "@schemastore/package": "^0.0.10", + "ansi-regex": "^6.2.2", + "env-var": "^7.5.0", + "glob": "^10.4.5", + "js-yaml": "^4.1.0", + "jsonpath-plus": "^10.3.0", + "normalize-url": "^8.0.1", + "p-map": "^7.0.3", + "p-throttle": "^4.1.1", + "regedit": "^5.1.4", + "tslog": "^3.3.3", + "tsup": "^2.0.3", + "yargs": "^17.7.2", + "zod": "^3.24.3", + "zod-to-json-schema": "^3.24.5", + "zod-to-ts": "^1.2.0" + }, + "bin": { + "pm-cli": "dist/main.js" + }, + "devDependencies": { + "@types/node": "^22.12.0", + "typescript": "^5.7.3" + } + }, + "../../polymech-mono/packages/fs": { + "name": "@polymech/fs", + "version": "0.13.41", + "license": "BSD-3-Clause", + "dependencies": { + "@polymech/core": "file:../core", + "@repo/typescript-config": "file:../typescript-config", + "denodeify": "^1.2.1", + "glob": "^10.4.1", + "mime": "^2.0.3", + "minimatch": "^10.0.1", + "mkdirp": "^3.0.1", + "q": "^1.4.1", + "rimraf": "^6.0.1", + "write-file-atomic": "^6.0.0", + "yargs": "^17.7.2" + }, + "devDependencies": { + "@types/denodeify": "^1.2.31", + "@types/mime": "^2.0.0", + "@types/node": "^22.10.2", + "fs-extra": "^4.0.2", + "globals": "^15.14.0", + "ts-node": "^10.9.1", + "typescript": "^5.7.2" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "../web/packages/client": { + "name": "@polymech/client-ts", + "version": "0.0.1", + "dependencies": { + "buffer": "^6.0.3", + "class-variance-authority": "^0.7.1", + "clsx": "^2.1.1", + "cmdk": "^1.0.0", + "date-fns": "^3.6.0", + "embla-carousel-react": "^8.3.0", + "input-otp": "^1.2.4", + "lucide-react": "^0.462.0", + "modbus-serial": "^8.0.16", + "protobufjs": "^7.5.3", + "sonner": "^1.5.0", + "stream-browserify": "^3.0.0", + "vaul": "^0.9.3", + "zod": "^3.23.8" + }, + "devDependencies": { + "@eslint/js": "^9.9.0", + "@types/node": "^22.15.3", + "globals": "^15.9.0", + "typescript": "^5.5.3", + "typescript-eslint": "^8.0.1", + "vite": "^5.4.1" + } + }, + "node_modules/@alcalzone/ansi-tokenize": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@alcalzone/ansi-tokenize/-/ansi-tokenize-0.2.4.tgz", + "integrity": "sha512-HTgrrTgZ9Jgeo6Z3oqbQ7lifOVvRR14vaDuBGPPUxk9Thm+vObaO4QfYYYWw4Zo5CWQDBEfsinFA6Gre+AqwNQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@calebboyd/semaphore": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@calebboyd/semaphore/-/semaphore-1.3.1.tgz", + "integrity": "sha512-17z9me12RgAEcMhIgR7f+BiXKbzwF9p1VraI69OxrUUSWGuSMOyOTEHQNVtMKuVrkEDVD0/Av5uiGZPBMYZljw==", + "license": "MIT" + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@discoveryjs/json-ext": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.6.3.tgz", + "integrity": "sha512-4B4OijXeVNOPZlYA2oEwWOTkzyltLao+xbotHQeqN++Rv27Y6s818+n2Qkp8q+Fxhn0t/5lA5X1Mxktud8eayQ==", + "license": "MIT", + "engines": { + "node": ">=14.17.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/gen-mapping/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz", + "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==", + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "node_modules/@jridgewell/source-map/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@jsep-plugin/assignment": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@jsep-plugin/assignment/-/assignment-1.3.0.tgz", + "integrity": "sha512-VVgV+CXrhbMI3aSusQyclHkenWSAm95WaiKrMxRFam3JSUiIaQjoMIw2sEs/OX4XifnqeQUN4DYbJjlA8EfktQ==", + "license": "MIT", + "engines": { + "node": ">= 10.16.0" + }, + "peerDependencies": { + "jsep": "^0.4.0||^1.0.0" + } + }, + "node_modules/@jsep-plugin/regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@jsep-plugin/regex/-/regex-1.0.4.tgz", + "integrity": "sha512-q7qL4Mgjs1vByCaTnDFcBnV9HS7GVPJX5vyVoCgZHNSC9rjwIlmbXG5sUuorR5ndfHAIlJ8pVStxvjXHbNvtUg==", + "license": "MIT", + "engines": { + "node": ">= 10.16.0" + }, + "peerDependencies": { + "jsep": "^0.4.0||^1.0.0" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@polymech/client-ts": { + "resolved": "../web/packages/client", + "link": true + }, + "node_modules/@polymech/commons": { + "resolved": "../../polymech-mono/packages/commons", + "link": true + }, + "node_modules/@polymech/fs": { + "resolved": "../../polymech-mono/packages/fs", + "link": true + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "license": "BSD-3-Clause" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.57.1.tgz", + "integrity": "sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.57.1.tgz", + "integrity": "sha512-dQaAddCY9YgkFHZcFNS/606Exo8vcLHwArFZ7vxXq4rigo2bb494/xKMMwRRQW6ug7Js6yXmBZhSBRuBvCCQ3w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.57.1.tgz", + "integrity": "sha512-crNPrwJOrRxagUYeMn/DZwqN88SDmwaJ8Cvi/TN1HnWBU7GwknckyosC2gd0IqYRsHDEnXf328o9/HC6OkPgOg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.57.1.tgz", + "integrity": "sha512-Ji8g8ChVbKrhFtig5QBV7iMaJrGtpHelkB3lsaKzadFBe58gmjfGXAOfI5FV0lYMH8wiqsxKQ1C9B0YTRXVy4w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.57.1.tgz", + "integrity": "sha512-R+/WwhsjmwodAcz65guCGFRkMb4gKWTcIeLy60JJQbXrJ97BOXHxnkPFrP+YwFlaS0m+uWJTstrUA9o+UchFug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.57.1.tgz", + "integrity": "sha512-IEQTCHeiTOnAUC3IDQdzRAGj3jOAYNr9kBguI7MQAAZK3caezRrg0GxAb6Hchg4lxdZEI5Oq3iov/w/hnFWY9Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.57.1.tgz", + "integrity": "sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.57.1.tgz", + "integrity": "sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.57.1.tgz", + "integrity": "sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.57.1.tgz", + "integrity": "sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.57.1.tgz", + "integrity": "sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.57.1.tgz", + "integrity": "sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.57.1.tgz", + "integrity": "sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.57.1.tgz", + "integrity": "sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.57.1.tgz", + "integrity": "sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.57.1.tgz", + "integrity": "sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.57.1.tgz", + "integrity": "sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.57.1.tgz", + "integrity": "sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.57.1.tgz", + "integrity": "sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.57.1.tgz", + "integrity": "sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.57.1.tgz", + "integrity": "sha512-4wYoDpNg6o/oPximyc/NG+mYUejZrCU2q+2w6YZqrAs2UcNUChIZXjtafAiiZSUc7On8v5NyNj34Kzj/Ltk6dQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.57.1.tgz", + "integrity": "sha512-O54mtsV/6LW3P8qdTcamQmuC990HDfR71lo44oZMZlXU4tzLrbvTii87Ni9opq60ds0YzuAlEr/GNwuNluZyMQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.57.1.tgz", + "integrity": "sha512-P3dLS+IerxCT/7D2q2FYcRdWRl22dNbrbBEtxdWhXrfIMPP9lQhb5h4Du04mdl5Woq05jVCDPCMF7Ub0NAjIew==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.57.1.tgz", + "integrity": "sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.57.1.tgz", + "integrity": "sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sindresorhus/is": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz", + "integrity": "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==", + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", + "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "license": "MIT", + "dependencies": { + "defer-to-connect": "^2.0.1" + }, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz", + "integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==", + "license": "MIT" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "license": "MIT" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "license": "MIT" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "license": "MIT" + }, + "node_modules/@types/emscripten": { + "version": "1.41.5", + "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.41.5.tgz", + "integrity": "sha512-cMQm7pxu6BxtHyqJ7mQZ2kXWV5SLmugybFdHCBbJ5eHzOo6VhBckEgAT3//rP5FwPHNPeEiq4SmQ5ucBwsOo4Q==", + "license": "MIT" + }, + "node_modules/@types/eslint": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", + "license": "MIT", + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", + "license": "MIT", + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "license": "MIT" + }, + "node_modules/@types/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-L3LgimLHXtGkWikKnsPg0/VFx9OGZaC+eN1u4r+OB1XRqH3meBIAVC2zr1WdMH+RHmnRkqliQAOHNJ/E0j/e0Q==", + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "license": "MIT" + }, + "node_modules/@types/jsonpath-plus": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/@types/jsonpath-plus/-/jsonpath-plus-5.0.5.tgz", + "integrity": "sha512-aaqqDf5LcGOtAfEntO5qKZS6ixT0MpNhUXNwbVPdLf7ET9hKsufJq+buZr7eXSnWoLRyGzVj2Yz2hbjVSK3wsA==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "20.19.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.30.tgz", + "integrity": "sha512-WJtwWJu7UdlvzEAUm484QNg5eAoq5QR08KDNx7g45Usrs2NtOPiX8ugDqmKdXkyL03rBqU5dYNYVQetEpBHq2g==", + "license": "MIT", + "peer": true, + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/source-list-map": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.6.tgz", + "integrity": "sha512-5JcVt1u5HDmlXkwOD2nslZVllBBc7HDuOICfiZah2Z0is8M8g+ddAEawbmd3VjedfDHBzxCaXLs07QEmb7y54g==", + "license": "MIT" + }, + "node_modules/@types/tapable": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.12.tgz", + "integrity": "sha512-bTHG8fcxEqv1M9+TD14P8ok8hjxoOCkfKc8XXLaaD05kI7ohpeI956jtDOD3XHKBQrlyPughUtzm1jtVhHpA5Q==", + "license": "MIT" + }, + "node_modules/@types/uglify-js": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.17.5.tgz", + "integrity": "sha512-TU+fZFBTBcXj/GpDpDaBmgWk/gn96kMZ+uocaFUlV2f8a6WdMzzI44QBCmGcCiYR0Y6ZlNRiyUyKKt5nl/lbzQ==", + "license": "MIT", + "dependencies": { + "source-map": "^0.6.1" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@types/webpack": { + "version": "4.41.40", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.40.tgz", + "integrity": "sha512-u6kMFSBM9HcoTpUXnL6mt2HSzftqb3JgYV6oxIgL2dl6sX6aCa5k6SOkzv5DuZjBTPUE/dJltKtwwuqrkZHpfw==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/tapable": "^1", + "@types/uglify-js": "*", + "@types/webpack-sources": "*", + "anymatch": "^3.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/@types/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-4nZOdMwSPHZ4pTEZzSp0AsTM4K7Qmu40UKW4tJDiOVs20UzYF9l+qUe4s0ftfN0pin06n+5cWWDJXH+sbhAiDw==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/source-list-map": "*", + "source-map": "^0.7.3" + } + }, + "node_modules/@types/webpack-sources/node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@types/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/yargs": { + "version": "17.0.35", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.35.tgz", + "integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@vitest/expect": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.1.tgz", + "integrity": "sha512-jXL+9+ZNIJKruofqXuuTClf44eSpcHlgj3CiuNihUF3Ioujtmc0zIa3UJOW5RjDK1YLBJZnWBlPuqhYycLioog==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", + "chai": "^4.3.10" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.1.tgz", + "integrity": "sha512-3nSnYXkVkf3mXFfE7vVyPmi3Sazhb/2cfZGGs0JRzFsPFvAMBEcrweV1V1GsrstdXeKCTXlJbvnQwGWgEIHmOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "1.6.1", + "p-limit": "^5.0.0", + "pathe": "^1.1.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.1.tgz", + "integrity": "sha512-WvidQuWAzU2p95u8GAKlRMqMyN1yOJkGHnx3M1PL9Raf7AQ1kwLKg04ADlCa3+OXUZE7BceOhVZiuWAbzCKcUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.1.tgz", + "integrity": "sha512-MGcMmpGkZebsMZhbQKkAf9CX5zGvjkBTqf8Zx3ApYWXr3wG+QvEu2eXWfnIIWYSJExIp4V9FCKDEeygzkYrXMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^2.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.1.tgz", + "integrity": "sha512-jOrrUvXM4Av9ZWiG1EajNto0u96kWAhJ1LmPmJhXXQx/32MecEKd10pOLYgS2BQx1TgkGhloPU1ArDW2vvaY6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "diff-sequences": "^29.6.3", + "estree-walker": "^3.0.3", + "loupe": "^2.3.7", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz", + "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/helper-numbers": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", + "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", + "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", + "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz", + "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.13.2", + "@webassemblyjs/helper-api-error": "1.13.2", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", + "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz", + "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz", + "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", + "license": "MIT", + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.13.2.tgz", + "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", + "license": "Apache-2.0", + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", + "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", + "license": "MIT" + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz", + "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/helper-wasm-section": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-opt": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1", + "@webassemblyjs/wast-printer": "1.14.1" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz", + "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz", + "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz", + "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-api-error": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz", + "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-3.0.1.tgz", + "integrity": "sha512-u8d0pJ5YFgneF/GuvEiDA61Tf1VDomHHYMjv/wc9XzYj7nopltpG96nXN5dJRstxZhcNpV1g+nT6CydO7pHbjA==", + "license": "MIT", + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "webpack": "^5.82.0", + "webpack-cli": "6.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-3.0.1.tgz", + "integrity": "sha512-coEmDzc2u/ffMvuW9aCjoRzNSPDl/XLuhPdlFRpT9tZHmJ/039az33CE7uH+8s0uL1j5ZNtfdv0HkfaKRBGJsQ==", + "license": "MIT", + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "webpack": "^5.82.0", + "webpack-cli": "6.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-3.0.1.tgz", + "integrity": "sha512-sbgw03xQaCLiT6gcY/6u3qBDn01CWw/nbaXl3gTdTFuJJ75Gffv3E3DBpgvY2fkkrdS1fpjaXNOmJlnbtKauKg==", + "license": "MIT", + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "webpack": "^5.82.0", + "webpack-cli": "6.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "license": "BSD-3-Clause" + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "license": "Apache-2.0" + }, + "node_modules/@yarnpkg/fslib": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@yarnpkg/fslib/-/fslib-3.1.4.tgz", + "integrity": "sha512-Yyguw5RM+xI1Bv0RFbs1ZF5HwU+9/He4YT7yeT722yAlLfkz9IzZHO6a5yStEshxiliPn9Fdj4H54a785xpK/g==", + "license": "BSD-2-Clause", + "dependencies": { + "tslib": "^2.4.0" + }, + "engines": { + "node": ">=18.12.0" + } + }, + "node_modules/@yarnpkg/libzip": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@yarnpkg/libzip/-/libzip-3.2.2.tgz", + "integrity": "sha512-Kqxgjfy6SwwC4tTGQYToIWtUhIORTpkowqgd9kkMiBixor0eourHZZAggt/7N4WQKt9iCyPSkO3Xvr44vXUBAw==", + "license": "BSD-2-Clause", + "dependencies": { + "@types/emscripten": "^1.39.6", + "@yarnpkg/fslib": "^3.1.3", + "tslib": "^2.4.0" + }, + "engines": { + "node": ">=18.12.0" + }, + "peerDependencies": { + "@yarnpkg/fslib": "^3.1.3" + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-import-phases": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz", + "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + }, + "peerDependencies": { + "acorn": "^8.14.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "peer": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/ansi-escapes": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.2.0.tgz", + "integrity": "sha512-g6LhBsl+GBPRWGWsBtutpzBYuIIdBkLEvad5C/va/74Db018+5TZiyA26cZJAr3Rft5lprVqOIPxf5Vid6tqAw==", + "license": "MIT", + "dependencies": { + "environment": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/app-builder": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/app-builder/-/app-builder-7.0.4.tgz", + "integrity": "sha512-QCmWZnoNN2uItlRV+gj4J6OONaFcJPyFoIuP1RkoILcuq19MlkynYB+wtH8uGv/umyynMWHI1HxnH1jGa1hNKQ==", + "license": "MIT" + }, + "node_modules/archive-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/archive-type/-/archive-type-4.0.0.tgz", + "integrity": "sha512-zV4Ky0v1F8dBrdYElwTvQhweQ0P7Kwc1aluqJsYtOBP01jXcWCyW2IEfI1YiqsG+Iy7ZR+o5LF1N+PGECBxHWA==", + "license": "MIT", + "dependencies": { + "file-type": "^4.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/archive-type/node_modules/file-type": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz", + "integrity": "sha512-f2UbFQEk7LXgWpi5ntcO86OeA/cC80fuDDDaX/fZ2ZGel+AF7leRQqBBW1eJNiiQkrZlAoM6P+VYP5P6bOlDEQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/archiver": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.3.2.tgz", + "integrity": "sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==", + "license": "MIT", + "dependencies": { + "archiver-utils": "^2.1.0", + "async": "^3.2.4", + "buffer-crc32": "^0.2.1", + "readable-stream": "^3.6.0", + "readdir-glob": "^1.1.2", + "tar-stream": "^2.2.0", + "zip-stream": "^4.1.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/archiver-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-2.1.0.tgz", + "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", + "license": "MIT", + "dependencies": { + "glob": "^7.1.4", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^2.0.0" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/archiver-utils/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/archiver-utils/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/archiver-utils/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "license": "MIT" + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "license": "MIT" + }, + "node_modules/auto-bind": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/auto-bind/-/auto-bind-5.0.1.tgz", + "integrity": "sha512-ooviqdwwgfIfNmDwo94wlshcdzfO64XV0Cg6oDsDYBJfITDz1EngD2z7DkbvCWn+XIMsIqW27sEVF6qcpJrRcg==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/baseline-browser-mapping": { + "version": "2.9.19", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz", + "integrity": "sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg==", + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.js" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "license": "ISC" + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", + "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "baseline-browser-mapping": "^2.9.0", + "caniuse-lite": "^1.0.30001759", + "electron-to-chromium": "^1.5.263", + "node-releases": "^2.0.27", + "update-browserslist-db": "^1.2.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "license": "MIT", + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "license": "MIT" + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==", + "license": "MIT" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-lookup": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", + "integrity": "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==", + "license": "MIT", + "engines": { + "node": ">=14.16" + } + }, + "node_modules/cacheable-request": { + "version": "10.2.14", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.14.tgz", + "integrity": "sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ==", + "license": "MIT", + "dependencies": { + "@types/http-cache-semantics": "^4.0.2", + "get-stream": "^6.0.1", + "http-cache-semantics": "^4.1.1", + "keyv": "^4.5.3", + "mimic-response": "^4.0.0", + "normalize-url": "^8.0.0", + "responselike": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001766", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001766.tgz", + "integrity": "sha512-4C0lfJ0/YPjJQHagaE9x2Elb69CIqEPZeG0anQt9SIvIoOH4a4uaRl73IavyO+0qZh6MDLH//DrXThEYKHkmYA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/caw": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/caw/-/caw-2.0.1.tgz", + "integrity": "sha512-Cg8/ZSBEa8ZVY9HspcGUYaK63d/bN7rqS3CYCzEGUxuYv6UlmcjzDUz2fCFFHyTvUW5Pk0I+3hkA3iXlIj6guA==", + "license": "MIT", + "dependencies": { + "get-proxy": "^2.0.0", + "isurl": "^1.0.0-alpha5", + "tunnel-agent": "^0.6.0", + "url-to-options": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chai": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", + "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/cheerio": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.2.0.tgz", + "integrity": "sha512-WDrybc/gKFpTYQutKIK6UvfcuxijIZfMfXaYm8NMsPQxSYvf+13fXUJ4rztGGbJcBQ/GF55gvrZ0Bc0bj/mqvg==", + "license": "MIT", + "dependencies": { + "cheerio-select": "^2.1.0", + "dom-serializer": "^2.0.0", + "domhandler": "^5.0.3", + "domutils": "^3.2.2", + "encoding-sniffer": "^0.2.1", + "htmlparser2": "^10.1.0", + "parse5": "^7.3.0", + "parse5-htmlparser2-tree-adapter": "^7.1.0", + "parse5-parser-stream": "^7.1.2", + "undici": "^7.19.0", + "whatwg-mimetype": "^4.0.0" + }, + "engines": { + "node": ">=20.18.1" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", + "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-select": "^5.1.0", + "css-what": "^6.1.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/chrome-trace-event": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", + "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", + "license": "MIT", + "engines": { + "node": ">=6.0" + } + }, + "node_modules/cli-boxes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", + "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "license": "MIT", + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-5.1.1.tgz", + "integrity": "sha512-SroPvNHxUnk+vIW/dOSfNqdy1sPEFkrTk6TUtqLCnBlo3N7TNYYkzzN7uSD6+jVjrdO4+p8nH7JzH6cIvUem6A==", + "license": "MIT", + "dependencies": { + "slice-ansi": "^7.1.0", + "string-width": "^8.0.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha512-yjLXh88P599UOyPTFX0POsd7WxnbsVsGohcwzHOLspIhhpalPw1BcqED8NblyZLKcGrL8dTgMlcaZxV2jAD41Q==", + "license": "MIT", + "dependencies": { + "mimic-response": "^1.0.0" + } + }, + "node_modules/clone-response/node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/code-excerpt": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/code-excerpt/-/code-excerpt-4.0.0.tgz", + "integrity": "sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA==", + "license": "MIT", + "dependencies": { + "convert-to-spaces": "^2.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "license": "MIT" + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, + "node_modules/compress-commons": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.2.tgz", + "integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==", + "license": "MIT", + "dependencies": { + "buffer-crc32": "^0.2.13", + "crc32-stream": "^4.0.2", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/config-chain": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", + "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", + "license": "MIT", + "dependencies": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/convert-to-spaces": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/convert-to-spaces/-/convert-to-spaces-2.0.1.tgz", + "integrity": "sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" + }, + "node_modules/crc": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/crc/-/crc-3.4.0.tgz", + "integrity": "sha512-ycVC2+4/DLgXXq7QweYi2znhqDuZz6P5TQXnkQo8v15XY/5p/IWeZwsSE31Ifo8w15b8TWLsqhXOjXyilHuQxw==", + "license": "MIT" + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/crc32-stream": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.3.tgz", + "integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==", + "license": "MIT", + "dependencies": { + "crc-32": "^1.2.0", + "readable-stream": "^3.4.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-select": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz", + "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==", + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz", + "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/d3": { + "version": "3.5.17", + "resolved": "https://registry.npmjs.org/d3/-/d3-3.5.17.tgz", + "integrity": "sha512-yFk/2idb8OHPKkbAL8QaOaqENNoMhIaSHZerk3oQsECwkObkCpJyjYwCe+OHiq6UEdhe1m8ZGARRRO3ljFjlKg==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/decode-uri-component": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/decompress": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz", + "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==", + "license": "MIT", + "dependencies": { + "decompress-tar": "^4.0.0", + "decompress-tarbz2": "^4.0.0", + "decompress-targz": "^4.0.0", + "decompress-unzip": "^4.0.1", + "graceful-fs": "^4.1.10", + "make-dir": "^1.0.0", + "pify": "^2.3.0", + "strip-dirs": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-tar": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", + "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", + "license": "MIT", + "dependencies": { + "file-type": "^5.2.0", + "is-stream": "^1.1.0", + "tar-stream": "^1.5.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tar/node_modules/bl": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", + "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", + "license": "MIT", + "dependencies": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/decompress-tar/node_modules/file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tar/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/decompress-tar/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/decompress-tar/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/decompress-tar/node_modules/tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "license": "MIT", + "dependencies": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/decompress-tarbz2": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", + "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", + "license": "MIT", + "dependencies": { + "decompress-tar": "^4.1.0", + "file-type": "^6.1.0", + "is-stream": "^1.1.0", + "seek-bzip": "^1.0.5", + "unbzip2-stream": "^1.0.9" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tarbz2/node_modules/file-type": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", + "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-targz": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", + "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", + "license": "MIT", + "dependencies": { + "decompress-tar": "^4.1.1", + "file-type": "^5.2.0", + "is-stream": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-targz/node_modules/file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-unzip": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", + "integrity": "sha512-1fqeluvxgnn86MOh66u8FjbtJpAFv5wgCT9Iw8rcBqQcCo5tO8eiJw7NNTrvt9n4CRBVq7CstiS922oPgyGLrw==", + "license": "MIT", + "dependencies": { + "file-type": "^3.8.0", + "get-stream": "^2.2.0", + "pify": "^2.3.0", + "yauzl": "^2.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-unzip/node_modules/file-type": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-unzip/node_modules/get-stream": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "integrity": "sha512-AUGhbbemXxrZJRD5cDvKtQxLuYaIbNtDTK8YqupCI393Q2KSTreEsLUN3ZxAWFGiKTzL6nKuzfcIvieflUX9qA==", + "license": "MIT", + "dependencies": { + "object-assign": "^4.0.1", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-unzip/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress/node_modules/make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "license": "MIT", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress/node_modules/make-dir/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/deep-eql": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", + "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "license": "MIT", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/diff": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz", + "integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", + "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/download": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/download/-/download-8.0.0.tgz", + "integrity": "sha512-ASRY5QhDk7FK+XrQtQyvhpDKanLluEEQtWl/J7Lxuf/b+i8RYh997QeXvL85xitrmRKVlx9c7eTrcRdq2GS4eA==", + "license": "MIT", + "dependencies": { + "archive-type": "^4.0.0", + "content-disposition": "^0.5.2", + "decompress": "^4.2.1", + "ext-name": "^5.0.0", + "file-type": "^11.1.0", + "filenamify": "^3.0.0", + "get-stream": "^4.1.0", + "got": "^8.3.1", + "make-dir": "^2.1.0", + "p-event": "^2.1.0", + "pify": "^4.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/download/node_modules/@sindresorhus/is": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", + "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/cacheable-request": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz", + "integrity": "sha512-vag0O2LKZ/najSoUwDbVlnlCFvhBE/7mGTY2B5FgCBDcRD+oVV1HYTOwM6JZfMg/hIcM6IwnTZ1uQQL5/X3xIQ==", + "license": "MIT", + "dependencies": { + "clone-response": "1.0.2", + "get-stream": "3.0.0", + "http-cache-semantics": "3.8.1", + "keyv": "3.0.0", + "lowercase-keys": "1.0.0", + "normalize-url": "2.0.1", + "responselike": "1.0.2" + } + }, + "node_modules/download/node_modules/cacheable-request/node_modules/get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/cacheable-request/node_modules/lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha512-RPlX0+PHuvxVDZ7xX+EBVAp4RsVxP/TdDSN2mJYdiq1Lc4Hz7EUSjUI7RZrKKlmrIzVhf6Jo2stj7++gVarS0A==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/download/node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", + "license": "MIT", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/got": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/got/-/got-8.3.2.tgz", + "integrity": "sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==", + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^0.7.0", + "cacheable-request": "^2.1.1", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "into-stream": "^3.1.0", + "is-retry-allowed": "^1.1.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "mimic-response": "^1.0.0", + "p-cancelable": "^0.4.0", + "p-timeout": "^2.0.1", + "pify": "^3.0.0", + "safe-buffer": "^5.1.1", + "timed-out": "^4.0.1", + "url-parse-lax": "^3.0.0", + "url-to-options": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/got/node_modules/get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/got/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/http-cache-semantics": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", + "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", + "license": "BSD-2-Clause" + }, + "node_modules/download/node_modules/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==", + "license": "MIT" + }, + "node_modules/download/node_modules/keyv": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", + "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==", + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.0" + } + }, + "node_modules/download/node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/download/node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/normalize-url": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-2.0.1.tgz", + "integrity": "sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw==", + "license": "MIT", + "dependencies": { + "prepend-http": "^2.0.0", + "query-string": "^5.0.1", + "sort-keys": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/p-cancelable": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", + "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha512-/Fpe5guzJk1gPqdJLJR5u7eG/gNY4nImjbRDaVWVMRhne55TCmj2i9Q+54PBRfatRC8v/rIiv9BN0pMd9OV5EQ==", + "license": "MIT", + "dependencies": { + "lowercase-keys": "^1.0.0" + } + }, + "node_modules/download/node_modules/sort-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", + "integrity": "sha512-/dPCrG1s3ePpWm6yBbxZq5Be1dXGLyLn9Z791chDC3NFrpkVbWGzkBwPN1knaciexFXgRJ7hzdnwZ4stHSDmjg==", + "license": "MIT", + "dependencies": { + "is-plain-obj": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/duplexer3": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.5.tgz", + "integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==", + "license": "BSD-3-Clause" + }, + "node_modules/electron-to-chromium": { + "version": "1.5.283", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.283.tgz", + "integrity": "sha512-3vifjt1HgrGW/h76UEeny+adYApveS9dH2h3p57JYzBSXJIKUJAvtmIytDKjcSCt9xHfrNCFJ7gts6vkhuq++w==", + "license": "ISC" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/encoding-sniffer": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz", + "integrity": "sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==", + "license": "MIT", + "dependencies": { + "iconv-lite": "^0.6.3", + "whatwg-encoding": "^3.1.1" + }, + "funding": { + "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.18.4", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.4.tgz", + "integrity": "sha512-LgQMM4WXU3QI+SYgEc2liRgznaD5ojbmY3sb8LxyguVkIg5FxdpTkvk72te2R38/TGKxH634oLxXRGY6d7AP+Q==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/env-var": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/env-var/-/env-var-7.5.0.tgz", + "integrity": "sha512-mKZOzLRN0ETzau2W2QXefbFjo5EF4yWq28OyKb9ICdeNhHJlOE/pHHnz4hdYJ9cNZXcJHo5xN4OT4pzuSHSNvA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/envinfo": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.21.0.tgz", + "integrity": "sha512-Lw7I8Zp5YKHFCXL7+Dz95g4CcbMEpgvqZNNq3AmlT5XAV6CgAAk6gyAMqn2zjw08K9BHfcNuKrMiCPLByGafow==", + "license": "MIT", + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/environment": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz", + "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==", + "license": "MIT" + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-toolkit": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.44.0.tgz", + "integrity": "sha512-6penXeZalaV88MM3cGkFZZfOoLGWshWWfdy0tWw/RlVVyhvMaWSBTOvXNeiW3e5FwdS5ePW0LGEu17zT139ktg==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks" + ] + }, + "node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ext-list": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz", + "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.28.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ext-name": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz", + "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==", + "license": "MIT", + "dependencies": { + "ext-list": "^2.0.0", + "sort-keys-length": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "license": "MIT", + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fastq": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/file-type": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-11.1.0.tgz", + "integrity": "sha512-rM0UO7Qm9K7TWTtA6AShI/t7H5BPjDeGVDaNyg9BjHAj3PysKy7+8C8D137R88jnR3rFJZQB/tFgydl5sN5m7g==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/filenamify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-3.0.0.tgz", + "integrity": "sha512-5EFZ//MsvJgXjBAFJ+Bh2YaCTRF/VP1YOmGrgt+KJ4SFRLjI87EIdwLLuT6wQX0I4F9W41xutobzczjsOKlI/g==", + "license": "MIT", + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.0", + "trim-repeated": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "license": "BSD-3-Clause", + "bin": { + "flat": "cli.js" + } + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/form-data-encoder": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-2.1.4.tgz", + "integrity": "sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==", + "license": "MIT", + "engines": { + "node": ">= 14.17" + } + }, + "node_modules/from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "node_modules/from2/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/from2/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/from2/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", + "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-proxy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/get-proxy/-/get-proxy-2.1.0.tgz", + "integrity": "sha512-zmZIaQTWnNQb4R4fJUEp/FC51eZsc6EkErspy3xtIYStaq8EB/hDIWipxsal+E8rz0qD7f2sL/NA9Xee4RInJw==", + "license": "MIT", + "dependencies": { + "npm-conf": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "license": "BSD-2-Clause" + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/got": { + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/got/-/got-12.6.1.tgz", + "integrity": "sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==", + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^5.2.0", + "@szmarczak/http-timer": "^5.0.1", + "cacheable-lookup": "^7.0.0", + "cacheable-request": "^10.2.8", + "decompress-response": "^6.0.0", + "form-data-encoder": "^2.1.2", + "get-stream": "^6.0.1", + "http2-wrapper": "^2.1.10", + "lowercase-keys": "^3.0.0", + "p-cancelable": "^3.0.0", + "responselike": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/got/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbol-support-x": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", + "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-to-string-tag-x": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", + "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "license": "MIT", + "dependencies": { + "has-symbol-support-x": "^1.4.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/htmlparser2": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.1.0.tgz", + "integrity": "sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.2.2", + "entities": "^7.0.1" + } + }, + "node_modules/htmlparser2/node_modules/entities": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz", + "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", + "license": "BSD-2-Clause" + }, + "node_modules/http2-wrapper": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz", + "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==", + "license": "MIT", + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.2.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC" + }, + "node_modules/ink": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/ink/-/ink-6.6.0.tgz", + "integrity": "sha512-QDt6FgJxgmSxAelcOvOHUvFxbIUjVpCH5bx+Slvc5m7IEcpGt3dYwbz/L+oRnqEGeRvwy1tineKK4ect3nW1vQ==", + "license": "MIT", + "dependencies": { + "@alcalzone/ansi-tokenize": "^0.2.1", + "ansi-escapes": "^7.2.0", + "ansi-styles": "^6.2.1", + "auto-bind": "^5.0.1", + "chalk": "^5.6.0", + "cli-boxes": "^3.0.0", + "cli-cursor": "^4.0.0", + "cli-truncate": "^5.1.1", + "code-excerpt": "^4.0.0", + "es-toolkit": "^1.39.10", + "indent-string": "^5.0.0", + "is-in-ci": "^2.0.0", + "patch-console": "^2.0.0", + "react-reconciler": "^0.33.0", + "signal-exit": "^3.0.7", + "slice-ansi": "^7.1.0", + "stack-utils": "^2.0.6", + "string-width": "^8.1.0", + "type-fest": "^4.27.0", + "widest-line": "^5.0.0", + "wrap-ansi": "^9.0.0", + "ws": "^8.18.0", + "yoga-layout": "~3.2.1" + }, + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "@types/react": ">=19.0.0", + "react": ">=19.0.0", + "react-devtools-core": "^6.1.2" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react-devtools-core": { + "optional": true + } + } + }, + "node_modules/interpret": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/into-stream": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", + "integrity": "sha512-TcdjPibTksa1NQximqep2r17ISRiNE9fwlfbg3F8ANdvP5/yrFTew86VcO//jk4QTaMlbjypPBq76HN2zaKfZQ==", + "license": "MIT", + "dependencies": { + "from2": "^2.1.1", + "p-is-promise": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz", + "integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==", + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.3.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-in-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-in-ci/-/is-in-ci-2.0.0.tgz", + "integrity": "sha512-cFeerHriAnhrQSbpAxL37W1wcJKUUX07HyLWZCW1URJT/ra3GyUTzBgUnh24TMVfNTV2Hij2HLxkPHFZfOZy5w==", + "license": "MIT", + "bin": { + "is-in-ci": "cli.js" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-natural-number": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", + "integrity": "sha512-Y4LTamMe0DDQIIAlaer9eKebAlDSV6huy+TWhJVPlzZh2o4tRP5SQWFlLn5N0To4mDD22/qdOq+veo1cSISLgQ==", + "license": "MIT" + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", + "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "license": "MIT", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-retry-allowed": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isurl": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", + "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", + "license": "MIT", + "dependencies": { + "has-to-string-tag-x": "^1.2.0", + "is-object": "^1.0.1" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/js-tokens": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", + "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsep": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jsep/-/jsep-1.4.0.tgz", + "integrity": "sha512-B7qPcEVE3NVkmSJbaYxvv4cHkVW7DQsZz13pUMrfS8z8Q/BuShN+gcTXrUlPiGqM2/t/EEaI030bpxMqY8gMlw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 10.16.0" + } + }, + "node_modules/jsmodbus": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/jsmodbus/-/jsmodbus-4.0.10.tgz", + "integrity": "sha512-ea2VfDamQVI7RE8X9i9KU+cYoobSaemaXhaKik9FTAZJnkgslc4LoRupzepl3DywFVR3rxqjhcS2wk1BDsIe+Q==", + "license": "MIT", + "dependencies": { + "crc": "3.4.0", + "debug": "^3.1.0" + }, + "bin": { + "jsmodbus": "bin/jsmodbus.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/jsonpath-plus": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-10.3.0.tgz", + "integrity": "sha512-8TNmfeTCk2Le33A3vRRwtuworG/L5RrgMvdjhKZxvyShO+mBu2fP50OWUjRLNtvw344DdDarFh9buFAZs5ujeA==", + "license": "MIT", + "dependencies": { + "@jsep-plugin/assignment": "^1.3.0", + "@jsep-plugin/regex": "^1.0.4", + "jsep": "^1.4.0" + }, + "bin": { + "jsonpath": "bin/jsonpath-cli.js", + "jsonpath-plus": "bin/jsonpath-cli.js" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lazystream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", + "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.5" + }, + "engines": { + "node": ">= 0.6.3" + } + }, + "node_modules/lazystream/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/lazystream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/lazystream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/loader-runner": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.1.tgz", + "integrity": "sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==", + "license": "MIT", + "engines": { + "node": ">=6.11.5" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/local-pkg": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.1.tgz", + "integrity": "sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mlly": "^1.7.3", + "pkg-types": "^1.2.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "license": "MIT" + }, + "node_modules/lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==", + "license": "MIT" + }, + "node_modules/lodash.difference": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==", + "license": "MIT" + }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.union": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", + "integrity": "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==", + "license": "MIT" + }, + "node_modules/log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "license": "MIT", + "dependencies": { + "chalk": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/log-symbols/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" + }, + "node_modules/log-symbols/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/log-symbols/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/loose-envify/node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/lowercase-keys": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", + "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "license": "MIT", + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "license": "ISC" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "license": "MIT" + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/meriyah": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/meriyah/-/meriyah-4.5.0.tgz", + "integrity": "sha512-Rbiu0QPIxTXgOXwiIpRVJfZRQ2FWyfzYrOGBs9SN5RbaXg1CN5ELn/plodwWwluX93yzc4qO/bNIen1ThGFCxw==", + "license": "ISC", + "engines": { + "node": ">=10.4.0" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/mimic-response": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-4.0.0.tgz", + "integrity": "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mlly": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.0.tgz", + "integrity": "sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.15.0", + "pathe": "^2.0.3", + "pkg-types": "^1.3.1", + "ufo": "^1.6.1" + } + }, + "node_modules/mlly/node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/multistream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/multistream/-/multistream-4.1.0.tgz", + "integrity": "sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "once": "^1.4.0", + "readable-stream": "^3.6.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "license": "MIT" + }, + "node_modules/nexe": { + "version": "5.0.0-beta.4", + "resolved": "https://registry.npmjs.org/nexe/-/nexe-5.0.0-beta.4.tgz", + "integrity": "sha512-FWKmhS5aZBzAF4brSuwrDM08VscAmaHiY/vkJCNRWf+cZ9HpIIdMlLQYw1CzYrengtPlJyFqAzFBb8pUkOaEEw==", + "license": "MIT", + "dependencies": { + "@calebboyd/semaphore": "^1.3.1", + "@yarnpkg/fslib": "^3.0.0-rc.43", + "@yarnpkg/libzip": "^3.0.0-rc.43", + "app-builder": "^7.0.4", + "archiver": "^5.3.1", + "caw": "^2.0.1", + "chalk": "^2.4.2", + "download": "^8.0.0", + "globby": "^11.0.2", + "got": "^12.6.0", + "meriyah": "^4.3.5", + "minimist": "^1.2.8", + "mkdirp": "^1.0.4", + "multistream": "^4.1.0", + "ora": "^3.4.0", + "resolve-dependencies": "^6.0.9", + "rimraf": "^3.0.2", + "run-script-os": "^1.1.6", + "webpack-config-prefabs": "0.0.5" + }, + "bin": { + "nexe": "index.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/nexe/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/nexe/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/nexe/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/nexe/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" + }, + "node_modules/nexe/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/nexe/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/nexe/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/node-addon-api": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.5.0.tgz", + "integrity": "sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/node-releases": { + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.1.1.tgz", + "integrity": "sha512-JYc0DPlpGWB40kH5g07gGTrYuMqV653k3uBKY6uITPWds3M0ov3GaWGp9lbE3Bzngx8+XkfzgvASb9vk9JDFXQ==", + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-conf": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz", + "integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==", + "license": "MIT", + "dependencies": { + "config-chain": "^1.1.11", + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-conf/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz", + "integrity": "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg==", + "license": "MIT", + "dependencies": { + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-spinners": "^2.0.0", + "log-symbols": "^2.2.0", + "strip-ansi": "^5.2.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ora/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ora/node_modules/cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==", + "license": "MIT", + "dependencies": { + "restore-cursor": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ora/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/ora/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" + }, + "node_modules/ora/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/ora/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ora/node_modules/mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ora/node_modules/onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ==", + "license": "MIT", + "dependencies": { + "mimic-fn": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ora/node_modules/restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha512-6IzJLuGi4+R14vwagDHX+JrXmPVtPpn4mffDJ1UdR7/Edm87fl6yi8mMBIVvFtJaNTUvjughmW4hwLhRG7gC1Q==", + "license": "MIT", + "dependencies": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ora/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-cancelable": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", + "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==", + "license": "MIT", + "engines": { + "node": ">=12.20" + } + }, + "node_modules/p-event": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-2.3.1.tgz", + "integrity": "sha512-NQCqOFhbpVTMX4qMe8PF8lbGtzZ+LCiN7pcNrb/413Na7+TRoe1xkKUzuWa/YEJdGQ0FvKtj35EEbDoVPO2kbA==", + "license": "MIT", + "dependencies": { + "p-timeout": "^2.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/p-is-promise": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha512-zL7VE4JVS2IFSkR2GQKDSPEVxkoH43/p7oEnwpdCndKYJO0HVeRB7fA8TJwuLOTBREtK0ea8eHaxdwcpob5dmg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/p-limit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", + "integrity": "sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-timeout": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz", + "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==", + "license": "MIT", + "dependencies": { + "p-finally": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/parse5": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", + "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", + "license": "MIT", + "dependencies": { + "entities": "^6.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz", + "integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==", + "license": "MIT", + "dependencies": { + "domhandler": "^5.0.3", + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-parser-stream": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", + "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", + "license": "MIT", + "dependencies": { + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5/node_modules/entities": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/patch-console": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/patch-console/-/patch-console-2.0.0.tgz", + "integrity": "sha512-0YNdUceMdaQwoKce1gatDScmMo5pu/tfABfnzEqeG0gtTmd7mh/WcwgUjtAeOU7N8nFFlbQBnFK2gXW5fGvmMA==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT" + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "license": "MIT", + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, + "node_modules/pkg-types/node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/prop-types/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", + "license": "ISC" + }, + "node_modules/protobufjs": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.4.tgz", + "integrity": "sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/query-string": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "license": "MIT", + "dependencies": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/react": { + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", + "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true, + "license": "MIT" + }, + "node_modules/react-reconciler": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.33.0.tgz", + "integrity": "sha512-KetWRytFv1epdpJc3J4G75I4WrplZE5jOL7Yq0p34+OVOKF4Se7WrdIdVC45XsSSmUTlht2FM/fM1FZb1mfQeA==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "peerDependencies": { + "react": "^19.2.0" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdir-glob": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", + "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.1.0" + } + }, + "node_modules/readdir-glob/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/readdir-glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/rechoir": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "license": "MIT", + "dependencies": { + "resolve": "^1.20.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "license": "MIT" + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-dependencies": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/resolve-dependencies/-/resolve-dependencies-6.0.9.tgz", + "integrity": "sha512-1BfxvQZyAjSC3Kkcov3ZhHQiLaXVWX1dhFjWyyrPA5yb9yeW9aSC8GQP6TtkJImM7XvitN7kHrLcQxG+1VU7Gg==", + "license": "MIT", + "dependencies": { + "enhanced-resolve": "^5.12.0", + "fast-glob": "^3.2.12", + "meriyah": "^4.3.5" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/responselike": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", + "integrity": "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==", + "license": "MIT", + "dependencies": { + "lowercase-keys": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "license": "MIT", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.57.1.tgz", + "integrity": "sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.57.1", + "@rollup/rollup-android-arm64": "4.57.1", + "@rollup/rollup-darwin-arm64": "4.57.1", + "@rollup/rollup-darwin-x64": "4.57.1", + "@rollup/rollup-freebsd-arm64": "4.57.1", + "@rollup/rollup-freebsd-x64": "4.57.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.57.1", + "@rollup/rollup-linux-arm-musleabihf": "4.57.1", + "@rollup/rollup-linux-arm64-gnu": "4.57.1", + "@rollup/rollup-linux-arm64-musl": "4.57.1", + "@rollup/rollup-linux-loong64-gnu": "4.57.1", + "@rollup/rollup-linux-loong64-musl": "4.57.1", + "@rollup/rollup-linux-ppc64-gnu": "4.57.1", + "@rollup/rollup-linux-ppc64-musl": "4.57.1", + "@rollup/rollup-linux-riscv64-gnu": "4.57.1", + "@rollup/rollup-linux-riscv64-musl": "4.57.1", + "@rollup/rollup-linux-s390x-gnu": "4.57.1", + "@rollup/rollup-linux-x64-gnu": "4.57.1", + "@rollup/rollup-linux-x64-musl": "4.57.1", + "@rollup/rollup-openbsd-x64": "4.57.1", + "@rollup/rollup-openharmony-arm64": "4.57.1", + "@rollup/rollup-win32-arm64-msvc": "4.57.1", + "@rollup/rollup-win32-ia32-msvc": "4.57.1", + "@rollup/rollup-win32-x64-gnu": "4.57.1", + "@rollup/rollup-win32-x64-msvc": "4.57.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/run-script-os": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/run-script-os/-/run-script-os-1.1.6.tgz", + "integrity": "sha512-ql6P2LzhBTTDfzKts+Qo4H94VUKpxKDFz6QxxwaUZN0mwvi7L3lpOI7BqPCq7lgDh3XLl0dpeXwfcVIitlrYrw==", + "license": "MIT", + "bin": { + "run-os": "index.js", + "run-script-os": "index.js" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/schema-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz", + "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/seek-bzip": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz", + "integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==", + "license": "MIT", + "dependencies": { + "commander": "^2.8.1" + }, + "bin": { + "seek-bunzip": "bin/seek-bunzip", + "seek-table": "bin/seek-bzip-table" + } + }, + "node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "license": "ISC" + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.2.tgz", + "integrity": "sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha512-vzn8aSqKgytVik0iwdBEi+zevbTYZogewTUM6dtpmGwEcdzbub/TX4bCzRhebDCRC3QzXgJsLRKB2V/Oof7HXg==", + "license": "MIT", + "dependencies": { + "is-plain-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sort-keys-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz", + "integrity": "sha512-GRbEOUqCxemTAk/b32F2xa8wDTs+Z1QHOkbhJDQTvv/6G3ZkbJ+frYWsTcc7cBB3Fu4wy4XlLCuNtJuMn7Gsvw==", + "license": "MIT", + "dependencies": { + "sort-keys": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-loader": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-5.0.0.tgz", + "integrity": "sha512-k2Dur7CbSLcAH73sBcIkV5xjPV4SzqO1NJ7+XaQl8if3VODDUj3FNchNGpqgJSKbvUfJuhVdv8K2Eu8/TNl2eA==", + "license": "MIT", + "dependencies": { + "iconv-lite": "^0.6.3", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.72.1" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz", + "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==", + "dev": true, + "license": "MIT" + }, + "node_modules/strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-replace-loader": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/string-replace-loader/-/string-replace-loader-3.3.0.tgz", + "integrity": "sha512-AZ3y7ktSHhd/Ebipczkp6vdfp01d2kQVwFujCGAgmogTB8t4dRhbsRGDKnyZAYqBbIA9QW7+D/IsACVJOOpcBg==", + "license": "MIT", + "dependencies": { + "schema-utils": "^4" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "webpack": "^5" + } + }, + "node_modules/string-width": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.1.1.tgz", + "integrity": "sha512-KpqHIdDL9KwYk22wEOg/VIqYbrnLeSApsKT/bSj6Ez7pn3CftUiLAv2Lccpq1ALcpLV9UX1Ppn92npZWu2w/aw==", + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.3.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-dirs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", + "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", + "license": "MIT", + "dependencies": { + "is-natural-number": "^4.0.1" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-literal": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.1.1.tgz", + "integrity": "sha512-631UJ6O00eNGfMiWG78ck80dfBab8X6IVFB51jZK5Icd7XAs60Z5y7QdSd/wGIklnWvRbUNloVzhOKKmutxQ6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^9.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-outer/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tapable": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", + "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==", + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/terser": { + "version": "5.46.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.46.0.tgz", + "integrity": "sha512-jTwoImyr/QbOWFFso3YoU3ik0jBBDJ6JTOQiy/J2YxVJdZCc+5u7skhNwiOR3FQIygFqVUPHl7qbbxtjW2K3Qg==", + "license": "BSD-2-Clause", + "peer": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.15.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.16", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.16.tgz", + "integrity": "sha512-h9oBFCWrq78NyWWVcSwZarJkZ01c2AyGrzs1crmHZO3QUg9D61Wu4NPjBy69n7JqylFF5y+CsUZYmYEIZ3mR+Q==", + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.25", + "jest-worker": "^27.4.5", + "schema-utils": "^4.3.0", + "serialize-javascript": "^6.0.2", + "terser": "^5.31.1" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/terser-webpack-plugin/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "license": "MIT" + }, + "node_modules/timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinypool": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.4.tgz", + "integrity": "sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", + "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/to-buffer": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.2.tgz", + "integrity": "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw==", + "license": "MIT", + "dependencies": { + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/to-buffer/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "license": "MIT" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tree-sitter": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.21.1.tgz", + "integrity": "sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==", + "hasInstallScript": true, + "license": "MIT", + "peer": true, + "dependencies": { + "node-addon-api": "^8.0.0", + "node-gyp-build": "^4.8.0" + } + }, + "node_modules/tree-sitter-c": { + "version": "0.23.6", + "resolved": "https://registry.npmjs.org/tree-sitter-c/-/tree-sitter-c-0.23.6.tgz", + "integrity": "sha512-0dxXKznVyUA0s6PjNolJNs2yF87O5aL538A/eR6njA5oqX3C3vH4vnx3QdOKwuUdpKEcFdHuiDpRKLLCA/tjvQ==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^8.3.0", + "node-gyp-build": "^4.8.4" + }, + "peerDependencies": { + "tree-sitter": "^0.22.1" + }, + "peerDependenciesMeta": { + "tree-sitter": { + "optional": true + } + } + }, + "node_modules/tree-sitter-cpp": { + "version": "0.23.4", + "resolved": "https://registry.npmjs.org/tree-sitter-cpp/-/tree-sitter-cpp-0.23.4.tgz", + "integrity": "sha512-qR5qUDyhZ5jJ6V8/umiBxokRbe89bCGmcq/dk94wI4kN86qfdV8k0GHIUEKaqWgcu42wKal5E97LKpLeVW8sKw==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^8.2.1", + "node-gyp-build": "^4.8.2", + "tree-sitter-c": "^0.23.1" + }, + "peerDependencies": { + "tree-sitter": "^0.21.1" + }, + "peerDependenciesMeta": { + "tree-sitter": { + "optional": true + } + } + }, + "node_modules/trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/trim-repeated/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/ts-loader": { + "version": "9.5.4", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.4.tgz", + "integrity": "sha512-nCz0rEwunlTZiy6rXFByQU1kVVpCIgUpc/psFiKVrUwrizdnIbRFu8w7bxhUF0X613DYwT4XzrZHpVyMe758hQ==", + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4", + "source-map": "^0.7.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "typescript": "*", + "webpack": "^5.0.0" + } + }, + "node_modules/ts-loader/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ts-loader/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ts-loader/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-loader/node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ts-loader/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/tslog": { + "version": "4.10.2", + "resolved": "https://registry.npmjs.org/tslog/-/tslog-4.10.2.tgz", + "integrity": "sha512-XuELoRpMR+sq8fuWwX7P0bcj+PRNiicOKDEb3fGNURhxWVyykCi9BNq7c4uVz7h7P0sj8qgBsr5SWS6yBClq3g==", + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/fullstack-build/tslog?sponsor=1" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ufo": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", + "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "license": "MIT", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/undici": { + "version": "7.19.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.19.2.tgz", + "integrity": "sha512-4VQSpGEGsWzk0VYxyB/wVX/Q7qf9t5znLRgs0dzszr9w9Fej/8RVNQ+S20vdXSAyra/bJ7ZQfGv6ZMj7UEbzSg==", + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha512-NjFKA0DidqPa5ciFcSrXnAltTtzz84ogy+NebPvfEgAck0+TNg4UJ4IN+fB7zRZfbgUf0syOo9MDxFkDSMuFaQ==", + "license": "MIT", + "dependencies": { + "prepend-http": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/url-to-options": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", + "integrity": "sha512-0kQLIzG4fdk/G5NONku64rSH/x32NOA39LVQqlK8Le6lvTF6GGRJpqaQFGgU+CLwySIqBSMdwYM0sYcW9f6P4A==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/utf-8-validate": { + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.6.tgz", + "integrity": "sha512-q3l3P9UtEEiAHcsgsqTgf9PPjctrDWoIXW3NpOHFdRDbLvu4DLIcxHangJ4RLrWkBcKjmcs/6NkerI8T/rE4LA==", + "hasInstallScript": true, + "license": "MIT", + "peer": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "license": "MIT" + }, + "node_modules/vite": { + "version": "5.4.21", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz", + "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.1.tgz", + "integrity": "sha512-YAXkfvGtuTzwWbDSACdJSg4A4DZiAqckWe90Zapc/sEX3XvHcw1NdurM/6od8J207tSDqNbSsgdCacBgvJKFuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^5.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite-node/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.1.tgz", + "integrity": "sha512-Ljb1cnSJSivGN0LqXd/zmDbWEM0RNNg2t1QW/XUhYl/qPqyu7CsqeWtqQXHVaJsecLPuDoak2oJcZN2QoRIOag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "1.6.1", + "@vitest/runner": "1.6.1", + "@vitest/snapshot": "1.6.1", + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", + "acorn-walk": "^8.3.2", + "chai": "^4.3.10", + "debug": "^4.3.4", + "execa": "^8.0.1", + "local-pkg": "^0.5.0", + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.5.0", + "strip-literal": "^2.0.0", + "tinybench": "^2.5.1", + "tinypool": "^0.8.3", + "vite": "^5.0.0", + "vite-node": "1.6.1", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "1.6.1", + "@vitest/ui": "1.6.1", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/watchpack": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.5.1.tgz", + "integrity": "sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==", + "license": "MIT", + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "license": "MIT", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/webpack": { + "version": "5.104.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.104.1.tgz", + "integrity": "sha512-Qphch25abbMNtekmEGJmeRUhLDbe+QfiWTiqpKYkpCOWY64v9eyl+KRRLmqOFA2AvKPpc9DC6+u2n76tQLBoaA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.8", + "@types/json-schema": "^7.0.15", + "@webassemblyjs/ast": "^1.14.1", + "@webassemblyjs/wasm-edit": "^1.14.1", + "@webassemblyjs/wasm-parser": "^1.14.1", + "acorn": "^8.15.0", + "acorn-import-phases": "^1.0.3", + "browserslist": "^4.28.1", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.17.4", + "es-module-lexer": "^2.0.0", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.11", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.3.1", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^4.3.3", + "tapable": "^2.3.0", + "terser-webpack-plugin": "^5.3.16", + "watchpack": "^2.4.4", + "webpack-sources": "^3.3.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-6.0.1.tgz", + "integrity": "sha512-MfwFQ6SfwinsUVi0rNJm7rHZ31GyTcpVE5pgVA3hwFRb7COD4TzjUUwhGWKfO50+xdc2MQPuEBBJoqIMGt3JDw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@discoveryjs/json-ext": "^0.6.1", + "@webpack-cli/configtest": "^3.0.1", + "@webpack-cli/info": "^3.0.1", + "@webpack-cli/serve": "^3.0.1", + "colorette": "^2.0.14", + "commander": "^12.1.0", + "cross-spawn": "^7.0.3", + "envinfo": "^7.14.0", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^6.0.1" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.82.0" + }, + "peerDependenciesMeta": { + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/webpack-config-prefabs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/webpack-config-prefabs/-/webpack-config-prefabs-0.0.5.tgz", + "integrity": "sha512-A9F08XY1JkFqui6oTMwwr57xiMD/skKdd+A0MRKoDW26ShpLQnWdEPJbgY9IqS7N2l1rvPdkswlS4b6o0JliGQ==", + "license": "MIT", + "dependencies": { + "@types/webpack": "^4.4.34", + "find-up": "^4.1.0", + "lodash": "^4.17.11", + "source-map-loader": "*", + "string-replace-loader": "*", + "ts-loader": "*", + "tslib": "^2.0.1", + "typescript": "*", + "webpack": "*", + "webpack-cli": "*" + } + }, + "node_modules/webpack-merge": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-6.0.1.tgz", + "integrity": "sha512-hXXvrjtx2PLYx4qruKl+kyRSLc52V+cCvMxRjmKwoA+CBbbF5GfIBtR6kCvl0fYGqTUPKB+1ktVmTHqMOzgCBg==", + "license": "MIT", + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz", + "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack-visualizer-plugin2": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/webpack-visualizer-plugin2/-/webpack-visualizer-plugin2-2.0.0.tgz", + "integrity": "sha512-kvlbGAEahg8V00g7SPgggF0ewn7FOsh+b33amp0w9XApAJaz4MBbaIH6Wzqo2Fd3wSW7uhwvPcRTsAuMMcqJKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "d3": "^3.5.6", + "mkdirp": "^0.5.1", + "prop-types": "^15.7.2", + "react": "^18.0.0", + "react-dom": "^18.0.0" + }, + "engines": { + "npm": ">=5.0.0" + } + }, + "node_modules/webpack-visualizer-plugin2/node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/webpack-visualizer-plugin2/node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack-visualizer-plugin2/node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/webpack-visualizer-plugin2/node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation", + "license": "MIT", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.20", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.20.tgz", + "integrity": "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", + "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==", + "license": "MIT", + "dependencies": { + "string-width": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/widest-line/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/widest-line/node_modules/emoji-regex": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "license": "MIT" + }, + "node_modules/widest-line/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/widest-line/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "license": "MIT" + }, + "node_modules/wrap-ansi": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", + "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "license": "MIT" + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz", + "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.2.tgz", + "integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yoga-layout": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/yoga-layout/-/yoga-layout-3.2.1.tgz", + "integrity": "sha512-0LPOt3AxKqMdFBZA3HBAt/t/8vIKq7VaQYbuA8WxCgung+p9TVyKRYdpvCb80HcdTN2NkbIKbhNwKUfm3tQywQ==", + "license": "MIT" + }, + "node_modules/zip-stream": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.1.tgz", + "integrity": "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==", + "license": "MIT", + "dependencies": { + "archiver-utils": "^3.0.4", + "compress-commons": "^4.1.2", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/zip-stream/node_modules/archiver-utils": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-3.0.4.tgz", + "integrity": "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==", + "license": "MIT", + "dependencies": { + "glob": "^7.2.3", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/cli-ts/package.json b/cli-ts/package.json new file mode 100644 index 00000000..90e76d57 --- /dev/null +++ b/cli-ts/package.json @@ -0,0 +1,65 @@ +{ + "name": "pm-config", + "version": "1.0.0", + "description": "", + "main": "dist-in/index.js", + "bin": { + "pm-config": "dist-in/index.js" + }, + "type": "module", + "scripts": { + "start": "node dist-in/index.js", + "build": "tsc", + "dev": "tsc -w", + "connect": "node dist-in/commands/ws-client.js", + "test": "vitest run", + "test:di": "vitest run tests/di/plunger.test.ts", + "test:components": "vitest run tests/ast/components.test.ts", + "test:mb": "pm-config mb --fn 6 --reg 100 --value 1", + "test:mb:read": "pm-config mb --fn 3 --reg 1258 --count 2", + "build:proto": "ts-node src/commands/build-proto.ts", + "build:proto:js": "npm run build:proto -- --lang=js", + "setup-profiles": "ts-node src/commands/setup-profiles.ts", + "setup-settings": "ts-node src/commands/setup-settings.ts", + "reset": "node dist-in/index.js mb --fn 6 --reg 100 --value 1", + "setup-signals": "ts-node src/commands/setup-signals.ts", + "setup-network": "pm-config setup-network", + "patch-config": "ts-node src/commands/patch-config.ts", + "webpack": "webpack --config webpack.config.js --stats-error-details" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "@polymech/client-ts": "file:../web/packages/client", + "@polymech/commons": "file:../../polymech-mono/packages/commons", + "@polymech/fs": "file:../../polymech-mono/packages/fs", + "@types/jsonpath-plus": "^5.0.5", + "@types/unist": "^3.0.3", + "cheerio": "^1.1.0", + "env-var": "^7.5.0", + "ink": "^6.0.1", + "jsmodbus": "^4.0.6", + "jsonpath-plus": "^10.3.0", + "nexe": "^5.0.0-beta.4", + "protobufjs": "^7.5.3", + "tree-sitter": "^0.21.1", + "tree-sitter-cpp": "^0.23.4", + "ts-node": "^10.9.2", + "tslog": "^4.9.3", + "utf-8-validate": "^6.0.5", + "ws": "^8.18.0", + "yargs": "^17.7.2", + "zod": "^3.22.4" + }, + "devDependencies": { + "@types/node": "^20.19.11", + "@types/ws": "^8.5.11", + "@types/yargs": "^17.0.32", + "typescript": "^5.3.3", + "vitest": "^1.6.0", + "webpack": "^5.101.3", + "webpack-cli": "^6.0.1", + "webpack-visualizer-plugin2": "^2.0.0" + } +} \ No newline at end of file diff --git a/cli-ts/patch-sample.json b/cli-ts/patch-sample.json new file mode 100644 index 00000000..de8374a7 --- /dev/null +++ b/cli-ts/patch-sample.json @@ -0,0 +1,10 @@ +{ + "features": { + "ENABLE_WIFI": false, + "ENABLE_PLUNGER": true + }, + "settings": { + "WIFI_SSID": "MyNewNetwork", + "SAKO_VFD_SLAVE_ID": 15 + } +} \ No newline at end of file diff --git a/cli-ts/plunger.json b/cli-ts/plunger.json new file mode 100644 index 00000000..6fd344cc --- /dev/null +++ b/cli-ts/plunger.json @@ -0,0 +1,25 @@ +{ + "speedSlowHz": 16, + "speedMediumHz": 20, + "speedFastHz": 35, + "speedFillPlungeHz": 25, + "speedFillHomeHz": 20, + "currentJamThresholdMa": 1000, + "jammedDurationHomingMs": 100, + "jammedDurationMs": 1400, + "autoModeHoldDurationMs": 1000, + "maxUniversalJamTimeMs": 7000, + "fillJoystickHoldDurationMs": 1000, + "fillPlungedWaitDurationMs": 1000, + "fillHomedWaitDurationMs": 50, + "recordHoldDurationMs": 2000, + "maxRecordDurationMs": 30000, + "replayDurationMs": 4500, + "enablePostFlow": false, + "postFlowDurationMs": 3000, + "postFlowSpeedHz": 15, + "currentPostFlowMa": 1300, + "postFlowStoppingWaitMs": 500, + "postFlowCompleteWaitMs": 500, + "defaultMaxOperationDurationMs": 18000 +} \ No newline at end of file diff --git a/cli-ts/plunger_default.json b/cli-ts/plunger_default.json new file mode 100644 index 00000000..6fd344cc --- /dev/null +++ b/cli-ts/plunger_default.json @@ -0,0 +1,25 @@ +{ + "speedSlowHz": 16, + "speedMediumHz": 20, + "speedFastHz": 35, + "speedFillPlungeHz": 25, + "speedFillHomeHz": 20, + "currentJamThresholdMa": 1000, + "jammedDurationHomingMs": 100, + "jammedDurationMs": 1400, + "autoModeHoldDurationMs": 1000, + "maxUniversalJamTimeMs": 7000, + "fillJoystickHoldDurationMs": 1000, + "fillPlungedWaitDurationMs": 1000, + "fillHomedWaitDurationMs": 50, + "recordHoldDurationMs": 2000, + "maxRecordDurationMs": 30000, + "replayDurationMs": 4500, + "enablePostFlow": false, + "postFlowDurationMs": 3000, + "postFlowSpeedHz": 15, + "currentPostFlowMa": 1300, + "postFlowStoppingWaitMs": 500, + "postFlowCompleteWaitMs": 500, + "defaultMaxOperationDurationMs": 18000 +} \ No newline at end of file diff --git a/cli-ts/profile_defaults.json b/cli-ts/profile_defaults.json new file mode 100644 index 00000000..0b628c32 --- /dev/null +++ b/cli-ts/profile_defaults.json @@ -0,0 +1,46 @@ + + { + "slot": 0, + "duration": 20000, + "status": 0, + "currentTemp": 0, + "name": "Default Temperature Profile2", + "max": 150, + "enabled": true, + "elapsed": 0, + "remaining": 0, + "signalPlot": -1, + "description": "", + "controlPoints": [ + { + "x": 0, + "y": 200 + }, + { + "x": 500, + "y": 800 + }, + { + "x": 700, + "y": 400 + }, + { + "x": 900, + "y": 300 + }, + { + "x": 1000, + "y": 200 + } + ], + "targetRegisters": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + } \ No newline at end of file diff --git a/cli-ts/scripts/build.sh b/cli-ts/scripts/build.sh new file mode 100644 index 00000000..fb56423a --- /dev/null +++ b/cli-ts/scripts/build.sh @@ -0,0 +1,4 @@ +npm run build +npm run webpack +sh scripts/nexe.sh +cp ./dist/win-64/pm-fw-cli.exe ../cassandra-rc2/dist/ \ No newline at end of file diff --git a/cli-ts/scripts/nexe.js b/cli-ts/scripts/nexe.js new file mode 100644 index 00000000..f181ec2e --- /dev/null +++ b/cli-ts/scripts/nexe.js @@ -0,0 +1,94 @@ +// nexe.js - Compile pm-media to Windows executable using nexe Node.js API +import { compile } from 'nexe'; +import path from 'path'; +import fs from 'fs'; + +async function buildExecutable() { + const outputDir = './dist/win-64'; + const outputFile = 'pm-fw-cli.exe'; + const entryPoint = './dist/main_node.cjs'; + const nexeTemp = '../../nexe-24'; + const nodeVersion = '24.5.0'; + + // Ensure output directory exists + if (!fs.existsSync(outputDir)) { + fs.mkdirSync(outputDir, { recursive: true }); + console.log(`📠Created output directory: ${outputDir}`); + } + + // Ensure nexe temp directory exists + if (!fs.existsSync(nexeTemp)) { + fs.mkdirSync(nexeTemp, { recursive: true }); + console.log(`📠Created temp directory: ${nexeTemp}`); + } + + // Check if entry point exists + if (!fs.existsSync(entryPoint)) { + console.log(`⌠Entry point ${entryPoint} not found. Please run 'npm run build' first.`); + process.exit(1); + } + + const outputPath = path.join(outputDir, outputFile); + + console.log('📦 Compiling with nexe...'); + console.log(` Entry: ${entryPoint}`); + console.log(` Output: ${outputPath}`); + console.log(` Temp: ${nexeTemp}`); + console.log(` Target: windows-x64-${nodeVersion}`); + + try { + await compile({ + input: entryPoint, + output: outputPath, + target: `windows-x64-${nodeVersion}`, + build: true, // Build from source for native modules like sharp + temp: nexeTemp, + clean: false, + name: 'pm-media', + configure: ['--with-intl=full-icu'], // Full ICU support + make: ['-j4'], // Parallel build + loglevel: 'verbose', + // Resources - include any additional files if needed + resources: [ + // Add any resource patterns here if needed + // './assets/**/*' + ], + patches: [ + // Patch for better native module support + async (compiler, next) => { + // This patch helps with native modules like sharp + await compiler.replaceInFileAsync( + 'lib/internal/bootstrap/pre_execution.js', + 'process.dlopen = function(', + ` + // Nexe patch for native modules + const originalDlopen = process.dlopen; + process.dlopen = function(` + ); + return next(); + } + ] + }); + + console.log(`✅ Successfully compiled to ${outputPath}`); + + // Show file size + if (fs.existsSync(outputPath)) { + const stats = fs.statSync(outputPath); + const fileSizeInMB = (stats.size / (1024 * 1024)).toFixed(2); + console.log(`📊 Executable size: ${fileSizeInMB} MB`); + } + + console.log('🎉 Build complete!'); + + } catch (error) { + console.error('⌠Compilation failed:', error.message); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); + } +} + +// Run the build +buildExecutable().catch(console.error); diff --git a/cli-ts/scripts/nexe.sh b/cli-ts/scripts/nexe.sh new file mode 100644 index 00000000..aa0db379 --- /dev/null +++ b/cli-ts/scripts/nexe.sh @@ -0,0 +1,6 @@ +#npm run build +#npm run webpack +# cp ./dist/main_node.js ./dist/main_node.cjs +node scripts/nexe.js +#mkdir -p dist/win-64/dist +#cp dist/win-64/*.wasm dist/win-64/dist/ diff --git a/cli-ts/settings.json b/cli-ts/settings.json new file mode 100644 index 00000000..d6781bae --- /dev/null +++ b/cli-ts/settings.json @@ -0,0 +1,60 @@ +{ + "master": "cassandra-master", + "slaves": [ + "cassandra-24" + ], + "partitions": [ + { + "name": "Cassandra Bank Alpha2", + "controllers": [ + { + "slaveid": 10, + "name": "Katrina", + "enabled": true + }, + { + "slaveid": 11, + "name": "Castor", + "enabled": true + }, + { + "slaveid": 12, + "name": "Cetus", + "enabled": true + }, + { + "slaveid": 13, + "name": "Corona", + "enabled": true + } + ] + }, + { + "name": "Cassandra Bank Beta", + "controllers": [ + { + "slaveid": 14, + "name": "Coma B", + "enabled": true + }, + { + "slaveid": 15, + "name": "Corvus", + "enabled": true + }, + { + "slaveid": 16, + "name": "Crater", + "enabled": true + }, + { + "slaveid": 17, + "name": "Crux", + "enabled": true + } + ], + "startslaveid": 14, + "numcontrollers": 4 + } + ] +} \ No newline at end of file diff --git a/cli-ts/signal_plots.json b/cli-ts/signal_plots.json new file mode 100644 index 00000000..289d8dfe --- /dev/null +++ b/cli-ts/signal_plots.json @@ -0,0 +1,96 @@ +[ + { + "slot": 0, + "name": "Single Stage Default", + "duration": 1200000, + "status": 0, + "enabled": false, + "elapsed": 0, + "remaining": 0, + "controlPoints": [ + { + "id": 1, + "time": 80, + "state": 2, + "type": 7, + "arg_0": 0, + "arg_1": 0, + "name": "Kiss", + "description": "kiss kiss" + }, + { + "id": 2, + "time": 222, + "state": 2, + "type": 7, + "arg_0": 0, + "arg_1": 0, + "name": "Bang", + "description": "bang bang" + }, + { + "id": 3, + "time": 432, + "state": 2, + "type": 9, + "arg_0": 0, + "arg_1": 0, + "name": "Pause", + "description": "New control point" + } + ] + }, + { + "slot": 1, + "name": "ShortPlot_70s", + "duration": 70000, + "status": 0, + "enabled": false, + "elapsed": 0, + "remaining": 0, + "controlPoints": [ + { + "id": 1, + "time": 250, + "name": "Valve Open", + "description": "Open valve at address 1", + "state": 2, + "type": 1, + "arg_0": 1, + "arg_1": 1, + "arg_2": 0 + }, + { + "id": 2, + "time": 750, + "name": "Valve Close", + "description": "Close valve at address 1", + "state": 2, + "type": 1, + "arg_0": 1, + "arg_1": 0, + "arg_2": 0 + } + ] + }, + { + "slot": 2, + "name": "SignalPlot_922_Slot_2", + "duration": 0, + "status": 0, + "enabled": false, + "elapsed": 0, + "remaining": 0, + "controlPoints": [] + }, + { + "slot": 3, + "name": "SignalPlot_923_Slot_3", + "duration": 0, + "status": 0, + "enabled": false, + "elapsed": 0, + "remaining": 0, + "controlPoints": [] + } +] \ No newline at end of file diff --git a/cli-ts/src/commands/build-proto.ts b/cli-ts/src/commands/build-proto.ts new file mode 100644 index 00000000..17e5ef7c --- /dev/null +++ b/cli-ts/src/commands/build-proto.ts @@ -0,0 +1,42 @@ +import type { Argv } from "yargs"; +import path from "path"; +import fs from "fs/promises"; +import { log } from "../lib/logger.js"; + +export const command = "build-proto"; +export const desc = "Copies .proto files to the client app for dynamic loading."; + +const REPO_ROOT = path.join(path.resolve("./")); + +// --- Configuration --- +const CLIENT_PROTO_DEST_DIR = path.resolve(REPO_ROOT, "../web/packages/modbus-ui/src/proto"); +const PROTO_SRC_DIR = path.join(REPO_ROOT, "proto"); + +console.log("REPO_ROOT", REPO_ROOT); +console.log("CLIENT_PROTO_DEST_DIR", CLIENT_PROTO_DEST_DIR); +const cmd = `pbjs -t static-module -w commonjs -o ${CLIENT_PROTO_DEST_DIR}/bundle.js ${PROTO_SRC_DIR}/bundle.proto`; +export const handler = async (): Promise => { + try { + log.info(`Converting .proto files from '${PROTO_SRC_DIR}' to '${CLIENT_PROTO_DEST_DIR}'`); + + await fs.mkdir(CLIENT_PROTO_DEST_DIR, { recursive: true }); + + const protoFiles = (await fs.readdir(PROTO_SRC_DIR)).filter(f => f.endsWith(".proto")); + if (protoFiles.length === 0) { + log.warn("No .proto files found to copy."); + return; + } + + for (const file of protoFiles) { + const srcPath = path.join(PROTO_SRC_DIR, file); + const destPath = path.join(CLIENT_PROTO_DEST_DIR, file); + console.log("srcPath", srcPath); + console.log("destPath", destPath); + } + + log.info("\nSuccessfully copied all .proto files to the client!"); + } catch (error) { + log.error("\nFailed to convert .proto files.", error); + process.exit(1); + } +}; \ No newline at end of file diff --git a/cli-ts/src/commands/dump.ts b/cli-ts/src/commands/dump.ts new file mode 100644 index 00000000..e918d101 --- /dev/null +++ b/cli-ts/src/commands/dump.ts @@ -0,0 +1,148 @@ +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; +import { sync as write } from "@polymech/fs/write"; +import modbusApiService from "@polymech/client-ts/modbusApiService"; +import { resolve } from "@polymech/commons/variables"; + +async function dumpModbusData(targetDir: string) { + try { + log.info(`Fetching all registers...`); + const registers = await modbusApiService.getRegisters(); + const filePath = path.resolve(resolve("${POLYMECH_ROOT}/site2/src/content/resources/cassandra/registers.json")) + await write(filePath, JSON.stringify(registers, null, 2)); + log.info(`Saved registers.json to ${filePath}`); + } catch (error) { + if (error instanceof Error) { + log.error(`Failed to dump registers: ${error.message}`); + } else { + log.error(`Failed to dump registers:`, error); + } + } + + try { + log.info(`Fetching all coils...`); + const coils = await modbusApiService.getCoils(); + const filePath = path.resolve(resolve("${POLYMECH_ROOT}/site2/src/content/resources/cassandra/coils.json")) + await write(filePath, JSON.stringify(coils, null, 2)); + log.info(`Saved coils.json to ${filePath}`); + } catch (error) { + if (error instanceof Error) { + log.error(`Failed to dump coils: ${error.message}`); + } else { + log.error(`Failed to dump coils:`, error); + } + } +} + +export const command = "dump"; +export const describe = "Dumps JSON data from API endpoints to files."; + +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + directory: { + describe: "Target directory to save JSON files", + default: "../cassandra-rc2/templates/cassandra/", + type: "string", + }, +} as const; + +const endpoints = [ + { path: "/v1/profiles", filename: "default_profiles.json" }, + { path: "/v1/settings", filename: "settings.json" }, + { path: "/v1/signalplots", filename: "signals_plots.json" }, + { path: "/v1/fs?file=layout.json", filename: "layout.json" }, + { path: "/v1/network/settings", filename: "network.json" }, + { path: "/v1/state", filename: "state.json" }, + { path: "/v1/pressure-profiles", filename: "pressure_profiles.json" }, +]; + +async function fetchEndpoint(baseUrl: string, endpoint: string): Promise { + const url = `${baseUrl}${endpoint}`; + const response = await fetch(url, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + }); + + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } catch (e) { + // Ignore + } + throw new Error(`Failed to fetch ${endpoint}: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } + + return await response.json(); +} + +async function testConnection(baseUrl: string): Promise { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } catch (error) { + return false; + } +} + +export async function handler(argv: { targethost: string; directory: string, [key: string]: any }) { + + log.info(`Dumping data from host: ${argv.targethost}`); + + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + + try { + modbusApiService.setBaseUrl(baseUrl); + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + + const targetDir = path.resolve(process.cwd(), argv.directory); + + try { + await fs.mkdir(targetDir, { recursive: true }); + } catch (error) { + // Directory might already exist + } + + for (const endpoint of endpoints) { + try { + log.info(`Fetching ${endpoint.path}...`); + const data = await fetchEndpoint(baseUrl, endpoint.path); + const filePath = path.join(targetDir, endpoint.filename); + await write(filePath, JSON.stringify(data, null, 2)); + log.info(`Saved ${endpoint.filename} to ${filePath}`); + } catch (error) { + if (error instanceof Error) { + log.error(`Failed to dump ${endpoint.path}: ${error.message}`); + } else { + log.error(`Failed to dump ${endpoint.path}:`, error); + } + } + } + + await dumpModbusData(targetDir); + log.info("Dump completed."); + } catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } else { + log.error("An unknown error occurred.", error); + } + } +} diff --git a/cli-ts/src/commands/mb.ts b/cli-ts/src/commands/mb.ts new file mode 100644 index 00000000..f44f7384 --- /dev/null +++ b/cli-ts/src/commands/mb.ts @@ -0,0 +1,111 @@ +import { log } from "../lib/logger.js"; + +import { ModbusClient, E_FN_CODE } from "../lib/modbus-client.js"; + +export const command = "mb"; +export const describe = "Modbus TCP client"; + +export const builder = { + host: { + describe: "The target host", + demandOption: false, + type: "string", + default: "192.168.1.250", + }, + port: { + describe: "The target port", + demandOption: false, + type: "number", + default: 502, + }, + fn: { + describe: "Function code", + demandOption: true, + type: "number", + }, + reg: { + describe: "Register address", + demandOption: true, + type: "number", + }, + value: { + describe: "Value to write", + demandOption: false, + type: "number", + }, + count: { + describe: "Number of registers/coils to read", + demandOption: false, + type: "number", + default: 1, + }, + "slave-id": { + describe: "Modbus slave/unit ID", + demandOption: false, + type: "number", + default: 1, + } +} as const; + +export async function handler(argv: { host: string; port: number; fn: number; reg: number; value?: number; count: number; "slave-id": number;[key: string]: any }) { + + log.info(`Connecting to ${argv.host}:${argv.port}`); + const client = new ModbusClient(argv.host, argv.port); + + log.info(`Function code: ${argv.fn}`); + log.info(`Register address: ${argv.reg}`); + log.info(`Value: ${argv.value}`); + log.info(`Count: ${argv.count}`); + log.info(`Slave ID: ${argv["slave-id"]}`); + + try { + await client.connect(); + + if (argv.value !== undefined) { // Write operation + switch (argv.fn) { + case E_FN_CODE.FN_WRITE_HOLD_REGISTER: + log.info(`Writing holding register ${argv.reg} with value ${argv.value} to slave ${argv["slave-id"]}`); + if (argv.reg !== 100) { + await client.writeHoldingRegister(argv.reg, argv.value, argv["slave-id"]); + } else { + client.writeHoldingRegister(argv.reg, argv.value, argv["slave-id"]); + process.exit(0); + } + break; + case E_FN_CODE.FN_WRITE_COIL: + log.info(`Writing coil ${argv.reg} with value ${argv.value} to slave ${argv["slave-id"]}`); + await client.writeCoil(argv.reg, argv.value > 0, argv["slave-id"]); + log.info(`Write successful.`); + break; + default: + log.error(`Function code ${argv.fn} not supported for write operation.`); + } + } else { // Read operation + switch (argv.fn) { + case E_FN_CODE.FN_READ_HOLD_REGISTER: { + log.info(`Reading ${argv.count} holding register(s) from address ${argv.reg} on slave ${argv["slave-id"]}`); + const values = await client.readHoldingRegisters(argv.reg, argv.count, argv["slave-id"]); + process.stdout.write(JSON.stringify(values) + '\n'); + break; + } + case E_FN_CODE.FN_READ_COIL: { + log.info(`Reading ${argv.count} coil(s) from address ${argv.reg} on slave ${argv["slave-id"]}`); + const values = await client.readCoils(argv.reg, argv.count, argv["slave-id"]); + process.stdout.write(JSON.stringify(values) + '\n'); + break; + } + default: + log.error(`Function code ${argv.fn} not supported for read operation.`); + } + } + + } catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } else { + log.error("An unknown error occurred.", error); + } + } finally { + client.disconnect(); + } +} \ No newline at end of file diff --git a/cli-ts/src/commands/patch-app.ts b/cli-ts/src/commands/patch-app.ts new file mode 100644 index 00000000..5f0f51fe --- /dev/null +++ b/cli-ts/src/commands/patch-app.ts @@ -0,0 +1,253 @@ +import { promises as fs } from 'fs'; +import path from 'path'; +import * as cheerio from 'cheerio'; + +export const command = 'patch-app'; +export const desc = 'Patch app by changing asset loading to be sequential.'; + +export const builder = (yargs) => + yargs.options({ + src: { + describe: 'Path to source index.html', + default: './data/index.html', + }, + dst: { + describe: 'Path to destination index.html', + default: './data/index.html', + }, + }); + + const createLoaderScript = (assets) => { + const assetsJson = JSON.stringify(assets, null, 2); + return ` +(function() { + const assets = ${assetsJson}; + const DEFAULT_RETRIES = 5; + const RETRY_DELAY_MS = 1500; + const SCRIPT_SUCCESS_DELAY_MS = 800; + const NEXT_ASSET_DELAY_MS = 1500; + + let assetIndex = 0; + let allAssetsLoaded = false; + let appIsReady = false; + const splashText = document.getElementById('loading-splash-text'); + + function updateSplash(text) { + if (splashText) { + splashText.textContent = text; + } + } + + function hideSplash() { + const splash = document.getElementById('loading-splash'); + if (splash) { + splash.style.opacity = '0'; + setTimeout(() => splash.remove(), 500); // fade out + } + } + + function checkAndHideSplash() { + if (allAssetsLoaded && appIsReady) { + hideSplash(); + } + } + + window.markAppAsReady = function() { + console.log('markAppAsReady called.'); + appIsReady = true; + checkAndHideSplash(); + }; + + function onAllAssetsLoaded() { + console.log('All assets loaded sequentially.'); + window.dispatchEvent(new CustomEvent('allAssetsLoaded')); + allAssetsLoaded = true; + checkAndHideSplash(); + } + + function loadNextAsset() { + if (assetIndex >= assets.length) { + onAllAssetsLoaded(); + return; + } + + const asset = assets[assetIndex]; + const assetUrl = asset.attrs.href || asset.attrs.src; + const isCss = assetUrl && assetUrl.endsWith('.css'); + + updateSplash('Loading: ' + (assetUrl || 'asset...')); + + if (!assetUrl) { + console.error('Asset has no href or src', asset); + assetIndex++; + const delay = appIsReady ? 1500 : NEXT_ASSET_DELAY_MS; + setTimeout(loadNextAsset, delay); + return; + } + + if (isCss) { + // Use fetch to inline CSS + function fetchWithRetry(url, retries = DEFAULT_RETRIES, retryDelay = RETRY_DELAY_MS) { + updateSplash('Fetching: ' + url); + fetch(url) + .then(response => { + if (response.ok) return response.text(); + if (response.status === 503 && retries > 0) { + updateSplash('Error 503, retrying: ' + url + ' (' + (retries - 1) + ' left)'); + console.warn('Request for ' + url + ' failed with 503. Retrying in ' + retryDelay + 'ms... (' + retries + ' retries left)'); + setTimeout(() => fetchWithRetry(url, retries - 1, retryDelay), retryDelay); + return null; + } + throw new Error('Request failed with status ' + response.status); + }) + .then(text => { + if (text === null) return; // Retry in progress + + updateSplash('Inlining CSS: ' + url); + console.log('Successfully inlined CSS from:', url); + const style = document.createElement('style'); + style.textContent = text; + document.head.appendChild(style); + + assetIndex++; + const delay = appIsReady ? 0 : NEXT_ASSET_DELAY_MS; + setTimeout(loadNextAsset, delay); + }) + .catch(err => { + updateSplash('Failed to load CSS: ' + url); + console.error('Failed to load CSS asset ' + url + ' after retries:', err); + assetIndex++; + const delay = appIsReady ? 0 : NEXT_ASSET_DELAY_MS; + setTimeout(loadNextAsset, delay); + }); + } + fetchWithRetry(assetUrl); + } else { + // Use tag-based loading for JS + let retries = DEFAULT_RETRIES; + const retryDelay = RETRY_DELAY_MS; + + function attemptLoad() { + updateSplash('Loading script: ' + (assetUrl || '...')); + const element = document.createElement(asset.tagName); + for (const attr in asset.attrs) { + element.setAttribute(attr, asset.attrs[attr]); + } + + element.onload = () => { + updateSplash('Loaded script: ' + assetUrl); + console.log('Successfully loaded asset:', assetUrl); + assetIndex++; + const delay = appIsReady ? 0 : SCRIPT_SUCCESS_DELAY_MS; + setTimeout(loadNextAsset, delay); + }; + + element.onerror = () => { + element.remove(); + console.warn('Failed to load asset:', assetUrl); + if (retries > 0) { + retries--; + updateSplash('Retrying script: ' + assetUrl + ' (' + retries + ' left)'); + console.log('Retrying... (' + retries + ' retries left)'); + setTimeout(attemptLoad, retryDelay); + } else { + updateSplash('Failed to load script: ' + assetUrl); + console.error('Failed to load asset after multiple retries:', assetUrl); + assetIndex++; + const delay = appIsReady ? 0 : NEXT_ASSET_DELAY_MS; + setTimeout(loadNextAsset, delay); + } + }; + + document.head.appendChild(element); + } + attemptLoad(); + } + } + + loadNextAsset(); +})(); +`; + }; + + +export const handler = async (argv) => { + const { src, dst } = argv; + + try { + const srcPath = path.resolve(src); + const dstPath = path.resolve(dst); + + console.log(`Patching ${srcPath} for sequential asset loading...`); + + const html = await fs.readFile(srcPath, 'utf-8'); + const $ = cheerio.load(html); + + const splashCss = ` +#loading-splash { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: #222; + color: #eee; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + z-index: 9999; + font-family: "Courier New", Courier, monospace; + font-size: 1em; + text-align: center; + transition: opacity 0.5s ease-out; +} +#loading-splash-text { + margin-top: 20px; + min-height: 1.2em; +} +`; + const splashHtml = ` +
+

Cassandra RC2

+

Initializing Application...

+
+
+`; + + $('head').append(``); + $('body').prepend(splashHtml); + + const assetsToLoad: { tagName: string; attrs: { [name: string]: string; } }[] = []; + + $('head link[href^="/assets/"], head script[src^="/assets/"]').each(function () { + const el = $(this); + const tagName = el.prop('tagName'); + if (!tagName) return; + + const attrs = el.attr(); + + if (attrs && (attrs.src || attrs.href)) { + assetsToLoad.push({ + tagName: tagName.toLowerCase(), + attrs, + }); + el.remove(); + } + }); + + if (assetsToLoad.length > 0) { + const loaderScriptContent = createLoaderScript(assetsToLoad); + $('body').append(``); + console.log(`Injected sequential asset loader script with ${assetsToLoad.length} assets.`); + } else { + console.log('No assets found to patch in .'); + } + + await fs.writeFile(dstPath, $.html()); + console.log(`Successfully patched and saved to ${dstPath}`); + } catch (error) { + console.error('Error patching app:', error); + process.exit(1); + } +}; \ No newline at end of file diff --git a/cli-ts/src/commands/patch-config.ts b/cli-ts/src/commands/patch-config.ts new file mode 100644 index 00000000..4aa11784 --- /dev/null +++ b/cli-ts/src/commands/patch-config.ts @@ -0,0 +1,39 @@ +import path from 'path'; +import fs from 'fs/promises'; +import { patchConfig } from '../lib/config.js'; + +export const command = 'patch-config'; +export const describe = 'Create a configuration overlay file from a JSON patch.'; + +export const builder = { + patch: { + describe: 'Path to the JSON patch file', + type: 'string', + demandOption: true, + }, + dst: { + default: 'src/config-user.h', + describe: 'Path to the destination configuration file', + type: 'string', + } +}; + +export const handler = async (argv: { patch: string, src: string, dst: string }) => { + try { + const patchPath = path.resolve(argv.patch); + //const srcPath = path.resolve(argv.src); + const dstPath = path.resolve(argv.dst); + + const patchContent = await fs.readFile(patchPath, 'utf-8'); + const patch = JSON.parse(patchContent); + + await patchConfig(dstPath, patch); + console.log(`Successfully created overlay file at ${dstPath}`); + } catch (error) { + if (error instanceof Error) { + console.error(`Error applying patch: ${error.message}`); + } else { + console.error('An unknown error occurred while applying the patch.'); + } + } +}; \ No newline at end of file diff --git a/cli-ts/src/commands/restore.ts b/cli-ts/src/commands/restore.ts new file mode 100644 index 00000000..f352e0ce --- /dev/null +++ b/cli-ts/src/commands/restore.ts @@ -0,0 +1,128 @@ +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; +import modbusApiService from "@polymech/client-ts/modbusApiService"; + +export const command = "restore"; +export const describe = "Restores JSON data from files to API endpoints via filesystem upload."; + +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + directory: { + describe: "Source directory to read JSON files", + default: "./data", + type: "string", + }, +} as const; + +const endpoints = [ + { local: "default_profiles.json", remote: "profile_defaults.json" }, + { local: "settings.json", remote: "settings.json" }, + { local: "signals_plots.json", remote: "signal_plots.json" }, + { local: "layout.json", remote: "layout.json" }, + { local: "network.json", remote: "network.json" }, + { local: "state.json", remote: "state.json" }, + { local: "pressure_profiles.json", remote: "pressure_profiles.json" }, +]; + +async function uploadFile(baseUrl: string, filename: string, content: string): Promise { + const url = `${baseUrl}/v1/fs`; + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + filename: filename, + content: content + }), + }); + + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } catch (e) { + // Ignore + } + throw new Error(`Failed to upload ${filename}: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } +} + +async function testConnection(baseUrl: string): Promise { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } catch (error) { + return false; + } +} + +export async function handler(argv: { targethost: string; directory: string, [key: string]: any }) { + log.info(`Restoring data to host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + + try { + modbusApiService.setBaseUrl(baseUrl); + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + + const sourceDir = path.resolve(process.cwd(), argv.directory); + log.info(`Reading files from: ${sourceDir}`); + + try { + await fs.access(sourceDir); + } catch (error) { + log.error(`Source directory does not exist: ${sourceDir}`); + return; + } + + for (const endpoint of endpoints) { + try { + const filePath = path.join(sourceDir, endpoint.local); + log.info(`Reading ${endpoint.local}...`); + + let fileContent: string; + try { + fileContent = await fs.readFile(filePath, 'utf-8'); + } catch (e) { + log.warn(`Skipping ${endpoint.local}: File not found.`); + continue; + } + + log.info(`Uploading to /${endpoint.remote}...`); + const uploadResult = await uploadFile(baseUrl, endpoint.remote, fileContent); + log.info(`Successfully restored ${endpoint.local} as /${endpoint.remote}`); + + } catch (error) { + if (error instanceof Error) { + log.error(`Failed to restore ${endpoint.local}: ${error.message}`); + } else { + log.error(`Failed to restore ${endpoint.local}:`, error); + } + } + } + + log.info("Restore completed."); + + } catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } else { + log.error("An unknown error occurred.", error); + } + } +} diff --git a/cli-ts/src/commands/setup-network.ts b/cli-ts/src/commands/setup-network.ts new file mode 100644 index 00000000..c6235525 --- /dev/null +++ b/cli-ts/src/commands/setup-network.ts @@ -0,0 +1,120 @@ +import { networkSettingsSchema } from "../schemas/network-schema.js"; +import type { NetworkSettingsUpdatePayload } from "../types.js"; +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; + +export const command = "setup-network"; +export const describe = "Sets up network settings for a target host."; + +const networkOptions = Object.keys(networkSettingsSchema.shape).reduce((acc, key) => { + acc[key] = { + describe: `Overrides ${key} from the settings file`, + type: 'string', + demandOption: false, + }; + return acc; +}, {} as { [key: string]: { describe: string; type: 'string'; demandOption: false } }); + + +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + file: { + describe: "Path to the network settings file", + default: "network.json", + type: "string", + }, + ...networkOptions, +} as const; + +async function setNetworkSettings(baseUrl: string, settings: NetworkSettingsUpdatePayload): Promise { + const url = `${baseUrl}/v1/network/settings`; + log.info(`Setting network settings to ${url}`); + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(settings), + }); + + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } catch (e) { + // Ignore + } + throw new Error(`Failed to set network settings: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } + try { + return await response.json(); + } catch (e) { + return { success: true, message: 'Network settings updated.' }; + } +} + +async function testConnection(baseUrl: string): Promise { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } catch (error) { + return false; + } +} + + +export async function handler(argv: { targethost: string; file: string;[key: string]: any }) { + log.info(`Setting up network for host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + + try { + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + + const filePath = path.resolve(process.cwd(), argv.file); + const fileContent = await fs.readFile(filePath, "utf-8"); + const settingsFromFile: NetworkSettingsUpdatePayload = JSON.parse(fileContent); + + const cliOverrides = Object.keys(networkSettingsSchema.shape).reduce((acc, key) => { + if (argv[key] !== undefined && argv[key] !== null) { + acc[key as keyof NetworkSettingsUpdatePayload] = argv[key]; + } + return acc; + }, {} as Partial); + + const settings = { ...settingsFromFile, ...cliOverrides }; + + log.info("Validating network settings...", cliOverrides); + const validationResult = networkSettingsSchema.safeParse(settings); + + if (!validationResult.success) { + log.error("Invalid network settings:", validationResult.error.flatten()); + return; + } + + log.info(`Validation successful. Applying settings to ${baseUrl}`); + const res = await setNetworkSettings(baseUrl, validationResult.data); + log.info(`Network settings applied successfully: \n\n`, { message: res.message }); + + } catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } else { + log.error("An unknown error occurred.", error); + } + } +} \ No newline at end of file diff --git a/cli-ts/src/commands/setup-profiles.ts b/cli-ts/src/commands/setup-profiles.ts new file mode 100644 index 00000000..6b981fe9 --- /dev/null +++ b/cli-ts/src/commands/setup-profiles.ts @@ -0,0 +1,99 @@ +import { profilesSchema } from "../schemas/profiles-schema.js"; +import type { ProfilesUpdatePayload } from "../types.js"; +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; + +export const command = "setup-profiles"; +export const describe = "Sets up profiles for a target host."; + +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + file: { + describe: "Path to the profiles file", + default: "profile_defaults.json", + type: "string", + }, +} as const; + +async function setProfiles(baseUrl: string, settings: ProfilesUpdatePayload): Promise { + const url = `${baseUrl}/v1/profiles`; + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(settings), + }); + + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } catch (e) { + // Ignore + } + throw new Error(`Failed to set profiles: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } + try { + return await response.json(); + } catch (e) { + return { success: true, message: 'Profiles updated.' }; + } +} + +async function testConnection(baseUrl: string): Promise { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } catch (error) { + return false; + } +} + + +export async function handler(argv: { targethost: string; file: string, [key: string]: any }) { + log.info(`Setting up profiles for host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + + try { + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + + const filePath = path.resolve(process.cwd(), argv.file); + const fileContent = await fs.readFile(filePath, "utf-8"); + const settings: ProfilesUpdatePayload = JSON.parse(fileContent); + + log.info("Validating profiles..."); + const validationResult = profilesSchema.parse(settings); + + if (!validationResult) { + log.error("Invalid profiles:", validationResult); + return; + } + + log.info(`Validation successful. Applying profiles to ${baseUrl}`); + const res = await setProfiles(baseUrl, validationResult); + log.info(`Profiles applied successfully: \n\n`, { message: res.message }); + + } catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } else { + log.error("An unknown error occurred.", error); + } + } +} \ No newline at end of file diff --git a/cli-ts/src/commands/setup-settings.ts b/cli-ts/src/commands/setup-settings.ts new file mode 100644 index 00000000..48c4f820 --- /dev/null +++ b/cli-ts/src/commands/setup-settings.ts @@ -0,0 +1,106 @@ +import { settingsSchema } from "../schemas/settings-schema.js"; +import type { SettingsUpdatePayload } from "../types.js"; +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; + + +export const command = "setup-settings"; +export const describe = "Sets up settings for a target host."; + +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + file: { + describe: "Path to the settings file", + default: "settings.json", + type: "string", + }, +} as const; + +async function setSettings( + baseUrl: string, + settings: SettingsUpdatePayload, +): Promise { + const url = `${baseUrl}/v1/settings`; + const response = await fetch(url, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(settings), + }); + + if (!response.ok) { + let errorBody = ""; + try { + errorBody = await response.text(); + } catch (e) { + // Ignore + } + throw new Error( + `Failed to set settings: ${response.statusText} ${errorBody ? `- ${errorBody}` : "" + }`, + ); + } + try { + return await response.json(); + } catch (e) { + return { success: true, message: "Settings updated." }; + } +} + +async function testConnection(baseUrl: string): Promise { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } catch (error) { + return false; + } +} + +export async function handler(argv: { targethost: string; file: string;[key: string]: any }) { + log.info(`Setting up settings for host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith("/api")) { + baseUrl = `${baseUrl}/api`; + } + + try { + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error( + `Failed to connect to ${argv.targethost}. Please check the host address and network connection.`, + ); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + + const filePath = path.resolve(process.cwd(), argv.file); + const fileContent = await fs.readFile(filePath, "utf-8"); + const settings: SettingsUpdatePayload = JSON.parse(fileContent); + + log.info("Validating settings..."); + const validationResult = settingsSchema.safeParse(settings); + + if (!validationResult.success) { + log.error("Invalid settings:", validationResult.error.flatten()); + return; + } + + log.info(`Validation successful. Applying settings to ${baseUrl}`); + const res = await setSettings(baseUrl, validationResult.data); + log.info(`Settings applied successfully: \n\n`, { message: res.message }); + } catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } else { + log.error("An unknown error occurred.", error); + } + } +} \ No newline at end of file diff --git a/cli-ts/src/commands/setup-signals.ts b/cli-ts/src/commands/setup-signals.ts new file mode 100644 index 00000000..572af12d --- /dev/null +++ b/cli-ts/src/commands/setup-signals.ts @@ -0,0 +1,99 @@ +import { signalPlotsSchema } from "../schemas/signal-plots-schema.js"; +import type { SignalPlotsUpdatePayload } from "../types.js"; +import { log } from "../lib/logger.js"; +import path from "path"; +import fs from "fs/promises"; + +export const command = "setup-signals"; +export const describe = "Sets up signal plots for a target host."; + +export const builder = { + targethost: { + describe: "The target host (e.g., http://192.168.1.250)", + demandOption: true, + type: "string", + default: "http://192.168.1.250", + }, + file: { + describe: "Path to the signal plots file", + default: "signal_plots.json", + type: "string", + }, +} as const; + +async function setSignalPlots(baseUrl: string, settings: SignalPlotsUpdatePayload): Promise { + const url = `${baseUrl}/v1/signalplots`; + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(settings), + }); + + if (!response.ok) { + let errorBody = ''; + try { + errorBody = await response.text(); + } catch (e) { + // Ignore + } + throw new Error(`Failed to set signal plots: ${response.statusText} ${errorBody ? `- ${errorBody}` : ''}`); + } + try { + return await response.json(); + } catch (e) { + return { success: true, message: 'Signal plots updated.' }; + } +} + +async function testConnection(baseUrl: string): Promise { + try { + const response = await fetch(`${baseUrl}/v1/system/info`); + return response.ok; + } catch (error) { + return false; + } +} + + +export async function handler(argv: { targethost: string; file: string, [key: string]: any }) { + log.info(`Setting up signal plots for host: ${argv.targethost}`); + let baseUrl = argv.targethost; + baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; + if (!baseUrl.endsWith('/api')) { + baseUrl = `${baseUrl}/api`; + } + + try { + const isConnected = await testConnection(baseUrl); + if (!isConnected) { + log.error(`Failed to connect to ${argv.targethost}. Please check the host address and network connection.`); + return; + } + log.info(`Successfully connected to ${argv.targethost}.`); + + const filePath = path.resolve(process.cwd(), argv.file); + const fileContent = await fs.readFile(filePath, "utf-8"); + const settings: SignalPlotsUpdatePayload = JSON.parse(fileContent); + + log.info("Validating signal plots..."); + const validationResult = signalPlotsSchema.safeParse(settings); + + if (!validationResult.success) { + log.error("Invalid signal plots:", validationResult.error.flatten()); + return; + } + + log.info(`Validation successful. Applying signal plots to ${baseUrl}`); + const res = await setSignalPlots(baseUrl, validationResult.data); + log.info(`Signal plots applied successfully: \n\n`, { message: res.message }); + + } catch (error) { + if (error instanceof Error) { + log.error(`An error occurred: ${error.message}`); + } else { + log.error("An unknown error occurred.", error); + } + } +} \ No newline at end of file diff --git a/cli-ts/src/commands/test-web.ts b/cli-ts/src/commands/test-web.ts new file mode 100644 index 00000000..48d44286 --- /dev/null +++ b/cli-ts/src/commands/test-web.ts @@ -0,0 +1,164 @@ +import WebSocket from 'ws'; +import { Arguments, CommandBuilder } from 'yargs'; +import { performance } from 'perf_hooks'; + +export const command = 'test-web'; +export const describe = 'Simulates the web app behavior: connects to WebSocket and fetches registers via REST.'; + +interface Options { + wsUrl: string; + apiUrl: string; + interval: number; + payloadTest: boolean; + payloadSize: number; + period: number; +} + +export const builder: CommandBuilder = (yargs) => + yargs + .option('wsUrl', { + alias: 'w', + type: 'string', + description: 'WebSocket URL to connect to', + default: 'ws://192.168.1.250/ws', + }) + .option('apiUrl', { + alias: 'a', + type: 'string', + description: 'Base API URL', + default: 'http://192.168.1.250/api', + }) + .option('interval', { + alias: 'i', + type: 'number', + description: 'Interval between register fetches in ms', + default: 30, + }) + .option('payloadTest', { + type: 'boolean', + description: 'Run WebSocket payload size test', + default: true, + }) + .option('payloadSize', { + type: 'number', + description: 'Size of payload to request in bytes', + default: 1024, + }) + .option('period', { + alias: 'p', + type: 'number', + description: 'Period between payload requests in ms', + default: 150, + }); + +export const handler = async (argv: Arguments): Promise => { + + const { wsUrl, apiUrl, interval, payloadTest, payloadSize, period } = argv; + + console.log(`Starting test-web...`); + console.log(`WebSocket URL: ${wsUrl}`); + console.log(`API URL: ${apiUrl}`); + + // 1. Connect to WebSocket + const ws = new WebSocket(wsUrl); + + ws.on('open', () => { + console.log('WebSocket connected.'); + }); + + ws.on('message', (data: WebSocket.Data) => { + // Just consume messages to keep the connection active and simulate traffic processing + // console.log('WS Message received:', data.toString().length, 'bytes'); + if (payloadTest) { + try { + const msg = JSON.parse(data.toString()); + if (msg.type === 'test_payload') { + console.log(`Received test payload: ${msg.data.size} bytes requested, payload length: ${msg.data.payload.length}`); + } + } catch (e) { + // ignore + } + } + }); + + ws.on('close', (code: number, reason: Buffer) => { + console.log(`WebSocket disconnected. Code: ${code}, Reason: ${reason.toString()}`); + process.exit(0); + }); + + ws.on('error', (error: Error) => { + console.error('WebSocket error:', error.message); + console.error('WebSocket readyState:', ws.readyState); + }); + + ws.on('ping', (data: Buffer) => { + console.log('WS received ping:', data.toString()); + }); + + ws.on('pong', (data: Buffer) => { + console.log('WS received pong:', data.toString()); + }); + + // 2. Fetch Registers via REST (simulating modbusApiService.ts) + const fetchRegisters = async () => { + console.log('Starting register fetch...'); + let currentPage = 0; + let totalPages = 1; + const pageSize = 10; + let totalRegisters = 0; + + while (currentPage < totalPages) { + const startTime = performance.now(); + try { + const response = await fetch(`${apiUrl}/v1/registers?page=${currentPage}&pageSize=${pageSize}`); + if (!response.ok) { + throw new Error(`HTTP error ${response.status}: ${response.statusText}`); + } + const data: any = await response.json(); + + if (data.registers) { + totalRegisters += data.registers.length; + } + + if (data.meta) { + totalPages = data.meta.totalPages; + } else { + break; + } + + const duration = performance.now() - startTime; + console.log(`Fetched page ${currentPage}/${totalPages} in ${duration.toFixed(2)}ms`); + + } catch (error) { + console.error(`Failed to fetch page ${currentPage}:`, error); + } + + currentPage++; + if (interval > 0) { + await new Promise(resolve => setTimeout(resolve, interval)); + } + } + console.log(`Finished fetching ${totalRegisters} registers.`); + }; + + // await fetchRegisters(); + + if (payloadTest) { + ws.on('open', () => { + console.log(`Starting periodic payload test (size: ${payloadSize}, period: ${period}ms)...`); + setInterval(() => { + if (ws.readyState === WebSocket.OPEN) { + console.log('Sending payload test... ' + payloadSize + ' bytes'); + ws.send(JSON.stringify({ command: 'test_payload', size: payloadSize })); + } else { + console.log('WebSocket is not open. Payload test skipped.'); + } + }, period); + }); + } else { + // Start fetching registers immediately + } + + // Keep process alive + process.stdin.resume(); +}; diff --git a/cli-ts/src/commands/ws-client.ts b/cli-ts/src/commands/ws-client.ts new file mode 100644 index 00000000..77c1ad6b --- /dev/null +++ b/cli-ts/src/commands/ws-client.ts @@ -0,0 +1,166 @@ +import WebSocket from 'ws'; +import { Arguments, CommandBuilder } from 'yargs'; +import { performance } from 'perf_hooks'; +import { decodeNetworkValue } from '../lib/pb-decoder.js'; +import * as fs from 'fs'; +import * as path from 'path'; +import { JSONPath } from 'jsonpath-plus'; + +export const command = 'ws-client'; +export const describe = 'Connects to the device WebSocket server.'; + +const queryPresets = { + coils: '$[?(@.type=="coil_update")]', + registers: '$[?(@.type=="register_update")]', +}; + +interface Options { + url: string; + timeout: number; + dest: string; + query: string; + verbose: boolean; +} + +export const builder: CommandBuilder = (yargs) => + yargs + .option('url', { + alias: 'u', + type: 'string', + description: 'WebSocket URL to connect to', + default: 'ws://192.168.1.250/ws', + }) + .option('timeout', { + alias: 't', + type: 'number', + description: 'Disconnect after N seconds. 0 for no timeout.', + default: 0, + }) + .option('dest', { + alias: 'd', + type: 'string', + description: 'Path to a JSON file to save messages to.', + default: './last-ws.json' + }) + .option('query', { + alias: 'q', + type: 'string', + description: 'JSONPath query to filter messages. Presets: coils, registers.', + coerce: (arg) => queryPresets[arg as keyof typeof queryPresets] || arg, + }) + .option('verbose', { + alias: 'v', + type: 'boolean', + description: 'Show full message payloads in the console.', + default: false, + }) + .example('$0 ws-client -q coils', 'Show only coil update messages.') + .example('$0 ws-client -q \'$[?(@.address==1003)]\'','') + .example('$0 ws-client -q \'$[?(@.data.address==1002)]\'', '') + .example('$0 ws-client -q \'$[?(@.type=="register_update" && @.data.address==1002)]\'', ''); + +export const handler = (argv: Arguments): void => { + const { url, timeout, dest, query, verbose } = argv; + const destPath = path.resolve(dest); + let messages: any[] = []; + + // Load existing messages if the file exists and is valid JSON + try { + if (fs.existsSync(destPath)) { + const fileContent = fs.readFileSync(destPath, 'utf-8'); + const existingData = JSON.parse(fileContent); + if (Array.isArray(existingData)) { + messages = existingData; + console.log(`Loaded ${messages.length} existing messages from ${destPath}`); + } + } + } catch (e) { + console.log(`Could not parse existing destination file ${destPath}. Starting fresh.`); + messages = []; + } + + const saveAndExit = () => { + try { + fs.writeFileSync(destPath, JSON.stringify(messages, null, 2)); + console.log(`\nMessages saved to ${destPath}`); + } catch (error) { + console.error(`\nFailed to write messages to ${destPath}:`, error); + } + process.exit(0); + }; + + const connect = () => { + console.log(`Connecting to ${url}...`); + const ws = new WebSocket(url); + + if (timeout > 0) { + console.log(`Will disconnect in ${timeout} seconds.`); + setTimeout(() => { + console.log('Timeout reached. Disconnecting.'); + ws.close(); + }, timeout * 1000); + } + + ws.on('open', () => { + console.log('Connected to WebSocket server.'); + }); + + ws.on('message', (data: WebSocket.Data, isBinary: boolean) => { + let messageData: any; + + if (isBinary) { + const buffer = data as Buffer; + const startTime = performance.now(); + const decoded = decodeNetworkValue(buffer); + const endTime = performance.now(); + const duration = (endTime - startTime) * 1000; + messageData = decoded; + } else { + const jsonStr = data.toString(); + try { + const message = JSON.parse(jsonStr); + if (message.type === 'welcome') { + console.log(`Successfully connected. Client ID: ${message.clientId}`); + return; // Don't process welcome message further + } + messageData = message; + } catch (e) { + messageData = { type: 'raw', payload: jsonStr }; + } + } + + if (messageData) { + messages.push(messageData); + + if (query) { + try { + const result = JSONPath({ path: query, json: [messageData] }); + if (result.length > 0) { + if (verbose) console.log(JSON.stringify(result[0], null, 2)); + } + } catch (e) { + // Ignore errors for messages that don't match the query structure + } + } else { + if (verbose) console.log(JSON.stringify(messageData, null, 2)); + } + } + }); + + ws.on('close', () => { + console.log('Disconnected.'); + saveAndExit(); + }); + + ws.on('error', (error: Error) => { + console.error('WebSocket error:', error.message); + ws.close(); + }); + }; + + // Ensure file is saved on exit signals + process.on('SIGINT', saveAndExit); + process.on('SIGTERM', saveAndExit); + + connect(); +}; \ No newline at end of file diff --git a/cli-ts/src/index.ts b/cli-ts/src/index.ts new file mode 100644 index 00000000..d62923ce --- /dev/null +++ b/cli-ts/src/index.ts @@ -0,0 +1,36 @@ +#!/usr/bin/env node +import yargs from "yargs"; +import { hideBin } from "yargs/helpers"; +import * as setupNetworkCommand from "./commands/setup-network.js"; +import * as setupSettingsCommand from "./commands/setup-settings.js"; +import * as setupProfilesCommand from "./commands/setup-profiles.js"; +import * as setupSignalsCommand from "./commands/setup-signals.js"; +//import * as menuCommand from "./commands/menu.js"; +import * as patchConfigCommand from "./commands/patch-config.js"; +// import * as buildProtoCommand from "./commands/build-proto.js"; +import * as wsClientCommand from "./commands/ws-client.js"; +import * as mbCommand from "./commands/mb.js"; +import * as patchAppCommand from "./commands/patch-app.js"; +import * as dumpCommand from "./commands/dump.js"; +import * as restoreCommand from "./commands/restore.js"; +import * as testWebCommand from "./commands/test-web.js"; +// import * as writeCommand from "./commands/write.js"; + +yargs(hideBin(process.argv)) + .command(setupNetworkCommand as any) + .command(setupSettingsCommand as any) + .command(setupProfilesCommand as any) + .command(setupSignalsCommand as any) + //.command(menuCommand as any) + .command(patchConfigCommand as any) + //.command(buildProtoCommand as any) + .command(wsClientCommand as any) + .command(mbCommand as any) + .command(patchAppCommand as any) + .command(dumpCommand as any) + .command(restoreCommand as any) + .command(testWebCommand as any) + // .command(writeCommand as any) + .demandCommand(1, "You need at least one command before moving on") + .help() + .argv; diff --git a/cli-ts/src/lib/config.ts b/cli-ts/src/lib/config.ts new file mode 100644 index 00000000..cea82a1d --- /dev/null +++ b/cli-ts/src/lib/config.ts @@ -0,0 +1,39 @@ +import fs from 'fs/promises'; + +interface ConfigPatch { + features?: { [key: string]: boolean }; + settings?: { [key: string]: string | number }; +} + +export async function patchConfig(dst: string, patch: ConfigPatch) { + const newLines = [ + '#ifndef CONFIG_USER_H', + '#define CONFIG_USER_H', + '' + ]; + + if (patch.features) { + for (const [name, enabled] of Object.entries(patch.features)) { + if (enabled) { + newLines.push(`#define ${name}`); + } else { + newLines.push(`#undef ${name}`); + } + } + } + + if (patch.settings && Object.keys(patch.settings).length > 0) { + newLines.push(''); + for (const [name, value] of Object.entries(patch.settings)) { + const valueFormatted = typeof value === 'string' ? `"${value}"` : String(value); + // Undefine the original before defining the new one to avoid compiler warnings. + newLines.push(`#undef ${name}`); + newLines.push(`#define ${name} ${valueFormatted}`); + } + } + + newLines.push(''); + newLines.push('#endif // CONFIG_USER_H'); + + await fs.writeFile(dst, newLines.join('\n')); +} \ No newline at end of file diff --git a/cli-ts/src/lib/di.ts b/cli-ts/src/lib/di.ts new file mode 100644 index 00000000..e5187ad2 --- /dev/null +++ b/cli-ts/src/lib/di.ts @@ -0,0 +1,372 @@ +import fs from 'fs/promises'; +import { log } from "./logger.js"; +import path from "path"; + +import Parser from 'tree-sitter'; +import Cpp from 'tree-sitter-cpp'; + +const parser = new Parser(); +parser.setLanguage(Cpp); + +interface FeatureDetails { + headerFile: string; + dependencies: string[]; + settings: Record; +} + +interface ComponentNode { + name: string; + headerFile: string; + baseComponent: string | null; + dependencies: ComponentNode[]; +} + +type ComponentMap = Map; // Map + +// 1. Parse a C++ file and extract all defines (commented and uncommented) +function parseDefines(fileContent: string): Map { + const defines = new Map(); + const tree = parser.parse(fileContent); + + function traverse(node: Parser.SyntaxNode) { + if (node.type === 'preproc_def') { + const nameNode = node.childForFieldName('name'); + const valueNode = node.childForFieldName('value'); + if (nameNode) { + defines.set(nameNode.text, { + value: valueNode?.text.trim() ?? null, + isComment: false + }); + } + } else if (node.type === 'comment' && node.text.includes('#define')) { + const match = node.text.match(/#define\s+(\S+)\s*(.*)/); + if (match) { + defines.set(match[1], { + value: match[2].trim() || null, + isComment: true + }); + } + } else { + for (const child of node.children) { + traverse(child); + } + } + } + traverse(tree.rootNode); + return defines; +} + +// 2. Build a map of all possible features from features.h (Feature -> Header) +export async function buildFeatureCatalog(projectRoot: string): Promise> { + const catalog = new Map(); + const featuresPath = path.join(projectRoot, 'src', 'features.h'); + log.silly(`Building feature catalog from: ${featuresPath}`); + const featuresContent = await fs.readFile(featuresPath, 'utf-8'); + const tree = parser.parse(featuresContent); + + function findIfdefs(node: Parser.SyntaxNode) { + if (node.type === 'preproc_ifdef') { + const featureName = node.childForFieldName('name')?.text; + const includePath = node.descendantsOfType('preproc_include')[0]?.childForFieldName('path')?.text.replace(/["<>]/g, ''); + if (featureName && includePath) { + catalog.set(featureName, includePath); + } + } + for (const child of node.children) { + findIfdefs(child); + } + } + + findIfdefs(tree.rootNode); + log.silly(`Found ${catalog.size} potential features in catalog.`); + return catalog; +} + +// 3. Create a map of ClassName -> FeatureFlag for all components +export async function buildClassNameToFeatureMap(featureCatalog: Map, includeDirs: string[]): Promise> { + const map = new Map(); + + // --- AST DUMP LOGIC --- + const astDir = path.join(process.cwd(), 'ast'); + await fs.mkdir(astDir, { recursive: true }); + function serializeNode(node: Parser.SyntaxNode): any { + const children = node.children.map(serializeNode); + const result: any = { type: node.type }; + if (children.length > 0) { + result.children = children; + } else { + result.text = node.text; + } + return result; + } + // --- END AST DUMP LOGIC --- + + for (const [featureFlag, headerFile] of featureCatalog.entries()) { + let absolutePath: string | null = null; + for (const dir of includeDirs) { + const testPath = path.join(dir, headerFile); + try { + await fs.stat(testPath); + absolutePath = testPath; + break; + } catch (e) { /* continue */ } + } + if (absolutePath) { + const content = await fs.readFile(absolutePath, 'utf-8'); + const tree = parser.parse(content); + const className = findClassName(tree.rootNode); + if (className) { + map.set(className, featureFlag); + + // --- AST DUMP FOR THIS COMPONENT --- + const astJson = JSON.stringify(serializeNode(tree.rootNode), null, 2); + const componentName = path.basename(headerFile, '.h'); + await fs.writeFile(path.join(astDir, `${componentName}.json`), astJson); + log.info(`[DEBUG] AST for ${componentName} written to ${astDir}`); + // --- END AST DUMP --- + } + } + } + log.silly(`Mapped ${map.size} class names to feature flags by parsing headers.`); + return map; +} + +// 4. For a given component header, find its dependencies +export async function analyzeComponentDependencies(headerPath: string, includeDirs: string[], classNameToFeatureMap: Map): Promise { + const dependencies = new Set(); + let absolutePath: string | null = null; + + for (const dir of includeDirs) { + const testPath = path.join(dir, headerPath); + try { + await fs.stat(testPath); + absolutePath = testPath; + break; + } catch (e) { /* continue */ } + } + + if (!absolutePath) { + log.warn(`Could not find header file: ${headerPath}`); + return []; + } + + log.silly(`Analyzing dependencies for: ${absolutePath}`); + const content = await fs.readFile(absolutePath, 'utf-8'); + const tree = parser.parse(content); + + // Find dependencies from constructor + const className = findClassName(tree.rootNode); + if (!className) return []; + + const constructorDeclarations = tree.rootNode.descendantsOfType('constructor_or_destructor_declaration'); + + for (const declaration of constructorDeclarations) { + const functionName = declaration.childForFieldName('name')?.text; + if (functionName !== className) continue; // It's a destructor, skip it + + const declarators = declaration.descendantsOfType('function_declarator'); + + for (const declarator of declarators) { + const params = declarator.descendantsOfType('parameter_declaration'); + for (const param of params) { + const typeNode = param.descendantsOfType('type_identifier')[0]; + const typeName = typeNode?.text; + if (typeName && classNameToFeatureMap.has(typeName)) { + dependencies.add(classNameToFeatureMap.get(typeName)!); + } + } + } + } + + return Array.from(dependencies); +} + +function findClassName(rootNode: Parser.SyntaxNode): string | null { + const classSpecifier = rootNode.descendantsOfType('class_specifier')[0]; + return classSpecifier?.childForFieldName('name')?.text ?? null; +} + +// Main orchestration function +export async function generateFeatureTree(projectRoot: string): Promise> { + + // Load and parse config.h + const configPath = path.join(projectRoot, 'src', 'config.h'); + log.silly(`Loading config from: ${configPath}`); + const configContent = await fs.readFile(configPath, 'utf-8'); + const allDefines = parseDefines(configContent); + + // Filter for active features + const enabledFeatures: string[] = []; + for (const [name, { isComment }] of allDefines.entries()) { + if (name.startsWith('ENABLE_') && !isComment) { + enabledFeatures.push(name); + } + } + log.info(`Found ${enabledFeatures.length} enabled features.`); + + // Build the catalog of all possible features + const featureCatalog = await buildFeatureCatalog(projectRoot); + const includeDirs = [ + path.join(projectRoot, 'src'), + path.join(projectRoot, 'lib/polymech-base/src') + ]; + + const classNameToFeatureMap = await buildClassNameToFeatureMap(featureCatalog, includeDirs); + const finalTree: Record = {}; + + for (const feature of enabledFeatures) { + const headerFile = featureCatalog.get(feature); + if (!headerFile) { + log.warn(`Enabled feature "${feature}" not found in features.h catalog.`); + continue; + } + + const dependencies = await analyzeComponentDependencies(headerFile, includeDirs, classNameToFeatureMap); + + const settings: Record = {}; + const baseName = feature.replace('ENABLE_', ''); + for (const [define, { value, isComment }] of allDefines.entries()) { + if (!isComment && define.startsWith(baseName + '_') && value) { + settings[define] = value; + } + } + + finalTree[feature] = { + headerFile, + dependencies, + settings + }; + } + + return finalTree; +} + +async function* getFiles(dir: string): AsyncGenerator { + const dirents = await fs.readdir(dir, { withFileTypes: true }); + for (const dirent of dirents) { + const res = path.resolve(dir, dirent.name); + if (dirent.isDirectory()) { + yield* getFiles(res); + } else if (res.endsWith('.h')) { + yield res; + } + } +} + +export async function findComponents(includeDirs: string[]): Promise { + const componentMap: ComponentMap = new Map(); + const parser = new Parser(); + parser.setLanguage(Cpp); + + const childByType = (node: Parser.SyntaxNode, type: string) => { + for (const child of node.children) { + if (child.grammarType === type) { + return child; + } + } + } + + const childrenByType = (node: Parser.SyntaxNode, type: string) => { + const children: Parser.SyntaxNode[] = []; + for (const child of node.children) { + if (child.grammarType === type) { + children.push(child); + } + } + } + + for (const dir of includeDirs) { + for await (const f of getFiles(dir)) { + try { + const content = await fs.readFile(f, 'utf-8'); + if (!content) continue; + + const tree = parser.parse(content); + const classNodes = tree.rootNode.descendantsOfType('class_specifier'); + const classNode = classNodes[0]; + if (!classNode) continue; + const nameNode = childByType(classNode, 'type_identifier'); + if (!nameNode) continue; + // componentMap.set(nameNode.text, f); + + for (const classNode of classNodes) { + const baseClauseNode = childByType(classNode, 'base_class_clause'); + if (!baseClauseNode) continue; + const nameNode = childByType(baseClauseNode, 'identifier'); + if (!nameNode) continue; + + if (nameNode.text === 'Component') { + const nameNode = childByType(baseClauseNode, 'identifier'); + if (!nameNode) continue; + + componentMap.set(nameNode.text, f); + } + } + } catch (error) { + log.warn(`Skipping file: ${f}`, error instanceof Error ? error.message : error); + } + } + } + log.info(`Discovered ${componentMap.size} components inheriting from 'Component'.`); + return componentMap; +} + +async function getDependencies( + classNode: Parser.SyntaxNode, + className: string, + componentMap: ComponentMap +): Promise { + const dependencies: ComponentNode[] = []; + const constructorNode = classNode.descendantsOfType('declaration').find(decl => + decl.childForFieldName('declarator')?.childForFieldName('declarator')?.text === className + ); + + if (constructorNode) { + const params = constructorNode.descendantsOfType('parameter_declaration'); + for (const param of params) { + const typeNode = param.childForFieldName('type'); + const typeName = typeNode?.text.replace('*', '').trim(); + + if (typeName && componentMap.has(typeName)) { + const headerFile = componentMap.get(typeName)!; + const depTree = await getComponentTree(typeName, componentMap); + if (depTree) dependencies.push(depTree); + } + } + } + return Array.from(new Map(dependencies.map(item => [item.name, item])).values()); +} + +export async function getComponentTree( + targetComponentName: string, + allComponents: ComponentMap +): Promise { + const headerFile = allComponents.get(targetComponentName); + if (!headerFile) { + log.warn(`Component "${targetComponentName}" not found in component map.`); + return null; + } + + const parser = new Parser(); + parser.setLanguage(Cpp); + const content = await fs.readFile(headerFile, 'utf-8'); + const tree = parser.parse(content); + + const classNode = tree.rootNode.descendantsOfType('class_specifier') + .find(node => node.childForFieldName('name')?.text === targetComponentName); + + if (!classNode) { + log.warn(`Could not find class specifier for "${targetComponentName}" in ${headerFile}`); + return null; + } + + const baseComponent = classNode.childForFieldName('base')?.text.replace('public', '').trim() ?? null; + const dependencies = await getDependencies(classNode, targetComponentName, allComponents); + + return { + name: targetComponentName, + headerFile: path.relative(path.resolve(headerFile, '..', '..', '..'), headerFile).replace(/\\/g, '/'), + baseComponent, + dependencies + }; +} \ No newline at end of file diff --git a/cli-ts/src/lib/logger.ts b/cli-ts/src/lib/logger.ts new file mode 100644 index 00000000..82d12d27 --- /dev/null +++ b/cli-ts/src/lib/logger.ts @@ -0,0 +1,11 @@ + +import { Logger } from "tslog"; + +// Create a shared logger instance with custom configuration +// "we dont need the script path nor linenumbers" +export const log = new Logger({ + prettyLogTemplate: "{{yyyy}}-{{mm}}-{{dd}} {{hh}}:{{MM}}:{{ss}}\t{{logLevelName}}\t", +}); + +// Optionally export a factory if we need creating separate named instances later, +// but for now a singleton `log` is sufficient for the user requirement. diff --git a/cli-ts/src/lib/modbus-client.ts b/cli-ts/src/lib/modbus-client.ts new file mode 100644 index 00000000..7d5d0a30 --- /dev/null +++ b/cli-ts/src/lib/modbus-client.ts @@ -0,0 +1,184 @@ +import { log } from "./logger.js"; +import net from "net"; + + +export enum E_FN_CODE { + FN_ANY_FUNCTION_CODE = 0x00, // Only valid for server to register function codes + FN_READ_COIL = 0x01, + FN_READ_DISCR_INPUT = 0x02, + FN_READ_HOLD_REGISTER = 0x03, + FN_READ_INPUT_REGISTER = 0x04, + FN_WRITE_COIL = 0x05, + FN_WRITE_HOLD_REGISTER = 0x06, + FN_READ_EXCEPTION_SERIAL = 0x07, + FN_DIAGNOSTICS_SERIAL = 0x08, + FN_READ_COMM_CNT_SERIAL = 0x0B, + FN_READ_COMM_LOG_SERIAL = 0x0C, + FN_WRITE_MULT_COILS = 0x0F, + FN_WRITE_MULT_REGISTERS = 0x10, + FN_REPORT_SERVER_ID_SERIAL = 0x11, + FN_READ_FILE_RECORD = 0x14, + FN_WRITE_FILE_RECORD = 0x15, + FN_MASK_WRITE_REGISTER = 0x16, + FN_R_W_MULT_REGISTERS = 0x17, + FN_READ_FIFO_QUEUE = 0x18, + FN_ENCAPSULATED_INTERFACE = 0x2B, + FN_USER_DEFINED_41 = 0x41, + FN_USER_DEFINED_42 = 0x42, + FN_USER_DEFINED_43 = 0x43, + FN_USER_DEFINED_44 = 0x44, + FN_USER_DEFINED_45 = 0x45, + FN_USER_DEFINED_46 = 0x46, + FN_USER_DEFINED_47 = 0x47, + FN_USER_DEFINED_48 = 0x48, + FN_USER_DEFINED_64 = 0x64, + FN_USER_DEFINED_65 = 0x65, + FN_USER_DEFINED_66 = 0x66, + FN_USER_DEFINED_67 = 0x67, + FN_USER_DEFINED_68 = 0x68, + FN_USER_DEFINED_69 = 0x69, + FN_USER_DEFINED_6A = 0x6A, + FN_USER_DEFINED_6B = 0x6B, + FN_USER_DEFINED_6C = 0x6C, + FN_USER_DEFINED_6D = 0x6D, + FN_USER_DEFINED_6E = 0x6E, + FN_NONE = 0xFF, +} +export enum E_ModbusAccess { + MB_ACCESS_NONE = 0, + MB_ACCESS_READ_ONLY = 1, + MB_ACCESS_WRITE_ONLY = 2, + MB_ACCESS_READ_WRITE = 3 +} +export interface RegisterData { + // Modbus address + address: number + // Value of the register + value: number; + // Name of the register + name: string; + // Component id + id: string; + // Type of the register + type: E_FN_CODE; + // Flags of the register + flags: number; + // Group of the register + group: string; + // Component of the register + component: string; + // Error of the register + error?: number; + // Slave ID of the register + slaveId?: number; +} + +export class ModbusClient { + private host: string; + private port: number; + private client: net.Socket; + + constructor(host: string, port: number) { + this.host = host; + this.port = port; + this.client = new net.Socket(); + } + + connect(): Promise { + return new Promise((resolve, reject) => { + this.client.connect(this.port, this.host, () => { + log.info("Connected to Modbus server"); + resolve(); + }); + + this.client.on('error', (err) => { + log.error("Connection error:", err); + reject(err); + }); + }); + } + + disconnect() { + this.client.end(); + log.info("Disconnected from Modbus server"); + } + + private sendRequest(unitId: number, functionCode: number, data: Buffer): Promise { + return new Promise((resolve, reject) => { + const transactionId = Math.floor(Math.random() * 65535); + const protocolId = 0; // Modbus protocol + + const pdu = Buffer.concat([Buffer.from([functionCode]), data]); + const length = 1 + pdu.length; + + const header = Buffer.alloc(7); + header.writeUInt16BE(transactionId, 0); + header.writeUInt16BE(protocolId, 2); + header.writeUInt16BE(length, 4); + header.writeUInt8(unitId, 6); + + const request = Buffer.concat([header, pdu]); + + this.client.once('data', (response) => { + const responseTransactionId = response.readUInt16BE(0); + if (responseTransactionId !== transactionId) { + return reject(new Error("Transaction ID mismatch")); + } + const responseFunctionCode = response.readUInt8(7); + if (responseFunctionCode > 0x80) { + const errorCode = response.readUInt8(8); + return reject(new Error(`Modbus Exception (FC: ${functionCode}): ${errorCode}`)); + } + resolve(response.subarray(8)); + }); + + this.client.write(request); + }); + } + + async writeHoldingRegister(address: number, value: number, unitId: number = 1) { + const data = Buffer.alloc(4); + data.writeUInt16BE(address, 0); + data.writeUInt16BE(value, 2); + await this.sendRequest(unitId, E_FN_CODE.FN_WRITE_HOLD_REGISTER, data); + } + + async writeCoil(address: number, value: boolean, unitId: number = 1) { + const data = Buffer.alloc(4); + data.writeUInt16BE(address, 0); + data.writeUInt16BE(value ? 0xFF00 : 0x0000, 2); + await this.sendRequest(unitId, E_FN_CODE.FN_WRITE_COIL, data); + } + + async readHoldingRegisters(address: number, count: number, unitId: number = 1): Promise { + const data = Buffer.alloc(4); + data.writeUInt16BE(address, 0); + data.writeUInt16BE(count, 2); + const response = await this.sendRequest(unitId, E_FN_CODE.FN_READ_HOLD_REGISTER, data); + + const byteCount = response[0]; + const values: number[] = []; + for (let i = 0; i < byteCount / 2; i++) { + values.push(response.readUInt16BE(1 + i * 2)); + } + return values; + } + + async readCoils(address: number, count: number, unitId: number = 1): Promise { + const data = Buffer.alloc(4); + data.writeUInt16BE(address, 0); + data.writeUInt16BE(count, 2); + const response = await this.sendRequest(unitId, E_FN_CODE.FN_READ_COIL, data); + + const byteCount = response[0]; + const values: boolean[] = []; + for (let i = 0; i < byteCount; i++) { + for (let j = 0; j < 8; j++) { + if (values.length < count) { + values.push((response[1 + i] & (1 << j)) !== 0); + } + } + } + return values; + } +} \ No newline at end of file diff --git a/cli-ts/src/lib/pb-decoder.ts b/cli-ts/src/lib/pb-decoder.ts new file mode 100644 index 00000000..c3b0ab01 --- /dev/null +++ b/cli-ts/src/lib/pb-decoder.ts @@ -0,0 +1,71 @@ +import pkg from 'protobufjs'; +const { Reader } = pkg; + +export interface DecodedNV { + address: number; + timestamp: number; + value: number | boolean | Buffer | number[]; +} + +/** + * Decodes a NetworkValue update from a Protobuf binary buffer. + * This is a manual implementation based on the schema defined in the documentation, + * as we are not using .proto files on the client. + * @param buffer The binary buffer received from the WebSocket. + * @returns A structured object with the decoded data. + */ +export function decodeNetworkValue(buffer: Buffer): DecodedNV { + const reader = Reader.create(buffer); + const result: Partial = {}; + let value: any = null; + + while (reader.pos < reader.len) { + const tag = reader.uint32(); + // The field number is the upper 3 bits of the tag. + const fieldNumber = tag >>> 3; + // The wire type is the lower 3 bits of the tag. + const wireType = tag & 7; + + switch (fieldNumber) { + case 1: // address + result.address = reader.uint32(); + break; + case 2: // timestamp + // Timestamps are uint64. JS numbers can lose precision for very large values, + // but for millis() this is safe for a very long time. + result.timestamp = reader.uint64() as unknown as number; + break; + case 3: // sint_value + value = reader.sint64() as unknown as number; + break; + case 4: // bool_value + value = reader.bool(); + break; + case 5: // float_value + value = reader.float(); + break; + case 6: // bytes_value + const bytes = Buffer.from(reader.bytes()); + // Assuming bytes are an array of 32-bit signed integers (4 bytes each) + if (bytes.length > 0 && bytes.length % 4 === 0) { + const numbers: number[] = []; + for (let i = 0; i < bytes.length; i += 4) { + numbers.push(bytes.readInt32LE(i)); + } + value = numbers; + } else { + // If not a multiple of 4, treat as a raw buffer + value = bytes; + } + break; + default: + // Skip unknown fields to maintain forward compatibility. + reader.skipType(wireType); + break; + } + } + + result.value = value; + + return result as DecodedNV; +} \ No newline at end of file diff --git a/cli-ts/src/schemas/network-schema.ts b/cli-ts/src/schemas/network-schema.ts new file mode 100644 index 00000000..4280cff3 --- /dev/null +++ b/cli-ts/src/schemas/network-schema.ts @@ -0,0 +1,17 @@ +import { z } from 'zod'; + +export const networkSettingsSchema = z.object({ + sta_ssid: z.string().optional(), + sta_password: z.string().optional(), + sta_local_ip: z.string().ip({ version: 'v4' }).optional(), + sta_gateway: z.string().ip({ version: 'v4' }).optional(), + sta_subnet: z.string().ip({ version: 'v4' }).optional(), + sta_primary_dns: z.string().ip({ version: 'v4' }).optional(), + sta_secondary_dns: z.string().ip({ version: 'v4' }).optional(), + ap_ssid: z.string().optional(), + ap_password: z.string().optional(), + ap_config_ip: z.string().ip({ version: 'v4' }).optional(), + ap_config_gateway: z.string().ip({ version: 'v4' }).optional(), + ap_config_subnet: z.string().ip({ version: 'v4' }).optional(), + hostname: z.string().optional(), +}); \ No newline at end of file diff --git a/cli-ts/src/schemas/profiles-schema.ts b/cli-ts/src/schemas/profiles-schema.ts new file mode 100644 index 00000000..9a374db0 --- /dev/null +++ b/cli-ts/src/schemas/profiles-schema.ts @@ -0,0 +1,20 @@ +import { z } from "zod"; + +export const controlPointSchema = z.object({ + x: z.number(), + y: z.number(), +}); + +export const profileSchema = z.object({ + slot: z.number(), + duration: z.number(), + name: z.string(), + max: z.number(), + enabled: z.boolean(), + signalPlot: z.number(), + description: z.string(), + controlPoints: z.array(controlPointSchema).optional(), + targetRegisters: z.array(z.number()).optional(), +}); + +export const profilesSchema = profileSchema \ No newline at end of file diff --git a/cli-ts/src/schemas/settings-schema.ts b/cli-ts/src/schemas/settings-schema.ts new file mode 100644 index 00000000..9c87b863 --- /dev/null +++ b/cli-ts/src/schemas/settings-schema.ts @@ -0,0 +1,34 @@ +import { z } from "zod"; + +const settingValueSchema = z.union([z.string(), z.number(), z.boolean()]); + +const settingSchema = z.object({ + enabled: z.boolean(), + id: z.number(), + name: z.string(), + group: z.string(), + flags: z.number(), + parent: z.number(), + type: z.string(), + value: settingValueSchema, +}); + +const controllerSchema = z.object({ + slaveid: z.number(), + name: z.string(), + enabled: z.boolean(), +}); + +const partitionSchema = z.object({ + name: z.string(), + controllers: z.array(controllerSchema), + startslaveid: z.number().optional(), + numcontrollers: z.number().optional(), +}); + +export const settingsSchema = z.object({ + master: z.string(), + slaves: z.array(z.string()), + partitions: z.array(partitionSchema), + settings: z.array(settingSchema), +}); \ No newline at end of file diff --git a/cli-ts/src/schemas/signal-plots-schema.ts b/cli-ts/src/schemas/signal-plots-schema.ts new file mode 100644 index 00000000..bb32cac1 --- /dev/null +++ b/cli-ts/src/schemas/signal-plots-schema.ts @@ -0,0 +1,44 @@ +import { z } from "zod"; + +export const signalTypeEnum = z.enum([ + "NONE", + "MB_WRITE_COIL", + "MB_WRITE_HOLDING_REGISTER", + "CALL_METHOD", + "CALL_FUNCTION", + "CALL_REST", + "GPIO_WRITE", + "DISPLAY_MESSAGE", + "USER_DEFINED", + "PAUSE_PROFILE", +]); + +export const signalStateEnum = z.enum([ + "STATE_NONE", + "STATE_ERROR", + "STATE_ON", + "STATE_OFF", + "STATE_CUSTOM_1", +]); + +export const signalControlPointSchema = z.object({ + id: z.number(), + time: z.number(), + state: z.number(), + type: z.number(), + arg_0: z.number(), + arg_1: z.number(), + arg_2: z.number().optional(), + user: z.any().optional(), + name: z.string().optional(), + description: z.string().optional(), +}); + +export const signalPlotSchema = z.object({ + name: z.string(), + duration: z.number(), + slot: z.number(), + controlPoints: z.array(signalControlPointSchema), +}); + +export const signalPlotsSchema = z.array(signalPlotSchema); \ No newline at end of file diff --git a/cli-ts/src/types.ts b/cli-ts/src/types.ts new file mode 100644 index 00000000..c66cbf7a --- /dev/null +++ b/cli-ts/src/types.ts @@ -0,0 +1,12 @@ +import { z } from "zod"; +import { networkSettingsSchema } from "./schemas/network-schema.js"; +import { settingsSchema } from "./schemas/settings-schema.js"; +import { profilesSchema } from "./schemas/profiles-schema.js"; +import { signalPlotsSchema } from "./schemas/signal-plots-schema.js"; + +export type NetworkSettingsUpdatePayload = z.infer< + typeof networkSettingsSchema +>; +export type SettingsUpdatePayload = z.infer; +export type ProfilesUpdatePayload = z.infer; +export type SignalPlotsUpdatePayload = z.infer; \ No newline at end of file diff --git a/cli-ts/tests/ast/components.json b/cli-ts/tests/ast/components.json new file mode 100644 index 00000000..9837e3bd --- /dev/null +++ b/cli-ts/tests/ast/components.json @@ -0,0 +1,3 @@ +{ + "Component": "C:\\Users\\zx\\Desktop\\polymech\\polymech-fw-apps\\cassandra-rc2\\lib\\polymech-base\\src\\SerialMessage.h" +} \ No newline at end of file diff --git a/cli-ts/tests/ast/components.test.js b/cli-ts/tests/ast/components.test.js new file mode 100644 index 00000000..e6ec2774 --- /dev/null +++ b/cli-ts/tests/ast/components.test.js @@ -0,0 +1,28 @@ +import { describe, it, expect } from 'vitest'; +import { findComponents } from '../../src/lib/di.js'; +import path from 'path'; +import fs from 'fs/promises'; +describe('Component Discovery', () => { + it('should scan the project and produce a map of all valid components', async () => { + const projectRoot = path.resolve(process.cwd(), '..', 'cassandra-rc2'); + const includeDirs = [ + path.join(projectRoot, 'src'), + path.join(projectRoot, 'lib/polymech-base/src') + ]; + // This function scans all .h files and returns a map of ClassName -> AbsoluteFilePath + const allComponents = await findComponents(includeDirs); + // Save the output for inspection + const outputDir = path.join(process.cwd(), 'tests', 'ast'); + await fs.mkdir(outputDir, { recursive: true }); + const outputPath = path.join(outputDir, 'components.json'); + // Convert Map to a plain object for pretty JSON serialization + const componentsObject = Object.fromEntries(allComponents); + await fs.writeFile(outputPath, JSON.stringify(componentsObject, null, 2)); + // Assert that the discovery is working at a basic level + expect(allComponents).toBeDefined(); + expect(allComponents.size).toBeGreaterThan(10); // Expect to find a reasonable number of components + expect(allComponents.has('Plunger')).toBe(true); + expect(allComponents.get('Plunger')).toContain('Plunger.h'); + }); +}); +//# sourceMappingURL=components.test.js.map \ No newline at end of file diff --git a/cli-ts/tests/ast/components.test.js.map b/cli-ts/tests/ast/components.test.js.map new file mode 100644 index 00000000..841aa90f --- /dev/null +++ b/cli-ts/tests/ast/components.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"components.test.js","sourceRoot":"","sources":["components.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IAEjC,EAAE,CAAC,mEAAmE,EAAE,KAAK,IAAI,EAAE;QAC/E,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;QACvE,MAAM,WAAW,GAAG;YAChB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,uBAAuB,CAAC;SAClD,CAAC;QAEF,sFAAsF;QACtF,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,CAAC;QAExD,iCAAiC;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC3D,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;QAE3D,8DAA8D;QAC9D,MAAM,gBAAgB,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QAC3D,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAE1E,wDAAwD;QACxD,MAAM,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,mDAAmD;QACnG,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/tests/ast/components.test.ts b/cli-ts/tests/ast/components.test.ts new file mode 100644 index 00000000..6900b528 --- /dev/null +++ b/cli-ts/tests/ast/components.test.ts @@ -0,0 +1,33 @@ +import { describe, it, expect } from 'vitest'; +import { findComponents } from '../../src/lib/di.js'; +import path from 'path'; +import fs from 'fs/promises'; + +describe('Component Discovery', () => { + + it('should scan the project and produce a map of all valid components', async () => { + const projectRoot = path.resolve(process.cwd(), '..', 'cassandra-rc2'); + const includeDirs = [ + path.join(projectRoot, 'src'), + path.join(projectRoot, 'lib/polymech-base/src') + ]; + + // This function scans all .h files and returns a map of ClassName -> AbsoluteFilePath + const allComponents = await findComponents(includeDirs); + + // Save the output for inspection + const outputDir = path.join(process.cwd(), 'tests', 'ast'); + await fs.mkdir(outputDir, { recursive: true }); + const outputPath = path.join(outputDir, 'components.json'); + + // Convert Map to a plain object for pretty JSON serialization + const componentsObject = Object.fromEntries(allComponents); + await fs.writeFile(outputPath, JSON.stringify(componentsObject, null, 2)); + + // Assert that the discovery is working at a basic level + expect(allComponents).toBeDefined(); + expect(allComponents.size).toBeGreaterThan(10); // Expect to find a reasonable number of components + expect(allComponents.has('Plunger')).toBe(true); + expect(allComponents.get('Plunger')).toContain('Plunger.h'); + }); +}); \ No newline at end of file diff --git a/cli-ts/tests/config-user.h b/cli-ts/tests/config-user.h new file mode 100644 index 00000000..de825625 --- /dev/null +++ b/cli-ts/tests/config-user.h @@ -0,0 +1,13 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#undef ENABLE_WIFI +#define ENABLE_PLUNGER + +#undef WIFI_SSID +#define WIFI_SSID "MyNewNetwork" + +#undef SAKO_VFD_SLAVE_ID +#define SAKO_VFD_SLAVE_ID 15 + +#endif // CONFIG_USER_H \ No newline at end of file diff --git a/cli-ts/tests/config.h b/cli-ts/tests/config.h new file mode 100644 index 00000000..e755bc19 --- /dev/null +++ b/cli-ts/tests/config.h @@ -0,0 +1,374 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include +#include +#include "config_adv.h" + +#include + +/////////////////////////////////////////////////////// +// +// Overrides + +#define WS_MAX_QUEUED_MESSAGES 128 + +//////////////////////////////////////////////////////////////////////////////// +// +// Component IDs +// +typedef enum COMPONENT_KEY +{ + COMPONENT_KEY_LOGGER = 10, + COMPONENT_KEY_RELAY_0 = 300, + COMPONENT_KEY_RELAY_1 = 301, + COMPONENT_KEY_RELAY_2 = 302, + COMPONENT_KEY_RELAY_3 = 303, + COMPONENT_KEY_RELAY_4 = 304, + COMPONENT_KEY_RELAY_5 = 305, + COMPONENT_KEY_SOLENOID_0 = 310, + COMPONENT_KEY_PID_0 = 100, + COMPONENT_KEY_PID_1 = 101, + COMPONENT_KEY_PID_2 = 102, + COMPONENT_KEY_ANALOG_0 = 350, + COMPONENT_KEY_ANALOG_1 = 351, + COMPONENT_KEY_ANALOG_2 = 352, + COMPONENT_KEY_LOADCELL_0 = 360, + COMPONENT_KEY_LOADCELL_1 = 361, + COMPONENT_KEY_ANALOG_3POS_SWITCH_0 = 420, + COMPONENT_KEY_ANALOG_3POS_SWITCH_1 = 421, + COMPONENT_KEY_ANALOG_LEVEL_SWITCH_0 = 450, + COMPONENT_KEY_ANALOG_LEVEL_SWITCH_1 = 451, + COMPONENT_KEY_JOYSTICK_0 = 500, + COMPONENT_KEY_STEPPER_0 = 601, + COMPONENT_KEY_STEPPER_1 = 602, + COMPONENT_KEY_PID = 620, + COMPONENT_KEY_EXTRUDER = 650, + COMPONENT_KEY_PLUNGER = 670, + COMPONENT_KEY_FEEDBACK_0 = 701, + COMPONENT_KEY_FEEDBACK_1 = 730, + COMPONENT_KEY_FEEDBACK_2 = 740, + COMPONENT_KEY_PRESS_CYLINDER_0 = 760, + COMPONENT_KEY_SAKO_VFD = 750, + COMPONENT_KEY_RS485_TESTER = 800, + COMPONENT_KEY_RS485 = 801, + COMPONENT_KEY_AMPERAGE_BUDGET_MANAGER = 850, + COMPONENT_KEY_GPIO_MAP = 810, + COMPONENT_KEY_REST_SERVER = 900, + COMPONENT_KEY_PROFILE_START = 910, + COMPONENT_KEY_PRESSURE_PROFILE_START = 920, + COMPONENT_KEY_SIGNAL_PLOT_START = 920, + COMPONENT_KEY_END = 1000, + COMPONENT_KEY_TEST_NV = 1001, + COMPONENT_KEY_OPERATOR_SWITCH = 1002, + COMPONENT_KEY_MODBUS_MIRROR = 2000, +} COMPONENT_KEY; + +//////////////////////////////////////////////////////////////////////////////// +// +// Platform + +// Automatic platform detection +#if defined(ARDUINO_PORTENTA_H7_M7) +#define PLATFORM_PORTENTA_H7_M7 +#define BOARD_NAME "Portenta H7 M7" +#include +using namespace machinecontrol; +#elif defined(ARDUINO_CONTROLLINO_MEGA) +#define PLATFORM_CONTROLLINO_MEGA +#define BOARD_NAME "Controllino Mega" +#include +#elif defined(ESP32) +#define PLATFORM_ESP32 +#define BOARD_NAME "ESP32" +#elif defined(ARDUINO_AVR_UNO) // Detect Arduino Uno +#define PLATFORM_ARDUINO_UNO +#define BOARD_NAME "Arduino Uno" +#else +#error "Unsupported platform" +#endif + +//////////////////////////////////////////////////////////////////////////////// +// +// Debugging +#ifndef DISABLE_SERIAL_LOGGING +// Serial Bridge Debugging Switches +#define BRIDGE_DEBUG_REGISTER +#define BRIDGE_DEBUG_CALL_METHOD +// Serial Command Messaging Debugging Switches +#define DEBUG_MESSAGES_PARSE +#endif +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// App Features + +// When printing Modbus registers (via serial), print register descriptions +// #define HAS_MODBUS_REGISTER_DESCRIPTIONS 1 + +/////////////////////////////////////////////////////// +// +// Status Feedback Settings + +#define STATUS_WARNING_PIN GPIO_PIN_CH6 +#define STATUS_ERROR_PIN GPIO_PIN_CH5 +#define STATUS_BLINK_INTERVAL 800 + +/////////////////////////////////////////////////////// +// +// Serial Port Settings +/** @brief Serial port baud rate */ +#define SERIAL_BAUD_RATE 115200 +/** @brief Parse commands every 100ms */ +#define SERIAL_COMMAND_PARSE_INTERVAL 100 + +#define LOOP_CYCLE_INTVAL 100 + +//////////////////////////////////////////////////////////////// +// +// Auxiliary Settings : Relays + +#ifdef PLATFORM_ESP32 +// Waveshare - CH6 Board +#define GPIO_PIN_CH1 1 // CH1 Control GPIO +#define GPIO_PIN_CH2 2 // CH2 Control GPIO +#define GPIO_PIN_CH3 41 // CH3 Control GPIO +#define GPIO_PIN_CH4 42 // CH4 Control GPIO +#define GPIO_PIN_CH5 45 // CH5 Control GPIO +#define GPIO_PIN_CH6 46 // CH6 Control GPIO +#define GPIO_PIN_RGB 38 // RGB Control GPIO +#define GPIO_PIN_Buzzer 21 // Buzzer Control GPIO + +#define AUX_RELAY_0 GPIO_PIN_CH6 +#define AUX_RELAY_1 GPIO_PIN_CH5 +#define PIN_SOLENOID_0 GPIO_PIN_CH2 + +#endif + +//////////////////////////////////////////////////////////////// +// +// Auxiliary Settings : Analog Inputs (POTs) +// +// #define MB_ANALOG_0 15 +// #define MB_ANALOG_1 7 + +#define POT_RAW_MAX_VALUE 4095 // Max raw ADC value +#define POT_SCALED_MAX_VALUE 100 // Max scaled value (0-100) + +//#define MB_GPIO_MB_MAP_7 7 +//#define MB_GPIO_MB_MAP_15 15 +//////////////////////////////////////////////////////////////// +// +// Auxiliary Settings : Analog Level Switch +// +#ifdef PLATFORM_ESP32 +//#define PIN_ANALOG_LEVEL_SWITCH_0 34 // <<< CHOOSE YOUR ADC PIN +#endif + +/** @brief Analog Level Switch 0 */ +#define ID_ANALOG_LEVEL_SWITCH_0 200 +#define ALS_0_NUM_LEVELS 4 // Number of slots +#define ALS_0_ADC_STEP 800 // ADC counts per slot +#define ALS_0_ADC_OFFSET 200 // ADC value for the start of the first slot +#define ALS_0_MB_ADDR 60 // Modbus base address (Uses 60-65 for 4 slots) + +//////////////////////////////////////////////////////////////// +// +// Auxiliary Settings : LED Feedback +// +//#define PIN_LED_FEEDBACK_0 1 // <<< CHOOSE NEOPIXEL DATA PIN +#define LED_PIXEL_COUNT_0 1 +#define ID_LED_FEEDBACK_0 210 +#define LED_FEEDBACK_0_MB_ADDR 70 +// #define LED_UPDATE_INTERVAL_MS 20 + +//////////////////////////////////////////////////////////////// +// +// Auxiliary Settings : Analog Switch Inputs (3 Position Switches) +// +#ifdef PLATFORM_ESP32 +// #define AUX_ANALOG_3POS_SWITCH_0 34 +// #define AUX_ANALOG_3POS_SWITCH_1 35 +#endif + +//////////////////////////////////////////////////////////////// +// +// Auxiliary Settings : Joystick +// +#ifdef PLATFORM_ESP32 + #define PIN_JOYSTICK_UP 47 // UP direction pin + #define PIN_JOYSTICK_DOWN 48 // DOWN direction pin + #define PIN_JOYSTICK_LEFT 40 // LEFT direction pin + #define PIN_JOYSTICK_RIGHT 39 // RIGHT direction pin + + #define PIN_OPERATOR_SWITCH_STOP 47 + #define PIN_OPERATOR_SWITCH_CYCLE 48 +#endif + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Network +// + +#define NETWORK_CONFIG_FILENAME "/network.json" +// Static IP Addresses for STA mode (and STA part of AP_STA) +static IPAddress local_IP(192, 168, 1, 250); +static IPAddress gateway(192, 168, 1, 1); +static IPAddress subnet(255, 255, 0, 0); +static IPAddress primaryDNS(8, 8, 8, 8); +static IPAddress secondaryDNS(8, 8, 4, 4); + +#define WIFI_SSID "Livebox6-EBCD" +#define WIFI_PASSWORD "c4RK35h4PZNS" + +// AP_STA Mode Configuration +// To enable AP_STA mode, define ENABLE_AP_STA. +// If ENABLE_AP_STA is defined, the device will act as both an Access Point +// and a WiFi client (Station) simultaneously. +// The AP will have its own SSID and IP configuration. +// The STA part will connect to the WiFi network defined by WIFI_SSID and WIFI_PASSWORD. + +#define ENABLE_AP_STA // Uncomment to enable AP_STA mode + +#ifdef ENABLE_AP_STA +#define AP_SSID "PolyMechAP" +#define AP_PASSWORD "poly1234" // Password must be at least 8 characters +static IPAddress ap_local_IP(192, 168, 4, 1); +static IPAddress ap_gateway(192, 168, 4, 1); // Typically the same as ap_local_IP for the AP +static IPAddress ap_subnet(255, 255, 255, 240); // Changed to .240 (/28 subnet) +#endif + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Temperature Control & Profiles +// +#define TEMP_PROFILE_MAX_TARGET_REGS NUM_OMRON_DEVICES +// #define TEMPERATURE_PROFILE_LOOP_INTERVAL_MS 400 + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Features +// + + +// Auxiliary Components +// #define ENABLE_JOYSTICK (4P Joystick) +#define ENABLE_OPERATOR_SWITCH +#define ENABLE_RELAYS + +// Feedback +// #define ENABLE_STATUS +#define ENABLE_FEEDBACK_3C +#define ENABLE_FEEDBACK_BUZZER + +// Motor +#define ENABLE_SAKO_VFD +#define SAKO_VFD_SLAVE_ID 10 +#define MB_SAKO_VFD_SLAVE_ID 10 +#define MB_SAKO_VFD_READ_INTERVAL 400 + +// Pressure Cylinder +#define ENABLE_LOADCELL +#define ENABLE_SOLENOID +#define ENABLE_PRESS_CYLINDER + +// Temperature Control +#define ENABLE_OMRON_E5 +#ifndef NUM_OMRON_DEVICES + #define NUM_OMRON_DEVICES 8 + #define OMRON_E5_SLAVE_ID_BASE 10 +#endif + +#define ENABLE_AMPERAGE_BUDGET_MANAGER // sequential heating + +// built-in PID, not implemented yet +// #define ENABLE_PID + +// Profiles +#define ENABLE_PROFILE_TEMPERATURE +#ifdef ENABLE_PROFILE_TEMPERATURE +// #define PROFILE_TEMPERATURE_COUNT 8 +#endif + +// #define ENABLE_PROFILE_PRESSURE +#ifdef ENABLE_PROFILE_PRESSURE +#define PROFILE_PRESSURE_COUNT 1 +#define PRESSURE_PROFILE_MAX_TARGET_REGS 1 +#endif + + +#define ENABLE_PROFILE_SIGNAL_PLOT +#define PROFILE_SIGNAL_PLOT_COUNT 8 + +// Protocols +#define ENABLE_MODBUS_TCP +#define ENABLE_RS485 // RS485 is used for SAKO VFD +#define ENABLE_RS485_DEVICES + +// Internal +#define ENABLE_PROFILER // CPU & Memory Profiling +#define ENABLE_LOGGER +#define ENABLE_LOGGING_TARGET_PRINT +#define ENABLE_LOGGING_TARGET_WEBSOCKET +// #define ENABLE_LOGGING_TARGET_FILE +// #define ENABLE_NETWORK_VALUE_TEST // test for NetworkValue + +// Systems +// #define ENABLE_MB_SCRIPT // Experimental : Modbus Logic Engine +#define ENABLE_SETTINGS +#define ENABLE_MODBUS_MIRROR +// #define ENABLE_EXTRUDER // not implemented yet +#define ENABLE_PLUNGER // arbor driven injection plunger, using SAKO VFD + +//////////////////////////////////////////////////////////////// +// +// Web Server Features +// +#define ENABLE_WIFI +#define ENABLE_WEBSERVER +#define ENABLE_REST_SERVER +#define ENABLE_LITTLEFS +#define ENABLE_WEBSOCKET +#define ENABLE_WEBSERVER_WIFI_SETTINGS + +//////////////////////////////////////////////////////////////// +// +// Modbus Mirror +#ifdef ENABLE_MODBUS_MIRROR +#define MODBUS_MIRROR_SERVER_IP {192, 168, 1, 200} +#define MODBUS_MIRROR_SERVER_PORT 502 +#define MODBUS_MIRROR_RECONNECT_INTERVAL_MS 5000 // 5 seconds +#define MODBUS_MIRROR_MAX_RECONNECT_TIME_MS (5 * 60 * 1000) // 5 minutes +#endif + +#include "config-extern.h" +#include "config-validate.h" + +#if defined(ENABLE_LOGGER) + extern Logger* g_logger; + + // For use inside a Component class method (implicitly uses 'this') + #define L_FATAL(format, ...) if (g_logger) g_logger->fatal(this, format, ##__VA_ARGS__) + #define L_ERROR(format, ...) if (g_logger) g_logger->error(this, format, ##__VA_ARGS__) + #define L_WARN(format, ...) if (g_logger) g_logger->warn(this, format, ##__VA_ARGS__) + #define L_INFO(format, ...) if (g_logger) g_logger->info(this, format, ##__VA_ARGS__) + #define L_TRACE(format, ...) if (g_logger) g_logger->trace(this, format, ##__VA_ARGS__) + #define L_VERBOSE(format, ...) if (g_logger) g_logger->verbose(this, format, ##__VA_ARGS__) + + // For static calls (no 'this' available) + #define LS_FATAL(format, ...) if (g_logger) g_logger->fatal(format, ##__VA_ARGS__) + #define LS_ERROR(format, ...) if (g_logger) g_logger->error(format, ##__VA_ARGS__) + #define LS_WARNING(format, ...) if (g_logger) g_logger->warn(format, ##__VA_ARGS__) + #define LS_INFO(format, ...) if (g_logger) g_logger->info(format, ##__VA_ARGS__) + #define LS_TRACE(format, ...) if (g_logger) g_logger->trace(format, ##__VA_ARGS__) + #define LS_VERBOSE(format, ...) if (g_logger) g_logger->verbose(format, ##__VA_ARGS__) +#else + #define L_FATAL(format, ...) Log.fatal(format, ##__VA_ARGS__) + #define L_ERROR(format, ...) Log.error(format, ##__VA_ARGS__) + #define L_WARN(format, ...) Log.warning(format, ##__VA_ARGS__) + #define L_INFO(format, ...) Log.info(format, ##__VA_ARGS__) + #define L_TRACE(format, ...) Log.trace(format, ##__VA_ARGS__) + #define L_VERBOSE(format, ...) Log.verbose(format, ##__VA_ARGS__) +#endif + + +#endif diff --git a/cli-ts/tests/di/di.basic.test.js b/cli-ts/tests/di/di.basic.test.js new file mode 100644 index 00000000..b4e5fc84 --- /dev/null +++ b/cli-ts/tests/di/di.basic.test.js @@ -0,0 +1,46 @@ +import { describe, it, expect, beforeAll } from 'vitest'; +import { buildFeatureCatalog, buildClassNameToFeatureMap, analyzeComponentDependencies } from '../../src/lib/di.js'; +import path from 'path'; +describe('Dependency Injection Analysis - Basic Units', () => { + let projectRoot; + let featureCatalog; + let classNameToFeatureMap; + let includeDirs; + beforeAll(async () => { + projectRoot = path.resolve(process.cwd(), '..', 'cassandra-rc2'); + includeDirs = [ + path.join(projectRoot, 'src'), + path.join(projectRoot, 'lib/polymech-base/src') + ]; + }); + it('Step 1: should build the feature catalog correctly', async () => { + featureCatalog = await buildFeatureCatalog(projectRoot); + expect(featureCatalog.size).toBeGreaterThan(10); // Should find many features + expect(featureCatalog.get('ENABLE_PLUNGER')).toEqual('components/Plunger.h'); + expect(featureCatalog.get('ENABLE_SAKO_VFD')).toEqual('components/SAKO_VFD.h'); + }); + it('Step 2: should map class names to feature flags correctly', async () => { + // Depends on Step 1 + featureCatalog = await buildFeatureCatalog(projectRoot); + classNameToFeatureMap = await buildClassNameToFeatureMap(featureCatalog, includeDirs); + expect(classNameToFeatureMap.size).toBeGreaterThan(10); + expect(classNameToFeatureMap.get('Plunger')).toEqual('ENABLE_PLUNGER'); + expect(classNameToFeatureMap.get('SAKO_VFD')).toEqual('ENABLE_SAKO_VFD'); + expect(classNameToFeatureMap.get('Joystick')).toEqual('ENABLE_JOYSTICK'); + expect(classNameToFeatureMap.get('POT')).toEqual('ENABLE_POT'); + }); + it('Step 3: should analyze Plunger dependencies correctly', async () => { + // Depends on Steps 1 & 2 + featureCatalog = await buildFeatureCatalog(projectRoot); + classNameToFeatureMap = await buildClassNameToFeatureMap(featureCatalog, includeDirs); + const plungerHeader = featureCatalog.get('ENABLE_PLUNGER'); + expect(plungerHeader).toBeDefined(); + const dependencies = await analyzeComponentDependencies(plungerHeader, includeDirs, classNameToFeatureMap); + expect(dependencies).toBeDefined(); + expect(dependencies.length).toBeGreaterThan(0); + expect(dependencies).toContain('ENABLE_SAKO_VFD'); + expect(dependencies).toContain('ENABLE_JOYSTICK'); + expect(dependencies).toContain('ENABLE_POT'); + }); +}); +//# sourceMappingURL=di.basic.test.js.map \ No newline at end of file diff --git a/cli-ts/tests/di/di.basic.test.js.map b/cli-ts/tests/di/di.basic.test.js.map new file mode 100644 index 00000000..68e6f324 --- /dev/null +++ b/cli-ts/tests/di/di.basic.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"di.basic.test.js","sourceRoot":"","sources":["di.basic.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EACH,mBAAmB,EACnB,0BAA0B,EAC1B,4BAA4B,EAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;IAEzD,IAAI,WAAmB,CAAC;IACxB,IAAI,cAAmC,CAAC;IACxC,IAAI,qBAA0C,CAAC;IAC/C,IAAI,WAAqB,CAAC;IAE1B,SAAS,CAAC,KAAK,IAAI,EAAE;QACjB,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;QACjE,WAAW,GAAG;YACV,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,uBAAuB,CAAC;SAClD,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,KAAK,IAAI,EAAE;QAChE,cAAc,GAAG,MAAM,mBAAmB,CAAC,WAAW,CAAC,CAAC;QACxD,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,4BAA4B;QAC7E,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAC7E,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QACvE,oBAAoB;QACpB,cAAc,GAAG,MAAM,mBAAmB,CAAC,WAAW,CAAC,CAAC;QACxD,qBAAqB,GAAG,MAAM,0BAA0B,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QAEtF,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QACvD,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACvE,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACzE,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACzE,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;QACnE,yBAAyB;QACzB,cAAc,GAAG,MAAM,mBAAmB,CAAC,WAAW,CAAC,CAAC;QACxD,qBAAqB,GAAG,MAAM,0BAA0B,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACtF,MAAM,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAE3D,MAAM,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,CAAC;QAEpC,MAAM,YAAY,GAAG,MAAM,4BAA4B,CAAC,aAAc,EAAE,WAAW,EAAE,qBAAqB,CAAC,CAAC;QAE5G,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QAClD,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QAClD,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/tests/di/di.basic.test.ts b/cli-ts/tests/di/di.basic.test.ts new file mode 100644 index 00000000..1baa2e2c --- /dev/null +++ b/cli-ts/tests/di/di.basic.test.ts @@ -0,0 +1,59 @@ +import { describe, it, expect, beforeAll } from 'vitest'; +import { + buildFeatureCatalog, + buildClassNameToFeatureMap, + analyzeComponentDependencies +} from '../../src/lib/di.js'; +import path from 'path'; + +describe('Dependency Injection Analysis - Basic Units', () => { + + let projectRoot: string; + let featureCatalog: Map; + let classNameToFeatureMap: Map; + let includeDirs: string[]; + + beforeAll(async () => { + projectRoot = path.resolve(process.cwd(), '..', 'cassandra-rc2'); + includeDirs = [ + path.join(projectRoot, 'src'), + path.join(projectRoot, 'lib/polymech-base/src') + ]; + }); + + it('Step 1: should build the feature catalog correctly', async () => { + featureCatalog = await buildFeatureCatalog(projectRoot); + expect(featureCatalog.size).toBeGreaterThan(10); // Should find many features + expect(featureCatalog.get('ENABLE_PLUNGER')).toEqual('components/Plunger.h'); + expect(featureCatalog.get('ENABLE_SAKO_VFD')).toEqual('components/SAKO_VFD.h'); + }); + + it('Step 2: should map class names to feature flags correctly', async () => { + // Depends on Step 1 + featureCatalog = await buildFeatureCatalog(projectRoot); + classNameToFeatureMap = await buildClassNameToFeatureMap(featureCatalog, includeDirs); + + expect(classNameToFeatureMap.size).toBeGreaterThan(10); + expect(classNameToFeatureMap.get('Plunger')).toEqual('ENABLE_PLUNGER'); + expect(classNameToFeatureMap.get('SAKO_VFD')).toEqual('ENABLE_SAKO_VFD'); + expect(classNameToFeatureMap.get('Joystick')).toEqual('ENABLE_JOYSTICK'); + expect(classNameToFeatureMap.get('POT')).toEqual('ENABLE_POT'); + }); + + it('Step 3: should analyze Plunger dependencies correctly', async () => { + // Depends on Steps 1 & 2 + featureCatalog = await buildFeatureCatalog(projectRoot); + classNameToFeatureMap = await buildClassNameToFeatureMap(featureCatalog, includeDirs); + const plungerHeader = featureCatalog.get('ENABLE_PLUNGER'); + + expect(plungerHeader).toBeDefined(); + + const dependencies = await analyzeComponentDependencies(plungerHeader!, includeDirs, classNameToFeatureMap); + + expect(dependencies).toBeDefined(); + expect(dependencies.length).toBeGreaterThan(0); + expect(dependencies).toContain('ENABLE_SAKO_VFD'); + expect(dependencies).toContain('ENABLE_JOYSTICK'); + expect(dependencies).toContain('ENABLE_POT'); + }); +}); \ No newline at end of file diff --git a/cli-ts/tests/di/plunger.test.js b/cli-ts/tests/di/plunger.test.js new file mode 100644 index 00000000..73be2041 --- /dev/null +++ b/cli-ts/tests/di/plunger.test.js @@ -0,0 +1,41 @@ +import { describe, it, expect } from 'vitest'; +import { findComponents, getComponentTree } from '../../src/lib/di.js'; +import path from 'path'; +import fs from 'fs/promises'; +describe('Component Tree Analysis', () => { + it('should generate a complete and correct dependency tree for the Plunger component', async () => { + const projectRoot = path.resolve(process.cwd(), '..', 'cassandra-rc2'); + const includeDirs = [ + path.join(projectRoot, 'src'), + path.join(projectRoot, 'lib/polymech-base/src') + ]; + // 1. Discover all valid components in the project that inherit from "Component" + const allComponents = await findComponents(includeDirs); + const outputDir = path.join(projectRoot, 'cli-ts', 'tests', 'ast'); + await fs.mkdir(outputDir, { recursive: true }); + // Save the discovered components map for inspection + const componentsObject = Object.fromEntries(allComponents); + await fs.writeFile(path.join(outputDir, 'components.json'), JSON.stringify(componentsObject, null, 2)); + expect(allComponents.has('Plunger')).toBe(true); + expect(allComponents.has('SAKO_VFD')).toBe(true); + expect(allComponents.has('Joystick')).toBe(true); + expect(allComponents.has('POT')).toBe(true); + // 2. Get the specific dependency tree for Plunger + const plungerTree = await getComponentTree('Plunger', allComponents); + expect(plungerTree).toBeDefined(); + // 3. Save the output for inspection + const outputPath = path.join(outputDir, 'plunger.json'); + await fs.writeFile(outputPath, JSON.stringify(plungerTree, null, 2)); + // 4. Assert the structure is correct + expect(plungerTree?.name).toEqual('Plunger'); + expect(plungerTree?.baseComponent).toEqual('Component'); + const dependencyNames = plungerTree?.dependencies.map(d => d.name); + expect(dependencyNames).toContain('SAKO_VFD'); + expect(dependencyNames).toContain('Joystick'); + expect(dependencyNames).toContain('POT'); + const potDependency = plungerTree?.dependencies.find(d => d.name === 'POT'); + expect(potDependency).toBeDefined(); + expect(potDependency?.headerFile).toContain('components/POT.h'); + }); +}); +//# sourceMappingURL=plunger.test.js.map \ No newline at end of file diff --git a/cli-ts/tests/di/plunger.test.js.map b/cli-ts/tests/di/plunger.test.js.map new file mode 100644 index 00000000..63327fb0 --- /dev/null +++ b/cli-ts/tests/di/plunger.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plunger.test.js","sourceRoot":"","sources":["plunger.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IAErC,EAAE,CAAC,kFAAkF,EAAE,KAAK,IAAI,EAAE;QAC9F,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;QACvE,MAAM,WAAW,GAAG;YAChB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,uBAAuB,CAAC;SAClD,CAAC;QAEF,gFAAgF;QAChF,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,CAAC;QAExD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACnE,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE/C,oDAAoD;QACpD,MAAM,gBAAgB,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QAC3D,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAEvG,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE5C,kDAAkD;QAClD,MAAM,WAAW,GAAG,MAAM,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACrE,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;QAElC,oCAAoC;QACpC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACxD,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAErE,qCAAqC;QACrC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7C,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAExD,MAAM,eAAe,GAAG,WAAW,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACnE,MAAM,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAEzC,MAAM,aAAa,GAAG,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;QAC5E,MAAM,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/cli-ts/tests/di/plunger.test.ts b/cli-ts/tests/di/plunger.test.ts new file mode 100644 index 00000000..ab5a6568 --- /dev/null +++ b/cli-ts/tests/di/plunger.test.ts @@ -0,0 +1,51 @@ +import { describe, it, expect } from 'vitest'; +import { findComponents, getComponentTree } from '../../src/lib/di.js'; +import path from 'path'; +import fs from 'fs/promises'; + +describe('Component Tree Analysis', () => { + + it('should generate a complete and correct dependency tree for the Plunger component', async () => { + const projectRoot = path.resolve(process.cwd(), '..', 'cassandra-rc2'); + const includeDirs = [ + path.join(projectRoot, 'src'), + path.join(projectRoot, 'lib/polymech-base/src') + ]; + + // 1. Discover all valid components in the project that inherit from "Component" + const allComponents = await findComponents(includeDirs); + + const outputDir = path.join(projectRoot, 'cli-ts', 'tests', 'ast'); + await fs.mkdir(outputDir, { recursive: true }); + + // Save the discovered components map for inspection + const componentsObject = Object.fromEntries(allComponents); + await fs.writeFile(path.join(outputDir, 'components.json'), JSON.stringify(componentsObject, null, 2)); + + expect(allComponents.has('Plunger')).toBe(true); + expect(allComponents.has('SAKO_VFD')).toBe(true); + expect(allComponents.has('Joystick')).toBe(true); + expect(allComponents.has('POT')).toBe(true); + + // 2. Get the specific dependency tree for Plunger + const plungerTree = await getComponentTree('Plunger', allComponents); + expect(plungerTree).toBeDefined(); + + // 3. Save the output for inspection + const outputPath = path.join(outputDir, 'plunger.json'); + await fs.writeFile(outputPath, JSON.stringify(plungerTree, null, 2)); + + // 4. Assert the structure is correct + expect(plungerTree?.name).toEqual('Plunger'); + expect(plungerTree?.baseComponent).toEqual('Component'); + + const dependencyNames = plungerTree?.dependencies.map(d => d.name); + expect(dependencyNames).toContain('SAKO_VFD'); + expect(dependencyNames).toContain('Joystick'); + expect(dependencyNames).toContain('POT'); + + const potDependency = plungerTree?.dependencies.find(d => d.name === 'POT'); + expect(potDependency).toBeDefined(); + expect(potDependency?.headerFile).toContain('components/POT.h'); + }); +}); \ No newline at end of file diff --git a/cli-ts/tests/index.html b/cli-ts/tests/index.html new file mode 100644 index 00000000..66f4fbb4 --- /dev/null +++ b/cli-ts/tests/index.html @@ -0,0 +1,31 @@ + + + + + + Cassandra RC2 + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/cli-ts/tsconfig.json b/cli-ts/tsconfig.json new file mode 100644 index 00000000..3589df4e --- /dev/null +++ b/cli-ts/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "outDir": "dist-in", + "sourceMap": true, + "noImplicitAny": false, + "esModuleInterop": true, + "jsx": "react-jsx", + "allowJs": true, + "rootDir": "src", + "baseUrl": ".", + "typeRoots": ["./src/types"], + "skipLibCheck": true, + "paths": { + "@/*": [ + "src/*" + ] + } + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules", "node_modules/@types/webpack"] +} \ No newline at end of file diff --git a/cli-ts/webpack.config.js b/cli-ts/webpack.config.js new file mode 100644 index 00000000..768acc1f --- /dev/null +++ b/cli-ts/webpack.config.js @@ -0,0 +1,32 @@ +import path from 'path'; +import { fileURLToPath } from 'url'; +import webpack from 'webpack'; + +const __dirname = fileURLToPath(new URL('.', import.meta.url)); + +export default { + devtool: false, + plugins: [ + new webpack.BannerPlugin({ banner: "#!/usr/bin/env node", raw: true }) + ], + entry: './dist-in/index.js', + target: 'node', + mode: 'production', + module: { + rules: [] + }, + optimization: { + minimize: false + }, + resolve: { + extensions: ['.js', '.ts'] + }, + output: { + filename: 'main_node.cjs', + path: path.resolve(__dirname, 'dist') + }, + externals: { + 'utf-8-validate': 'commonjs utf-8-validate', + 'bufferutil': 'commonjs bufferutil' + } +}; \ No newline at end of file diff --git a/library.properties b/library.properties deleted file mode 100644 index e763cd6b..00000000 --- a/library.properties +++ /dev/null @@ -1,11 +0,0 @@ -name=polymech-base -version=1.0.0 -author=mc007 -maintainer=mc007 -sentence=polymech-base library -paragraph= -category=Uncategorized -url=https://git.polymech.info/polymech/firmware-base.git -architectures=* -includes=PolymechBase.h -depends=ArduinoLog,Vector,Streaming diff --git a/mb-script/.cursorignore b/mb-script/.cursorignore new file mode 100644 index 00000000..cb274c2d --- /dev/null +++ b/mb-script/.cursorignore @@ -0,0 +1,9 @@ +./.pio +./.vscode +./data +./docs +./examples +./scripts +./tmp +./ref +./README.md diff --git a/mb-script/.cursorrules b/mb-script/.cursorrules new file mode 100644 index 00000000..a2ab8d23 --- /dev/null +++ b/mb-script/.cursorrules @@ -0,0 +1,25 @@ +# LLM Development Workflow Commands + + +## Directory & File structure + +- application code resides in ./src +- application's core code resides in ./lib/polymech-base/src + +## Environment + +- ESP32 / Platform.io + +## Commands + +- build : npm run build +- update device : npm run update (build & upload) + +## Code + +- dont comment code at all, unless really needed, assume expert C++ level +- Vector needs an array as storage +- Mermaid diagrams :dont use braces in node names +- never do more than asked, do baby-steps +- be silent, keep your thoughts + diff --git a/mb-script/.gitignore b/mb-script/.gitignore new file mode 100644 index 00000000..c7c0eee4 --- /dev/null +++ b/mb-script/.gitignore @@ -0,0 +1,35 @@ +# PlatformIO +.pio/ +.cache/ + +# Build artifacts +*.elf +*.bin +*.map + +# Secrets +src/config_secrets.h + +# Doxygen Output +docs/doxygen/ +firmware-docs + +# Python build artifacts +scripts/__pycache__/ +*.pyc + +# Node.js +node_modules/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.vscode/ +.idea/ +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +tests/reports/ diff --git a/mb-script/README.md b/mb-script/README.md new file mode 100644 index 00000000..1619cbc9 --- /dev/null +++ b/mb-script/README.md @@ -0,0 +1,96 @@ +# Polymech Cassandra Firmware + +This repository contains the firmware for the Polymech Cassandra project, running on an ESP32-S3. + +## Overview + +The firmware manages various hardware components and provides multiple interfaces for control and monitoring: + +* **Serial Interface:** For debugging, testing, and direct command execution. +* **Modbus TCP Server:** Allows interaction with components using the Modbus protocol over WiFi. +* **REST API & Web UI:** Provides a web-based interface (status page, API documentation) and a RESTful API for interacting with the system over WiFi. + +## Architecture + +The firmware is built upon a component-based architecture: + +* **`App` / `PHApp`:** The main application class (`src/PHApp.h`). +* **`Component`:** Base class (`src/Component.h`) for all functional units. +* **`Bridge`:** (`src/Bridge.h`) Facilitates serial command dispatch. +* **`SerialMessage`:** (`src/SerialMessage.h`) Handles serial communication. +* **`ModbusManager`:** (`src/ModbusManager.h`) Manages the Modbus TCP server. +* **`RESTServer`:** (`src/RestServer.h`) Implements the web server and REST API. +* **Details:** See [docs/components.md](./docs/components.md) for how components are structured, configured, and added. + +## Interfaces + +### 1. Serial Communication + +A command-line interface is available over the USB serial port used for programming and monitoring. + +* **Purpose:** Debugging, direct method calls on components. +* **Command Format:** `<>` +* **Examples & Details:** See [docs/serial.md](./docs/serial.md) +* **Sending Commands:** Use `npm run send -- ""` or a standard serial terminal. + +### 2. Modbus TCP + +The device runs a Modbus TCP server (slave/responder) on port 502. + +* **Implementation:** Managed by `ModbusManager` using the `eModbus` library. +* **Component Interaction:** Components supporting Modbus (like `Relay` or `PHApp` itself) implement `readNetworkValue` and `writeNetworkValue` methods. They are registered with the `ModbusManager` along with their corresponding Modbus addresses. +* **Configuration:** Modbus addresses are defined in `src/config-modbus.h`. +* **Design Details:** See [docs/design-network.md](./docs/design-network.md) +* **Testing:** Use the `python scripts/modbus_*.py` scripts directly (npm script argument passing has issues): + ```bash + # Read Coil 51 + python scripts/modbus_read_coils.py --address 51 --ip-address + # Write Coil 51 ON + python scripts/modbus_write_coil.py --address 51 --value 1 --ip-address + # Read Register 20 + python scripts/modbus_read_registers.py --address 20 --ip-address + # Write Register 20 + python scripts/modbus_write_register.py --address 20 --value 123 --ip-address + ``` + +### 3. Web Interface & REST API + +A web server runs on port 80, providing: + +* **Status Page:** `http:///` +* **Swagger UI:** `http:///api-docs` (Interactive API documentation) +* **REST API:** `http:///api/v1/...` +* **Working Endpoints:** + * `GET /api/v1/system/info`: Device status. + * `GET /api/v1/coils`: List of registered coils. + * `GET /api/v1/registers`: List of registered registers. + * `GET /api/v1/coils?address=`: Read a specific registered coil. + * `GET /api/v1/registers?address=`: Read a specific registered register. + * `POST /api/v1/relay/test`: Trigger internal relay test. +* **Non-Functional Endpoints (Known Issue):** + * `POST /coils/{address}`: Returns 404. + * `POST /registers/{address}`: Returns 404. +* **Details & Examples:** See [docs/web.md](./docs/web.md) +* **Testing:** Use `npm run test-api-ip` (note that some tests related to POST endpoints will fail). + +## Building and Development + +See [firmware/.cursor/rules](./.cursor/rules) for a summary of common workflow commands. + +**Key `npm` Scripts:** + +* `npm run build`: Compile the firmware. +* `npm run upload`: Upload the firmware to the device. +* `npm run clean`: Clean build artifacts. +* `npm run monitor`: Open the serial monitor. +* `npm run build-web`: Generate web assets (from `swagger.yaml`, `front/`) and build firmware. +* `npm run send -- ""`: Send a serial command. +* `npm run test-api-ip`: Run the REST API test script against the device IP. +* *(Modbus tests need direct python execution, see Modbus section above)* + +## Configuration + +* **Hardware Pins, Features:** `src/config.h`, `src/config_adv.h` +* **WiFi Credentials:** `src/config_secrets.h` (ensure this file exists and is populated) +* **Modbus Addresses:** `src/config-modbus.h` +* **Component IDs:** `src/enums.h` (enum `COMPONENT_KEY`) \ No newline at end of file diff --git a/mb-script/config/network.json b/mb-script/config/network.json new file mode 100644 index 00000000..e2e1fe76 --- /dev/null +++ b/mb-script/config/network.json @@ -0,0 +1,14 @@ +{ + "sta_ssid": "Livebox6-EBCD", + "sta_password": "c4RK35h4PZNS", + "sta_local_ip": "192.168.1.250", + "sta_gateway": "192.168.1.1", + "sta_subnet": "255.255.0.0", + "sta_primary_dns": "8.8.8.8", + "sta_secondary_dns": "8.8.4.4", + "ap_ssid": "PolyMechAP", + "ap_password": "poly1234", + "ap_config_ip": "192.168.4.1", + "ap_config_gateway": "192.168.4.1", + "ap_config_subnet": "255.255.255.240" +} \ No newline at end of file diff --git a/mb-script/config/plunger.json b/mb-script/config/plunger.json new file mode 100644 index 00000000..6fd344cc --- /dev/null +++ b/mb-script/config/plunger.json @@ -0,0 +1,25 @@ +{ + "speedSlowHz": 16, + "speedMediumHz": 20, + "speedFastHz": 35, + "speedFillPlungeHz": 25, + "speedFillHomeHz": 20, + "currentJamThresholdMa": 1000, + "jammedDurationHomingMs": 100, + "jammedDurationMs": 1400, + "autoModeHoldDurationMs": 1000, + "maxUniversalJamTimeMs": 7000, + "fillJoystickHoldDurationMs": 1000, + "fillPlungedWaitDurationMs": 1000, + "fillHomedWaitDurationMs": 50, + "recordHoldDurationMs": 2000, + "maxRecordDurationMs": 30000, + "replayDurationMs": 4500, + "enablePostFlow": false, + "postFlowDurationMs": 3000, + "postFlowSpeedHz": 15, + "currentPostFlowMa": 1300, + "postFlowStoppingWaitMs": 500, + "postFlowCompleteWaitMs": 500, + "defaultMaxOperationDurationMs": 18000 +} \ No newline at end of file diff --git a/mb-script/config/plunger_default.json b/mb-script/config/plunger_default.json new file mode 100644 index 00000000..6fd344cc --- /dev/null +++ b/mb-script/config/plunger_default.json @@ -0,0 +1,25 @@ +{ + "speedSlowHz": 16, + "speedMediumHz": 20, + "speedFastHz": 35, + "speedFillPlungeHz": 25, + "speedFillHomeHz": 20, + "currentJamThresholdMa": 1000, + "jammedDurationHomingMs": 100, + "jammedDurationMs": 1400, + "autoModeHoldDurationMs": 1000, + "maxUniversalJamTimeMs": 7000, + "fillJoystickHoldDurationMs": 1000, + "fillPlungedWaitDurationMs": 1000, + "fillHomedWaitDurationMs": 50, + "recordHoldDurationMs": 2000, + "maxRecordDurationMs": 30000, + "replayDurationMs": 4500, + "enablePostFlow": false, + "postFlowDurationMs": 3000, + "postFlowSpeedHz": 15, + "currentPostFlowMa": 1300, + "postFlowStoppingWaitMs": 500, + "postFlowCompleteWaitMs": 500, + "defaultMaxOperationDurationMs": 18000 +} \ No newline at end of file diff --git a/mb-script/data/network.json b/mb-script/data/network.json new file mode 100644 index 00000000..e2e1fe76 --- /dev/null +++ b/mb-script/data/network.json @@ -0,0 +1,14 @@ +{ + "sta_ssid": "Livebox6-EBCD", + "sta_password": "c4RK35h4PZNS", + "sta_local_ip": "192.168.1.250", + "sta_gateway": "192.168.1.1", + "sta_subnet": "255.255.0.0", + "sta_primary_dns": "8.8.8.8", + "sta_secondary_dns": "8.8.4.4", + "ap_ssid": "PolyMechAP", + "ap_password": "poly1234", + "ap_config_ip": "192.168.4.1", + "ap_config_gateway": "192.168.4.1", + "ap_config_subnet": "255.255.255.240" +} \ No newline at end of file diff --git a/mb-script/data/plunger.json b/mb-script/data/plunger.json new file mode 100644 index 00000000..6fd344cc --- /dev/null +++ b/mb-script/data/plunger.json @@ -0,0 +1,25 @@ +{ + "speedSlowHz": 16, + "speedMediumHz": 20, + "speedFastHz": 35, + "speedFillPlungeHz": 25, + "speedFillHomeHz": 20, + "currentJamThresholdMa": 1000, + "jammedDurationHomingMs": 100, + "jammedDurationMs": 1400, + "autoModeHoldDurationMs": 1000, + "maxUniversalJamTimeMs": 7000, + "fillJoystickHoldDurationMs": 1000, + "fillPlungedWaitDurationMs": 1000, + "fillHomedWaitDurationMs": 50, + "recordHoldDurationMs": 2000, + "maxRecordDurationMs": 30000, + "replayDurationMs": 4500, + "enablePostFlow": false, + "postFlowDurationMs": 3000, + "postFlowSpeedHz": 15, + "currentPostFlowMa": 1300, + "postFlowStoppingWaitMs": 500, + "postFlowCompleteWaitMs": 500, + "defaultMaxOperationDurationMs": 18000 +} \ No newline at end of file diff --git a/mb-script/data/plunger_default.json b/mb-script/data/plunger_default.json new file mode 100644 index 00000000..6fd344cc --- /dev/null +++ b/mb-script/data/plunger_default.json @@ -0,0 +1,25 @@ +{ + "speedSlowHz": 16, + "speedMediumHz": 20, + "speedFastHz": 35, + "speedFillPlungeHz": 25, + "speedFillHomeHz": 20, + "currentJamThresholdMa": 1000, + "jammedDurationHomingMs": 100, + "jammedDurationMs": 1400, + "autoModeHoldDurationMs": 1000, + "maxUniversalJamTimeMs": 7000, + "fillJoystickHoldDurationMs": 1000, + "fillPlungedWaitDurationMs": 1000, + "fillHomedWaitDurationMs": 50, + "recordHoldDurationMs": 2000, + "maxRecordDurationMs": 30000, + "replayDurationMs": 4500, + "enablePostFlow": false, + "postFlowDurationMs": 3000, + "postFlowSpeedHz": 15, + "currentPostFlowMa": 1300, + "postFlowStoppingWaitMs": 500, + "postFlowCompleteWaitMs": 500, + "defaultMaxOperationDurationMs": 18000 +} \ No newline at end of file diff --git a/mb-script/docs/mb-lang.md b/mb-script/docs/mb-lang.md new file mode 100644 index 00000000..b9a00790 --- /dev/null +++ b/mb-script/docs/mb-lang.md @@ -0,0 +1,181 @@ +# Modbus Logic Language (mb-lang) + +This document describes the design and usage of the simple logic engine configurable via Modbus TCP. + +## Purpose + +The Modbus Logic Engine allows users to define simple conditional automation rules directly by writing to specific Modbus holding registers. This enables basic automation sequences like "if sensor value X exceeds Y, then turn on relay Z" without modifying the core firmware code. + +## Architecture + +A dedicated component, `ModbusLogicEngine`, runs within the firmware. +- It exposes a block of Modbus Holding Registers for configuration and status. +- It periodically evaluates the enabled rules. +- It can read the state of other Modbus registers/coils. +- It can perform actions like writing to Modbus registers/coils or calling pre-defined methods on other firmware components. +- It updates status registers after each rule evaluation/action attempt. + +## Configuration and Status + +The engine supports a fixed number of logic rules, defined by `MAX_LOGIC_RULES` (e.g., 8). Each rule is configured and monitored using a block of `REGISTERS_PER_RULE` (now 13) consecutive Holding Registers. + +- **Base Address:** `MODBUS_LOGIC_RULES_START` (Defined in `config-modbus.h`) +- **Rule N Address:** `MODBUS_LOGIC_RULES_START + (N * REGISTERS_PER_RULE)` where `N` is the rule index (0 to `MAX_LOGIC_RULES - 1`). + +### Register Map per Rule (N) + +| Offset | Register Name | Address Offset | R/W | Description | Notes | +| :----- | :---------------------------- | :-------------------------------- | :-- | :--------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- | +| +0 | `Rule_N_Enabled` | `Base + (N*13) + 0` | R/W | **Enable/Disable Rule:** 0 = Disabled, 1 = Enabled | Rules are ignored if disabled. | +| +1 | `Rule_N_Cond_Src_Type` | `Base + (N*13) + 1` | R/W | **Condition Source Type:** 0 = Holding Register, 1 = Coil | Specifies what type of Modbus item the condition reads. | +| +2 | `Rule_N_Cond_Src_Addr` | `Base + (N*13) + 2` | R/W | **Condition Source Address:** Modbus address of the register/coil to read for the condition. | The address of the data point to check. | +| +3 | `Rule_N_Cond_Operator` | `Base + (N*13) + 3` | R/W | **Condition Operator:** 0=`==`, 1=`!=`, 2=`<`, 3=`<=`, 4=`>`, 5=`>=` | The comparison to perform. | +| +4 | `Rule_N_Cond_Value` | `Base + (N*13) + 4` | R/W | **Condition Value:** The value to compare the source against. | For Coils, use 0 for OFF and 1 for ON. | +| +5 | `Rule_N_Action_Type` | `Base + (N*13) + 5` | R/W | **Action Type:** 0=None, 1=Write Holding Reg, 2=Write Coil, 3=Call Component Method | Specifies what to do if the condition is true. | +| +6 | `Rule_N_Action_Target` | `Base + (N*13) + 6` | R/W | **Action Target:** Modbus Address (for Write Reg/Coil) or Component ID (for Call Method) | Specifies *what* to act upon (Register Address, Coil Address, Component ID). | +| +7 | `Rule_N_Action_Param1` | `Base + (N*13) + 7` | R/W | **Action Parameter 1:** Value (for Write Reg), ON/OFF (for Write Coil, 0=OFF, 1=ON), Method ID (for Call) | Specifies *how* to act upon the target. | +| +8 | `Rule_N_Action_Param2` | `Base + (N*13) + 8` | R/W | **Action Parameter 2:** Argument 1 for `Call Component Method` | First argument for the component method. Ignored for Write actions. | +| +9 | `Rule_N_Action_Param3` | `Base + (N*13) + 9` | R/W | **Action Parameter 3:** Argument 2 for `Call Component Method` | Second argument for the component method. Ignored for Write actions. | +| +10 | `Rule_N_Last_Status` | `Base + (N*13) + 10` | R | **Last Action Status:** 0=Idle/OK, 1=Err Cond Read, 2=Err Action Write/Call, 3=Invalid Action Params | Reports the outcome of the last trigger attempt. (See Status Codes below) | +| +11 | `Rule_N_Last_Trigger_Timestamp` | `Base + (N*13) + 11` | R | **Last Trigger Timestamp:** System time (e.g., seconds since boot) when rule last triggered. | 0 if never triggered. Wraps eventually. | +| +12 | `Rule_N_Trigger_Count` | `Base + (N*13) + 12` | R | **Trigger Count:** Number of times this rule's action has been successfully triggered. | Wraps eventually. Can be reset by writing 0 via Modbus. | + +*Note: `Base` refers to `MODBUS_LOGIC_RULES_START`. R=Read-Only, W=Writeable (from Modbus perspective). Status registers (+10 to +12) are updated internally but the count (+12) can potentially be reset via write.* + +### Status Codes (`Rule_N_Last_Status`) + +| Code | Meaning | +| :--- | :-------------------------- | +| 0 | Idle / Action OK | +| 1 | Error Reading Condition Src | +| 2 | Error Performing Action | +| 3 | Invalid Action Parameters | +| 4 | Component Method Call Failed| +| ... | (Other specific errors TBD) | + +## Actions + +### 1. Write Holding Register + +- **Action Type:** 1 +- **Action Target:** Modbus address of the Holding Register. +- **Action Parameter 1:** Value to write. +- **Action Parameters 2 & 3:** Ignored. + +### 2. Write Coil + +- **Action Type:** 2 +- **Action Target:** Modbus address of the Coil. +- **Action Parameter 1:** Value to write (0 for OFF, 1 for ON). Other non-zero values may also be interpreted as ON. +- **Action Parameters 2 & 3:** Ignored. + +### 3. Call Component Method + +- **Action Type:** 3 +- **Action Target:** The numeric `Component ID`. +- **Action Parameter 1:** The numeric `Method ID`. +- **Action Parameter 2:** The first integer argument (`arg1`). +- **Action Parameter 3:** The second integer argument (`arg2`). + +**Important:** Only specific, pre-registered methods can be called. Available Component/Method IDs need separate documentation. + +## Execution Flow + +1. The `ModbusLogicEngine` loops periodically. +2. For each rule `N` from 0 to `MAX_LOGIC_RULES - 1`: + a. Read `Rule_N_Enabled`. If 0, skip. + b. Read condition parameters. + c. Attempt to read the current value from `Cond_Src_Addr`. + d. If read fails, update `Rule_N_Last_Status` (e.g., to 1) and skip to the next rule. + e. Evaluate the condition. + f. If the condition is TRUE: + i. Read action parameters. + ii. Attempt to perform the specified action. + iii. Update `Rule_N_Last_Status` based on action success (0) or failure (e.g., 2, 3, 4). + iv. If action was successful, increment `Rule_N_Trigger_Count` and update `Rule_N_Last_Trigger_Timestamp`. + g. If the condition is FALSE, potentially reset `Rule_N_Last_Status` to 0 (Idle), unless it holds an error state. + +## Example Scenarios + +*(Addresses updated for REGISTERS_PER_RULE = 13)* + +### Example 1: Turn on Relay 5 if Register 200 >= 100 + +Assume: +- `MODBUS_LOGIC_RULES_START` = 1000 +- Rule Index `N = 0` (`Base = 1000`) +- Relay 5 is mapped to Coil address 5 +- Register 200 + +Write: + +| Register Address | Value | Meaning | +| :--------------- | :---- | :------------------------ | +| 1000 | 1 | Rule 0: Enabled | +| 1001 | 0 | Cond Src Type: Reg | +| 1002 | 200 | Cond Src Addr: 200 | +| 1003 | 5 | Cond Operator: >= (5) | +| 1004 | 100 | Cond Value: 100 | +| 1005 | 2 | Action Type: Write Coil | +| 1006 | 5 | Action Target: Coil Addr 5| +| 1007 | 1 | Action Param 1: Value ON | +| 1008 | 0 | Action Param 2: (Ignored) | +| 1009 | 0 | Action Param 3: (Ignored) | + +Read Status (after trigger): + +| Register Address | Value | Meaning | +| :--------------- | :------------ | :-------------------------- | +| 1010 | 0 | Last Status: OK | +| 1011 | e.g., 12345 | Last Trigger: Timestamp | +| 1012 | e.g., 1 | Trigger Count: 1 | + +### Example 2: Call `resetCounter()` Method on Component `StatsTracker` if Coil 10 is ON + +Assume: +- Rule Index `N = 1` (`Base = 1000 + 13 = 1013`) +- Coil 10 +- Component `StatsTracker` ID = 5 +- Method `resetCounter` ID = 1 (takes no args) + +Write: + +| Register Address | Value | Meaning | +| :--------------- | :---- | :---------------------------- | +| 1013 | 1 | Rule 1: Enabled | +| 1014 | 1 | Cond Src Type: Coil | +| 1015 | 10 | Cond Src Addr: Coil 10 | +| 1016 | 0 | Cond Operator: == (0) | +| 1017 | 1 | Cond Value: ON (1) | +| 1018 | 3 | Action Type: Call Method | +| 1019 | 5 | Action Target: Component ID 5 | +| 1020 | 1 | Action Param 1: Method ID 1 | +| 1021 | 0 | Action Param 2: Arg1 = 0 | +| 1022 | 0 | Action Param 3: Arg2 = 0 | + +Read Status (after trigger): + +| Register Address | Value | Meaning | +| :--------------- | :------------ | :-------------------------- | +| 1023 | 0 | Last Status: OK | +| 1024 | e.g., 12360 | Last Trigger: Timestamp | +| 1025 | e.g., 1 | Trigger Count: 1 | + +## Limitations & Considerations + +- **Complexity:** Only simple, single conditions per rule. No `AND`/`OR`/`ELSE`. +- **Execution Order:** Rules evaluated sequentially. +- **Performance:** Rule evaluation takes time. Consider impact and execution frequency. +- **Timestamp:** The `Last_Trigger_Timestamp` resolution and potential for wrapping depend on the firmware implementation (e.g., `millis()` overflow, using seconds since boot). +- **Error Handling:** Status codes provide basic feedback. More detailed logging might be needed for complex debugging. +- **Method Availability:** Callable methods are fixed in firmware. +- **Concurrency:** Actions (especially method calls) might take time. The engine design needs to consider if rule evaluation should block or if actions run asynchronously (current design implies synchronous execution within the loop). + + +## Limitations & Considerations + +- **Complexity:** Only simple, single conditions per rule are supported. No `AND`/`OR` or `ELSE` logic. +- **Execution Order:** Rules are evaluated sequentially. Be mindful of potential interactions if multiple rules modify the same target. +- **Performance:** Reading Modbus values and executing actions takes time. Complex rules or a large number of rules might impact overall system performance. Rule execution frequency should be considered. +- **Error Handling:** The current design doesn't explicitly define Modbus registers for rule execution status or errors. This could be added later. +- **Method Availability:** The list of callable methods (`Component ID`, `Method ID`) is fixed in the firmware and needs to be documented for users. \ No newline at end of file diff --git a/mb-script/docs/mb-plc.md b/mb-script/docs/mb-plc.md new file mode 100644 index 00000000..df57572d --- /dev/null +++ b/mb-script/docs/mb-plc.md @@ -0,0 +1,109 @@ +# Comparison: Modbus Logic Engine (MB_SCRIPT) vs. PLC Ladder Logic + +## 1. Introduction + +This document compares the custom Modbus Logic Engine (`MB_SCRIPT`) implemented in this firmware with traditional PLC (Programmable Logic Controller) programming languages, primarily focusing on Ladder Logic (LD). + +* **Modbus Logic Engine (MB_SCRIPT):** A feature enabling simple, rule-based automation directly within the ESP32 firmware. Rules are configured and monitored via Modbus registers. It allows defining conditions based on Modbus values and triggering actions like writing Modbus values or calling internal C++ functions. +* **PLC Ladder Logic (LD):** A graphical programming language widely used in industrial automation. It mimics the appearance of electrical relay logic diagrams, making it intuitive for electricians and technicians. It runs on dedicated PLC hardware in a cyclic scan execution model. + +## 2. Core Concepts Comparison + +| Feature | PLC Ladder Logic (Typical) | Modbus Logic Engine (MB_SCRIPT) | +| :---------------------- | :------------------------------------------------------------- | :------------------------------------------------------------------ | +| **Programming Model** | Graphical (Relay Logic Diagram), Textual (ST, FBD often avail.) | Rule-Based (IF condition THEN action), Configuration via Registers | +| **Representation** | Rungs, Contacts (NO/NC), Coils, Function Blocks (Timers, Cnt) | Blocks of Holding Registers defining rules | +| **Execution Model** | Cyclic Scan (Read Inputs -> Solve Logic -> Write Outputs) | Iterative `loop()` checks rules sequentially based on interval | +| **Data Addressing** | Standardized I/O points (%I, %Q), Memory (%M), Data Regs (%MW) | Modbus Addresses (Coils/Registers) managed by firmware components | +| **Built-in Functions** | Timers (TON/TOF), Counters (CTU/CTD), Math, Compare, Move | Basic Comparisons (==, !=, <, >...), Write Coil/Reg, Call Method | +| **Complex Logic** | Subroutines, Jumps, Structured Text (ST), Function Blocks | Requires registering custom C++ methods (`CallableMethod`) | +| **Configuration Tool** | Dedicated PLC IDE (e.g., TIA Portal, RSLogix) | Standard Modbus Client/Master Software | +| **Deployment** | Download program binary to PLC hardware | Write configuration values to Modbus registers | +| **Debugging/Monitor** | Online monitoring in IDE, Forcing I/O, Status LEDs | Reading Status registers via Modbus, Serial Logs (Debug/Receipt Flags) | +| **Hardware** | Dedicated Industrial PLC Hardware | Runs on the ESP32 microcontroller within the firmware | +| **Extensibility** | Adding I/O modules, using advanced function blocks, libraries | Adding/Registering C++ methods, potentially modifying engine code | +| **Target User** | Automation Engineers, Technicians, Electricians | Firmware developers, System integrators familiar with Modbus | + +## 3. Detailed Comparison + +### 3.1. Programming Model & Representation + +* **Ladder Logic:** Visual and intuitive for those familiar with electrical schematics. Logic flows left-to-right across rungs. Standard symbols for contacts, coils, timers, etc., are well-understood in the industry. +* **MB_SCRIPT:** Abstract. Logic is defined by setting numerical values in specific Modbus registers according to predefined offsets (`ModbusLogicEngineOffsets`). Requires understanding the specific register map and enum values (`E_RegType`, `ConditionOperator`, `CommandType`, `MB_Error`). Less visual and more data-entry focused. + +### 3.2. Execution + +* **Ladder Logic:** Typically deterministic cyclic scan. The PLC reads all inputs, executes the entire ladder program from top to bottom, and then updates all outputs in a predictable cycle time. +* **MB_SCRIPT:** Executes within the ESP32's main `loop()`. Rules are checked sequentially within the `ModbusLogicEngine::loop()` call, which runs periodically based on `loopInterval`. Execution time can be influenced by other tasks running on the ESP32. It's event-driven based on Modbus value changes *observed* during rule evaluation, but the evaluation itself is interval-based. + +### 3.3. Data Handling + +* **Ladder Logic:** Uses well-defined memory areas for inputs, outputs, internal bits, timers, counters, and data registers, accessed via standardized addressing. +* **MB_SCRIPT:** Relies entirely on the existing Modbus address space managed by other firmware components (`ModbusManager`). Condition sources and action targets are arbitrary Modbus addresses. Internal rule state (status, timestamp, count) is exposed via dedicated status registers within the rule's block. Complex data manipulation requires C++ functions. + +### 3.4. Capabilities & Functionality + +* **Ladder Logic:** Offers standard, pre-built function blocks for common automation tasks like timing delays, counting events, basic arithmetic, and data manipulation. More advanced PLCs include PID loops, communication protocols, motion control, etc. +* **MB_SCRIPT:** Provides fundamental building blocks: compare Modbus values and trigger simple actions (write Modbus value, call internal function). It lacks built-in timers, counters, or complex math operations within the rule definition itself. Such functionality must be implemented in C++ and exposed via the `CALL_COMPONENT_METHOD` command. + +### 3.5. Configuration & Deployment + +* **Ladder Logic:** Requires specialized, often vendor-specific, programming software. The compiled logic is downloaded as a binary program to the PLC. Configuration is done offline in the IDE. +* **MB_SCRIPT:** Configured "online" by writing values to Modbus registers using any standard Modbus master tool. No separate compilation or download step for the logic itself is needed (only for the firmware containing the engine). This allows dynamic reconfiguration without reflashing firmware (though registered methods are fixed in firmware). + +### 3.6. Debugging & Monitoring + +* **Ladder Logic:** IDEs provide powerful online monitoring tools, allowing visualization of rung state, live value tracing, and forcing of inputs/outputs for testing. PLCs often have hardware status LEDs. +* **MB_SCRIPT:** Debugging relies on reading the `LAST_STATUS`, `LAST_TRIGGER_TS`, and `TRIGGER_COUNT` registers via Modbus. More detail requires enabling the `RULE_FLAG_DEBUG` and `RULE_FLAG_RECEIPT` flags and monitoring the device's serial output (`npm run build:monitor`). Less interactive than typical PLC debugging. + +## 4. Strengths & Weaknesses + +**MB_SCRIPT:** + +* **Strengths:** + * Simple rule structure, easy to understand if the register map is known. + * Configuration via standard Modbus tools - no specialized IDE needed. + * Runs directly on the ESP32, reducing need for external micro-controllers for simple logic. + * Extensible via C++ (`CALL_COMPONENT_METHOD`) for complex custom actions. + * Logic configuration can potentially be updated without firmware reflash. +* **Weaknesses:** + * Limited built-in functions (no timers, counters, complex math within rules). + * Logic representation is abstract (register values) and not visual. + * Debugging relies heavily on Modbus reads and serial logs. + * Sequential rule execution might have timing implications compared to cyclic scan. + * Scalability limited by `MAX_LOGIC_RULES` and ESP32 resources. + * Complex logic requires C++ development and method registration. + +**PLC Ladder Logic:** + +* **Strengths:** + * Visual and intuitive programming paradigm (especially LD). + * Industry standard, widely understood by technicians and engineers. + * Rich set of built-in standard functions (timers, counters, etc.). + * Mature, powerful IDEs with excellent online monitoring and debugging capabilities. + * Deterministic execution (typically). + * Highly scalable with modular hardware. +* **Weaknesses:** + * Requires dedicated, often expensive, PLC hardware. + * Requires specialized, often expensive, vendor-specific IDE software. + * Less straightforward to integrate directly with custom C++ functions or device-specific hardware features compared to code running *on* the device. + * Configuration/updates typically require offline editing and download. + +## 5. Use Cases + +* **MB_SCRIPT is suitable for:** + * Simple, reactive logic based directly on Modbus values on the device. + * Triggering predefined C++ functions based on Modbus conditions. + * Implementing basic interlocks or sequences configurable via Modbus. + * Situations where adding a full PLC is overkill or impractical. + * Environments where configuration via standard Modbus tools is preferred. +* **PLC Ladder Logic is suitable for:** + * Complex industrial automation and control sequences. + * Applications requiring standard timing, counting, and process control functions. + * Systems needing robust, deterministic execution. + * Environments where technicians are primarily familiar with Ladder Logic. + * Large-scale systems with extensive I/O requirements. + +## 6. Conclusion + +The Modbus Logic Engine (`MB_SCRIPT`) provides a useful, lightweight mechanism for implementing simple, Modbus-driven automation rules directly on the ESP32 firmware. It leverages the existing Modbus infrastructure for configuration and interaction but relies on C++ for complex actions. It is not a replacement for a full PLC system using Ladder Logic, which offers a more comprehensive, standardized, and visually intuitive environment with richer built-in capabilities tailored for industrial control, albeit with the requirement of dedicated hardware and software. The choice depends on the complexity of the required logic, the target environment, user expertise, and integration needs. \ No newline at end of file diff --git a/mb-script/docs/mb-script-design.md b/mb-script/docs/mb-script-design.md new file mode 100644 index 00000000..9b308006 --- /dev/null +++ b/mb-script/docs/mb-script-design.md @@ -0,0 +1,240 @@ +# Modbus Logic Engine (MB_SCRIPT) Design + +## 1. Overview + +The Modbus Logic Engine (`ModbusLogicEngine` class, enabled by `#define ENABLE_MB_SCRIPT`) provides a way to implement simple automation rules directly on the device, configured and monitored via Modbus. It allows users to define rules based on the state of Modbus registers or coils (conditions) and trigger actions like writing to other registers/coils or calling internal component methods. + +This enables reactive logic without requiring an external controller polling and writing values constantly. + +## 2. Modbus Register Layout + +Each logic rule occupies a contiguous block of Modbus holding registers. The number of rules is defined by `MAX_LOGIC_RULES` (default 8) and the number of registers per rule by `LOGIC_ENGINE_REGISTERS_PER_RULE` (currently 13). The starting address for the first rule is defined by `MODBUS_LOGIC_RULES_START`. + +**Register Layout per Rule:** + +```mermaid +graph TD + subgraph Rule N + Reg0[Offset 0: ENABLED (0/1)] + Reg1[Offset 1: COND_SRC_TYPE (E_RegType)] + Reg2[Offset 2: COND_SRC_ADDR] + Reg3[Offset 3: COND_OPERATOR (ConditionOperator)] + Reg4[Offset 4: COND_VALUE] + Reg5[Offset 5: COMMAND_TYPE (CommandType)] + Reg6[Offset 6: COMMAND_TARGET (Addr/CompID)] + Reg7[Offset 7: COMMAND_PARAM1 (Value/MethodID)] + Reg8[Offset 8: COMMAND_PARAM2 (Arg1)] + Reg9[Offset 9: FLAGS (Debug/Receipt)] + Reg10[Offset 10: LAST_STATUS (MB_Error)] + Reg11[Offset 11: LAST_TRIGGER_TS (Lower 16bit)] + Reg12[Offset 12: TRIGGER_COUNT] + end + + style Reg0 fill:#f9f,stroke:#333,stroke-width:2px + style Reg1 fill:#f9f,stroke:#333,stroke-width:2px + style Reg2 fill:#f9f,stroke:#333,stroke-width:2px + style Reg3 fill:#f9f,stroke:#333,stroke-width:2px + style Reg4 fill:#f9f,stroke:#333,stroke-width:2px + style Reg5 fill:#f9f,stroke:#333,stroke-width:2px + style Reg6 fill:#f9f,stroke:#333,stroke-width:2px + style Reg7 fill:#f9f,stroke:#333,stroke-width:2px + style Reg8 fill:#f9f,stroke:#333,stroke-width:2px + style Reg9 fill:#f9f,stroke:#333,stroke-width:2px + style Reg10 fill:#ccf,stroke:#333,stroke-width:2px + style Reg11 fill:#ccf,stroke:#333,stroke-width:2px + style Reg12 fill:#ccf,stroke:#333,stroke-width:2px + +``` + +**Register Descriptions (Offsets defined in `ModbusLogicEngineOffsets`):** + +* **Configuration Registers (Read/Write via Modbus):** + * `ENABLED` (0): `0` = Disabled, `1` = Enabled. + * `COND_SRC_TYPE` (1): Type of the Modbus entity to check for the condition. Uses `RegisterState::E_RegType` enum values (e.g., `REG_HOLDING = 3`, `REG_COIL = 2`). + * `COND_SRC_ADDR` (2): Modbus address of the register/coil for the condition. + * `COND_OPERATOR` (3): Comparison operator to use. Uses `ConditionOperator` enum values (e.g., `EQUAL = 0`, `NOT_EQUAL = 1`, ...). + * `COND_VALUE` (4): The value to compare the source register/coil against. + * `COMMAND_TYPE` (5): The action to perform if the condition is met. Uses `CommandType` enum values (e.g., `WRITE_COIL = 2`, `WRITE_HOLDING_REGISTER = 3`, `CALL_COMPONENT_METHOD = 100`). + * `COMMAND_TARGET` (6): Target of the command. + * For `WRITE_*`: The Modbus address to write to. + * For `CALL_COMPONENT_METHOD`: The `Component::id` of the target component. + * `COMMAND_PARAM1` (7): First parameter for the command. + * For `WRITE_*`: The value to write. + * For `CALL_COMPONENT_METHOD`: The `methodId` registered with `ModbusLogicEngine::registerMethod`. + * `COMMAND_PARAM2` (8): Second parameter for the command. + * For `WRITE_*`: Unused. + * For `CALL_COMPONENT_METHOD`: The first argument (`arg1`) passed to the registered method. + * `FLAGS` (9): Bit flags for rule behavior (See Section 7). + +* **Status Registers (Read-Only via Modbus, except TRIGGER_COUNT reset):** + * `LAST_STATUS` (10): Result of the last evaluation/action attempt for this rule. Uses `MB_Error` enum values (e.g., `Success = 0`, `IllegalDataAddress = 2`, `ServerDeviceFailure = 4`). + * `LAST_TRIGGER_TS` (11): Timestamp (lower 16 bits of `millis()/1000`) of the last successful trigger. + * `TRIGGER_COUNT` (12): Counter of successful triggers. Can be reset by writing `0`. + +## 3. Data Structures + +* **`LogicRule` Struct:** + * Holds the internal representation of a single rule. + * `config[9]`: An array storing the 9 configuration registers (Offset 0 to 8) read from/written to Modbus. + * `lastStatus` (type `RuleStatus`/`MB_Error`): Internal state variable reflecting the last status. + * `lastTriggerTimestamp` (type `uint32_t`): Internal state variable for the full timestamp. + * `triggerCount` (type `uint16_t`): Internal state variable for the trigger count. + * Helper methods (`isEnabled()`, `getCondSourceType()`, `getCommandType()`, `getFlags()`, etc.) provide convenient access to the values stored in the `config` array. +* **`std::vector rules`:** Member variable in `ModbusLogicEngine` holding all configured rules. +* **`std::map callableMethods`:** Member variable storing methods registered via `registerMethod`, keyed by `(componentId << 16) | methodId`. + +## 4. Core Logic Flow + +```mermaid +sequenceDiagram + participant ModbusClient + participant ModbusManager + participant ModbusLogicEngine as MLE + participant TargetComponent + + Note over ModbusClient, MLE: Initialization + PHApp->>MLE: constructor(app) + PHApp->>MLE: setup() + MLE->>MLE: rules.resize(MAX_LOGIC_RULES) + Note over MLE: Methods registered via registerMethod() + PHApp->>MLE: registerMethod(compID, methodID, function) + MLE->>MLE: callableMethods.insert(...) + + loop Application Loop + PHApp->>MLE: loop() + alt Not Initialized or Interval Not Met + MLE-->>PHApp: return E_OK + else Rule Evaluation + MLE->>MLE: For each rule in rules vector + alt Rule Enabled? + MLE->>MLE: evaluateCondition(rule) + Note over MLE: Reads condition source + MLE->>ModbusManager: findComponentForAddress(condAddr) + ModbusManager-->>MLE: TargetComponent* + MLE->>TargetComponent: readNetworkValue(condAddr) + TargetComponent-->>MLE: currentValue (or error) + Note over MLE: Performs comparison + alt Condition Met? + MLE->>MLE: performAction(rule) + opt CommandType == WRITE_* + Note over MLE: Performs write action + MLE->>ModbusManager: findComponentForAddress(targetAddr) + ModbusManager-->>MLE: TargetComponent* + MLE->>TargetComponent: writeNetworkValue(targetAddr, value) + TargetComponent-->>MLE: E_OK (or error) + MLE->>MLE: updateRuleStatus(rule, MB_Error::Success / ServerDeviceFailure) + opt CommandType == CALL_COMPONENT_METHOD + Note over MLE: Performs method call + MLE->>MLE: callableMethods.find(key) + alt Method Found? + MLE->>TargetComponent: Execute registered std::function(arg1) + TargetComponent-->>MLE: E_OK (or error) + MLE->>MLE: updateRuleStatus(rule, MB_Error::Success / OpExecutionFailed) + else Method Not Found + MLE->>MLE: updateRuleStatus(rule, MB_Error::IllegalDataAddress) + end + end + MLE->>MLE: update timestamp & trigger count + else Condition Not Met + MLE->>MLE: updateRuleStatus(rule, MB_Error::Success) if not error + end + else Rule Disabled + MLE->>MLE: Skip rule + end + end + end + + Note over ModbusClient, MLE: Configuration/Status Access + ModbusClient->>ModbusManager: Read/Write Request (Holding Registers) + ModbusManager->>MLE: readNetworkValue(addr) / writeNetworkValue(addr, val) + MLE->>MLE: getRuleInfoFromAddress(addr) + alt Read Request + MLE->>MLE: Access rule.config[] or internal status + MLE-->>ModbusManager: value / status + else Write Request + MLE->>MLE: rule.setConfigValue(offset, val) / rule.triggerCount = 0 + MLE-->>ModbusManager: E_OK / error + end + ModbusManager-->>ModbusClient: Response + +``` + +* **`setup()`:** Initializes the `rules` vector based on `MAX_LOGIC_RULES`. +* **`loop()`:** Called periodically by the main application loop (`PHApp`). + * Checks if initialized and if the evaluation `loopInterval` has passed. + * Iterates through each `LogicRule` in the `rules` vector. + * If a rule `isEnabled()`, it calls `evaluateCondition()`. + * If `evaluateCondition()` returns `true` (condition met), it calls `performAction()`. +* **`evaluateCondition()`:** + * Retrieves condition parameters (source type, address, operator, value) from the rule. + * Calls `readConditionSourceValue()` to get the current value of the source register/coil. + * Performs the comparison based on the `condOperator`. + * Updates `rule.lastStatus` (e.g., `MB_Error::IllegalDataAddress` on read failure, `MB_Error::IllegalDataValue` on invalid operator). + * Returns `true` if the condition is met, `false` otherwise (including errors). +* **`performAction()`:** + * Retrieves command parameters (type, target, params) from the rule. + * Based on `commandType`: + * Calls `performWriteAction()` for `WRITE_*` commands. + * Calls `performCallAction()` for `CALL_COMPONENT_METHOD`. + * Updates `rule.lastStatus` based on the success/failure of the action (e.g., `MB_Error::Success`, `MB_Error::ServerDeviceFailure`, `MB_Error::OpExecutionFailed`, `MB_Error::IllegalFunction`). + * If successful, updates `rule.lastTriggerTimestamp` and increments `rule.triggerCount`. + * Returns `true` on success, `false` on failure. + +## 5. Interaction with ModbusManager + +The `ModbusLogicEngine` relies on the `ModbusManager` (accessed via the `PHApp* app` pointer) to interact with other components' Modbus values. + +* **`readConditionSourceValue()`:** + * Takes the source type (`RegisterState::E_RegType`) and address. + * Uses `app->modbusManager->findComponentForAddress(address)` to find the component responsible for that address. + * Calls the target component's `readNetworkValue(address)` method. + * Returns the value or indicates failure. +* **`performWriteAction()`:** + * Takes the command type (`WRITE_COIL` or `WRITE_HOLDING_REGISTER`), target address, and value. + * Uses `app->modbusManager->findComponentForAddress(address)` to find the target component. + * Calls the target component's `writeNetworkValue(address, value)` method. + * Returns `true` if the write call returns `E_OK`, `false` otherwise. + +## 6. Method Calling (`CALL_COMPONENT_METHOD`) + +This command type allows rules to trigger C++ methods within other components. + +* **Registration:** Components (like `PHApp` or custom components) that want to expose methods to the Logic Engine must call `ModbusLogicEngine::registerMethod(componentId, methodId, method)`. + * `componentId`: The unique `Component::id` of the component exposing the method. + * `methodId`: A unique ID (within that component) for the specific method being exposed. + * `method`: A `std::function` object wrapping the actual C++ method (often created using `std::bind`). The function should accept two `short` arguments and return `E_OK` (or another error code). + * The engine stores this registration in the `callableMethods` map. +* **Configuration:** A rule is configured with `COMMAND_TYPE = CALL_COMPONENT_METHOD`. + * `COMMAND_TARGET` is set to the `componentId`. + * `COMMAND_PARAM1` is set to the `methodId`. + * `COMMAND_PARAM2` is set to the value to be passed as the first argument (`arg1`) to the registered C++ method. +* **Execution (`performCallAction()`):** + * Combines `componentId` (from Target) and `methodId` (from Param1) into a key. + * Looks up the key in the `callableMethods` map. + * If found, executes the stored `std::function`, passing `param2` (as `arg1`) and a dummy `0` (as `arg2`) to the bound C++ method. + * Updates status based on the return value of the C++ method (`MB_Error::Success` if `E_OK`, `MB_Error::OpExecutionFailed` otherwise) or `MB_Error::IllegalDataAddress` if the method was not found in the map. + +*Note: This `std::function`-based registration is internal to the `ModbusLogicEngine` and separate from the `Bridge` mechanism used for serial commands.* + +## 7. Flags (`FLAGS` Register - Offset 9) + +The `FLAGS` register allows modifying rule behavior using bitmasks: + +* **`RULE_FLAG_DEBUG` (Bit 0 / Value 1):** If set, enables verbose logging (`Log.verboseln`) during the evaluation and action phases for this specific rule, showing details like addresses, values, and outcomes. +* **`RULE_FLAG_RECEIPT` (Bit 1 / Value 2):** If set, logs an informational message (`Log.infoln`) whenever the rule's action is executed successfully. + +These flags can be combined (e.g., value `3` enables both). + +## 8. Modbus Interface (`read/writeNetworkValue`) + +* The `ModbusLogicEngine` implements `readNetworkValue` and `writeNetworkValue` as required by the `Component` base class. +* These methods are called by `ModbusManager` when a Modbus client reads/writes registers within the engine's address range (`MODBUS_LOGIC_RULES_START` onwards). +* They calculate the `ruleIndex` and `offset` from the requested Modbus address. +* **Read:** + * If the offset corresponds to a configuration register (0-8), it returns the value from `rule.config[offset]`. + * If the offset is `FLAGS` (9), it returns the flag value via `getFlags()`. + * If the offset corresponds to a status register (10-12), it returns the value from the internal state variables (`rule.lastStatus`, `rule.lastTriggerTimestamp & 0xFFFF`, `rule.triggerCount`). +* **Write:** + * If the offset corresponds to a configuration register (0-9, including FLAGS), it updates `rule.config[offset]` using `rule.setConfigValue()`. + * If the offset is `TRIGGER_COUNT` (12) and the value is `0`, it resets `rule.triggerCount`. + * Writes to read-only status registers (10, 11) are disallowed and return an error. \ No newline at end of file diff --git a/mb-script/docs/mb-script-testing.md b/mb-script/docs/mb-script-testing.md new file mode 100644 index 00000000..e915e79f --- /dev/null +++ b/mb-script/docs/mb-script-testing.md @@ -0,0 +1,197 @@ +# Modbus Logic Engine (MB_SCRIPT) Functional Testing Strategy + +## 1. Objective + +To verify the functional correctness of the `ModbusLogicEngine` component (enabled by the `ENABLE_MB_SCRIPT` define). This includes: +* Correct configuration of logic rules via Modbus. +* Accurate evaluation of rule conditions based on Modbus register/coil values. +* Proper execution of defined actions (writing registers/coils, calling component methods). +* Correct reporting of rule status, trigger timestamps, and trigger counts via Modbus. +* Handling of various error conditions. + +## 2. Scope + +This strategy focuses on black-box functional testing from the perspective of a Modbus client interacting with the device. It does not cover unit testing of individual `ModbusLogicEngine` methods or performance/stress testing (which may have separate test plans). + +## 3. Approach + +Testing will primarily utilize the existing `npm` scripts which wrap Python helper scripts to interact with the device over Modbus TCP. + +* **Configuration:** Rules will be configured by writing to the specific Modbus holding registers allocated to the Logic Engine (`MODBUS_LOGIC_RULES_START` and subsequent offsets defined in `src/ModbusLogicEngine.h`). +* **Triggering:** Rule conditions will be triggered by writing appropriate values to the source Modbus holding registers or coils specified in the rule's condition. +* **Verification:** + * Action outcomes will be verified by reading the target Modbus holding registers or coils. + * Rule status, timestamps, and trigger counts will be verified by reading the corresponding status registers for the rule. + * Internal behavior and potential errors can be monitored using device logs (`npm run build:monitor` or `npm run debug:serial`). +* **No New Scripts:** This strategy aims to use only the pre-existing `npm` scripts for Modbus interaction. + +## 4. Tools + +* **Modbus Read/Write:** + * `npm run modbus:read:holding -- --address ` + * `npm run modbus:write:holding -- --address --value ` + * `npm run modbus:read:coil -- --address ` + * `npm run modbus:write:coil -- --address --value <0|1>` +* **Logging:** + * `npm run build:monitor` (Live serial monitoring) + * `npm run debug:serial` (Fetch buffered logs via REST API) +* **Reference:** + * `src/ModbusLogicEngine.h` (for register offsets, enums) + * `src/config-modbus.h` (for `MODBUS_LOGIC_RULES_START` address) + +## 5. Prerequisites + +* Firmware compiled with `#define ENABLE_MB_SCRIPT` in `config.h` and flashed to the ESP32. +* Device connected to the network and accessible via its IP address or mDNS name (`modbus-esp32.local` by default). +* Python environment configured correctly to run the scripts in the `scripts/` directory. +* Knowledge of the Modbus register mapping for the Logic Engine (starting address + offsets). + +## 6. Test Cases + +Let `RULE_START = MODBUS_LOGIC_RULES_START`. +Let `RULE_0_BASE = RULE_START`. +Let `RULE_1_BASE = RULE_START + LOGIC_ENGINE_REGISTERS_PER_RULE`. +Offsets are defined in `ModbusLogicEngineOffsets`. + +*(Note: Choose suitable, otherwise unused Modbus addresses for source/target registers/coils for testing)* + +**TC 1: Basic Rule - Write Holding Register** +1. **Configure:** + * Write `1` to `RULE_0_BASE + ENABLED`. + * Write `3` (REG_HOLDING) to `RULE_0_BASE + COND_SRC_TYPE`. + * Write `2000` to `RULE_0_BASE + COND_SRC_ADDR`. + * Write `0` (EQUAL) to `RULE_0_BASE + COND_OPERATOR`. + * Write `123` to `RULE_0_BASE + COND_VALUE`. + * Write `3` (WRITE_HOLDING_REGISTER) to `RULE_0_BASE + COMMAND_TYPE`. + * Write `2001` to `RULE_0_BASE + COMMAND_TARGET`. + * Write `456` to `RULE_0_BASE + COMMAND_PARAM1` (Value to write). + * Write `0` to `RULE_0_BASE + COMMAND_PARAM2` (Unused). + * Write `0` to `RULE_0_BASE + FLAGS`. +2. **Trigger:** Write `123` to Modbus address `2000`. +3. **Verify:** + * Read address `2001`. Expected: `456`. + * Read `RULE_0_BASE + LAST_STATUS`. Expected: `0` (MB_Error::Success). + * Read `RULE_0_BASE + TRIGGER_COUNT`. Expected: `1`. + +**TC 2: Condition Operator - Not Equal** +1. **Configure:** Similar to TC 1, but: + * Write `1` (NOT_EQUAL) to `RULE_0_BASE + COND_OPERATOR`. + * Write `123` to `RULE_0_BASE + COND_VALUE`. +2. **Trigger 1:** Write `123` to address `2000`. +3. **Verify 1:** Read address `2001`. Expected: *Unchanged* from previous state (action should *not* run). +4. **Trigger 2:** Write `124` to address `2000`. +5. **Verify 2:** + * Read address `2001`. Expected: `456`. + * Read `RULE_0_BASE + LAST_STATUS`. Expected: `0` (MB_Error::Success). + * Read `RULE_0_BASE + TRIGGER_COUNT`. Expected: Incremented. + * *(Repeat for other operators: `<`, `<=`, `>`, `>=`)* + +**TC 3: Source Type - Coil** +1. **Configure:** Similar to TC 1, but: + * Write `2` (REG_COIL) to `RULE_0_BASE + COND_SRC_TYPE`. + * Write `100` (Test Coil Addr) to `RULE_0_BASE + COND_SRC_ADDR`. + * Write `1` to `RULE_0_BASE + COND_VALUE` (Condition is Coil ON). +2. **Trigger:** Write `1` to Coil address `100`. +3. **Verify:** + * Read address `2001`. Expected: `456`. + * Read `RULE_0_BASE + LAST_STATUS`. Expected: `0` (MB_Error::Success). + +**TC 4: Action Type - Write Coil** +1. **Configure:** Similar to TC 1, but: + * Write `2` (WRITE_COIL) to `RULE_0_BASE + COMMAND_TYPE`. + * Write `101` to `RULE_0_BASE + COMMAND_TARGET`. + * Write `1` to `RULE_0_BASE + COMMAND_PARAM1` (Value: ON). + * Write `0` to `RULE_0_BASE + COMMAND_PARAM2` (Unused). +2. **Trigger:** Write `123` to address `2000`. +3. **Verify:** + * Read Coil address `101`. Expected: `1`. + * Read `RULE_0_BASE + LAST_STATUS`. Expected: `0` (MB_Error::Success). + +**TC 5: Action Type - Call Component Method (Requires Setup)** +* **Prerequisite:** A method must be registered with the `ModbusLogicEngine` that has a verifiable side-effect readable via Modbus. Example: A simple method in `PHApp` that increments a counter stored in a Modbus register (`e.g., address 3000`). + ```cpp + // In PHApp.h (or a test component) + short testMethod(short p1, short p2) { + testMethodCounter += p1; // Use p1 (arg1 from rule) + Log.infoln("Test Method Called! Arg1=%d, Counter: %d", p1, testMethodCounter); + return E_OK; + } + uint16_t testMethodCounter = 0; + + // In PHApp::setup() or where ModbusLogicEngine is initialized + logicEngine->registerMethod(this->id, 1, // Use app ID and method ID 1 + std::bind(&PHApp::testMethod, this, std::placeholders::_1, std::placeholders::_2)); + + // In PHApp::readNetworkValue() + if (address == 3000) return testMethodCounter; + ``` +1. **Configure:** Similar to TC 1, but: + * Write `100` (CALL_COMPONENT_METHOD) to `RULE_0_BASE + COMMAND_TYPE`. + * Write `app->id` to `RULE_0_BASE + COMMAND_TARGET` (Component ID). + * Write `1` to `RULE_0_BASE + COMMAND_PARAM1` (Method ID). + * Write `5` to `RULE_0_BASE + COMMAND_PARAM2` (Argument 1). +2. **Initial Read:** Read address `3000`. Note the value (e.g., `X`). +3. **Trigger:** Write `123` to address `2000`. +4. **Verify:** + * Read address `3000`. Expected: `X + 5`. + * Read `RULE_0_BASE + LAST_STATUS`. Expected: `0` (MB_Error::Success). + * Check logs (`build:monitor`) for "Test Method Called! Arg1=5". + +**TC 6: Rule Enable/Disable** +1. **Configure:** Configure rule as in TC 1. +2. **Disable:** Write `0` to `RULE_0_BASE + ENABLED`. +3. **Trigger:** Write `123` to address `2000`. +4. **Verify (Disabled):** Read address `2001`. Expected: *Unchanged*. Trigger count should *not* increment. +5. **Enable:** Write `1` to `RULE_0_BASE + ENABLED`. +6. **Trigger:** Write `123` to address `2000`. +7. **Verify (Enabled):** Read address `2001`. Expected: `456`. Trigger count *should* increment. + +**TC 7: Error - Invalid Condition Source Address** +1. **Configure:** Similar to TC 1, but: + * Write `9999` (Invalid/Unregistered address) to `RULE_0_BASE + COND_SRC_ADDR`. +2. **Trigger:** Let the engine loop run. +3. **Verify:** Read `RULE_0_BASE + LAST_STATUS`. Expected: `2` (MB_Error::IllegalDataAddress). + +**TC 8: Error - Invalid Action Target Address (Write)** +1. **Configure:** Similar to TC 1, but: + * Write `9998` (Invalid/Unregistered address) to `RULE_0_BASE + COMMAND_TARGET`. +2. **Trigger:** Write `123` to address `2000`. +3. **Verify:** Read `RULE_0_BASE + LAST_STATUS`. Expected: `4` (MB_Error::ServerDeviceFailure). + +**TC 9: Error - Invalid Action Target Method (Call)** +1. **Configure:** Similar to TC 5, but: + * Write `99` (Non-existent Method ID) to `RULE_0_BASE + COMMAND_PARAM1`. +2. **Trigger:** Write `123` to address `2000`. +3. **Verify:** Read `RULE_0_BASE + LAST_STATUS`. Expected: `2` (MB_Error::IllegalDataAddress). + +**TC 10: Status/Counter Reset** +1. **Configure & Trigger:** Perform TC 1. +2. **Verify Count:** Read `RULE_0_BASE + TRIGGER_COUNT`. Expected: `1` (or current count). +3. **Reset Counter:** Write `0` to `RULE_0_BASE + TRIGGER_COUNT`. +4. **Verify Reset:** Read `RULE_0_BASE + TRIGGER_COUNT`. Expected: `0`. +5. **Trigger Again:** Write `123` to address `2000`. +6. **Verify Increment:** Read `RULE_0_BASE + TRIGGER_COUNT`. Expected: `1`. + +**TC 11: Debug Flag** +1. **Configure:** Configure as in TC 1, but: + * Write `RULE_FLAG_DEBUG` (value 1) to `RULE_0_BASE + FLAGS`. +2. **Trigger:** Write `123` to address `2000`. +3. **Verify:** + * Check logs (`build:monitor`). Expected: Verbose logs like "MLE Eval [0]: ...", "MLE Action [0]: ...". + * Read address `2001`. Expected: `456`. + +**TC 12: Receipt Flag** +1. **Configure:** Configure as in TC 1, but: + * Write `RULE_FLAG_RECEIPT` (value 2) to `RULE_0_BASE + FLAGS`. +2. **Trigger:** Write `123` to address `2000`. +3. **Verify:** + * Check logs (`build:monitor`). Expected: Info log "MLE: Rule 0 action successful.". + * Read address `2001`. Expected: `456`. + +**TC 13: Debug + Receipt Flags** +1. **Configure:** Configure as in TC 1, but: + * Write `RULE_FLAG_DEBUG | RULE_FLAG_RECEIPT` (value 3) to `RULE_0_BASE + FLAGS`. +2. **Trigger:** Write `123` to address `2000`. +3. **Verify:** + * Check logs (`build:monitor`). Expected: Both verbose debug logs and the receipt log. + * Read address `2001`. Expected: `456`. \ No newline at end of file diff --git a/mb-script/include/README b/mb-script/include/README new file mode 100644 index 00000000..630164d3 --- /dev/null +++ b/mb-script/include/README @@ -0,0 +1,37 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the convention is to give header files names that end with `.h'. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/mb-script/lib/ArduinoJson/ArduinoJson.h b/mb-script/lib/ArduinoJson/ArduinoJson.h new file mode 100644 index 00000000..a0caed79 --- /dev/null +++ b/mb-script/lib/ArduinoJson/ArduinoJson.h @@ -0,0 +1,5 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include "src/ArduinoJson.h" diff --git a/mb-script/lib/ArduinoJson/CHANGELOG.md b/mb-script/lib/ArduinoJson/CHANGELOG.md new file mode 100644 index 00000000..9fdb7dcf --- /dev/null +++ b/mb-script/lib/ArduinoJson/CHANGELOG.md @@ -0,0 +1,239 @@ +ArduinoJson: change log +======================= + +v7.3.1 (2025-02-27) +------ + +* Fix conversion from static string to number +* Slightly reduce code size + +v7.3.0 (2024-12-29) +------ + +* Fix support for NUL characters in `deserializeJson()` +* Make `ElementProxy` and `MemberProxy` non-copyable +* Change string copy policy: only string literal are stored by pointer +* `JsonString` is now stored by copy, unless specified otherwise +* Replace undocumented `JsonString::Ownership` with `bool` +* Rename undocumented `JsonString::isLinked()` to `isStatic()` +* Move public facing SFINAEs to template declarations + +> ### BREAKING CHANGES +> +> In previous versions, `MemberProxy` (the class returned by `operator[]`) could lead to dangling pointers when used with a temporary string. +> To prevent this issue, `MemberProxy` and `ElementProxy` are now non-copyable. +> +> Your code is likely to be affected if you use `auto` to store the result of `operator[]`. For example, the following line won't compile anymore: +> +> ```cpp +> auto value = doc["key"]; +> ``` +> +> To fix the issue, you must append either `.as()` or `.to()`, depending on the situation. +> +> For example, if you are extracting values from a JSON document, you should update like this: +> +> ```diff +> - auto config = doc["config"]; +> + auto config = doc["config"].as(); +> const char* name = config["name"]; +> ``` +> +> However, if you are building a JSON document, you should update like this: +> +> ```diff +> - auto config = doc["config"]; +> + auto config = doc["config"].to(); +> config["name"] = "ArduinoJson"; +> ``` + +v7.2.1 (2024-11-15) +------ + +* Forbid `deserializeJson(JsonArray|JsonObject, ...)` (issue #2135) +* Fix VLA support in `JsonDocument::set()` +* Fix `operator[](variant)` ignoring NUL characters + +v7.2.0 (2024-09-18) +------ + +* Store object members with two slots: one for the key and one for the value +* Store 64-bit numbers (`double` and `long long`) in an additional slot +* Reduce the slot size (see table below) +* Improve message when user forgets third arg of `serializeJson()` et al. +* Set `ARDUINOJSON_USE_DOUBLE` to `0` by default on 8-bit architectures +* Deprecate `containsKey()` in favor of `doc["key"].is()` +* Add support for escape sequence `\'` (issue #2124) + +| Architecture | before | after | +|--------------|----------|----------| +| 8-bit | 8 bytes | 6 bytes | +| 32-bit | 16 bytes | 8 bytes | +| 64-bit | 24 bytes | 16 bytes | + +> ### BREAKING CHANGES +> +> After being on the death row for years, the `containsKey()` method has finally been deprecated. +> You should replace `doc.containsKey("key")` with `doc["key"].is()`, which not only checks that the key exists but also that the value is of the expected type. +> +> ```cpp +> // Before +> if (doc.containsKey("value")) { +> int value = doc["value"]; +> // ... +> } +> +> // After +> if (doc["value"].is()) { +> int value = doc["value"]; +> // ... +> } +> ``` + +v7.1.0 (2024-06-27) +------ + +* Add `ARDUINOJSON_STRING_LENGTH_SIZE` to the namespace name +* Add support for MsgPack binary (PR #2078 by @Sanae6) +* Add support for MsgPack extension +* Make string support even more generic (PR #2084 by @d-a-v) +* Optimize `deserializeMsgPack()` +* Allow using a `JsonVariant` as a key or index (issue #2080) + Note: works only for reading, not for writing +* Support `ElementProxy` and `MemberProxy` in `JsonDocument`'s constructor +* Don't add partial objects when allocation fails (issue #2081) +* Read MsgPack's 64-bit integers even if `ARDUINOJSON_USE_LONG_LONG` is `0` + (they are set to `null` if they don't fit in a `long`) + +v7.0.4 (2024-03-12) +------ + +* Make `JSON_STRING_SIZE(N)` return `N+1` to fix third-party code (issue #2054) + +v7.0.3 (2024-02-05) +------ + +* Improve error messages when using `char` or `char*` (issue #2043) +* Reduce stack consumption (issue #2046) +* Fix compatibility with GCC 4.8 (issue #2045) + +v7.0.2 (2024-01-19) +------ + +* Fix assertion `poolIndex < count_` after `JsonDocument::clear()` (issue #2034) + +v7.0.1 (2024-01-10) +------ + +* Fix "no matching function" with `JsonObjectConst::operator[]` (issue #2019) +* Remove unused files in the PlatformIO package +* Fix `volatile bool` serialized as `1` or `0` instead of `true` or `false` (issue #2029) + +v7.0.0 (2024-01-03) +------ + +* Remove `BasicJsonDocument` +* Remove `StaticJsonDocument` +* Add abstract `Allocator` class +* Merge `DynamicJsonDocument` with `JsonDocument` +* Remove `JSON_ARRAY_SIZE()`, `JSON_OBJECT_SIZE()`, and `JSON_STRING_SIZE()` +* Remove `ARDUINOJSON_ENABLE_STRING_DEDUPLICATION` (string deduplication cannot be disabled anymore) +* Remove `JsonDocument::capacity()` +* Store the strings in the heap +* Reference-count shared strings +* Always store `serialized("string")` by copy (#1915) +* Remove the zero-copy mode of `deserializeJson()` and `deserializeMsgPack()` +* Fix double lookup in `to()` +* Fix double call to `size()` in `serializeMsgPack()` +* Include `ARDUINOJSON_SLOT_OFFSET_SIZE` in the namespace name +* Remove `JsonVariant::shallowCopy()` +* `JsonDocument`'s capacity grows as needed, no need to pass it to the constructor anymore +* `JsonDocument`'s allocator is not monotonic anymore, removed values get recycled +* Show a link to the documentation when user passes an unsupported input type +* Remove `JsonDocument::memoryUsage()` +* Remove `JsonDocument::garbageCollect()` +* Add `deserializeJson(JsonVariant, ...)` and `deserializeMsgPack(JsonVariant, ...)` (#1226) +* Call `shrinkToFit()` in `deserializeJson()` and `deserializeMsgPack()` +* `serializeJson()` and `serializeMsgPack()` replace the content of `std::string` and `String` instead of appending to it +* Replace `add()` with `add()` (`add(T)` is still supported) +* Remove `createNestedArray()` and `createNestedObject()` (use `to()` and `to()` instead) + +> ### BREAKING CHANGES +> +> As every major release, ArduinoJson 7 introduces several breaking changes. +> I added some stubs so that most existing programs should compile, but I highty recommend you upgrade your code. +> +> #### `JsonDocument` +> +> In ArduinoJson 6, you could allocate the memory pool on the stack (with `StaticJsonDocument`) or in the heap (with `DynamicJsonDocument`). +> In ArduinoJson 7, the memory pool is always allocated in the heap, so `StaticJsonDocument` and `DynamicJsonDocument` have been merged into `JsonDocument`. +> +> In ArduinoJson 6, `JsonDocument` had a fixed capacity; in ArduinoJson 7, it has an elastic capacity that grows as needed. +> Therefore, you don't need to specify the capacity anymore, so the macros `JSON_ARRAY_SIZE()`, `JSON_OBJECT_SIZE()`, and `JSON_STRING_SIZE()` have been removed. +> +> ```c++ +> // ArduinoJson 6 +> StaticJsonDocument<256> doc; +> // or +> DynamicJsonDocument doc(256); +> +> // ArduinoJson 7 +> JsonDocument doc; +> ``` +> +> In ArduinoJson 7, `JsonDocument` reuses released memory, so `garbageCollect()` has been removed. +> `shrinkToFit()` is still available and releases the over-allocated memory. +> +> Due to a change in the implementation, it's not possible to store a pointer to a variant from another `JsonDocument`, so `shallowCopy()` has been removed. +> +> In ArduinoJson 6, the meaning of `memoryUsage()` was clear: it returned the number of bytes used in the memory pool. +> In ArduinoJson 7, the meaning of `memoryUsage()` would be ambiguous, so it has been removed. +> +> #### Custom allocators +> +> In ArduinoJson 6, you could specify a custom allocator class as a template parameter of `BasicJsonDocument`. +> In ArduinoJson 7, you must inherit from `ArduinoJson::Allocator` and pass a pointer to an instance of your class to the constructor of `JsonDocument`. +> +> ```c++ +> // ArduinoJson 6 +> class MyAllocator { +> // ... +> }; +> BasicJsonDocument doc(256); +> +> // ArduinoJson 7 +> class MyAllocator : public ArduinoJson::Allocator { +> // ... +> }; +> MyAllocator myAllocator; +> JsonDocument doc(&myAllocator); +> ``` +> +> #### `createNestedArray()` and `createNestedObject()` +> +> In ArduinoJson 6, you could create a nested array or object with `createNestedArray()` and `createNestedObject()`. +> In ArduinoJson 7, you must use `add()` or `to()` instead. +> +> For example, to create `[[],{}]`, you would write: +> +> ```c++ +> // ArduinoJson 6 +> arr.createNestedArray(); +> arr.createNestedObject(); +> +> // ArduinoJson 7 +> arr.add(); +> arr.add(); +> ``` +> +> And to create `{"array":[],"object":{}}`, you would write: +> +> ```c++ +> // ArduinoJson 6 +> obj.createNestedArray("array"); +> obj.createNestedObject("object"); +> +> // ArduinoJson 7 +> obj["array"].to(); +> obj["object"].to(); +> ``` diff --git a/mb-script/lib/ArduinoJson/CMakeLists.txt b/mb-script/lib/ArduinoJson/CMakeLists.txt new file mode 100644 index 00000000..bc48255a --- /dev/null +++ b/mb-script/lib/ArduinoJson/CMakeLists.txt @@ -0,0 +1,25 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +cmake_minimum_required(VERSION 3.15) + +if(ESP_PLATFORM) + # Build ArduinoJson as an ESP-IDF component + idf_component_register(INCLUDE_DIRS src) + return() +endif() + +project(ArduinoJson VERSION 7.3.1) + +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + include(CTest) +endif() + +add_subdirectory(src) + +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) + include(extras/CompileOptions.cmake) + add_subdirectory(extras/tests) + add_subdirectory(extras/fuzzing) +endif() diff --git a/mb-script/lib/ArduinoJson/CONTRIBUTING.md b/mb-script/lib/ArduinoJson/CONTRIBUTING.md new file mode 100644 index 00000000..d32a04ff --- /dev/null +++ b/mb-script/lib/ArduinoJson/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# Contribution to ArduinoJson + +First, thank you for taking the time to contribute to this project. + +You can submit changes via GitHub Pull Requests. + +Please: + +1. Update the test suite for any change of behavior +2. Use clang-format in "file" mode to format the code diff --git a/mb-script/lib/ArduinoJson/LICENSE.txt b/mb-script/lib/ArduinoJson/LICENSE.txt new file mode 100644 index 00000000..782b05d8 --- /dev/null +++ b/mb-script/lib/ArduinoJson/LICENSE.txt @@ -0,0 +1,10 @@ +The MIT License (MIT) +--------------------- + +Copyright © 2014-2025, Benoit BLANCHON + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Softwareâ€), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS ISâ€, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/mb-script/lib/ArduinoJson/README.md b/mb-script/lib/ArduinoJson/README.md new file mode 100644 index 00000000..4632534b --- /dev/null +++ b/mb-script/lib/ArduinoJson/README.md @@ -0,0 +1,158 @@ +

+ ArduinoJson +

+ +--- + +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bblanchon/ArduinoJson/ci.yml?branch=7.x&logo=github)](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A7.x) +[![Continuous Integration](https://ci.appveyor.com/api/projects/status/m7s53wav1l0abssg/branch/7.x?svg=true)](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/7.x) +[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/arduinojson.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson) +[![Coveralls branch](https://img.shields.io/coveralls/github/bblanchon/ArduinoJson/7.x?logo=coveralls)](https://coveralls.io/github/bblanchon/ArduinoJson?branch=7.x) +[![GitHub stars](https://img.shields.io/github/stars/bblanchon/ArduinoJson?style=flat&logo=github&color=orange)](https://github.com/bblanchon/ArduinoJson/stargazers) +[![GitHub Sponsors](https://img.shields.io/github/sponsors/bblanchon?logo=github&color=orange)](https://github.com/sponsors/bblanchon) + +ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things). + +## Features + +* [JSON deserialization](https://arduinojson.org/v7/api/json/deserializejson/) + * [Optionally decodes UTF-16 escape sequences to UTF-8](https://arduinojson.org/v7/api/config/decode_unicode/) + * [Optionally supports comments in the input](https://arduinojson.org/v7/api/config/enable_comments/) + * [Optionally filters the input to keep only desired values](https://arduinojson.org/v7/api/json/deserializejson/#filtering) + * Supports single quotes as a string delimiter + * Compatible with [NDJSON](http://ndjson.org/) and [JSON Lines](https://jsonlines.org/) +* [JSON serialization](https://arduinojson.org/v7/api/json/serializejson/) + * [Can write to a buffer or a stream](https://arduinojson.org/v7/api/json/serializejson/) + * [Optionally indents the document (prettified JSON)](https://arduinojson.org/v7/api/json/serializejsonpretty/) +* [MessagePack serialization](https://arduinojson.org/v7/api/msgpack/serializemsgpack/) +* [MessagePack deserialization](https://arduinojson.org/v7/api/msgpack/deserializemsgpack/) +* Efficient + * [Twice smaller than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/) + * [Almost 10% faster than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/) + * [Consumes roughly 10% less RAM than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/) + * [Deduplicates strings](https://arduinojson.org/news/2020/08/01/version-6-16-0/) +* Versatile + * Supports [custom allocators (to use external RAM chip, for example)](https://arduinojson.org/v7/how-to/use-external-ram-on-esp32/) + * Supports [`String`](https://arduinojson.org/v7/api/config/enable_arduino_string/), [`std::string`](https://arduinojson.org/v7/api/config/enable_std_string/), and [`std::string_view`](https://arduinojson.org/v7/api/config/enable_string_view/) + * Supports [`Stream`](https://arduinojson.org/v7/api/config/enable_arduino_stream/) and [`std::istream`/`std::ostream`](https://arduinojson.org/v7/api/config/enable_std_stream/) + * Supports [Flash strings](https://arduinojson.org/v7/api/config/enable_progmem/) + * Supports [custom readers](https://arduinojson.org/v7/api/json/deserializejson/#custom-reader) and [custom writers](https://arduinojson.org/v7/api/json/serializejson/#custom-writer) + * Supports [custom converters](https://arduinojson.org/news/2021/05/04/version-6-18-0/) +* Portable + * Usable on any C++ project (not limited to Arduino) + * Compatible with C++11, C++14 and C++17 + * Support for C++98/C++03 available on [ArduinoJson 6.20.x](https://github.com/bblanchon/ArduinoJson/tree/6.20.x) + * Zero warnings with `-Wall -Wextra -pedantic` and `/W4` + * [Header-only library](https://en.wikipedia.org/wiki/Header-only) + * Works with virtually any board + * Arduino boards: [Uno](https://amzn.to/38aL2ik), [Due](https://amzn.to/36YkWi2), [Micro](https://amzn.to/35WkdwG), [Nano](https://amzn.to/2QTvwRX), [Mega](https://amzn.to/36XWhuf), [Yun](https://amzn.to/30odURc), [Leonardo](https://amzn.to/36XWjlR)... + * Espressif chips: [ESP8266](https://amzn.to/36YluV8), [ESP32](https://amzn.to/2G4pRCB) + * Lolin (WeMos) boards: [D1 mini](https://amzn.to/2QUpz7q), [D1 Mini Pro](https://amzn.to/36UsGSs)... + * Teensy boards: [4.0](https://amzn.to/30ljXGq), [3.2](https://amzn.to/2FT0EuC), [2.0](https://amzn.to/2QXUMXj) + * Particle boards: [Argon](https://amzn.to/2FQHa9X), [Boron](https://amzn.to/36WgLUd), [Electron](https://amzn.to/30vEc4k), [Photon](https://amzn.to/387F9Cd)... + * Texas Instruments boards: [MSP430](https://amzn.to/30nJWgg)... + * Soft cores: [Nios II](https://en.wikipedia.org/wiki/Nios_II)... + * Tested on all major development environments + * [Arduino IDE](https://www.arduino.cc/en/Main/Software) + * [Atmel Studio](http://www.atmel.com/microsite/atmel-studio/) + * [Atollic TrueSTUDIO](https://atollic.com/truestudio/) + * [Energia](http://energia.nu/) + * [IAR Embedded Workbench](https://www.iar.com/iar-embedded-workbench/) + * [Keil uVision](http://www.keil.com/) + * [MPLAB X IDE](http://www.microchip.com/mplab/mplab-x-ide) + * [Particle](https://www.particle.io/) + * [PlatformIO](http://platformio.org/) + * [Sloeber plugin for Eclipse](https://eclipse.baeyens.it/) + * [Visual Micro](http://www.visualmicro.com/) + * [Visual Studio](https://www.visualstudio.com/) + * [Even works with online compilers like wandbox.org](https://wandbox.org/permlink/RlZSKy17DjJ6HcdN) + * [CMake friendly](https://arduinojson.org/v7/how-to/use-arduinojson-with-cmake/) +* Well designed + * [Elegant API](http://arduinojson.org/v7/example/) + * [Thread-safe](https://en.wikipedia.org/wiki/Thread_safety) + * Self-contained (no external dependency) + * `const` friendly + * [`for` friendly](https://arduinojson.org/v7/api/jsonobject/begin_end/) + * [TMP friendly](https://en.wikipedia.org/wiki/Template_metaprogramming) + * Handles [integer overflows](https://arduinojson.org/v7/api/jsonvariant/as/#integer-overflows) +* Well tested + * [Unit test coverage close to 100%](https://coveralls.io/github/bblanchon/ArduinoJson?branch=7.x) + * Continuously tested on + * [Visual Studio 2017, 2019, 2022](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/7.x) + * [GCC 4.8, 5, 6, 7, 8, 9, 10, 11, 12](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22) + * [Clang 3.9, 4.0, 5.0, 6.0, 7, 8, 9, 10, 11, 12, 13, 14, 15](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22) + * [Continuously fuzzed with Google OSS Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson) + * Passes all default checks of [clang-tidy](https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/clang-tidy/) +* Well documented + * [Tutorials](https://arduinojson.org/v7/doc/deserialization/) + * [Examples](https://arduinojson.org/v7/example/) + * [How-tos](https://arduinojson.org/v7/example/) + * [FAQ](https://arduinojson.org/v7/faq/) + * [Troubleshooter](https://arduinojson.org/v7/troubleshooter/) + * [Book](https://arduinojson.org/book/) + * [Changelog](CHANGELOG.md) +* Vibrant user community + * Most popular of all Arduino libraries on [GitHub](https://github.com/search?o=desc&q=arduino+library&s=stars&type=Repositories) + * [Used in hundreds of projects](https://www.hackster.io/search?i=projects&q=arduinojson) + * [Responsive support](https://github.com/bblanchon/ArduinoJson/issues?q=is%3Aissue+is%3Aclosed) + +## Quickstart + +### Deserialization + +Here is a program that parses a JSON document with ArduinoJson. + +```c++ +const char* json = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; + +JsonDocument doc; +deserializeJson(doc, json); + +const char* sensor = doc["sensor"]; +long time = doc["time"]; +double latitude = doc["data"][0]; +double longitude = doc["data"][1]; +``` + +See the [tutorial on arduinojson.org](https://arduinojson.org/v7/doc/deserialization/) + +### Serialization + +Here is a program that generates a JSON document with ArduinoJson: + +```c++ +JsonDocument doc; + +doc["sensor"] = "gps"; +doc["time"] = 1351824120; +doc["data"][0] = 48.756080; +doc["data"][1] = 2.302038; + +serializeJson(doc, Serial); +// This prints: +// {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} +``` + +See the [tutorial on arduinojson.org](https://arduinojson.org/v7/doc/serialization/) + +## Sponsors + +ArduinoJson is thankful to its sponsors. Please give them a visit; they deserve it! + +

+ + Programming Electronics Academy + +

+

+ + 1technophile + + + LArkema + +

+ +If you run a commercial project that embeds ArduinoJson, think about [sponsoring the library's development](https://github.com/sponsors/bblanchon): it ensures the code that your products rely on stays actively maintained. It can also give your project some exposure to the makers' community. + +If you are an individual user and want to support the development (or give a sign of appreciation), consider purchasing the book [Mastering ArduinoJson](https://arduinojson.org/book/) â¤, or simply [cast a star](https://github.com/bblanchon/ArduinoJson/stargazers) â­. diff --git a/mb-script/lib/ArduinoJson/SUPPORT.md b/mb-script/lib/ArduinoJson/SUPPORT.md new file mode 100644 index 00000000..c47e1b1b --- /dev/null +++ b/mb-script/lib/ArduinoJson/SUPPORT.md @@ -0,0 +1,27 @@ +# ArduinoJson Support + +First off, thank you very much for using ArduinoJson. + +We'll be very happy to help you, but first please read the following. + +## Before asking for help + +1. Read the [FAQ](https://arduinojson.org/faq/?utm_source=github&utm_medium=support) +2. Search in the [API Reference](https://arduinojson.org/api/?utm_source=github&utm_medium=support) + +If you did not find the answer, please create a [new issue on GitHub](https://github.com/bblanchon/ArduinoJson/issues/new). + +It is OK to add a comment to a currently opened issue, but please avoid adding comments to a closed issue. + +## Before hitting the Submit button + +Please provide all the relevant information: + +* Good title +* Short description of the problem +* Target platform +* Compiler model and version +* [MVCE](https://stackoverflow.com/help/mcve) +* Compiler output + +Good questions get fast answers! diff --git a/mb-script/lib/ArduinoJson/appveyor.yml b/mb-script/lib/ArduinoJson/appveyor.yml new file mode 100644 index 00000000..02f6abcd --- /dev/null +++ b/mb-script/lib/ArduinoJson/appveyor.yml @@ -0,0 +1,28 @@ +version: 7.3.1.{build} +environment: + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + CMAKE_GENERATOR: Visual Studio 17 2022 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + CMAKE_GENERATOR: Visual Studio 16 2019 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CMAKE_GENERATOR: Visual Studio 15 2017 + - CMAKE_GENERATOR: Ninja + MINGW32: i686-6.3.0-posix-dwarf-rt_v5-rev1 # MinGW-w64 6.3.0 i686 + - CMAKE_GENERATOR: Ninja + MINGW64: x86_64-6.3.0-posix-seh-rt_v5-rev1 # MinGW-w64 6.3.0 x86_64 + - CMAKE_GENERATOR: Ninja + MINGW64: x86_64-7.3.0-posix-seh-rt_v5-rev0 # MinGW-w64 7.3.0 x86_64 + - CMAKE_GENERATOR: Ninja + MINGW64: x86_64-8.1.0-posix-seh-rt_v6-rev0 # MinGW-w64 8.1.0 x86_64 +configuration: Debug +before_build: + - set PATH=%PATH:C:\Program Files\Git\usr\bin;=% # Workaround for CMake not wanting sh.exe on PATH for MinGW + - if defined MINGW set PATH=C:\%MINGW%\bin;%PATH% + - if defined MINGW32 set PATH=C:\mingw-w64\%MINGW32%\mingw32\bin;%PATH% + - if defined MINGW64 set PATH=C:\mingw-w64\%MINGW64%\mingw64\bin;%PATH% + - cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%CMAKE_GENERATOR%" . +build_script: + - cmake --build . --config %CONFIGURATION% +test_script: + - ctest -C %CONFIGURATION% --output-on-failure . diff --git a/mb-script/lib/ArduinoJson/component.mk b/mb-script/lib/ArduinoJson/component.mk new file mode 100644 index 00000000..dc25d1c0 --- /dev/null +++ b/mb-script/lib/ArduinoJson/component.mk @@ -0,0 +1 @@ +COMPONENT_ADD_INCLUDEDIRS := src diff --git a/mb-script/lib/ArduinoJson/examples/JsonConfigFile/JsonConfigFile.ino b/mb-script/lib/ArduinoJson/examples/JsonConfigFile/JsonConfigFile.ino new file mode 100644 index 00000000..32ad3a5b --- /dev/null +++ b/mb-script/lib/ArduinoJson/examples/JsonConfigFile/JsonConfigFile.ino @@ -0,0 +1,152 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to store your project configuration in a file. +// It uses the SD library but can be easily modified for any other file-system. +// +// The file contains a JSON document with the following content: +// { +// "hostname": "examples.com", +// "port": 2731 +// } +// +// To run this program, you need an SD card connected to the SPI bus as follows: +// * MOSI <-> pin 11 +// * MISO <-> pin 12 +// * CLK <-> pin 13 +// * CS <-> pin 4 +// +// https://arduinojson.org/v7/example/config/ + +#include +#include +#include + +// Our configuration structure. +struct Config { + char hostname[64]; + int port; +}; + +const char* filename = "/config.txt"; // <- SD library uses 8.3 filenames +Config config; // <- global configuration object + +// Loads the configuration from a file +void loadConfiguration(const char* filename, Config& config) { + // Open file for reading + File file = SD.open(filename); + + // Allocate a temporary JsonDocument + JsonDocument doc; + + // Deserialize the JSON document + DeserializationError error = deserializeJson(doc, file); + if (error) + Serial.println(F("Failed to read file, using default configuration")); + + // Copy values from the JsonDocument to the Config + config.port = doc["port"] | 2731; + strlcpy(config.hostname, // <- destination + doc["hostname"] | "example.com", // <- source + sizeof(config.hostname)); // <- destination's capacity + + // Close the file (Curiously, File's destructor doesn't close the file) + file.close(); +} + +// Saves the configuration to a file +void saveConfiguration(const char* filename, const Config& config) { + // Delete existing file, otherwise the configuration is appended to the file + SD.remove(filename); + + // Open file for writing + File file = SD.open(filename, FILE_WRITE); + if (!file) { + Serial.println(F("Failed to create file")); + return; + } + + // Allocate a temporary JsonDocument + JsonDocument doc; + + // Set the values in the document + doc["hostname"] = config.hostname; + doc["port"] = config.port; + + // Serialize JSON to file + if (serializeJson(doc, file) == 0) { + Serial.println(F("Failed to write to file")); + } + + // Close the file + file.close(); +} + +// Prints the content of a file to the Serial +void printFile(const char* filename) { + // Open file for reading + File file = SD.open(filename); + if (!file) { + Serial.println(F("Failed to read file")); + return; + } + + // Extract each characters by one by one + while (file.available()) { + Serial.print((char)file.read()); + } + Serial.println(); + + // Close the file + file.close(); +} + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) + continue; + + // Initialize SD library + const int chipSelect = 4; + while (!SD.begin(chipSelect)) { + Serial.println(F("Failed to initialize SD library")); + delay(1000); + } + + // Should load default config if run for the first time + Serial.println(F("Loading configuration...")); + loadConfiguration(filename, config); + + // Create configuration file + Serial.println(F("Saving configuration...")); + saveConfiguration(filename, config); + + // Dump config file + Serial.println(F("Print config file...")); + printFile(filename); +} + +void loop() { + // not used in this example +} + +// Performance issue? +// ------------------ +// +// File is an unbuffered stream, which is not optimal for ArduinoJson. +// See: https://arduinojson.org/v7/how-to/improve-speed/ + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// serialization or deserialization problem. +// +// The book "Mastering ArduinoJson" contains a case study of a project that has +// a complex configuration with nested members. +// Contrary to this example, the project in the book uses the SPIFFS filesystem. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount â¤â¤â¤â¤â¤ diff --git a/mb-script/lib/ArduinoJson/examples/JsonFilterExample/JsonFilterExample.ino b/mb-script/lib/ArduinoJson/examples/JsonFilterExample/JsonFilterExample.ino new file mode 100644 index 00000000..16e49ddb --- /dev/null +++ b/mb-script/lib/ArduinoJson/examples/JsonFilterExample/JsonFilterExample.ino @@ -0,0 +1,64 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to use DeserializationOption::Filter +// +// https://arduinojson.org/v7/example/filter/ + +#include + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) + continue; + + // The huge input: an extract from OpenWeatherMap response + auto input_json = F( + "{\"cod\":\"200\",\"message\":0,\"list\":[{\"dt\":1581498000,\"main\":{" + "\"temp\":3.23,\"feels_like\":-3.63,\"temp_min\":3.23,\"temp_max\":4.62," + "\"pressure\":1014,\"sea_level\":1014,\"grnd_level\":1010,\"humidity\":" + "58,\"temp_kf\":-1.39},\"weather\":[{\"id\":800,\"main\":\"Clear\"," + "\"description\":\"clear " + "sky\",\"icon\":\"01d\"}],\"clouds\":{\"all\":0},\"wind\":{\"speed\":6." + "19,\"deg\":266},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-12 " + "09:00:00\"},{\"dt\":1581508800,\"main\":{\"temp\":6.09,\"feels_like\":-" + "1.07,\"temp_min\":6.09,\"temp_max\":7.13,\"pressure\":1015,\"sea_" + "level\":1015,\"grnd_level\":1011,\"humidity\":48,\"temp_kf\":-1.04}," + "\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear " + "sky\",\"icon\":\"01d\"}],\"clouds\":{\"all\":9},\"wind\":{\"speed\":6." + "64,\"deg\":268},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-12 " + "12:00:00\"}],\"city\":{\"id\":2643743,\"name\":\"London\",\"coord\":{" + "\"lat\":51.5085,\"lon\":-0.1257},\"country\":\"GB\",\"population\":" + "1000000,\"timezone\":0,\"sunrise\":1581492085,\"sunset\":1581527294}}"); + + // The filter: it contains "true" for each value we want to keep + JsonDocument filter; + filter["list"][0]["dt"] = true; + filter["list"][0]["main"]["temp"] = true; + + // Deserialize the document + JsonDocument doc; + deserializeJson(doc, input_json, DeserializationOption::Filter(filter)); + + // Print the result + serializeJsonPretty(doc, Serial); +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// deserialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on deserialization. +// It begins with a simple example, like the one above, and then adds more +// features like deserializing directly from a file or an HTTP request. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount â¤â¤â¤â¤â¤ diff --git a/mb-script/lib/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino b/mb-script/lib/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino new file mode 100644 index 00000000..ffbc9a1c --- /dev/null +++ b/mb-script/lib/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino @@ -0,0 +1,65 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to generate a JSON document with ArduinoJson. +// +// https://arduinojson.org/v7/example/generator/ + +#include + +void setup() { + // Initialize Serial port + Serial.begin(9600); + while (!Serial) + continue; + + // Allocate the JSON document + JsonDocument doc; + + // Add values in the document + doc["sensor"] = "gps"; + doc["time"] = 1351824120; + + // Add an array + JsonArray data = doc["data"].to(); + data.add(48.756080); + data.add(2.302038); + + // Generate the minified JSON and send it to the Serial port + serializeJson(doc, Serial); + // The above line prints: + // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} + + // Start a new line + Serial.println(); + + // Generate the prettified JSON and send it to the Serial port + serializeJsonPretty(doc, Serial); + // The above line prints: + // { + // "sensor": "gps", + // "time": 1351824120, + // "data": [ + // 48.756080, + // 2.302038 + // ] + // } +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// serialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on serialization. +// It begins with a simple example, like the one above, and then adds more +// features like serializing directly to a file or an HTTP request. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount â¤â¤â¤â¤â¤ diff --git a/mb-script/lib/ArduinoJson/examples/JsonHttpClient/JsonHttpClient.ino b/mb-script/lib/ArduinoJson/examples/JsonHttpClient/JsonHttpClient.ino new file mode 100644 index 00000000..c2d38468 --- /dev/null +++ b/mb-script/lib/ArduinoJson/examples/JsonHttpClient/JsonHttpClient.ino @@ -0,0 +1,125 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to parse a JSON document in an HTTP response. +// It uses the Ethernet library, but can be easily adapted for Wifi. +// +// It performs a GET resquest on https://arduinojson.org/example.json +// Here is the expected response: +// { +// "sensor": "gps", +// "time": 1351824120, +// "data": [ +// 48.756080, +// 2.302038 +// ] +// } +// +// https://arduinojson.org/v7/example/http-client/ + +#include +#include +#include + +void setup() { + // Initialize Serial port + Serial.begin(9600); + while (!Serial) + continue; + + // Initialize Ethernet library + byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; + if (!Ethernet.begin(mac)) { + Serial.println(F("Failed to configure Ethernet")); + return; + } + delay(1000); + + Serial.println(F("Connecting...")); + + // Connect to HTTP server + EthernetClient client; + client.setTimeout(10000); + if (!client.connect("arduinojson.org", 80)) { + Serial.println(F("Connection failed")); + return; + } + + Serial.println(F("Connected!")); + + // Send HTTP request + client.println(F("GET /example.json HTTP/1.0")); + client.println(F("Host: arduinojson.org")); + client.println(F("Connection: close")); + if (client.println() == 0) { + Serial.println(F("Failed to send request")); + client.stop(); + return; + } + + // Check HTTP status + char status[32] = {0}; + client.readBytesUntil('\r', status, sizeof(status)); + // It should be "HTTP/1.0 200 OK" or "HTTP/1.1 200 OK" + if (strcmp(status + 9, "200 OK") != 0) { + Serial.print(F("Unexpected response: ")); + Serial.println(status); + client.stop(); + return; + } + + // Skip HTTP headers + char endOfHeaders[] = "\r\n\r\n"; + if (!client.find(endOfHeaders)) { + Serial.println(F("Invalid response")); + client.stop(); + return; + } + + // Allocate the JSON document + JsonDocument doc; + + // Parse JSON object + DeserializationError error = deserializeJson(doc, client); + if (error) { + Serial.print(F("deserializeJson() failed: ")); + Serial.println(error.f_str()); + client.stop(); + return; + } + + // Extract values + Serial.println(F("Response:")); + Serial.println(doc["sensor"].as()); + Serial.println(doc["time"].as()); + Serial.println(doc["data"][0].as(), 6); + Serial.println(doc["data"][1].as(), 6); + + // Disconnect + client.stop(); +} + +void loop() { + // not used in this example +} + +// Performance issue? +// ------------------ +// +// EthernetClient is an unbuffered stream, which is not optimal for ArduinoJson. +// See: https://arduinojson.org/v7/how-to/improve-speed/ + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// serialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on deserialization +// showing how to parse the response from GitHub's API. In the last chapter, +// it shows how to parse the huge documents from OpenWeatherMap +// and Reddit. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount â¤â¤â¤â¤â¤ diff --git a/mb-script/lib/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino b/mb-script/lib/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino new file mode 100644 index 00000000..7b326160 --- /dev/null +++ b/mb-script/lib/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino @@ -0,0 +1,65 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to deserialize a JSON document with ArduinoJson. +// +// https://arduinojson.org/v7/example/parser/ + +#include + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) + continue; + + // Allocate the JSON document + JsonDocument doc; + + // JSON input string. + const char* json = + "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; + + // Deserialize the JSON document + DeserializationError error = deserializeJson(doc, json); + + // Test if parsing succeeds + if (error) { + Serial.print(F("deserializeJson() failed: ")); + Serial.println(error.f_str()); + return; + } + + // Fetch the values + // + // Most of the time, you can rely on the implicit casts. + // In other case, you can do doc["time"].as(); + const char* sensor = doc["sensor"]; + long time = doc["time"]; + double latitude = doc["data"][0]; + double longitude = doc["data"][1]; + + // Print the values + Serial.println(sensor); + Serial.println(time); + Serial.println(latitude, 6); + Serial.println(longitude, 6); +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// deserialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on deserialization. +// It begins with a simple example, like the one above, and then adds more +// features like deserializing directly from a file or an HTTP request. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount â¤â¤â¤â¤â¤ diff --git a/mb-script/lib/ArduinoJson/examples/JsonServer/JsonServer.ino b/mb-script/lib/ArduinoJson/examples/JsonServer/JsonServer.ino new file mode 100644 index 00000000..51fdf3c2 --- /dev/null +++ b/mb-script/lib/ArduinoJson/examples/JsonServer/JsonServer.ino @@ -0,0 +1,118 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to implement an HTTP server that sends a JSON document +// in the response. +// It uses the Ethernet library but can be easily adapted for Wifi. +// +// The JSON document contains the values of the analog and digital pins. +// It looks like that: +// { +// "analog": [0, 76, 123, 158, 192, 205], +// "digital": [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0] +// } +// +// https://arduinojson.org/v7/example/http-server/ + +#include +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +EthernetServer server(80); + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) + continue; + + // Initialize Ethernet libary + if (!Ethernet.begin(mac)) { + Serial.println(F("Failed to initialize Ethernet library")); + return; + } + + // Start to listen + server.begin(); + + Serial.println(F("Server is ready.")); + Serial.print(F("Please connect to http://")); + Serial.println(Ethernet.localIP()); +} + +void loop() { + // Wait for an incomming connection + EthernetClient client = server.available(); + + // Do we have a client? + if (!client) + return; + + Serial.println(F("New client")); + + // Read the request (we ignore the content in this example) + while (client.available()) + client.read(); + + // Allocate a temporary JsonDocument + JsonDocument doc; + + // Create the "analog" array + JsonArray analogValues = doc["analog"].to(); + for (int pin = 0; pin < 6; pin++) { + // Read the analog input + int value = analogRead(pin); + + // Add the value at the end of the array + analogValues.add(value); + } + + // Create the "digital" array + JsonArray digitalValues = doc["digital"].to(); + for (int pin = 0; pin < 14; pin++) { + // Read the digital input + int value = digitalRead(pin); + + // Add the value at the end of the array + digitalValues.add(value); + } + + Serial.print(F("Sending: ")); + serializeJson(doc, Serial); + Serial.println(); + + // Write response headers + client.println(F("HTTP/1.0 200 OK")); + client.println(F("Content-Type: application/json")); + client.println(F("Connection: close")); + client.print(F("Content-Length: ")); + client.println(measureJsonPretty(doc)); + client.println(); + + // Write JSON document + serializeJsonPretty(doc, client); + + // Disconnect + client.stop(); +} + +// Performance issue? +// ------------------ +// +// EthernetClient is an unbuffered stream, which is not optimal for ArduinoJson. +// See: https://arduinojson.org/v7/how-to/improve-speed/ + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// serialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on serialization. +// It begins with a simple example, then adds more features like serializing +// directly to a file or an HTTP client. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount â¤â¤â¤â¤â¤ diff --git a/mb-script/lib/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino b/mb-script/lib/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino new file mode 100644 index 00000000..d6ecb551 --- /dev/null +++ b/mb-script/lib/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino @@ -0,0 +1,106 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to send a JSON document to a UDP socket. +// At regular interval, it sends a UDP packet that contains the status of +// analog and digital pins. +// It looks like that: +// { +// "analog": [0, 76, 123, 158, 192, 205], +// "digital": [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0] +// } +// +// If you want to test this program, you need to be able to receive the UDP +// packets. +// For example, you can run netcat on your computer +// $ ncat -ulp 8888 +// See https://nmap.org/ncat/ +// +// https://arduinojson.org/v7/example/udp-beacon/ + +#include +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress remoteIp(192, 168, 0, 108); // <- EDIT!!!! +unsigned short remotePort = 8888; +unsigned short localPort = 8888; +EthernetUDP udp; + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) + continue; + + // Initialize Ethernet libary + if (!Ethernet.begin(mac)) { + Serial.println(F("Failed to initialize Ethernet library")); + return; + } + + // Enable UDP + udp.begin(localPort); +} + +void loop() { + // Allocate a temporary JsonDocument + JsonDocument doc; + + // Create the "analog" array + JsonArray analogValues = doc["analog"].to(); + for (int pin = 0; pin < 6; pin++) { + // Read the analog input + int value = analogRead(pin); + + // Add the value at the end of the array + analogValues.add(value); + } + + // Create the "digital" array + JsonArray digitalValues = doc["digital"].to(); + for (int pin = 0; pin < 14; pin++) { + // Read the digital input + int value = digitalRead(pin); + + // Add the value at the end of the array + digitalValues.add(value); + } + + // Log + Serial.print(F("Sending to ")); + Serial.print(remoteIp); + Serial.print(F(" on port ")); + Serial.println(remotePort); + serializeJson(doc, Serial); + + // Send UDP packet + udp.beginPacket(remoteIp, remotePort); + serializeJson(doc, udp); + udp.println(); + udp.endPacket(); + + // Wait + delay(10000); +} + +// Performance issue? +// ------------------ +// +// EthernetUDP is an unbuffered stream, which is not optimal for ArduinoJson. +// See: https://arduinojson.org/v7/how-to/improve-speed/ + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// serialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on serialization. +// It begins with a simple example, then adds more features like serializing +// directly to a file or any stream. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount â¤â¤â¤â¤â¤ diff --git a/mb-script/lib/ArduinoJson/examples/MsgPackParser/MsgPackParser.ino b/mb-script/lib/ArduinoJson/examples/MsgPackParser/MsgPackParser.ino new file mode 100644 index 00000000..36490810 --- /dev/null +++ b/mb-script/lib/ArduinoJson/examples/MsgPackParser/MsgPackParser.ino @@ -0,0 +1,61 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to deserialize a MessagePack document with +// ArduinoJson. +// +// https://arduinojson.org/v7/example/msgpack-parser/ + +#include + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) + continue; + + // Allocate the JSON document + JsonDocument doc; + + // The MessagePack input string + uint8_t input[] = {131, 166, 115, 101, 110, 115, 111, 114, 163, 103, 112, 115, + 164, 116, 105, 109, 101, 206, 80, 147, 50, 248, 164, 100, + 97, 116, 97, 146, 203, 64, 72, 96, 199, 58, 188, 148, + 112, 203, 64, 2, 106, 146, 230, 33, 49, 169}; + // This MessagePack document contains: + // { + // "sensor": "gps", + // "time": 1351824120, + // "data": [48.75608, 2.302038] + // } + + // Parse the input + DeserializationError error = deserializeMsgPack(doc, input); + + // Test if parsing succeeded + if (error) { + Serial.print("deserializeMsgPack() failed: "); + Serial.println(error.f_str()); + return; + } + + // Fetch the values + // + // Most of the time, you can rely on the implicit casts. + // In other case, you can do doc["time"].as(); + const char* sensor = doc["sensor"]; + long time = doc["time"]; + double latitude = doc["data"][0]; + double longitude = doc["data"][1]; + + // Print the values + Serial.println(sensor); + Serial.println(time); + Serial.println(latitude, 6); + Serial.println(longitude, 6); +} + +void loop() { + // not used in this example +} diff --git a/mb-script/lib/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino b/mb-script/lib/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino new file mode 100644 index 00000000..729cb8bf --- /dev/null +++ b/mb-script/lib/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino @@ -0,0 +1,63 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows the different ways you can use Flash strings with +// ArduinoJson. +// +// Use Flash strings sparingly, because ArduinoJson duplicates them in the +// JsonDocument. Prefer plain old char*, as they are more efficient in term of +// code size, speed, and memory usage. +// +// https://arduinojson.org/v7/example/progmem/ + +#include + +void setup() { + JsonDocument doc; + + // You can use a Flash String as your JSON input. + // WARNING: the strings in the input will be duplicated in the JsonDocument. + deserializeJson(doc, F("{\"sensor\":\"gps\",\"time\":1351824120," + "\"data\":[48.756080,2.302038]}")); + + // You can use a Flash String as a key to get a member from JsonDocument + // No duplication is done. + long time = doc[F("time")]; + + // You can use a Flash String as a key to set a member of a JsonDocument + // WARNING: the content of the Flash String will be duplicated in the + // JsonDocument. + doc[F("time")] = time; + + // You can set a Flash String as the content of a JsonVariant + // WARNING: the content of the Flash String will be duplicated in the + // JsonDocument. + doc["sensor"] = F("gps"); + + // It works with serialized() too: + doc["sensor"] = serialized(F("\"gps\"")); + doc["sensor"] = serialized(F("\xA3gps"), 3); + + // You can compare the content of a JsonVariant to a Flash String + if (doc["sensor"] == F("gps")) { + // ... + } +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any memory +// problem. +// +// The book "Mastering ArduinoJson" contains a quick C++ course that explains +// how your microcontroller stores strings in memory. It also tells why you +// should not abuse Flash strings with ArduinoJson. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount â¤â¤â¤â¤â¤ diff --git a/mb-script/lib/ArduinoJson/examples/StringExample/StringExample.ino b/mb-script/lib/ArduinoJson/examples/StringExample/StringExample.ino new file mode 100644 index 00000000..845df9df --- /dev/null +++ b/mb-script/lib/ArduinoJson/examples/StringExample/StringExample.ino @@ -0,0 +1,76 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows the different ways you can use String with ArduinoJson. +// +// Use String objects sparingly, because ArduinoJson duplicates them in the +// JsonDocument. Prefer plain old char[], as they are more efficient in term of +// code size, speed, and memory usage. +// +// https://arduinojson.org/v7/example/string/ + +#include + +void setup() { + JsonDocument doc; + + // You can use a String as your JSON input. + // WARNING: the string in the input will be duplicated in the JsonDocument. + String input = + "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; + deserializeJson(doc, input); + + // You can use a String as a key to get a member from JsonDocument + // No duplication is done. + long time = doc[String("time")]; + + // You can use a String as a key to set a member of a JsonDocument + // WARNING: the content of the String will be duplicated in the JsonDocument. + doc[String("time")] = time; + + // You can get the content of a JsonVariant as a String + // No duplication is done, at least not in the JsonDocument. + String sensor = doc["sensor"]; + + // Unfortunately, the following doesn't work (issue #118): + // sensor = doc["sensor"]; // <- error "ambiguous overload for 'operator='" + // As a workaround, you need to replace by: + sensor = doc["sensor"].as(); + + // You can set a String as the content of a JsonVariant + // WARNING: the content of the String will be duplicated in the JsonDocument. + doc["sensor"] = sensor; + + // It works with serialized() too: + doc["sensor"] = serialized(sensor); + + // You can also concatenate strings + // WARNING: the content of the String will be duplicated in the JsonDocument. + doc[String("sen") + "sor"] = String("gp") + "s"; + + // You can compare the content of a JsonObject with a String + if (doc["sensor"] == sensor) { + // ... + } + + // Lastly, you can print the resulting JSON to a String + String output; + serializeJson(doc, output); +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any problem. +// +// The book "Mastering ArduinoJson" contains a quick C++ course that explains +// how your microcontroller stores strings in memory. On several occasions, it +// shows how you can avoid String in your program. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount â¤â¤â¤â¤â¤ diff --git a/mb-script/lib/ArduinoJson/extras/ArduinoJsonConfig.cmake.in b/mb-script/lib/ArduinoJson/extras/ArduinoJsonConfig.cmake.in new file mode 100644 index 00000000..9c15f36a --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/ArduinoJsonConfig.cmake.in @@ -0,0 +1,4 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/mb-script/lib/ArduinoJson/extras/CompileOptions.cmake b/mb-script/lib/ArduinoJson/extras/CompileOptions.cmake new file mode 100644 index 00000000..5d9f8046 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/CompileOptions.cmake @@ -0,0 +1,112 @@ +if(NOT DEFINED COVERAGE) + set(COVERAGE OFF) +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") + add_compile_options( + -pedantic + -Wall + -Wcast-align + -Wcast-qual + -Wconversion + -Wctor-dtor-privacy + -Wdisabled-optimization + -Werror + -Wextra + -Wformat=2 + -Winit-self + -Wmissing-include-dirs + -Wnon-virtual-dtor + -Wold-style-cast + -Woverloaded-virtual + -Wparentheses + -Wredundant-decls + -Wshadow + -Wsign-conversion + -Wsign-promo + -Wstrict-aliasing + -Wundef + ) + + if(${COVERAGE}) + set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage") + endif() +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9) AND(NOT ${COVERAGE})) + add_compile_options(-g -Og) + else() # GCC 4.8 + add_compile_options( + -g + -O0 # GCC 4.8 doesn't support -Og + -Wno-shadow # allow the same name for a function parameter and a member functions + -Wp,-w # Disable preprocessing warnings (see below) + ) + # GCC 4.8 doesn't support __has_include, so we need to help him + add_definitions( + -DARDUINOJSON_ENABLE_STD_STRING=1 + -DARDUINOJSON_ENABLE_STD_STREAM=1 + ) + endif() + + add_compile_options( + -Wstrict-null-sentinel + -Wno-vla # Allow VLA in tests + ) + add_definitions(-DHAS_VARIABLE_LENGTH_ARRAY) + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.5) + add_compile_options(-Wlogical-op) # the flag exists in 4.4 but is buggy + endif() + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6) + add_compile_options(-Wnoexcept) + endif() +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options( + -Wc++11-compat + -Wdeprecated-register + -Wno-vla-extension # Allow VLA in tests + ) + add_definitions( + -DHAS_VARIABLE_LENGTH_ARRAY + -DSUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR + ) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_compile_options(-stdlib=libc++) + link_libraries(c++ m) + + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0) AND(NOT ${COVERAGE})) + add_compile_options(-g -Og) + else() + add_compile_options(-g -O0) + endif() +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0) AND(NOT ${COVERAGE})) + add_compile_options(-g -Og) + else() + add_compile_options(-g -O0) + endif() +endif() + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_compile_options( + /W4 # Set warning level + /WX # Treats all compiler warnings as errors. + /Zc:__cplusplus # Enable updated __cplusplus macro + ) +endif() + +if(MINGW) + # Static link on MinGW to avoid linking with the wrong DLLs when multiple + # versions are installed. + add_link_options(-static) +endif() diff --git a/mb-script/lib/ArduinoJson/extras/ci/espidf/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/ci/espidf/CMakeLists.txt new file mode 100644 index 00000000..61357013 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/ci/espidf/CMakeLists.txt @@ -0,0 +1,8 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +cmake_minimum_required(VERSION 3.5) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(example) diff --git a/mb-script/lib/ArduinoJson/extras/ci/espidf/main/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/ci/espidf/main/CMakeLists.txt new file mode 100644 index 00000000..bf22507a --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/ci/espidf/main/CMakeLists.txt @@ -0,0 +1,8 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +idf_component_register( + SRCS "main.cpp" + INCLUDE_DIRS "" +) diff --git a/mb-script/lib/ArduinoJson/extras/ci/espidf/main/component.mk b/mb-script/lib/ArduinoJson/extras/ci/espidf/main/component.mk new file mode 100644 index 00000000..a98f634e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/ci/espidf/main/component.mk @@ -0,0 +1,4 @@ +# +# "main" pseudo-component makefile. +# +# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) diff --git a/mb-script/lib/ArduinoJson/extras/ci/espidf/main/main.cpp b/mb-script/lib/ArduinoJson/extras/ci/espidf/main/main.cpp new file mode 100644 index 00000000..436eb403 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/ci/espidf/main/main.cpp @@ -0,0 +1,16 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +extern "C" void app_main() { + char buffer[256]; + JsonDocument doc; + + doc["hello"] = "world"; + serializeJson(doc, buffer); + deserializeJson(doc, buffer); + serializeMsgPack(doc, buffer); + deserializeMsgPack(doc, buffer); +} diff --git a/mb-script/lib/ArduinoJson/extras/ci/particle.sh b/mb-script/lib/ArduinoJson/extras/ci/particle.sh new file mode 100644 index 00000000..55663530 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/ci/particle.sh @@ -0,0 +1,10 @@ +#!/bin/sh -ex + +BOARD=$1 + +cd "$(dirname "$0")/../../" + +cp extras/particle/src/smocktest.ino src/ +cp extras/particle/project.properties ./ + +particle compile "$BOARD" diff --git a/mb-script/lib/ArduinoJson/extras/conf_test/avr.cpp b/mb-script/lib/ArduinoJson/extras/conf_test/avr.cpp new file mode 100644 index 00000000..769317a8 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/conf_test/avr.cpp @@ -0,0 +1,18 @@ +#include + +static_assert(ARDUINOJSON_ENABLE_PROGMEM == 1, "ARDUINOJSON_ENABLE_PROGMEM"); + +static_assert(ARDUINOJSON_USE_LONG_LONG == 0, "ARDUINOJSON_USE_LONG_LONG"); + +static_assert(ARDUINOJSON_SLOT_ID_SIZE == 1, "ARDUINOJSON_SLOT_ID_SIZE"); + +static_assert(ARDUINOJSON_POOL_CAPACITY == 16, "ARDUINOJSON_POOL_CAPACITY"); + +static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); + +static_assert(ARDUINOJSON_USE_DOUBLE == 0, "ARDUINOJSON_USE_DOUBLE"); + +static_assert(ArduinoJson::detail::ResourceManager::slotSize == 6, "slot size"); + +void setup() {} +void loop() {} diff --git a/mb-script/lib/ArduinoJson/extras/conf_test/esp8266.cpp b/mb-script/lib/ArduinoJson/extras/conf_test/esp8266.cpp new file mode 100644 index 00000000..b37bfd67 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/conf_test/esp8266.cpp @@ -0,0 +1,16 @@ +#include + +static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG"); + +static_assert(ARDUINOJSON_SLOT_ID_SIZE == 2, "ARDUINOJSON_SLOT_ID_SIZE"); + +static_assert(ARDUINOJSON_POOL_CAPACITY == 128, "ARDUINOJSON_POOL_CAPACITY"); + +static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); + +static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); + +static_assert(ArduinoJson::detail::ResourceManager::slotSize == 8, "slot size"); + +void setup() {} +void loop() {} diff --git a/mb-script/lib/ArduinoJson/extras/conf_test/x64.cpp b/mb-script/lib/ArduinoJson/extras/conf_test/x64.cpp new file mode 100644 index 00000000..df6b044b --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/conf_test/x64.cpp @@ -0,0 +1,16 @@ +#include + +static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG"); + +static_assert(ARDUINOJSON_SLOT_ID_SIZE == 4, "ARDUINOJSON_SLOT_ID_SIZE"); + +static_assert(ARDUINOJSON_POOL_CAPACITY == 256, "ARDUINOJSON_POOL_CAPACITY"); + +static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); + +static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); + +static_assert(ArduinoJson::detail::ResourceManager::slotSize == 16, + "slot size"); + +int main() {} diff --git a/mb-script/lib/ArduinoJson/extras/conf_test/x86.cpp b/mb-script/lib/ArduinoJson/extras/conf_test/x86.cpp new file mode 100644 index 00000000..9dff8f17 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/conf_test/x86.cpp @@ -0,0 +1,15 @@ +#include + +static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG"); + +static_assert(ARDUINOJSON_SLOT_ID_SIZE == 2, "ARDUINOJSON_SLOT_ID_SIZE"); + +static_assert(ARDUINOJSON_POOL_CAPACITY == 128, "ARDUINOJSON_POOL_CAPACITY"); + +static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); + +static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); + +static_assert(ArduinoJson::detail::ResourceManager::slotSize == 8, "slot size"); + +int main() {} diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/fuzzing/CMakeLists.txt new file mode 100644 index 00000000..42c9260e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/CMakeLists.txt @@ -0,0 +1,67 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if(MSVC) + add_compile_options(-D_CRT_SECURE_NO_WARNINGS) +endif() + +add_executable(msgpack_reproducer + msgpack_fuzzer.cpp + reproducer.cpp +) +target_link_libraries(msgpack_reproducer + ArduinoJson +) + +add_executable(json_reproducer + json_fuzzer.cpp + reproducer.cpp +) +target_link_libraries(json_reproducer + ArduinoJson +) + +macro(add_fuzzer name) + set(FUZZER "${name}_fuzzer") + set(CORPUS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${name}_corpus") + set(SEED_CORPUS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${name}_seed_corpus") + add_executable("${FUZZER}" + "${name}_fuzzer.cpp" + ) + target_link_libraries("${FUZZER}" + ArduinoJson + ) + set_target_properties("${FUZZER}" + PROPERTIES + COMPILE_FLAGS "-fprofile-instr-generate -fcoverage-mapping -fsanitize=fuzzer -fno-sanitize-recover=all" + LINK_FLAGS "-fprofile-instr-generate -fcoverage-mapping -fsanitize=fuzzer -fno-sanitize-recover=all" + ) + + add_test( + NAME "${FUZZER}" + COMMAND "${FUZZER}" "${CORPUS_DIR}" "${SEED_CORPUS_DIR}" -max_total_time=5 -timeout=1 + ) + + set_tests_properties("${FUZZER}" + PROPERTIES + LABELS "Fuzzing" + ) +endmacro() + +# Needs Clang 6+ to compile +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6) + if(DEFINED ENV{GITHUB_ACTIONS} AND CMAKE_CXX_COMPILER_VERSION MATCHES "^11\\.") + # Clang 11 fails on GitHub Actions with the following error: + # > ERROR: UndefinedBehaviorSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22) + # > Sanitizer CHECK failed: /build/llvm-toolchain-11-mnvtwk/llvm-toolchain-11-11.1.0/compiler-rt/lib/sanitizer_common/sanitizer_common.cpp:54 ((0 && "unable to mmap")) != (0) (0, 0) + message(WARNING "Fuzzing is disabled on GitHub Actions to workaround a bug in Clang 11") + return() + endif() + + add_fuzzer(json) + add_fuzzer(msgpack) +endif() diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/Makefile b/mb-script/lib/ArduinoJson/extras/fuzzing/Makefile new file mode 100644 index 00000000..81fc4125 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/Makefile @@ -0,0 +1,22 @@ +# CAUTION: this file is invoked by https://github.com/google/oss-fuzz + +CXXFLAGS += -I../../src -DARDUINOJSON_DEBUG=1 -std=c++11 + +all: \ + $(OUT)/json_fuzzer \ + $(OUT)/json_fuzzer_seed_corpus.zip \ + $(OUT)/json_fuzzer.options \ + $(OUT)/msgpack_fuzzer \ + $(OUT)/msgpack_fuzzer_seed_corpus.zip \ + $(OUT)/msgpack_fuzzer.options + +$(OUT)/%_fuzzer: %_fuzzer.cpp $(shell find ../../src -type f) + $(CXX) $(CXXFLAGS) $< -o$@ $(LIB_FUZZING_ENGINE) + +$(OUT)/%_fuzzer_seed_corpus.zip: %_seed_corpus/* + zip -j $@ $? + +$(OUT)/%_fuzzer.options: + @echo "[libfuzzer]" > $@ + @echo "max_len = 256" >> $@ + @echo "timeout = 10" >> $@ diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/json_fuzzer.cpp b/mb-script/lib/ArduinoJson/extras/fuzzing/json_fuzzer.cpp new file mode 100644 index 00000000..8d78aa34 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/json_fuzzer.cpp @@ -0,0 +1,11 @@ +#include + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + JsonDocument doc; + DeserializationError error = deserializeJson(doc, data, size); + if (!error) { + std::string json; + serializeJson(doc, json); + } + return 0; +} diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Comments.json b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Comments.json new file mode 100644 index 00000000..bcc4cece --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Comments.json @@ -0,0 +1,10 @@ +//comment +/*comment*/ +[ //comment +/*comment*/"comment"/*comment*/,//comment +/*comment*/{//comment +/* comment*/"key"//comment +: //comment +"value"//comment +}/*comment*/ +]//comment \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyArray.json b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyArray.json new file mode 100644 index 00000000..0637a088 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyArray.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyObject.json b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyObject.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyObject.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/ExcessiveNesting.json b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/ExcessiveNesting.json new file mode 100644 index 00000000..9285019a --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/ExcessiveNesting.json @@ -0,0 +1 @@ +[1,[2,[3,[4,[5,[6,[7,[8,[9,[10,[11,[12,[13,[14,[15,[16,[17,[18,[19,[20,[21,[22,[23,[24,[25,[26,[27,[28,[29,[30,[31,[32,[33,[34,[35,[36,[37,[38,[39,[40,[41,[42,[43,[44,[45,[46,[47,[48,[49,[50,[51,[52,[53,[54,[55,[56,[57,[58,[59,[60,[61,[62,[63,[64,[65,[66,[67,[68,[69,[70,[71,[72,[73,[74,[75,[76,[77,[78,[79,[80,[81,[82,[83,[84,[85,[86,[87,[88,[89,[90,[91,[92,[93,[94,[95,[96,[97,[98,[99,[100,[101,[102,[103,[104,[105,[106,[107,[108,[109,[110,[111,[112,[113,[114,[115,[116,[117,[118,[119,[120]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/IntegerOverflow.json b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/IntegerOverflow.json new file mode 100644 index 00000000..3a33cb89 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/IntegerOverflow.json @@ -0,0 +1 @@ +9720730739393920739 diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Numbers.json b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Numbers.json new file mode 100644 index 00000000..f6b94194 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Numbers.json @@ -0,0 +1,24 @@ +[ + 123, + -123, + 123.456, + -123.456, + 12e34, + 12e-34, + 12e+34, + 12E34, + 12E-34, + 12E+34, + 12.34e56, + 12.34e-56, + 12.34e+56, + 12.34E56, + 12.34E-56, + 12.34E+56, + NaN, + -NaN, + +NaN, + Infinity, + +Infinity, + -Infinity +] \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/OpenWeatherMap.json b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/OpenWeatherMap.json new file mode 100644 index 00000000..27d6bafd --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/OpenWeatherMap.json @@ -0,0 +1,53 @@ +{ + "coord": { + "lon": -0.13, + "lat": 51.51 + }, + "weather": [ + { + "id": 301, + "main": "Drizzle", + "description": "drizzle", + "icon": "09n" + }, + { + "id": 701, + "main": "Mist", + "description": "mist", + "icon": "50n" + }, + { + "id": 741, + "main": "Fog", + "description": "fog", + "icon": "50n" + } + ], + "base": "stations", + "main": { + "temp": 281.87, + "pressure": 1032, + "humidity": 100, + "temp_min": 281.15, + "temp_max": 283.15 + }, + "visibility": 2900, + "wind": { + "speed": 1.5 + }, + "clouds": { + "all": 90 + }, + "dt": 1483820400, + "sys": { + "type": 1, + "id": 5091, + "message": 0.0226, + "country": "GB", + "sunrise": 1483776245, + "sunset": 1483805443 + }, + "id": 2643743, + "name": "London", + "cod": 200 +} diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Strings.json b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Strings.json new file mode 100644 index 00000000..3ffa235e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/Strings.json @@ -0,0 +1,8 @@ +[ + "hello", + 'hello', + hello, + {"hello":"world"}, + {'hello':'world'}, + {hello:world} +] \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/WeatherUnderground.json b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/WeatherUnderground.json new file mode 100644 index 00000000..d53ce006 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/json_seed_corpus/WeatherUnderground.json @@ -0,0 +1,90 @@ +{ + "response": { + "version": "0.1", + "termsofService": "http://www.wunderground.com/weather/api/d/terms.html", + "features": { + "conditions": 1 + } + }, + "current_observation": { + "image": { + "url": "http://icons-ak.wxug.com/graphics/wu2/logo_130x80.png", + "title": "Weather Underground", + "link": "http://www.wunderground.com" + }, + "display_location": { + "full": "San Francisco, CA", + "city": "San Francisco", + "state": "CA", + "state_name": "California", + "country": "US", + "country_iso3166": "US", + "zip": "94101", + "latitude": "37.77500916", + "longitude": "-122.41825867", + "elevation": "47.00000000" + }, + "observation_location": { + "full": "SOMA - Near Van Ness, San Francisco, California", + "city": "SOMA - Near Van Ness, San Francisco", + "state": "California", + "country": "US", + "country_iso3166": "US", + "latitude": "37.773285", + "longitude": "-122.417725", + "elevation": "49 ft" + }, + "estimated": {}, + "station_id": "KCASANFR58", + "observation_time": "Last Updated on June 27, 5:27 PM PDT", + "observation_time_rfc822": "Wed, 27 Jun 2012 17:27:13 -0700", + "observation_epoch": "1340843233", + "local_time_rfc822": "Wed, 27 Jun 2012 17:27:14 -0700", + "local_epoch": "1340843234", + "local_tz_short": "PDT", + "local_tz_long": "America/Los_Angeles", + "local_tz_offset": "-0700", + "weather": "Partly Cloudy", + "temperature_string": "66.3 F (19.1 C)", + "temp_f": 66.3, + "temp_c": 19.1, + "relative_humidity": "65%", + "wind_string": "From the NNW at 22.0 MPH Gusting to 28.0 MPH", + "wind_dir": "NNW", + "wind_degrees": 346, + "wind_mph": 22, + "wind_gust_mph": "28.0", + "wind_kph": 35.4, + "wind_gust_kph": "45.1", + "pressure_mb": "1013", + "pressure_in": "29.93", + "pressure_trend": "+", + "dewpoint_string": "54 F (12 C)", + "dewpoint_f": 54, + "dewpoint_c": 12, + "heat_index_string": "NA", + "heat_index_f": "NA", + "heat_index_c": "NA", + "windchill_string": "NA", + "windchill_f": "NA", + "windchill_c": "NA", + "feelslike_string": "66.3 F (19.1 C)", + "feelslike_f": "66.3", + "feelslike_c": "19.1", + "visibility_mi": "10.0", + "visibility_km": "16.1", + "solarradiation": "", + "UV": "5", + "precip_1hr_string": "0.00 in ( 0 mm)", + "precip_1hr_in": "0.00", + "precip_1hr_metric": " 0", + "precip_today_string": "0.00 in (0 mm)", + "precip_today_in": "0.00", + "precip_today_metric": "0", + "icon": "partlycloudy", + "icon_url": "http://icons-ak.wxug.com/i/c/k/partlycloudy.gif", + "forecast_url": "http://www.wunderground.com/US/CA/San_Francisco.html", + "history_url": "http://www.wunderground.com/history/airport/KCASANFR58/2012/6/27/DailyHistory.html", + "ob_url": "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=37.773285,-122.417725" + } +} diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_fuzzer.cpp b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_fuzzer.cpp new file mode 100644 index 00000000..3011501b --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_fuzzer.cpp @@ -0,0 +1,11 @@ +#include + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + JsonDocument doc; + DeserializationError error = deserializeMsgPack(doc, data, size); + if (!error) { + std::string json; + serializeMsgPack(doc, json); + } + return 0; +} diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16 new file mode 100644 index 00000000..714ba99e Binary files /dev/null and b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16 differ diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32 new file mode 100644 index 00000000..6e3ed7b1 Binary files /dev/null and b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32 differ diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/false b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/false new file mode 100644 index 00000000..52771883 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/false @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray new file mode 100644 index 00000000..95d54b19 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray @@ -0,0 +1 @@ +’¥hello¥world \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_negative b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_negative new file mode 100644 index 00000000..eda5949c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_negative @@ -0,0 +1 @@ +à \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_positive b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_positive new file mode 100644 index 00000000..16e0e90d --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_positive @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap new file mode 100644 index 00000000..df26118e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap @@ -0,0 +1 @@ +‚£one£two \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr new file mode 100644 index 00000000..2ff7b3f3 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr @@ -0,0 +1 @@ +«hello world \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32 new file mode 100644 index 00000000..a574220c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32 @@ -0,0 +1 @@ +Ê@Hõà \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64 new file mode 100644 index 00000000..36088bcd --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64 @@ -0,0 +1 @@ +Ë@ !ÊÀƒo \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16 new file mode 100644 index 00000000..9ffc705e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16 @@ -0,0 +1 @@ +ÑÏÇ \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32 new file mode 100644 index 00000000..d735e217 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32 @@ -0,0 +1 @@ +Ò¶iý. \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64 new file mode 100644 index 00000000..9d2cd3b9 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64 @@ -0,0 +1 @@ +Ó4Vxš¼Þð \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8 new file mode 100644 index 00000000..ae2ca9cc --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8 @@ -0,0 +1 @@ +Ðÿ \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16 new file mode 100644 index 00000000..836a7187 Binary files /dev/null and b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16 differ diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32 new file mode 100644 index 00000000..97ab162e Binary files /dev/null and b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32 differ diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil new file mode 100644 index 00000000..e7754cae --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil @@ -0,0 +1 @@ +À \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16 new file mode 100644 index 00000000..91c1396d Binary files /dev/null and b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16 differ diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32 new file mode 100644 index 00000000..50cac52a Binary files /dev/null and b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32 differ diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8 new file mode 100644 index 00000000..ff5a2c0e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8 @@ -0,0 +1 @@ +Ùhello \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/true b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/true new file mode 100644 index 00000000..6b10f958 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/true @@ -0,0 +1 @@ +à \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16 new file mode 100644 index 00000000..7f4c2e82 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16 @@ -0,0 +1 @@ +Í09 \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32 new file mode 100644 index 00000000..864826fb --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32 @@ -0,0 +1 @@ +Î4Vx \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64 new file mode 100644 index 00000000..20ede759 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64 @@ -0,0 +1 @@ +Ï4Vxš¼Þð \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8 b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8 new file mode 100644 index 00000000..6a961207 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8 @@ -0,0 +1 @@ +Ìÿ \ No newline at end of file diff --git a/mb-script/lib/ArduinoJson/extras/fuzzing/reproducer.cpp b/mb-script/lib/ArduinoJson/extras/fuzzing/reproducer.cpp new file mode 100644 index 00000000..beeb2dfe --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/fuzzing/reproducer.cpp @@ -0,0 +1,50 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +// This file is NOT use by Google's OSS fuzz +// I only use it to reproduce the bugs found + +#include // size_t +#include // fopen et al. +#include // exit +#include +#include + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); + +std::vector read(const char* path) { + FILE* f = fopen(path, "rb"); + if (!f) { + std::cerr << "Failed to open " << path << std::endl; + exit(1); + } + + fseek(f, 0, SEEK_END); + size_t size = static_cast(ftell(f)); + fseek(f, 0, SEEK_SET); + + std::vector buffer(size); + if (fread(buffer.data(), 1, size, f) != size) { + fclose(f); + std::cerr << "Failed to read " << path << std::endl; + exit(1); + } + + fclose(f); + return buffer; +} + +int main(int argc, const char* argv[]) { + if (argc < 2) { + std::cerr << "Usage: msgpack_fuzzer files" << std::endl; + return 1; + } + + for (int i = 1; i < argc; i++) { + std::cout << "Loading " << argv[i] << std::endl; + std::vector buffer = read(argv[i]); + LLVMFuzzerTestOneInput(buffer.data(), buffer.size()); + } + return 0; +} diff --git a/mb-script/lib/ArduinoJson/extras/particle/project.properties b/mb-script/lib/ArduinoJson/extras/particle/project.properties new file mode 100644 index 00000000..d39555ad --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/particle/project.properties @@ -0,0 +1 @@ +name=ArduinoJsonCI diff --git a/mb-script/lib/ArduinoJson/extras/particle/src/smocktest.ino b/mb-script/lib/ArduinoJson/extras/particle/src/smocktest.ino new file mode 100644 index 00000000..ca17189e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/particle/src/smocktest.ino @@ -0,0 +1,5 @@ +#include "ArduinoJson.h" + +void setup() {} + +void loop() {} diff --git a/mb-script/lib/ArduinoJson/extras/scripts/build-single-header.sh b/mb-script/lib/ArduinoJson/extras/scripts/build-single-header.sh new file mode 100644 index 00000000..00292e30 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/scripts/build-single-header.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +set -e + +RE_RELATIVE_INCLUDE='^#[[:space:]]*include[[:space:]]*"(.*)"' +RE_ABSOLUTE_INCLUDE='^#[[:space:]]*include[[:space:]]*<(ArduinoJson/.*)>' +RE_SYSTEM_INCLUDE='^#[[:space:]]*include[[:space:]]*<(.*)>' +RE_EMPTY='^(#[[:space:]]*pragma[[:space:]]+once)?[[:space:]]*(//.*)?$' +SRC_DIRECTORY="$(realpath "$(dirname $0)/../../src")" + + +declare -A INCLUDED + +process() +{ + local PARENT=$1 + local FOLDER=$(dirname $1) + local SHOW_COMMENT=$2 + while IFS= read -r LINE; do + if [[ $LINE =~ $RE_ABSOLUTE_INCLUDE ]]; then + local CHILD=${BASH_REMATCH[1]} + local CHILD_PATH + CHILD_PATH=$(realpath "$SRC_DIRECTORY/$CHILD") + echo "$PARENT -> $CHILD" >&2 + if [[ ! ${INCLUDED[$CHILD_PATH]} ]]; then + INCLUDED[$CHILD_PATH]=true + process "$CHILD" false + fi + elif [[ $LINE =~ $RE_RELATIVE_INCLUDE ]]; then + local CHILD=${BASH_REMATCH[1]} + pushd "$FOLDER" > /dev/null + local CHILD_PATH + CHILD_PATH=$(realpath "$CHILD") + echo "$PARENT -> $CHILD" >&2 + if [[ ! ${INCLUDED[$CHILD_PATH]} ]]; then + INCLUDED[$CHILD_PATH]=true + process "$CHILD" false + fi + popd > /dev/null + elif [[ $LINE =~ $RE_SYSTEM_INCLUDE ]]; then + local CHILD=${BASH_REMATCH[1]} + echo "$PARENT -> <$CHILD>" >&2 + if [[ ! ${INCLUDED[$CHILD]} ]]; then + echo "#include <$CHILD>" + INCLUDED[$CHILD]=true + fi + elif [[ "${SHOW_COMMENT}" = "true" ]] ; then + echo "$LINE" + elif [[ ! $LINE =~ $RE_EMPTY ]]; then + echo "$LINE" + fi + done < $PARENT +} + +simplify_namespaces() { + perl -p0i -e 's|ARDUINOJSON_END_PUBLIC_NAMESPACE\r?\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\r?\n||igs' "$1" + perl -p0i -e 's|ARDUINOJSON_END_PRIVATE_NAMESPACE\r?\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\r?\n||igs' "$1" + rm -f "$1.bak" +} + +INCLUDED=() +INPUT=$1 +OUTPUT=$2 +process "$INPUT" true > "$OUTPUT" +simplify_namespaces "$OUTPUT" diff --git a/mb-script/lib/ArduinoJson/extras/scripts/extract_changes.awk b/mb-script/lib/ArduinoJson/extras/scripts/extract_changes.awk new file mode 100644 index 00000000..d96d459d --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/scripts/extract_changes.awk @@ -0,0 +1,29 @@ +#!/usr/bin/awk -f + +# Start echoing after the first list item +/\* / { + STARTED=1 + EMPTY_LINE=0 +} + +# Remember if we have seen an empty line +/^[[:space:]]*$/ { + EMPTY_LINE=1 +} + +# Exit when seeing a new version number +/^v[[:digit:]]/ { + if (STARTED) exit +} + +# Print if the line is not empty +# and restore the empty line we have skipped +!/^[[:space:]]*$/ { + if (STARTED) { + if (EMPTY_LINE) { + print "" + EMPTY_LINE=0 + } + print + } +} diff --git a/mb-script/lib/ArduinoJson/extras/scripts/get-release-page.sh b/mb-script/lib/ArduinoJson/extras/scripts/get-release-page.sh new file mode 100644 index 00000000..10fa0877 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/scripts/get-release-page.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -eu + +VERSION="$1" +CHANGELOG="$2" +ARDUINOJSON_H="$3" + +cat << END +--- +branch: v7 +version: $VERSION +date: '$(date +'%Y-%m-%d')' +$(extras/scripts/wandbox/publish.sh "$ARDUINOJSON_H") +--- + +$(extras/scripts/extract_changes.awk "$CHANGELOG") +END diff --git a/mb-script/lib/ArduinoJson/extras/scripts/publish-particle-library.sh b/mb-script/lib/ArduinoJson/extras/scripts/publish-particle-library.sh new file mode 100644 index 00000000..d410c470 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/scripts/publish-particle-library.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -eu + +SOURCE_DIR="$(dirname "$0")/../.." +WORK_DIR=$(mktemp -d) +trap 'rm -rf "$WORK_DIR"' EXIT + +cp "$SOURCE_DIR/README.md" "$WORK_DIR/README.md" +cp "$SOURCE_DIR/CHANGELOG.md" "$WORK_DIR/CHANGELOG.md" +cp "$SOURCE_DIR/library.properties" "$WORK_DIR/library.properties" +cp "$SOURCE_DIR/LICENSE.txt" "$WORK_DIR/LICENSE.txt" +cp -r "$SOURCE_DIR/src" "$WORK_DIR/" +cp -r "$SOURCE_DIR/examples" "$WORK_DIR/" + +cd "$WORK_DIR" +particle library upload +particle library publish diff --git a/mb-script/lib/ArduinoJson/extras/scripts/publish.sh b/mb-script/lib/ArduinoJson/extras/scripts/publish.sh new file mode 100644 index 00000000..60af5fc4 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/scripts/publish.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +set -eu + +which awk sed jq curl perl >/dev/null + +cd "$(dirname "$0")/../.." + +if ! git diff --quiet --exit-code; then + echo "Repository contains uncommitted changes" + exit +fi + +VERSION="$1" +DATE=$(date +%F) +TAG="v$VERSION" +VERSION_REGEX='[0-9]+\.[0-9]+\.[0-9]+(-[a-z0-9]+)?' +STARS=$(curl -s https://api.github.com/repos/bblanchon/ArduinoJson | jq '.stargazers_count') + +update_version_in_source () { + IFS=".-" read MAJOR MINOR REVISION EXTRA < <(echo "$VERSION") + UNDERLINE=$(printf -- '-%.0s' $(seq 1 ${#TAG})) + + sed -i~ -bE "1,20{s/$VERSION_REGEX/$VERSION/g}" README.md + rm README.md~ + + sed -i~ -bE "4s/HEAD/$TAG ($DATE)/; 5s/-+/$UNDERLINE/" CHANGELOG.md + rm CHANGELOG.md~ + + sed -i~ -bE "s/(project\\s*\\(ArduinoJson\\s+VERSION\\s+).*?\\)/\\1$MAJOR.$MINOR.$REVISION)/" CMakeLists.txt + rm CMakeLists.txt~ + + sed -i~ -bE \ + -e "s/\"version\":.*$/\"version\": \"$VERSION\",/" \ + -e "s/[0-9]+ stars/$STARS stars/" \ + library.json + rm library.json~ + + sed -i~ -bE \ + -e "s/version=.*$/version=$VERSION/" \ + -e "s/[0-9]+ stars/$STARS stars/" \ + library.properties + rm library.properties~ + + sed -i~ -bE "s/version: .*$/version: $VERSION.{build}/" appveyor.yml + rm appveyor.yml~ + + sed -i~ -bE \ + -e "s/^version: .*$/version: \"$VERSION\"/" \ + -e "s/[0-9]+ stars/$STARS stars/" \ + idf_component.yml + rm idf_component.yml~ + + sed -i~ -bE \ + -e "s/ARDUINOJSON_VERSION .*$/ARDUINOJSON_VERSION \"$VERSION\"/" \ + -e "s/ARDUINOJSON_VERSION_MAJOR .*$/ARDUINOJSON_VERSION_MAJOR $MAJOR/" \ + -e "s/ARDUINOJSON_VERSION_MINOR .*$/ARDUINOJSON_VERSION_MINOR $MINOR/" \ + -e "s/ARDUINOJSON_VERSION_REVISION .*$/ARDUINOJSON_VERSION_REVISION $REVISION/" \ + -e "s/ARDUINOJSON_VERSION_MACRO .*$/ARDUINOJSON_VERSION_MACRO V$MAJOR$MINOR$REVISION/" \ + src/ArduinoJson/version.hpp + rm src/ArduinoJson/version.hpp*~ +} + +commit_new_version () { + git add src/ArduinoJson/version.hpp README.md CHANGELOG.md library.json library.properties appveyor.yml CMakeLists.txt idf_component.yml + git commit -m "Set version to $VERSION" +} + +add_tag () { + CHANGES=$(awk '/\* /{ FOUND=1; print; next } { if (FOUND) exit}' CHANGELOG.md) + git tag -m "ArduinoJson $VERSION"$'\n'"$CHANGES" "$TAG" +} + +push () { + git push --follow-tags +} + +update_version_in_source +commit_new_version +add_tag +push + +extras/scripts/build-single-header.sh "src/ArduinoJson.h" "../ArduinoJson-$TAG.h" +extras/scripts/build-single-header.sh "src/ArduinoJson.hpp" "../ArduinoJson-$TAG.hpp" +extras/scripts/get-release-page.sh "$VERSION" "CHANGELOG.md" "../ArduinoJson-$TAG.h" > "../ArduinoJson-$TAG.md" + +echo "You can now copy ../ArduinoJson-$TAG.md into arduinojson.org/collections/_versions/$VERSION.md" diff --git a/mb-script/lib/ArduinoJson/extras/scripts/wandbox/JsonGeneratorExample.cpp b/mb-script/lib/ArduinoJson/extras/scripts/wandbox/JsonGeneratorExample.cpp new file mode 100644 index 00000000..2e08b4ca --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/scripts/wandbox/JsonGeneratorExample.cpp @@ -0,0 +1,42 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to generate a JSON document with ArduinoJson. + +#include +#include "ArduinoJson.h" + +int main() { + // Allocate the JSON document + JsonDocument doc; + + // Add values in the document. + doc["sensor"] = "gps"; + doc["time"] = 1351824120; + + // Add an array + JsonArray data = doc["data"].to(); + data.add(48.756080); + data.add(2.302038); + + // Generate the minified JSON and send it to STDOUT + serializeJson(doc, std::cout); + // The above line prints: + // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} + + // Start a new line + std::cout << std::endl; + + // Generate the prettified JSON and send it to STDOUT + serializeJsonPretty(doc, std::cout); + // The above line prints: + // { + // "sensor": "gps", + // "time": 1351824120, + // "data": [ + // 48.756080, + // 2.302038 + // ] + // } +} diff --git a/mb-script/lib/ArduinoJson/extras/scripts/wandbox/JsonParserExample.cpp b/mb-script/lib/ArduinoJson/extras/scripts/wandbox/JsonParserExample.cpp new file mode 100644 index 00000000..1969cf26 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/scripts/wandbox/JsonParserExample.cpp @@ -0,0 +1,43 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to deserialize a JSON document with ArduinoJson. + +#include +#include "ArduinoJson.h" + +int main() { + // Allocate the JSON document + JsonDocument doc; + + // JSON input string + const char* json = + "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; + + // Deserialize the JSON document + DeserializationError error = deserializeJson(doc, json); + + // Test if parsing succeeds + if (error) { + std::cerr << "deserializeJson() failed: " << error.c_str() << std::endl; + return 1; + } + + // Fetch the values + // + // Most of the time, you can rely on the implicit casts. + // In other case, you can do doc["time"].as(); + const char* sensor = doc["sensor"]; + long time = doc["time"]; + double latitude = doc["data"][0]; + double longitude = doc["data"][1]; + + // Print the values + std::cout << sensor << std::endl; + std::cout << time << std::endl; + std::cout << latitude << std::endl; + std::cout << longitude << std::endl; + + return 0; +} diff --git a/mb-script/lib/ArduinoJson/extras/scripts/wandbox/MsgPackParserExample.cpp b/mb-script/lib/ArduinoJson/extras/scripts/wandbox/MsgPackParserExample.cpp new file mode 100644 index 00000000..81e68221 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/scripts/wandbox/MsgPackParserExample.cpp @@ -0,0 +1,51 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License +// +// This example shows how to generate a JSON document with ArduinoJson. + +#include +#include "ArduinoJson.h" + +int main() { + // Allocate the JSON document + JsonDocument doc; + + // The MessagePack input string + uint8_t input[] = {131, 166, 115, 101, 110, 115, 111, 114, 163, 103, 112, 115, + 164, 116, 105, 109, 101, 206, 80, 147, 50, 248, 164, 100, + 97, 116, 97, 146, 203, 64, 72, 96, 199, 58, 188, 148, + 112, 203, 64, 2, 106, 146, 230, 33, 49, 169}; + // This MessagePack document contains: + // { + // "sensor": "gps", + // "time": 1351824120, + // "data": [48.75608, 2.302038] + // } + + // Parse the input + DeserializationError error = deserializeMsgPack(doc, input); + + // Test if parsing succeeds + if (error) { + std::cerr << "deserializeMsgPack() failed: " << error.c_str() << std::endl; + return 1; + } + + // Fetch the values + // + // Most of the time, you can rely on the implicit casts. + // In other case, you can do doc["time"].as(); + const char* sensor = doc["sensor"]; + long time = doc["time"]; + double latitude = doc["data"][0]; + double longitude = doc["data"][1]; + + // Print the values + std::cout << sensor << std::endl; + std::cout << time << std::endl; + std::cout << latitude << std::endl; + std::cout << longitude << std::endl; + + return 0; +} diff --git a/mb-script/lib/ArduinoJson/extras/scripts/wandbox/publish.sh b/mb-script/lib/ArduinoJson/extras/scripts/wandbox/publish.sh new file mode 100644 index 00000000..611572f8 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/scripts/wandbox/publish.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -eu + +ARDUINOJSON_H="$1" + +read_string() { + jq --slurp --raw-input '.' "$1" +} + +compile() { + FILE_PATH="$(dirname $0)/$1.cpp" + cat >parameters.json < +// but we don't want it to included accidentally +#undef ARDUINO +#define ARDUINOJSON_ENABLE_STD_STREAM 0 +#define ARDUINOJSON_ENABLE_STD_STRING 0 + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +#if !ARDUINOJSON_ENABLE_STRING_VIEW +# error ARDUINOJSON_ENABLE_STRING_VIEW must be set to 1 +#endif + +using ArduinoJson::detail::sizeofArray; + +TEST_CASE("string_view") { + SpyingAllocator spy; + JsonDocument doc(&spy); + JsonVariant variant = doc.to(); + + SECTION("deserializeJson()") { + auto err = deserializeJson(doc, std::string_view("123", 2)); + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == 12); + } + + SECTION("JsonDocument::set()") { + doc.set(std::string_view("123", 2)); + REQUIRE(doc.as() == "12"); + } + + SECTION("JsonDocument::operator[]() const") { + doc["ab"] = "Yes"; + doc["abc"] = "No"; + REQUIRE(doc[std::string_view("abc", 2)] == "Yes"); + } + + SECTION("JsonDocument::operator[]()") { + doc[std::string_view("abc", 2)] = "Yes"; + REQUIRE(doc["ab"] == "Yes"); + } + + SECTION("JsonVariant::operator==()") { + variant.set("A"); + REQUIRE(variant == std::string_view("AX", 1)); + REQUIRE_FALSE(variant == std::string_view("BX", 1)); + } + + SECTION("JsonVariant::operator>()") { + variant.set("B"); + REQUIRE(variant > std::string_view("AX", 1)); + REQUIRE_FALSE(variant > std::string_view("CX", 1)); + } + + SECTION("JsonVariant::operator<()") { + variant.set("B"); + REQUIRE(variant < std::string_view("CX", 1)); + REQUIRE_FALSE(variant < std::string_view("AX", 1)); + } + + SECTION("String deduplication") { + doc.add(std::string_view("example one", 7)); + doc.add(std::string_view("example two", 7)); + doc.add(std::string_view("example\0tree", 12)); + doc.add(std::string_view("example\0tree and a half", 12)); + + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("example")), + Allocate(sizeofString("example tree")), + }); + } + + SECTION("as()") { + doc["s"] = "Hello World"; + doc["i"] = 42; + REQUIRE(doc["s"].as() == std::string_view("Hello World")); + REQUIRE(doc["i"].as() == std::string_view()); + } + + SECTION("is()") { + doc["s"] = "Hello World"; + doc["i"] = 42; + REQUIRE(doc["s"].is() == true); + REQUIRE(doc["i"].is() == false); + } + + SECTION("String containing NUL") { + doc.set("hello\0world"_s); + REQUIRE(doc.as().size() == 11); + REQUIRE(doc.as() == std::string_view("hello\0world", 11)); + } +} + +using ArduinoJson::detail::adaptString; + +TEST_CASE("StringViewAdapter") { + std::string_view str("bravoXXX", 5); + auto adapter = adaptString(str); + + CHECK(stringCompare(adapter, adaptString("alpha", 5)) > 0); + CHECK(stringCompare(adapter, adaptString("bravo", 5)) == 0); + CHECK(stringCompare(adapter, adaptString("charlie", 7)) < 0); + + CHECK(adapter.size() == 5); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Cpp20/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/Cpp20/CMakeLists.txt new file mode 100644 index 00000000..6346d4d2 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Cpp20/CMakeLists.txt @@ -0,0 +1,29 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +if(MSVC_VERSION LESS 1910) + return() +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10) + return() +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10) + return() +endif() + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +add_executable(Cpp20Tests + smoke_test.cpp +) + +add_test(Cpp20 Cpp20Tests) + +set_tests_properties(Cpp20 + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/Cpp20/smoke_test.cpp b/mb-script/lib/ArduinoJson/extras/tests/Cpp20/smoke_test.cpp new file mode 100644 index 00000000..72dd50f3 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Cpp20/smoke_test.cpp @@ -0,0 +1,15 @@ +#include + +#include +#include + +TEST_CASE("C++20 smoke test") { + JsonDocument doc; + + deserializeJson(doc, "{\"hello\":\"world\"}"); + REQUIRE(doc["hello"] == "world"); + + std::string json; + serializeJson(doc, json); + REQUIRE(json == "{\"hello\":\"world\"}"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/BasicJsonDocument.cpp b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/BasicJsonDocument.cpp new file mode 100644 index 00000000..788fc009 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/BasicJsonDocument.cpp @@ -0,0 +1,69 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +using ArduinoJson::detail::is_base_of; + +static std::string allocatorLog; + +struct CustomAllocator { + CustomAllocator() { + allocatorLog = ""; + } + + void* allocate(size_t n) { + allocatorLog += "A"; + return malloc(n); + } + + void deallocate(void* p) { + free(p); + allocatorLog += "D"; + } + + void* reallocate(void* p, size_t n) { + allocatorLog += "R"; + return realloc(p, n); + } +}; + +TEST_CASE("BasicJsonDocument") { + allocatorLog.clear(); + + SECTION("is a JsonDocument") { + REQUIRE( + is_base_of>::value == + true); + } + + SECTION("deserialize / serialize") { + BasicJsonDocument doc(256); + deserializeJson(doc, "{\"hello\":\"world\"}"); + REQUIRE(doc.as() == "{\"hello\":\"world\"}"); + doc.clear(); + REQUIRE(allocatorLog == "ARAARDDD"); + } + + SECTION("copy") { + BasicJsonDocument doc(256); + doc["hello"] = "world"; + auto copy = doc; + REQUIRE(copy.as() == "{\"hello\":\"world\"}"); + REQUIRE(allocatorLog == "AA"); + } + + SECTION("capacity") { + BasicJsonDocument doc(256); + REQUIRE(doc.capacity() == 256); + } + + SECTION("garbageCollect()") { + BasicJsonDocument doc(256); + doc.garbageCollect(); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/CMakeLists.txt new file mode 100644 index 00000000..bcf33e11 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/CMakeLists.txt @@ -0,0 +1,35 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") + add_compile_options( + -w + ) +endif() + +if(MSVC) + add_compile_options( + /wd4996 + ) +endif() + +add_executable(DeprecatedTests + add.cpp + BasicJsonDocument.cpp + containsKey.cpp + createNestedArray.cpp + createNestedObject.cpp + DynamicJsonDocument.cpp + macros.cpp + memoryUsage.cpp + shallowCopy.cpp + StaticJsonDocument.cpp +) + +add_test(Deprecated DeprecatedTests) + +set_tests_properties(Deprecated + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/DynamicJsonDocument.cpp b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/DynamicJsonDocument.cpp new file mode 100644 index 00000000..7c6d44b8 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/DynamicJsonDocument.cpp @@ -0,0 +1,37 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +using ArduinoJson::detail::is_base_of; + +TEST_CASE("DynamicJsonDocument") { + SECTION("is a JsonDocument") { + REQUIRE(is_base_of::value == true); + } + + SECTION("deserialize / serialize") { + DynamicJsonDocument doc(256); + deserializeJson(doc, "{\"hello\":\"world\"}"); + REQUIRE(doc.as() == "{\"hello\":\"world\"}"); + } + + SECTION("copy") { + DynamicJsonDocument doc(256); + doc["hello"] = "world"; + auto copy = doc; + REQUIRE(copy.as() == "{\"hello\":\"world\"}"); + } + + SECTION("capacity") { + DynamicJsonDocument doc(256); + REQUIRE(doc.capacity() == 256); + } + + SECTION("garbageCollect()") { + DynamicJsonDocument doc(256); + doc.garbageCollect(); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/StaticJsonDocument.cpp b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/StaticJsonDocument.cpp new file mode 100644 index 00000000..39a363be --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/StaticJsonDocument.cpp @@ -0,0 +1,32 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +using ArduinoJson::detail::is_base_of; + +TEST_CASE("StaticJsonDocument") { + SECTION("is a JsonDocument") { + REQUIRE(is_base_of>::value == true); + } + + SECTION("deserialize / serialize") { + StaticJsonDocument<256> doc; + deserializeJson(doc, "{\"hello\":\"world\"}"); + REQUIRE(doc.as() == "{\"hello\":\"world\"}"); + } + + SECTION("copy") { + StaticJsonDocument<256> doc; + doc["hello"] = "world"; + auto copy = doc; + REQUIRE(copy.as() == "{\"hello\":\"world\"}"); + } + + SECTION("capacity") { + StaticJsonDocument<256> doc; + REQUIRE(doc.capacity() == 256); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/add.cpp b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/add.cpp new file mode 100644 index 00000000..586e22b8 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/add.cpp @@ -0,0 +1,38 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArray::add()") { + JsonDocument doc; + JsonArray array = doc.to(); + array.add().set(42); + REQUIRE(doc.as() == "[42]"); +} + +TEST_CASE("JsonDocument::add()") { + JsonDocument doc; + doc.add().set(42); + REQUIRE(doc.as() == "[42]"); +} + +TEST_CASE("ElementProxy::add()") { + JsonDocument doc; + doc[0].add().set(42); + REQUIRE(doc.as() == "[[42]]"); +} + +TEST_CASE("MemberProxy::add()") { + JsonDocument doc; + doc["x"].add().set(42); + REQUIRE(doc.as() == "{\"x\":[42]}"); +} + +TEST_CASE("JsonVariant::add()") { + JsonDocument doc; + JsonVariant v = doc.add(); + v.add().set(42); + REQUIRE(doc.as() == "[[42]]"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/containsKey.cpp b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/containsKey.cpp new file mode 100644 index 00000000..d001d406 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/containsKey.cpp @@ -0,0 +1,246 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Literals.hpp" + +TEST_CASE("JsonDocument::containsKey()") { + JsonDocument doc; + + SECTION("returns true on object") { + doc["hello"] = "world"; + + REQUIRE(doc.containsKey("hello") == true); + } + + SECTION("returns true when value is null") { + doc["hello"] = static_cast(0); + + REQUIRE(doc.containsKey("hello") == true); + } + + SECTION("returns true when key is a std::string") { + doc["hello"] = "world"; + + REQUIRE(doc.containsKey("hello"_s) == true); + } + + SECTION("returns false on object") { + doc["world"] = "hello"; + + REQUIRE(doc.containsKey("hello") == false); + } + + SECTION("returns false on array") { + doc.add("hello"); + + REQUIRE(doc.containsKey("hello") == false); + } + + SECTION("returns false on null") { + REQUIRE(doc.containsKey("hello") == false); + } + + SECTION("supports JsonVariant") { + doc["hello"] = "world"; + doc["key"] = "hello"; + + REQUIRE(doc.containsKey(doc["key"]) == true); + REQUIRE(doc.containsKey(doc["foo"]) == false); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("supports VLAs") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + doc["hello"] = "world"; + + REQUIRE(doc.containsKey(vla) == true); + } +#endif +} + +TEST_CASE("MemberProxy::containsKey()") { + JsonDocument doc; + const auto& mp = doc["hello"]; + + SECTION("containsKey(const char*)") { + mp["key"] = "value"; + + REQUIRE(mp.containsKey("key") == true); + REQUIRE(mp.containsKey("key") == true); + } + + SECTION("containsKey(std::string)") { + mp["key"] = "value"; + + REQUIRE(mp.containsKey("key"_s) == true); + REQUIRE(mp.containsKey("key"_s) == true); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("supports VLAs") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + mp["hello"] = "world"; + + REQUIRE(mp.containsKey(vla) == true); + } +#endif +} + +TEST_CASE("JsonObject::containsKey()") { + JsonDocument doc; + JsonObject obj = doc.to(); + obj["hello"] = 42; + + SECTION("returns true only if key is present") { + REQUIRE(false == obj.containsKey("world")); + REQUIRE(true == obj.containsKey("hello")); + } + + SECTION("returns false after remove()") { + obj.remove("hello"); + + REQUIRE(false == obj.containsKey("hello")); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("key is a VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + REQUIRE(true == obj.containsKey(vla)); + } +#endif + + SECTION("key is a JsonVariant") { + doc["key"] = "hello"; + REQUIRE(true == obj.containsKey(obj["key"])); + REQUIRE(false == obj.containsKey(obj["hello"])); + } + + SECTION("std::string") { + REQUIRE(true == obj.containsKey("hello"_s)); + } + + SECTION("unsigned char[]") { + unsigned char key[] = "hello"; + REQUIRE(true == obj.containsKey(key)); + } +} + +TEST_CASE("JsonObjectConst::containsKey()") { + JsonDocument doc; + doc["hello"] = 42; + auto obj = doc.as(); + + SECTION("supports const char*") { + REQUIRE(false == obj.containsKey("world")); + REQUIRE(true == obj.containsKey("hello")); + } + + SECTION("supports std::string") { + REQUIRE(false == obj.containsKey("world"_s)); + REQUIRE(true == obj.containsKey("hello"_s)); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("supports VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + REQUIRE(true == obj.containsKey(vla)); + } +#endif + + SECTION("supports JsonVariant") { + doc["key"] = "hello"; + REQUIRE(true == obj.containsKey(obj["key"])); + REQUIRE(false == obj.containsKey(obj["hello"])); + } +} + +TEST_CASE("JsonVariant::containsKey()") { + JsonDocument doc; + JsonVariant var = doc.to(); + + SECTION("returns false is unbound") { + CHECK_FALSE(JsonVariant().containsKey("hello")); + } + + SECTION("containsKey(const char*)") { + var["hello"] = "world"; + + REQUIRE(var.containsKey("hello") == true); + REQUIRE(var.containsKey("world") == false); + } + + SECTION("containsKey(std::string)") { + var["hello"] = "world"; + + REQUIRE(var.containsKey("hello"_s) == true); + REQUIRE(var.containsKey("world"_s) == false); + } + + SECTION("containsKey(JsonVariant)") { + var["hello"] = "world"; + var["key"] = "hello"; + + REQUIRE(var.containsKey(doc["key"]) == true); + REQUIRE(var.containsKey(doc["foo"]) == false); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("supports VLAs") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + var["hello"] = "world"; + + REQUIRE(var.containsKey(vla) == true); + } +#endif +} + +TEST_CASE("JsonVariantConst::containsKey()") { + JsonDocument doc; + doc["hello"] = "world"; + JsonVariantConst var = doc.as(); + + SECTION("support const char*") { + REQUIRE(var.containsKey("hello") == true); + REQUIRE(var.containsKey("world") == false); + } + + SECTION("support std::string") { + REQUIRE(var.containsKey("hello"_s) == true); + REQUIRE(var.containsKey("world"_s) == false); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("supports VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + REQUIRE(true == var.containsKey(vla)); + } +#endif + + SECTION("support JsonVariant") { + doc["key"] = "hello"; + REQUIRE(var.containsKey(var["key"]) == true); + REQUIRE(var.containsKey(var["foo"]) == false); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/createNestedArray.cpp b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/createNestedArray.cpp new file mode 100644 index 00000000..858c022d --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/createNestedArray.cpp @@ -0,0 +1,113 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +#include "Literals.hpp" + +TEST_CASE("JsonDocument::createNestedArray()") { + JsonDocument doc; + + SECTION("createNestedArray()") { + JsonArray array = doc.createNestedArray(); + array.add(42); + REQUIRE(doc.as() == "[[42]]"); + } + + SECTION("createNestedArray(const char*)") { + JsonArray array = doc.createNestedArray("key"); + array.add(42); + REQUIRE(doc.as() == "{\"key\":[42]}"); + } + + SECTION("createNestedArray(std::string)") { + JsonArray array = doc.createNestedArray("key"_s); + array.add(42); + REQUIRE(doc.as() == "{\"key\":[42]}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("createNestedArray(VLA)") { + size_t i = 16; + char vla[i]; + strcpy(vla, "key"); + JsonArray array = doc.createNestedArray(vla); + array.add(42); + REQUIRE(doc.as() == "{\"key\":[42]}"); + } +#endif +} + +TEST_CASE("JsonArray::createNestedArray()") { + JsonDocument doc; + JsonArray array = doc.to(); + JsonArray nestedArray = array.createNestedArray(); + nestedArray.add(42); + REQUIRE(doc.as() == "[[42]]"); +} + +TEST_CASE("JsonObject::createNestedArray()") { + JsonDocument doc; + JsonObject object = doc.to(); + + SECTION("createNestedArray(const char*)") { + JsonArray array = object.createNestedArray("key"); + array.add(42); + REQUIRE(doc.as() == "{\"key\":[42]}"); + } + + SECTION("createNestedArray(std::string)") { + JsonArray array = object.createNestedArray("key"_s); + array.add(42); + REQUIRE(doc.as() == "{\"key\":[42]}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("createNestedArray(VLA)") { + size_t i = 16; + char vla[i]; + strcpy(vla, "key"); + JsonArray array = object.createNestedArray(vla); + array.add(42); + REQUIRE(doc.as() == "{\"key\":[42]}"); + } +#endif +} + +TEST_CASE("JsonVariant::createNestedArray()") { + JsonDocument doc; + JsonVariant variant = doc.to(); + + SECTION("createNestedArray()") { + JsonArray array = variant.createNestedArray(); + array.add(42); + REQUIRE(doc.as() == "[[42]]"); + } + + SECTION("createNestedArray(const char*)") { + JsonArray array = variant.createNestedArray("key"); + array.add(42); + REQUIRE(doc.as() == "{\"key\":[42]}"); + } + + SECTION("createNestedArray(std::string)") { + JsonArray array = variant.createNestedArray("key"_s); + array.add(42); + REQUIRE(doc.as() == "{\"key\":[42]}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("createNestedArray(VLA)") { + size_t i = 16; + char vla[i]; + strcpy(vla, "key"); + JsonArray array = variant.createNestedArray(vla); + array.add(42); + REQUIRE(doc.as() == "{\"key\":[42]}"); + } +#endif +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/createNestedObject.cpp b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/createNestedObject.cpp new file mode 100644 index 00000000..c035eb8f --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/createNestedObject.cpp @@ -0,0 +1,113 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +#include "Literals.hpp" + +TEST_CASE("JsonDocument::createNestedObject()") { + JsonDocument doc; + + SECTION("createNestedObject()") { + JsonObject object = doc.createNestedObject(); + object["hello"] = "world"; + REQUIRE(doc.as() == "[{\"hello\":\"world\"}]"); + } + + SECTION("createNestedObject(const char*)") { + JsonObject object = doc.createNestedObject("key"); + object["hello"] = "world"; + REQUIRE(doc.as() == "{\"key\":{\"hello\":\"world\"}}"); + } + + SECTION("createNestedObject(std::string)") { + JsonObject object = doc.createNestedObject("key"_s); + object["hello"] = "world"; + REQUIRE(doc.as() == "{\"key\":{\"hello\":\"world\"}}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("createNestedObject(VLA)") { + size_t i = 16; + char vla[i]; + strcpy(vla, "key"); + JsonObject object = doc.createNestedObject(vla); + object["hello"] = "world"; + REQUIRE(doc.as() == "{\"key\":{\"hello\":\"world\"}}"); + } +#endif +} + +TEST_CASE("JsonArray::createNestedObject()") { + JsonDocument doc; + JsonArray array = doc.to(); + JsonObject object = array.createNestedObject(); + object["hello"] = "world"; + REQUIRE(doc.as() == "[{\"hello\":\"world\"}]"); +} + +TEST_CASE("JsonObject::createNestedObject()") { + JsonDocument doc; + JsonObject object = doc.to(); + + SECTION("createNestedObject(const char*)") { + JsonObject nestedObject = object.createNestedObject("key"); + nestedObject["hello"] = "world"; + REQUIRE(doc.as() == "{\"key\":{\"hello\":\"world\"}}"); + } + + SECTION("createNestedObject(std::string)") { + JsonObject nestedObject = object.createNestedObject("key"_s); + nestedObject["hello"] = "world"; + REQUIRE(doc.as() == "{\"key\":{\"hello\":\"world\"}}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("createNestedObject(VLA)") { + size_t i = 16; + char vla[i]; + strcpy(vla, "key"); + JsonObject nestedObject = object.createNestedObject(vla); + nestedObject["hello"] = "world"; + REQUIRE(doc.as() == "{\"key\":{\"hello\":\"world\"}}"); + } +#endif +} + +TEST_CASE("JsonVariant::createNestedObject()") { + JsonDocument doc; + JsonVariant variant = doc.to(); + + SECTION("createNestedObject()") { + JsonObject object = variant.createNestedObject(); + object["hello"] = "world"; + REQUIRE(doc.as() == "[{\"hello\":\"world\"}]"); + } + + SECTION("createNestedObject(const char*)") { + JsonObject object = variant.createNestedObject("key"); + object["hello"] = "world"; + REQUIRE(doc.as() == "{\"key\":{\"hello\":\"world\"}}"); + } + + SECTION("createNestedObject(std::string)") { + JsonObject object = variant.createNestedObject("key"_s); + object["hello"] = "world"; + REQUIRE(doc.as() == "{\"key\":{\"hello\":\"world\"}}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("createNestedObject(VLA)") { + size_t i = 16; + char vla[i]; + strcpy(vla, "key"); + JsonObject object = variant.createNestedObject(vla); + object["hello"] = "world"; + REQUIRE(doc.as() == "{\"key\":{\"hello\":\"world\"}}"); + } +#endif +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/macros.cpp b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/macros.cpp new file mode 100644 index 00000000..2e73d5b3 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/macros.cpp @@ -0,0 +1,18 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JSON_ARRAY_SIZE") { + REQUIRE(JSON_ARRAY_SIZE(10) == ArduinoJson::detail::sizeofArray(10)); +} + +TEST_CASE("JSON_OBJECT_SIZE") { + REQUIRE(JSON_OBJECT_SIZE(10) == ArduinoJson::detail::sizeofObject(10)); +} + +TEST_CASE("JSON_STRING_SIZE") { + REQUIRE(JSON_STRING_SIZE(10) == 11); // issue #2054 +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/memoryUsage.cpp b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/memoryUsage.cpp new file mode 100644 index 00000000..89258f08 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/memoryUsage.cpp @@ -0,0 +1,51 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArray::memoryUsage()") { + JsonArray array; + REQUIRE(array.memoryUsage() == 0); +} + +TEST_CASE("JsonArrayConst::memoryUsage()") { + JsonArrayConst array; + REQUIRE(array.memoryUsage() == 0); +} + +TEST_CASE("JsonDocument::memoryUsage()") { + JsonDocument doc; + REQUIRE(doc.memoryUsage() == 0); +} + +TEST_CASE("JsonObject::memoryUsage()") { + JsonObject array; + REQUIRE(array.memoryUsage() == 0); +} + +TEST_CASE("JsonObjectConst::memoryUsage()") { + JsonObjectConst array; + REQUIRE(array.memoryUsage() == 0); +} + +TEST_CASE("JsonVariant::memoryUsage()") { + JsonVariant doc; + REQUIRE(doc.memoryUsage() == 0); +} + +TEST_CASE("JsonVariantConst::memoryUsage()") { + JsonVariantConst doc; + REQUIRE(doc.memoryUsage() == 0); +} + +TEST_CASE("ElementProxy::memoryUsage()") { + JsonDocument doc; + REQUIRE(doc[0].memoryUsage() == 0); +} + +TEST_CASE("MemberProxy::memoryUsage()") { + JsonDocument doc; + REQUIRE(doc["hello"].memoryUsage() == 0); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Deprecated/shallowCopy.cpp b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/shallowCopy.cpp new file mode 100644 index 00000000..1f0d12e3 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Deprecated/shallowCopy.cpp @@ -0,0 +1,14 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("shallowCopy()") { + JsonDocument doc1, doc2; + doc1["b"] = "c"; + doc2["a"].shallowCopy(doc1); + + REQUIRE(doc2.as() == "{\"a\":{\"b\":\"c\"}}"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/CMakeLists.txt new file mode 100644 index 00000000..08dbe529 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/CMakeLists.txt @@ -0,0 +1,32 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +macro(add_failing_build source_file) + get_filename_component(target ${source_file} NAME_WE) + + add_executable(${target} ${source_file}) + + set_target_properties(${target} + PROPERTIES + EXCLUDE_FROM_ALL TRUE + EXCLUDE_FROM_DEFAULT_BUILD TRUE + ) + add_test( + NAME ${target} + COMMAND ${CMAKE_COMMAND} --build . --target ${target} --config $ + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + set_tests_properties(${target} + PROPERTIES + WILL_FAIL TRUE + LABELS "WillFail" + ) +endmacro() + +add_failing_build(Issue978.cpp) +add_failing_build(read_long_long.cpp) +add_failing_build(write_long_long.cpp) +add_failing_build(variant_as_char.cpp) +add_failing_build(assign_char.cpp) +add_failing_build(deserialize_object.cpp) diff --git a/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/Issue978.cpp b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/Issue978.cpp new file mode 100644 index 00000000..3b9ec958 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/Issue978.cpp @@ -0,0 +1,13 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +struct Stream {}; + +int main() { + Stream* stream = 0; + JsonDocument doc; + deserializeJson(doc, stream); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/assign_char.cpp b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/assign_char.cpp new file mode 100644 index 00000000..888d23c9 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/assign_char.cpp @@ -0,0 +1,12 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +// See issue #1498 + +int main() { + JsonDocument doc; + doc["dummy"] = 'A'; +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/deserialize_object.cpp b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/deserialize_object.cpp new file mode 100644 index 00000000..b9313ed4 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/deserialize_object.cpp @@ -0,0 +1,12 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +// See issue #2135 + +int main() { + JsonObject obj; + deserializeJson(obj, ""); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/read_long_long.cpp b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/read_long_long.cpp new file mode 100644 index 00000000..daf1f40d --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/read_long_long.cpp @@ -0,0 +1,16 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_USE_LONG_LONG 0 +#include + +#if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ >= 8 +# error This test requires sizeof(long) < 8 +#endif + +ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(long long) +int main() { + JsonDocument doc; + doc["dummy"].as(); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/variant_as_char.cpp b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/variant_as_char.cpp new file mode 100644 index 00000000..b1e86ee6 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/variant_as_char.cpp @@ -0,0 +1,12 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +// See issue #1498 + +int main() { + JsonDocument doc; + doc["dummy"].as(); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/write_long_long.cpp b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/write_long_long.cpp new file mode 100644 index 00000000..4aee6565 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/FailingBuilds/write_long_long.cpp @@ -0,0 +1,15 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_USE_LONG_LONG 0 +#include + +#if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ >= 8 +# error This test requires sizeof(long) < 8 +#endif + +int main() { + JsonDocument doc; + doc["dummy"] = static_cast(42); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Helpers/Allocators.hpp b/mb-script/lib/ArduinoJson/extras/tests/Helpers/Allocators.hpp new file mode 100644 index 00000000..17e05cab --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Helpers/Allocators.hpp @@ -0,0 +1,288 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#pragma once + +#include +#include +#include + +#include + +namespace { + +struct FailingAllocator : ArduinoJson::Allocator { + static FailingAllocator* instance() { + static FailingAllocator allocator; + return &allocator; + } + + private: + FailingAllocator() = default; + ~FailingAllocator() = default; + + void* allocate(size_t) override { + return nullptr; + } + + void deallocate(void*) override {} + + void* reallocate(void*, size_t) override { + return nullptr; + } +}; + +class AllocatorLogEntry { + public: + AllocatorLogEntry(std::string s, size_t n = 1) : str_(s), count_(n) {} + + const std::string& str() const { + return str_; + } + + size_t count() const { + return count_; + } + + AllocatorLogEntry operator*(size_t n) const { + return AllocatorLogEntry(str_, n); + } + + private: + std::string str_; + size_t count_; +}; + +inline AllocatorLogEntry Allocate(size_t s) { + char buffer[32]; + snprintf(buffer, sizeof(buffer), "allocate(%zu)", s); + return AllocatorLogEntry(buffer); +} + +inline AllocatorLogEntry AllocateFail(size_t s) { + char buffer[32]; + snprintf(buffer, sizeof(buffer), "allocate(%zu) -> nullptr", s); + return AllocatorLogEntry(buffer); +} + +inline AllocatorLogEntry Reallocate(size_t s1, size_t s2) { + char buffer[32]; + snprintf(buffer, sizeof(buffer), "reallocate(%zu, %zu)", s1, s2); + return AllocatorLogEntry(buffer); +} + +inline AllocatorLogEntry ReallocateFail(size_t s1, size_t s2) { + char buffer[32]; + snprintf(buffer, sizeof(buffer), "reallocate(%zu, %zu) -> nullptr", s1, s2); + return AllocatorLogEntry(buffer); +} + +inline AllocatorLogEntry Deallocate(size_t s) { + char buffer[32]; + snprintf(buffer, sizeof(buffer), "deallocate(%zu)", s); + return AllocatorLogEntry(buffer); +} + +class AllocatorLog { + public: + AllocatorLog() = default; + AllocatorLog(std::initializer_list list) { + for (auto& entry : list) + append(entry); + } + + void clear() { + log_.str(""); + } + + void append(const AllocatorLogEntry& entry) { + for (size_t i = 0; i < entry.count(); i++) + log_ << entry.str() << "\n"; + } + + std::string str() const { + auto s = log_.str(); + if (s.empty()) + return "(empty)"; + s.pop_back(); // remove the trailing '\n' + return s; + } + + bool operator==(const AllocatorLog& other) const { + return str() == other.str(); + } + + friend std::ostream& operator<<(std::ostream& os, const AllocatorLog& log) { + os << log.str(); + return os; + } + + private: + std::ostringstream log_; +}; + +class SpyingAllocator : public ArduinoJson::Allocator { + public: + SpyingAllocator( + Allocator* upstream = ArduinoJson::detail::DefaultAllocator::instance()) + : upstream_(upstream) {} + virtual ~SpyingAllocator() {} + + size_t allocatedBytes() const { + return allocatedBytes_; + } + + void* allocate(size_t n) override { + auto block = reinterpret_cast( + upstream_->allocate(sizeof(AllocatedBlock) + n - 1)); + if (block) { + log_.append(Allocate(n)); + allocatedBytes_ += n; + block->size = n; + return block->payload; + } else { + log_.append(AllocateFail(n)); + return nullptr; + } + } + + void deallocate(void* p) override { + auto block = AllocatedBlock::fromPayload(p); + allocatedBytes_ -= block->size; + log_.append(Deallocate(block ? block->size : 0)); + upstream_->deallocate(block); + } + + void* reallocate(void* p, size_t n) override { + auto block = AllocatedBlock::fromPayload(p); + auto oldSize = block ? block->size : 0; + block = reinterpret_cast( + upstream_->reallocate(block, sizeof(AllocatedBlock) + n - 1)); + if (block) { + log_.append(Reallocate(oldSize, n)); + block->size = n; + allocatedBytes_ += n - oldSize; + return block->payload; + } else { + log_.append(ReallocateFail(oldSize, n)); + return nullptr; + } + } + + void clearLog() { + log_.clear(); + } + + const AllocatorLog& log() const { + return log_; + } + + private: + struct AllocatedBlock { + size_t size; + char payload[1]; + + static AllocatedBlock* fromPayload(void* p) { + if (!p) + return nullptr; + return reinterpret_cast( + // Cast to void* to silence "cast increases required alignment of + // target type [-Werror=cast-align]" + reinterpret_cast(reinterpret_cast(p) - + offsetof(AllocatedBlock, payload))); + } + }; + + AllocatorLog log_; + Allocator* upstream_; + size_t allocatedBytes_ = 0; +}; + +class KillswitchAllocator : public ArduinoJson::Allocator { + public: + KillswitchAllocator( + Allocator* upstream = ArduinoJson::detail::DefaultAllocator::instance()) + : working_(true), upstream_(upstream) {} + virtual ~KillswitchAllocator() {} + + void* allocate(size_t n) override { + return working_ ? upstream_->allocate(n) : 0; + } + + void deallocate(void* p) override { + upstream_->deallocate(p); + } + + void* reallocate(void* ptr, size_t n) override { + return working_ ? upstream_->reallocate(ptr, n) : 0; + } + + // Turn the killswitch on, so all allocation fail + void on() { + working_ = false; + } + + private: + bool working_; + Allocator* upstream_; +}; + +class TimebombAllocator : public ArduinoJson::Allocator { + public: + TimebombAllocator( + size_t initialCountdown, + Allocator* upstream = ArduinoJson::detail::DefaultAllocator::instance()) + : countdown_(initialCountdown), upstream_(upstream) {} + virtual ~TimebombAllocator() {} + + void* allocate(size_t n) override { + if (!countdown_) + return nullptr; + countdown_--; + return upstream_->allocate(n); + } + + void deallocate(void* p) override { + upstream_->deallocate(p); + } + + void* reallocate(void* ptr, size_t n) override { + if (!countdown_) + return nullptr; + countdown_--; + return upstream_->reallocate(ptr, n); + } + + void setCountdown(size_t value) { + countdown_ = value; + } + + private: + size_t countdown_ = 0; + Allocator* upstream_; +}; +} // namespace + +inline size_t sizeofPoolList(size_t n = ARDUINOJSON_INITIAL_POOL_COUNT) { + using namespace ArduinoJson::detail; + return sizeof(MemoryPool) * n; +} + +inline size_t sizeofPool( + ArduinoJson::detail::SlotCount n = ARDUINOJSON_POOL_CAPACITY) { + using namespace ArduinoJson::detail; + return MemoryPool::slotsToBytes(n); +} + +inline size_t sizeofStringBuffer(size_t iteration = 1) { + // returns 31, 63, 127, 255, etc. + auto capacity = ArduinoJson::detail::StringBuilder::initialCapacity; + for (size_t i = 1; i < iteration; i++) + capacity = capacity * 2 + 1; + return ArduinoJson::detail::sizeofString(capacity); +} + +inline size_t sizeofString(const char* s) { + return ArduinoJson::detail::sizeofString(strlen(s)); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Helpers/Arduino.h b/mb-script/lib/ArduinoJson/extras/tests/Helpers/Arduino.h new file mode 100644 index 00000000..d12f872a --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Helpers/Arduino.h @@ -0,0 +1,13 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#pragma once + +#include "api/Print.h" +#include "api/Stream.h" +#include "api/String.h" +#include "avr/pgmspace.h" + +#define ARDUINO +#define ARDUINO_H_INCLUDED 1 diff --git a/mb-script/lib/ArduinoJson/extras/tests/Helpers/CustomReader.hpp b/mb-script/lib/ArduinoJson/extras/tests/Helpers/CustomReader.hpp new file mode 100644 index 00000000..76a51383 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Helpers/CustomReader.hpp @@ -0,0 +1,24 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#pragma once + +#include + +class CustomReader { + std::stringstream stream_; + + public: + CustomReader(const char* input) : stream_(input) {} + CustomReader(const CustomReader&) = delete; + + int read() { + return stream_.get(); + } + + size_t readBytes(char* buffer, size_t length) { + stream_.read(buffer, static_cast(length)); + return static_cast(stream_.gcount()); + } +}; diff --git a/mb-script/lib/ArduinoJson/extras/tests/Helpers/Literals.hpp b/mb-script/lib/ArduinoJson/extras/tests/Helpers/Literals.hpp new file mode 100644 index 00000000..07c079dc --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Helpers/Literals.hpp @@ -0,0 +1,12 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#pragma once + +#include + +// the space before _s is required by GCC 4.8 +inline std::string operator"" _s(const char* str, size_t len) { + return std::string(str, len); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Helpers/api/Print.h b/mb-script/lib/ArduinoJson/extras/tests/Helpers/api/Print.h new file mode 100644 index 00000000..cdf05bbf --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Helpers/api/Print.h @@ -0,0 +1,33 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#pragma once + +#include +#include +#include + +class Print { + public: + virtual ~Print() {} + + virtual size_t write(uint8_t) = 0; + virtual size_t write(const uint8_t* buffer, size_t size) = 0; + + size_t write(const char* str) { + if (!str) + return 0; + return write(reinterpret_cast(str), strlen(str)); + } + + size_t write(const char* buffer, size_t size) { + return write(reinterpret_cast(buffer), size); + } +}; + +class Printable { + public: + virtual ~Printable() {} + virtual size_t printTo(Print& p) const = 0; +}; diff --git a/mb-script/lib/ArduinoJson/extras/tests/Helpers/api/Stream.h b/mb-script/lib/ArduinoJson/extras/tests/Helpers/api/Stream.h new file mode 100644 index 00000000..64b9eaf9 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Helpers/api/Stream.h @@ -0,0 +1,14 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#pragma once + +// Reproduces Arduino's Stream class +class Stream // : public Print +{ + public: + virtual ~Stream() {} + virtual int read() = 0; + virtual size_t readBytes(char* buffer, size_t length) = 0; +}; diff --git a/mb-script/lib/ArduinoJson/extras/tests/Helpers/api/String.h b/mb-script/lib/ArduinoJson/extras/tests/Helpers/api/String.h new file mode 100644 index 00000000..1841610c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Helpers/api/String.h @@ -0,0 +1,75 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#pragma once + +#include + +// Reproduces Arduino's String class +class String { + public: + String() = default; + String(const char* s) { + if (s) + str_.assign(s); + } + + void limitCapacityTo(size_t maxCapacity) { + maxCapacity_ = maxCapacity; + } + + unsigned char concat(const char* s) { + return concat(s, strlen(s)); + } + + size_t length() const { + return str_.size(); + } + + const char* c_str() const { + return str_.c_str(); + } + + bool operator==(const char* s) const { + return str_ == s; + } + + String& operator=(const char* s) { + if (s) + str_.assign(s); + else + str_.clear(); + return *this; + } + + char operator[](unsigned int index) const { + if (index >= str_.size()) + return 0; + return str_[index]; + } + + friend std::ostream& operator<<(std::ostream& lhs, const ::String& rhs) { + lhs << rhs.str_; + return lhs; + } + + protected: + // This function is protected in most Arduino cores + unsigned char concat(const char* s, size_t n) { + if (str_.size() + n > maxCapacity_) + return 0; + str_.append(s, n); + return 1; + } + + private: + std::string str_; + size_t maxCapacity_ = 1024; +}; + +class StringSumHelper : public ::String {}; + +inline bool operator==(const std::string& lhs, const ::String& rhs) { + return lhs == rhs.c_str(); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Helpers/avr/pgmspace.h b/mb-script/lib/ArduinoJson/extras/tests/Helpers/avr/pgmspace.h new file mode 100644 index 00000000..8cbf44e0 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Helpers/avr/pgmspace.h @@ -0,0 +1,31 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#pragma once + +#include // uint8_t + +#define PROGMEM + +class __FlashStringHelper; + +inline const void* convertPtrToFlash(const void* s) { + return reinterpret_cast(s) + 42; +} + +inline const void* convertFlashToPtr(const void* s) { + return reinterpret_cast(s) - 42; +} + +#define PSTR(X) reinterpret_cast(convertPtrToFlash(X)) +#define F(X) reinterpret_cast(PSTR(X)) + +inline uint8_t pgm_read_byte(const void* p) { + return *reinterpret_cast(convertFlashToPtr(p)); +} + +#define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, ...) \ + static type const ARDUINOJSON_CONCAT2(name, _progmem)[] = __VA_ARGS__; \ + static type const* name = reinterpret_cast( \ + convertPtrToFlash(ARDUINOJSON_CONCAT2(name, _progmem))); diff --git a/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/CMakeLists.txt new file mode 100644 index 00000000..d3e40048 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/CMakeLists.txt @@ -0,0 +1,24 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(IntegrationTests + gbathree.cpp + issue772.cpp + round_trip.cpp + openweathermap.cpp +) + +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6) + target_compile_options(IntegrationTests + PUBLIC + -fsingle-precision-constant # issue 544 + ) +endif() + +add_test(IntegrationTests IntegrationTests) + +set_tests_properties(IntegrationTests + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/gbathree.cpp b/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/gbathree.cpp new file mode 100644 index 00000000..fead9ff0 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/gbathree.cpp @@ -0,0 +1,210 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("Gbathree") { + JsonDocument doc; + + DeserializationError error = deserializeJson( + doc, + "{\"protocol_name\":\"fluorescence\",\"repeats\":1,\"wait\":0," + "\"averages\":1,\"measurements\":3,\"meas2_light\":15,\"meas1_" + "baseline\":0,\"act_light\":20,\"pulsesize\":25,\"pulsedistance\":" + "10000,\"actintensity1\":50,\"actintensity2\":255,\"measintensity\":" + "255,\"calintensity\":255,\"pulses\":[50,50,50],\"act\":[2,1,2,2]," + "\"red\":[2,2,2,2],\"detectors\":[[34,34,34,34],[34,34,34,34],[34," + "34,34,34],[34,34,34,34]],\"alta\":[2,2,2,2],\"altb\":[2,2,2,2]," + "\"measlights\":[[15,15,15,15],[15,15,15,15],[15,15,15,15],[15,15," + "15,15]],\"measlights2\":[[15,15,15,15],[15,15,15,15],[15,15,15,15]," + "[15,15,15,15]],\"altc\":[2,2,2,2],\"altd\":[2,2,2,2]}"); + JsonObject root = doc.as(); + + SECTION("Success") { + REQUIRE(error == DeserializationError::Ok); + } + + SECTION("ProtocolName") { + REQUIRE("fluorescence" == root["protocol_name"]); + } + + SECTION("Repeats") { + REQUIRE(1 == root["repeats"]); + } + + SECTION("Wait") { + REQUIRE(0 == root["wait"]); + } + + SECTION("Measurements") { + REQUIRE(3 == root["measurements"]); + } + + SECTION("Meas2_Light") { + REQUIRE(15 == root["meas2_light"]); + } + + SECTION("Meas1_Baseline") { + REQUIRE(0 == root["meas1_baseline"]); + } + + SECTION("Act_Light") { + REQUIRE(20 == root["act_light"]); + } + + SECTION("Pulsesize") { + REQUIRE(25 == root["pulsesize"]); + } + + SECTION("Pulsedistance") { + REQUIRE(10000 == root["pulsedistance"]); + } + + SECTION("Actintensity1") { + REQUIRE(50 == root["actintensity1"]); + } + + SECTION("Actintensity2") { + REQUIRE(255 == root["actintensity2"]); + } + + SECTION("Measintensity") { + REQUIRE(255 == root["measintensity"]); + } + + SECTION("Calintensity") { + REQUIRE(255 == root["calintensity"]); + } + + SECTION("Pulses") { + // "pulses":[50,50,50] + + JsonArray array = root["pulses"]; + REQUIRE(array.isNull() == false); + + REQUIRE(3 == array.size()); + + for (size_t i = 0; i < 3; i++) { + REQUIRE(50 == array[i]); + } + } + + SECTION("Act") { + // "act":[2,1,2,2] + + JsonArray array = root["act"]; + REQUIRE(array.isNull() == false); + + REQUIRE(4 == array.size()); + REQUIRE(2 == array[0]); + REQUIRE(1 == array[1]); + REQUIRE(2 == array[2]); + REQUIRE(2 == array[3]); + } + + SECTION("Detectors") { + // "detectors":[[34,34,34,34],[34,34,34,34],[34,34,34,34],[34,34,34,34]] + + JsonArray array = root["detectors"]; + REQUIRE(array.isNull() == false); + REQUIRE(4 == array.size()); + + for (size_t i = 0; i < 4; i++) { + JsonArray nestedArray = array[i]; + REQUIRE(4 == nestedArray.size()); + + for (size_t j = 0; j < 4; j++) { + REQUIRE(34 == nestedArray[j]); + } + } + } + + SECTION("Alta") { + // alta:[2,2,2,2] + + JsonArray array = root["alta"]; + REQUIRE(array.isNull() == false); + + REQUIRE(4 == array.size()); + + for (size_t i = 0; i < 4; i++) { + REQUIRE(2 == array[i]); + } + } + + SECTION("Altb") { + // altb:[2,2,2,2] + + JsonArray array = root["altb"]; + REQUIRE(array.isNull() == false); + + REQUIRE(4 == array.size()); + + for (size_t i = 0; i < 4; i++) { + REQUIRE(2 == array[i]); + } + } + + SECTION("Measlights") { + // "measlights":[[15,15,15,15],[15,15,15,15],[15,15,15,15],[15,15,15,15]] + + JsonArray array = root["measlights"]; + REQUIRE(array.isNull() == false); + REQUIRE(4 == array.size()); + + for (size_t i = 0; i < 4; i++) { + JsonArray nestedArray = array[i]; + + REQUIRE(4 == nestedArray.size()); + + for (size_t j = 0; j < 4; j++) { + REQUIRE(15 == nestedArray[j]); + } + } + } + + SECTION("Measlights2") { + // "measlights2":[[15,15,15,15],[15,15,15,15],[15,15,15,15],[15,15,15,15]] + + JsonArray array = root["measlights2"]; + REQUIRE(array.isNull() == false); + REQUIRE(4 == array.size()); + + for (size_t i = 0; i < 4; i++) { + JsonArray nestedArray = array[i]; + REQUIRE(4 == nestedArray.size()); + + for (size_t j = 0; j < 4; j++) { + REQUIRE(15 == nestedArray[j]); + } + } + } + + SECTION("Altc") { + // altc:[2,2,2,2] + + JsonArray array = root["altc"]; + REQUIRE(array.isNull() == false); + + REQUIRE(4 == array.size()); + + for (size_t i = 0; i < 4; i++) { + REQUIRE(2 == array[i]); + } + } + + SECTION("Altd") { + // altd:[2,2,2,2] + + JsonArray array = root["altd"]; + REQUIRE(array.isNull() == false); + + REQUIRE(4 == array.size()); + + for (size_t i = 0; i < 4; i++) { + REQUIRE(2 == array[i]); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/issue772.cpp b/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/issue772.cpp new file mode 100644 index 00000000..e81cf40c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/issue772.cpp @@ -0,0 +1,28 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +// https://github.com/bblanchon/ArduinoJson/issues/772 + +TEST_CASE("Issue772") { + JsonDocument doc1; + JsonDocument doc2; + DeserializationError err; + std::string data = + "{\"state\":{\"reported\":{\"timestamp\":\"2018-07-02T09:40:12Z\"," + "\"mac\":\"2C3AE84FC076\",\"firmwareVersion\":\"v0.2.7-5-gf4d4d78\"," + "\"visibleLight\":261,\"infraRed\":255,\"ultraViolet\":0.02," + "\"Temperature\":26.63,\"Pressure\":101145.7,\"Humidity\":54.79883," + "\"Vbat\":4.171261,\"soilMoisture\":0,\"ActB\":0}}}"; + err = deserializeJson(doc1, data); + REQUIRE(err == DeserializationError::Ok); + + data = ""; + serializeMsgPack(doc1, data); + err = deserializeMsgPack(doc2, data); + + REQUIRE(err == DeserializationError::Ok); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/openweathermap.cpp b/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/openweathermap.cpp new file mode 100644 index 00000000..34dbba25 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/openweathermap.cpp @@ -0,0 +1,68 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("OpenWeatherMap") { + // clang-format off + const char* input_json = "{\"cod\":\"200\",\"message\":0,\"cnt\":40,\"list\":[{\"dt\":1581498000,\"main\":{\"temp\":3.23,\"feels_like\":-3.63,\"temp_min\":3.23,\"temp_max\":4.62,\"pressure\":1014,\"sea_level\":1014,\"grnd_level\":1010,\"humidity\":58,\"temp_kf\":-1.39},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01d\"}],\"clouds\":{\"all\":0},\"wind\":{\"speed\":6.19,\"deg\":266},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-12 09:00:00\"},{\"dt\":1581508800,\"main\":{\"temp\":6.09,\"feels_like\":-1.07,\"temp_min\":6.09,\"temp_max\":7.13,\"pressure\":1015,\"sea_level\":1015,\"grnd_level\":1011,\"humidity\":48,\"temp_kf\":-1.04},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01d\"}],\"clouds\":{\"all\":9},\"wind\":{\"speed\":6.64,\"deg\":268},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-12 12:00:00\"},{\"dt\":1581519600,\"main\":{\"temp\":6.82,\"feels_like\":0.47,\"temp_min\":6.82,\"temp_max\":7.52,\"pressure\":1015,\"sea_level\":1015,\"grnd_level\":1011,\"humidity\":47,\"temp_kf\":-0.7},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":97},\"wind\":{\"speed\":5.55,\"deg\":267},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-12 15:00:00\"},{\"dt\":1581530400,\"main\":{\"temp\":5.76,\"feels_like\":1.84,\"temp_min\":5.76,\"temp_max\":6.11,\"pressure\":1015,\"sea_level\":1015,\"grnd_level\":1010,\"humidity\":57,\"temp_kf\":-0.35},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":99},\"wind\":{\"speed\":2.35,\"deg\":232},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-12 18:00:00\"},{\"dt\":1581541200,\"main\":{\"temp\":5.7,\"feels_like\":1.34,\"temp_min\":5.7,\"temp_max\":5.7,\"pressure\":1012,\"sea_level\":1012,\"grnd_level\":1008,\"humidity\":71,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":3.57,\"deg\":198},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-12 21:00:00\"},{\"dt\":1581552000,\"main\":{\"temp\":5.82,\"feels_like\":1.39,\"temp_min\":5.82,\"temp_max\":5.82,\"pressure\":1009,\"sea_level\":1009,\"grnd_level\":1004,\"humidity\":86,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":4.35,\"deg\":169},\"rain\":{\"3h\":0.5},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-13 00:00:00\"},{\"dt\":1581562800,\"main\":{\"temp\":5.9,\"feels_like\":-0.85,\"temp_min\":5.9,\"temp_max\":5.9,\"pressure\":1000,\"sea_level\":1000,\"grnd_level\":997,\"humidity\":86,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":7.69,\"deg\":178},\"rain\":{\"3h\":1.75},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-13 03:00:00\"},{\"dt\":1581573600,\"main\":{\"temp\":7.52,\"feels_like\":1.74,\"temp_min\":7.52,\"temp_max\":7.52,\"pressure\":993,\"sea_level\":993,\"grnd_level\":988,\"humidity\":88,\"temp_kf\":0},\"weather\":[{\"id\":501,\"main\":\"Rain\",\"description\":\"moderate rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":6.84,\"deg\":184},\"rain\":{\"3h\":7.06},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-13 06:00:00\"},{\"dt\":1581584400,\"main\":{\"temp\":7.23,\"feels_like\":0.81,\"temp_min\":7.23,\"temp_max\":7.23,\"pressure\":992,\"sea_level\":992,\"grnd_level\":988,\"humidity\":69,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":49},\"wind\":{\"speed\":6.77,\"deg\":239},\"rain\":{\"3h\":0.25},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-13 09:00:00\"},{\"dt\":1581595200,\"main\":{\"temp\":7.67,\"feels_like\":2.81,\"temp_min\":7.67,\"temp_max\":7.67,\"pressure\":991,\"sea_level\":991,\"grnd_level\":987,\"humidity\":75,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":73},\"wind\":{\"speed\":4.93,\"deg\":235},\"rain\":{\"3h\":0.75},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-13 12:00:00\"},{\"dt\":1581606000,\"main\":{\"temp\":8.83,\"feels_like\":3.23,\"temp_min\":8.83,\"temp_max\":8.83,\"pressure\":993,\"sea_level\":993,\"grnd_level\":990,\"humidity\":64,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":83},\"wind\":{\"speed\":5.7,\"deg\":293},\"rain\":{\"3h\":0.38},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-13 15:00:00\"},{\"dt\":1581616800,\"main\":{\"temp\":7.42,\"feels_like\":1.77,\"temp_min\":7.42,\"temp_max\":7.42,\"pressure\":1000,\"sea_level\":1000,\"grnd_level\":996,\"humidity\":71,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":54},\"wind\":{\"speed\":5.81,\"deg\":307},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-13 18:00:00\"},{\"dt\":1581627600,\"main\":{\"temp\":5.82,\"feels_like\":0.89,\"temp_min\":5.82,\"temp_max\":5.82,\"pressure\":1007,\"sea_level\":1007,\"grnd_level\":1003,\"humidity\":79,\"temp_kf\":0},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01n\"}],\"clouds\":{\"all\":6},\"wind\":{\"speed\":4.76,\"deg\":300},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-13 21:00:00\"},{\"dt\":1581638400,\"main\":{\"temp\":5.58,\"feels_like\":2.09,\"temp_min\":5.58,\"temp_max\":5.58,\"pressure\":1011,\"sea_level\":1011,\"grnd_level\":1007,\"humidity\":81,\"temp_kf\":0},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered clouds\",\"icon\":\"03n\"}],\"clouds\":{\"all\":47},\"wind\":{\"speed\":2.73,\"deg\":326},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-14 00:00:00\"},{\"dt\":1581649200,\"main\":{\"temp\":4.27,\"feels_like\":1.72,\"temp_min\":4.27,\"temp_max\":4.27,\"pressure\":1014,\"sea_level\":1014,\"grnd_level\":1010,\"humidity\":85,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":69},\"wind\":{\"speed\":1.24,\"deg\":295},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-14 03:00:00\"},{\"dt\":1581660000,\"main\":{\"temp\":3.91,\"feels_like\":1.54,\"temp_min\":3.91,\"temp_max\":3.91,\"pressure\":1016,\"sea_level\":1016,\"grnd_level\":1012,\"humidity\":87,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":85},\"wind\":{\"speed\":0.98,\"deg\":211},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-14 06:00:00\"},{\"dt\":1581670800,\"main\":{\"temp\":4.77,\"feels_like\":0.74,\"temp_min\":4.77,\"temp_max\":4.77,\"pressure\":1017,\"sea_level\":1017,\"grnd_level\":1013,\"humidity\":78,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":3.19,\"deg\":184},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-14 09:00:00\"},{\"dt\":1581681600,\"main\":{\"temp\":9.03,\"feels_like\":4,\"temp_min\":9.03,\"temp_max\":9.03,\"pressure\":1016,\"sea_level\":1016,\"grnd_level\":1012,\"humidity\":73,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":5.43,\"deg\":206},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-14 12:00:00\"},{\"dt\":1581692400,\"main\":{\"temp\":9.86,\"feels_like\":4.22,\"temp_min\":9.86,\"temp_max\":9.86,\"pressure\":1014,\"sea_level\":1014,\"grnd_level\":1010,\"humidity\":74,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":6.58,\"deg\":209},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-14 15:00:00\"},{\"dt\":1581703200,\"main\":{\"temp\":9.48,\"feels_like\":4.8,\"temp_min\":9.48,\"temp_max\":9.48,\"pressure\":1013,\"sea_level\":1013,\"grnd_level\":1009,\"humidity\":83,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":5.6,\"deg\":206},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-14 18:00:00\"},{\"dt\":1581714000,\"main\":{\"temp\":10.03,\"feels_like\":6.48,\"temp_min\":10.03,\"temp_max\":10.03,\"pressure\":1013,\"sea_level\":1013,\"grnd_level\":1009,\"humidity\":93,\"temp_kf\":0},\"weather\":[{\"id\":501,\"main\":\"Rain\",\"description\":\"moderate rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":4.75,\"deg\":226},\"rain\":{\"3h\":3.13},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-14 21:00:00\"},{\"dt\":1581724800,\"main\":{\"temp\":9.48,\"feels_like\":6.25,\"temp_min\":9.48,\"temp_max\":9.48,\"pressure\":1013,\"sea_level\":1013,\"grnd_level\":1009,\"humidity\":89,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":3.87,\"deg\":214},\"rain\":{\"3h\":2.38},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-15 00:00:00\"},{\"dt\":1581735600,\"main\":{\"temp\":9.12,\"feels_like\":7.08,\"temp_min\":9.12,\"temp_max\":9.12,\"pressure\":1011,\"sea_level\":1011,\"grnd_level\":1007,\"humidity\":96,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":2.43,\"deg\":194},\"rain\":{\"3h\":1},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-15 03:00:00\"},{\"dt\":1581746400,\"main\":{\"temp\":10.32,\"feels_like\":6.71,\"temp_min\":10.32,\"temp_max\":10.32,\"pressure\":1009,\"sea_level\":1009,\"grnd_level\":1004,\"humidity\":95,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":5.05,\"deg\":196},\"rain\":{\"3h\":1.75},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-15 06:00:00\"},{\"dt\":1581757200,\"main\":{\"temp\":11.57,\"feels_like\":5.85,\"temp_min\":11.57,\"temp_max\":11.57,\"pressure\":1006,\"sea_level\":1006,\"grnd_level\":1002,\"humidity\":85,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":7.91,\"deg\":205},\"rain\":{\"3h\":1.44},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-15 09:00:00\"},{\"dt\":1581768000,\"main\":{\"temp\":12.25,\"feels_like\":4.46,\"temp_min\":12.25,\"temp_max\":12.25,\"pressure\":1003,\"sea_level\":1003,\"grnd_level\":998,\"humidity\":78,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":10.65,\"deg\":201},\"rain\":{\"3h\":1.81},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-15 12:00:00\"},{\"dt\":1581778800,\"main\":{\"temp\":12.19,\"feels_like\":3.17,\"temp_min\":12.19,\"temp_max\":12.19,\"pressure\":998,\"sea_level\":998,\"grnd_level\":994,\"humidity\":80,\"temp_kf\":0},\"weather\":[{\"id\":501,\"main\":\"Rain\",\"description\":\"moderate rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":12.52,\"deg\":204},\"rain\":{\"3h\":3.5},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-15 15:00:00\"},{\"dt\":1581789600,\"main\":{\"temp\":12.25,\"feels_like\":4.15,\"temp_min\":12.25,\"temp_max\":12.25,\"pressure\":996,\"sea_level\":996,\"grnd_level\":992,\"humidity\":83,\"temp_kf\":0},\"weather\":[{\"id\":501,\"main\":\"Rain\",\"description\":\"moderate rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":11.42,\"deg\":215},\"rain\":{\"3h\":4.88},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-15 18:00:00\"},{\"dt\":1581800400,\"main\":{\"temp\":12.64,\"feels_like\":5.85,\"temp_min\":12.64,\"temp_max\":12.64,\"pressure\":994,\"sea_level\":994,\"grnd_level\":990,\"humidity\":76,\"temp_kf\":0},\"weather\":[{\"id\":501,\"main\":\"Rain\",\"description\":\"moderate rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":9.22,\"deg\":217},\"rain\":{\"3h\":6.88},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-15 21:00:00\"},{\"dt\":1581811200,\"main\":{\"temp\":12.96,\"feels_like\":4.03,\"temp_min\":12.96,\"temp_max\":12.96,\"pressure\":988,\"sea_level\":988,\"grnd_level\":984,\"humidity\":83,\"temp_kf\":0},\"weather\":[{\"id\":501,\"main\":\"Rain\",\"description\":\"moderate rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":12.88,\"deg\":211},\"rain\":{\"3h\":5.63},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-16 00:00:00\"},{\"dt\":1581822000,\"main\":{\"temp\":13.13,\"feels_like\":5.17,\"temp_min\":13.13,\"temp_max\":13.13,\"pressure\":987,\"sea_level\":987,\"grnd_level\":982,\"humidity\":82,\"temp_kf\":0},\"weather\":[{\"id\":501,\"main\":\"Rain\",\"description\":\"moderate rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":11.49,\"deg\":246},\"rain\":{\"3h\":7.25},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-16 03:00:00\"},{\"dt\":1581832800,\"main\":{\"temp\":9.07,\"feels_like\":0.79,\"temp_min\":9.07,\"temp_max\":9.07,\"pressure\":990,\"sea_level\":990,\"grnd_level\":986,\"humidity\":75,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":10.18,\"deg\":255},\"rain\":{\"3h\":2},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-16 06:00:00\"},{\"dt\":1581843600,\"main\":{\"temp\":8.05,\"feels_like\":-0.9,\"temp_min\":8.05,\"temp_max\":8.05,\"pressure\":994,\"sea_level\":994,\"grnd_level\":990,\"humidity\":51,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":9.65,\"deg\":245},\"rain\":{\"3h\":1.19},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-16 09:00:00\"},{\"dt\":1581854400,\"main\":{\"temp\":9.54,\"feels_like\":0.13,\"temp_min\":9.54,\"temp_max\":9.54,\"pressure\":996,\"sea_level\":996,\"grnd_level\":991,\"humidity\":41,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":94},\"wind\":{\"speed\":10.03,\"deg\":243},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-16 12:00:00\"},{\"dt\":1581865200,\"main\":{\"temp\":9.08,\"feels_like\":-0.35,\"temp_min\":9.08,\"temp_max\":9.08,\"pressure\":996,\"sea_level\":996,\"grnd_level\":991,\"humidity\":44,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":89},\"wind\":{\"speed\":10.15,\"deg\":246},\"rain\":{\"3h\":0.25},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2020-02-16 15:00:00\"},{\"dt\":1581876000,\"main\":{\"temp\":7.41,\"feels_like\":-1.34,\"temp_min\":7.41,\"temp_max\":7.41,\"pressure\":996,\"sea_level\":996,\"grnd_level\":992,\"humidity\":50,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":94},\"wind\":{\"speed\":9.21,\"deg\":240},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-16 18:00:00\"},{\"dt\":1581886800,\"main\":{\"temp\":6.42,\"feels_like\":-1.7,\"temp_min\":6.42,\"temp_max\":6.42,\"pressure\":997,\"sea_level\":997,\"grnd_level\":993,\"humidity\":58,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":67},\"wind\":{\"speed\":8.52,\"deg\":236},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-16 21:00:00\"},{\"dt\":1581897600,\"main\":{\"temp\":6.03,\"feels_like\":-2.65,\"temp_min\":6.03,\"temp_max\":6.03,\"pressure\":996,\"sea_level\":996,\"grnd_level\":993,\"humidity\":51,\"temp_kf\":0},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered clouds\",\"icon\":\"03n\"}],\"clouds\":{\"all\":38},\"wind\":{\"speed\":8.94,\"deg\":240},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-17 00:00:00\"},{\"dt\":1581908400,\"main\":{\"temp\":5.62,\"feels_like\":-2.86,\"temp_min\":5.62,\"temp_max\":5.62,\"pressure\":995,\"sea_level\":995,\"grnd_level\":991,\"humidity\":53,\"temp_kf\":0},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01n\"}],\"clouds\":{\"all\":0},\"wind\":{\"speed\":8.67,\"deg\":241},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-17 03:00:00\"},{\"dt\":1581919200,\"main\":{\"temp\":5.51,\"feels_like\":-2.41,\"temp_min\":5.51,\"temp_max\":5.51,\"pressure\":995,\"sea_level\":995,\"grnd_level\":991,\"humidity\":61,\"temp_kf\":0},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered clouds\",\"icon\":\"03n\"}],\"clouds\":{\"all\":35},\"wind\":{\"speed\":8.2,\"deg\":244},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2020-02-17 06:00:00\"}],\"city\":{\"id\":2643743,\"name\":\"London\",\"coord\":{\"lat\":51.5085,\"lon\":-0.1257},\"country\":\"GB\",\"population\":1000000,\"timezone\":0,\"sunrise\":1581492085,\"sunset\":1581527294}}"; + + const char* expected_json = "{\"list\":[" + "{\"dt\":1581498000,\"main\":{\"temp\":3.23},\"weather\":[{\"description\":\"clear sky\"}]}," + "{\"dt\":1581508800,\"main\":{\"temp\":6.09},\"weather\":[{\"description\":\"clear sky\"}]}," + "{\"dt\":1581519600,\"main\":{\"temp\":6.82},\"weather\":[{\"description\":\"overcast clouds\"}]}," + "{\"dt\":1581530400,\"main\":{\"temp\":5.76},\"weather\":[{\"description\":\"overcast clouds\"}]}," + "{\"dt\":1581541200,\"main\":{\"temp\":5.7},\"weather\":[{\"description\":\"overcast clouds\"}]}," + "{\"dt\":1581552000,\"main\":{\"temp\":5.82},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581562800,\"main\":{\"temp\":5.9},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581573600,\"main\":{\"temp\":7.52},\"weather\":[{\"description\":\"moderate rain\"}]}," + "{\"dt\":1581584400,\"main\":{\"temp\":7.23},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581595200,\"main\":{\"temp\":7.67},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581606000,\"main\":{\"temp\":8.83},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581616800,\"main\":{\"temp\":7.42},\"weather\":[{\"description\":\"broken clouds\"}]}," + "{\"dt\":1581627600,\"main\":{\"temp\":5.82},\"weather\":[{\"description\":\"clear sky\"}]}," + "{\"dt\":1581638400,\"main\":{\"temp\":5.58},\"weather\":[{\"description\":\"scattered clouds\"}]}," + "{\"dt\":1581649200,\"main\":{\"temp\":4.27},\"weather\":[{\"description\":\"broken clouds\"}]}," + "{\"dt\":1581660000,\"main\":{\"temp\":3.91},\"weather\":[{\"description\":\"overcast clouds\"}]}," + "{\"dt\":1581670800,\"main\":{\"temp\":4.77},\"weather\":[{\"description\":\"overcast clouds\"}]}," + "{\"dt\":1581681600,\"main\":{\"temp\":9.03},\"weather\":[{\"description\":\"overcast clouds\"}]}," + "{\"dt\":1581692400,\"main\":{\"temp\":9.86},\"weather\":[{\"description\":\"overcast clouds\"}]}," + "{\"dt\":1581703200,\"main\":{\"temp\":9.48},\"weather\":[{\"description\":\"overcast clouds\"}]}," + "{\"dt\":1581714000,\"main\":{\"temp\":10.03},\"weather\":[{\"description\":\"moderate rain\"}]}," + "{\"dt\":1581724800,\"main\":{\"temp\":9.48},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581735600,\"main\":{\"temp\":9.12},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581746400,\"main\":{\"temp\":10.32},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581757200,\"main\":{\"temp\":11.57},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581768000,\"main\":{\"temp\":12.25},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581778800,\"main\":{\"temp\":12.19},\"weather\":[{\"description\":\"moderate rain\"}]}," + "{\"dt\":1581789600,\"main\":{\"temp\":12.25},\"weather\":[{\"description\":\"moderate rain\"}]}," + "{\"dt\":1581800400,\"main\":{\"temp\":12.64},\"weather\":[{\"description\":\"moderate rain\"}]}," + "{\"dt\":1581811200,\"main\":{\"temp\":12.96},\"weather\":[{\"description\":\"moderate rain\"}]}," + "{\"dt\":1581822000,\"main\":{\"temp\":13.13},\"weather\":[{\"description\":\"moderate rain\"}]}," + "{\"dt\":1581832800,\"main\":{\"temp\":9.07},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581843600,\"main\":{\"temp\":8.05},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581854400,\"main\":{\"temp\":9.54},\"weather\":[{\"description\":\"overcast clouds\"}]}," + "{\"dt\":1581865200,\"main\":{\"temp\":9.08},\"weather\":[{\"description\":\"light rain\"}]}," + "{\"dt\":1581876000,\"main\":{\"temp\":7.41},\"weather\":[{\"description\":\"overcast clouds\"}]}," + "{\"dt\":1581886800,\"main\":{\"temp\":6.42},\"weather\":[{\"description\":\"broken clouds\"}]}," + "{\"dt\":1581897600,\"main\":{\"temp\":6.03},\"weather\":[{\"description\":\"scattered clouds\"}]}," + "{\"dt\":1581908400,\"main\":{\"temp\":5.62},\"weather\":[{\"description\":\"clear sky\"}]}," + "{\"dt\":1581919200,\"main\":{\"temp\":5.51},\"weather\":[{\"description\":\"scattered clouds\"}]}" + "]}"; + // clang-format on + + JsonDocument filter; + filter["list"][0]["dt"] = true; + filter["list"][0]["main"]["temp"] = true; + filter["list"][0]["weather"][0]["description"] = true; + + JsonDocument doc; + + REQUIRE( + deserializeJson(doc, input_json, DeserializationOption::Filter(filter)) == + DeserializationError::Ok); + + REQUIRE(doc.as() == expected_json); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/round_trip.cpp b/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/round_trip.cpp new file mode 100644 index 00000000..54bd6f4a --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/IntegrationTests/round_trip.cpp @@ -0,0 +1,82 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +void check(std::string originalJson) { + JsonDocument doc; + + std::string prettyJson; + deserializeJson(doc, originalJson); + serializeJsonPretty(doc, prettyJson); + + std::string finalJson; + deserializeJson(doc, originalJson); + serializeJson(doc, finalJson); + + REQUIRE(originalJson == finalJson); +} + +TEST_CASE("Round Trip: parse -> prettyPrint -> parse -> print") { + SECTION("OpenWeatherMap") { + check( + "{\"coord\":{\"lon\":145.77,\"lat\":-16.92},\"sys\":{\"type\":1,\"id\":" + "8166,\"message\":0.1222,\"country\":\"AU\",\"sunrise\":1414784325," + "\"sunset\":1414830137},\"weather\":[{\"id\":801,\"main\":\"Clouds\"," + "\"description\":\"few clouds\",\"icon\":\"02n\"}],\"base\":\"cmc " + "stations\",\"main\":{\"temp\":296.15,\"pressure\":1014,\"humidity\":" + "83,\"temp_min\":296.15,\"temp_max\":296.15},\"wind\":{\"speed\":2.22," + "\"deg\":114.501},\"clouds\":{\"all\":20},\"dt\":1414846800,\"id\":" + "2172797,\"name\":\"Cairns\",\"cod\":200}"); + } + + SECTION("YahooQueryLanguage") { + check( + "{\"query\":{\"count\":40,\"created\":\"2014-11-01T14:16:49Z\"," + "\"lang\":\"fr-FR\",\"results\":{\"item\":[{\"title\":\"Burkina army " + "backs Zida as interim leader\"},{\"title\":\"British jets intercept " + "Russian bombers\"},{\"title\":\"Doubts chip away at nation's most " + "trusted agencies\"},{\"title\":\"Cruise ship stuck off Norway, no " + "damage\"},{\"title\":\"U.S. military launches 10 air strikes in " + "Syria, Iraq\"},{\"title\":\"Blackout hits Bangladesh as line from " + "India fails\"},{\"title\":\"Burkina Faso president in Ivory Coast " + "after ouster\"},{\"title\":\"Kurds in Turkey rally to back city " + "besieged by IS\"},{\"title\":\"A majority of Scots would vote for " + "independence now:poll\"},{\"title\":\"Tunisia elections possible " + "model for region\"},{\"title\":\"Islamic State kills 85 more members " + "of Iraqi tribe\"},{\"title\":\"Iraqi officials:IS extremists line " + "up, kill 50\"},{\"title\":\"Burkina Faso army backs presidential " + "guard official to lead transition\"},{\"title\":\"Kurdish peshmerga " + "arrive with weapons in Syria's Kobani\"},{\"title\":\"Driver sought " + "in crash that killed 3 on Halloween\"},{\"title\":\"Ex-Marine arrives " + "in US after release from Mexico jail\"},{\"title\":\"UN panel " + "scrambling to finish climate report\"},{\"title\":\"Investigators, " + "Branson go to spacecraft crash site\"},{\"title\":\"Soldiers vie for " + "power after Burkina Faso president quits\"},{\"title\":\"For a man " + "without a party, turnout is big test\"},{\"title\":\"'We just had a " + "hunch':US marshals nab Eric Frein\"},{\"title\":\"Boko Haram leader " + "threatens to kill German hostage\"},{\"title\":\"Nurse free to move " + "about as restrictions eased\"},{\"title\":\"Former Burkina president " + "Compaore arrives in Ivory Coast:sources\"},{\"title\":\"Libyan port " + "rebel leader refuses to hand over oil ports to rival " + "group\"},{\"title\":\"Iraqi peshmerga fighters prepare for Syria " + "battle\"},{\"title\":\"1 Dem Senate candidate welcoming Obama's " + "help\"},{\"title\":\"Bikers cancel party after police recover " + "bar\"},{\"title\":\"New question in Texas:Can Davis survive " + "defeat?\"},{\"title\":\"Ukraine rebels to hold election, despite " + "criticism\"},{\"title\":\"Iraqi officials say Islamic State group " + "lines up, kills 50 tribesmen, women in Anbar " + "province\"},{\"title\":\"James rebounds, leads Cavaliers past " + "Bulls\"},{\"title\":\"UK warns travelers they could be terror " + "targets\"},{\"title\":\"Hello Kitty celebrates 40th " + "birthday\"},{\"title\":\"A look at people killed during space " + "missions\"},{\"title\":\"Nigeria's purported Boko Haram leader says " + "has 'married off' girls:AFP\"},{\"title\":\"Mexico orders immediate " + "release of Marine veteran\"},{\"title\":\"As election closes in, " + "Obama on center stage\"},{\"title\":\"Body of Zambian president " + "arrives home\"},{\"title\":\"South Africa arrests 2 Vietnamese for " + "poaching\"}]}}}"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/CMakeLists.txt new file mode 100644 index 00000000..0b8a5623 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/CMakeLists.txt @@ -0,0 +1,25 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(JsonArrayTests + add.cpp + clear.cpp + compare.cpp + copyArray.cpp + equals.cpp + isNull.cpp + iterator.cpp + nesting.cpp + remove.cpp + size.cpp + subscript.cpp + unbound.cpp +) + +add_test(JsonArray JsonArrayTests) + +set_tests_properties(JsonArray + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/add.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/add.cpp new file mode 100644 index 00000000..0983e3bd --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/add.cpp @@ -0,0 +1,262 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofArray; + +TEST_CASE("JsonArray::add(T)") { + SpyingAllocator spy; + JsonDocument doc(&spy); + JsonArray array = doc.to(); + + SECTION("int") { + array.add(123); + + REQUIRE(123 == array[0].as()); + REQUIRE(array[0].is()); + REQUIRE(array[0].is()); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("double") { + array.add(123.45); + + REQUIRE(123.45 == array[0].as()); + REQUIRE(array[0].is()); + REQUIRE_FALSE(array[0].is()); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("bool") { + array.add(true); + + REQUIRE(array[0].as() == true); + REQUIRE(array[0].is()); + REQUIRE_FALSE(array[0].is()); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("string literal") { + array.add("hello"); + + REQUIRE(array[0].as() == "hello"); + REQUIRE(array[0].is()); + REQUIRE(array[0].is() == false); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("std::string") { + array.add("hello"_s); + + REQUIRE(array[0].as() == "hello"); + REQUIRE(array[0].is() == true); + REQUIRE(array[0].is() == false); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } + + SECTION("const char*") { + const char* str = "hello"; + array.add(str); + + REQUIRE(array[0].as() == "hello"); + REQUIRE(array[0].as() != str); + REQUIRE(array[0].is() == true); + REQUIRE(array[0].is() == false); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } + + SECTION("serialized(const char*)") { + array.add(serialized("{}")); + + REQUIRE(doc.as() == "[{}]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("{}")), + }); + } + + SECTION("serialized(char*)") { + array.add(serialized(const_cast("{}"))); + + REQUIRE(doc.as() == "[{}]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("{}")), + }); + } + + SECTION("serialized(std::string)") { + array.add(serialized("{}"_s)); + + REQUIRE(doc.as() == "[{}]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("{}")), + }); + } + + SECTION("serialized(std::string)") { + array.add(serialized("\0XX"_s)); + + REQUIRE(doc.as() == "[\0XX]"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString(" XX")), + }); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("vla") { + size_t i = 16; + char vla[i]; + strcpy(vla, "world"); + + array.add(vla); + + strcpy(vla, "hello"); + REQUIRE(array[0] == "world"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } +#endif + + SECTION("nested array") { + JsonDocument doc2; + JsonArray arr = doc2.to(); + + array.add(arr); + + REQUIRE(arr == array[0].as()); + REQUIRE(array[0].is()); + REQUIRE_FALSE(array[0].is()); + } + + SECTION("nested object") { + JsonDocument doc2; + JsonObject obj = doc2.to(); + + array.add(obj); + + REQUIRE(obj == array[0].as()); + REQUIRE(array[0].is()); + REQUIRE_FALSE(array[0].is()); + } + + SECTION("array subscript") { + const char* str = "hello"; + JsonDocument doc2; + JsonArray arr = doc2.to(); + arr.add(str); + + array.add(arr[0]); + + REQUIRE(str == array[0]); + } + + SECTION("object subscript") { + const char* str = "hello"; + JsonDocument doc2; + JsonObject obj = doc2.to(); + obj["x"] = str; + + array.add(obj["x"]); + + REQUIRE(str == array[0]); + } +} + +TEST_CASE("JsonArray::add()") { + JsonDocument doc; + JsonArray array = doc.to(); + + SECTION("add()") { + JsonArray nestedArray = array.add(); + nestedArray.add(1); + nestedArray.add(2); + REQUIRE(doc.as() == "[[1,2]]"); + } + + SECTION("add()") { + JsonObject nestedObject = array.add(); + nestedObject["a"] = 1; + nestedObject["b"] = 2; + REQUIRE(doc.as() == "[{\"a\":1,\"b\":2}]"); + } + + SECTION("add()") { + JsonVariant nestedVariant = array.add(); + nestedVariant.set(42); + REQUIRE(doc.as() == "[42]"); + } +} + +TEST_CASE("JsonObject::add(JsonObject) ") { + JsonDocument doc1; + doc1["key1"_s] = "value1"_s; + + TimebombAllocator allocator(10); + SpyingAllocator spy(&allocator); + JsonDocument doc2(&spy); + JsonArray array = doc2.to(); + + SECTION("success") { + bool result = array.add(doc1.as()); + + REQUIRE(result == true); + REQUIRE(doc2.as() == "[{\"key1\":\"value1\"}]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("key1")), + Allocate(sizeofString("value1")), + }); + } + + SECTION("partial failure") { // issue #2081 + allocator.setCountdown(2); + + bool result = array.add(doc1.as()); + + REQUIRE(result == false); + REQUIRE(doc2.as() == "[]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("key1")), + AllocateFail(sizeofString("value1")), + Deallocate(sizeofString("key1")), + }); + } + + SECTION("complete failure") { + allocator.setCountdown(0); + + bool result = array.add(doc1.as()); + + REQUIRE(result == false); + REQUIRE(doc2.as() == "[]"); + REQUIRE(spy.log() == AllocatorLog{ + AllocateFail(sizeofPool()), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/clear.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/clear.cpp new file mode 100644 index 00000000..069376de --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/clear.cpp @@ -0,0 +1,46 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" + +TEST_CASE("JsonArray::clear()") { + SECTION("No-op on null JsonArray") { + JsonArray array; + array.clear(); + REQUIRE(array.isNull() == true); + REQUIRE(array.size() == 0); + } + + SECTION("Removes all elements") { + JsonDocument doc; + JsonArray array = doc.to(); + array.add(1); + array.add(2); + array.clear(); + REQUIRE(array.size() == 0); + REQUIRE(array.isNull() == false); + } + + SECTION("Removed elements are recycled") { + SpyingAllocator spy; + JsonDocument doc(&spy); + JsonArray array = doc.to(); + + // fill the pool entirely + for (int i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++) + array.add(i); + + // clear and fill again + array.clear(); + for (int i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++) + array.add(i); + + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/compare.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/compare.cpp new file mode 100644 index 00000000..23f2ea9d --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/compare.cpp @@ -0,0 +1,512 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("Compare JsonArray with JsonArray") { + JsonDocument doc; + + SECTION("Compare with unbound") { + JsonArray array = doc.to(); + array.add(1); + array.add("hello"); + JsonArray unbound; + + CHECK(array != unbound); + CHECK_FALSE(array == unbound); + CHECK_FALSE(array <= unbound); + CHECK_FALSE(array >= unbound); + CHECK_FALSE(array > unbound); + CHECK_FALSE(array < unbound); + + CHECK(unbound != array); + CHECK_FALSE(unbound == array); + CHECK_FALSE(unbound <= array); + CHECK_FALSE(unbound >= array); + CHECK_FALSE(unbound > array); + CHECK_FALSE(unbound < array); + } + + SECTION("Compare with self") { + JsonArray array = doc.to(); + array.add(1); + array.add("hello"); + + CHECK(array == array); + CHECK(array <= array); + CHECK(array >= array); + CHECK_FALSE(array != array); + CHECK_FALSE(array > array); + CHECK_FALSE(array < array); + } + + SECTION("Compare with identical array") { + JsonArray array1 = doc.add(); + array1.add(1); + array1.add("hello"); + array1.add(); + + JsonArray array2 = doc.add(); + array2.add(1); + array2.add("hello"); + array2.add(); + + CHECK(array1 == array2); + CHECK(array1 <= array2); + CHECK(array1 >= array2); + CHECK_FALSE(array1 != array2); + CHECK_FALSE(array1 > array2); + CHECK_FALSE(array1 < array2); + } + + SECTION("Compare with different array") { + JsonArray array1 = doc.add(); + array1.add(1); + array1.add("hello1"); + array1.add(); + + JsonArray array2 = doc.add(); + array2.add(1); + array2.add("hello2"); + array2.add(); + + CHECK(array1 != array2); + CHECK_FALSE(array1 == array2); + CHECK_FALSE(array1 > array2); + CHECK_FALSE(array1 < array2); + CHECK_FALSE(array1 <= array2); + CHECK_FALSE(array1 >= array2); + } +} + +TEST_CASE("Compare JsonArray with JsonVariant") { + JsonDocument doc; + + SECTION("Compare with self") { + JsonArray array = doc.to(); + array.add(1); + array.add("hello"); + + JsonVariant variant = array; + + CHECK(array == variant); + CHECK(array <= variant); + CHECK(array >= variant); + CHECK_FALSE(array != variant); + CHECK_FALSE(array > variant); + CHECK_FALSE(array < variant); + + CHECK(variant == array); + CHECK(variant <= array); + CHECK(variant >= array); + CHECK_FALSE(variant != array); + CHECK_FALSE(variant > array); + CHECK_FALSE(variant < array); + } + + SECTION("Compare with identical array") { + JsonArray array = doc.add(); + array.add(1); + array.add("hello"); + array.add(); + + JsonVariant variant = doc.add(); + variant.add(1); + variant.add("hello"); + variant.add(); + + CHECK(array == variant); + CHECK(array <= variant); + CHECK(array >= variant); + CHECK_FALSE(array != variant); + CHECK_FALSE(array > variant); + CHECK_FALSE(array < variant); + + CHECK(variant == array); + CHECK(variant <= array); + CHECK(variant >= array); + CHECK_FALSE(variant != array); + CHECK_FALSE(variant > array); + CHECK_FALSE(variant < array); + } + + SECTION("Compare with different array") { + JsonArray array = doc.add(); + array.add(1); + array.add("hello1"); + array.add(); + + JsonVariant variant = doc.add(); + variant.add(1); + variant.add("hello2"); + variant.add(); + + CHECK(array != variant); + CHECK_FALSE(array == variant); + CHECK_FALSE(array > variant); + CHECK_FALSE(array < variant); + CHECK_FALSE(array <= variant); + CHECK_FALSE(array >= variant); + } +} + +TEST_CASE("Compare JsonArray with JsonVariantConst") { + JsonDocument doc; + + SECTION("Compare with unbound") { + JsonArray array = doc.to(); + array.add(1); + array.add("hello"); + JsonVariantConst unbound; + + CHECK(array != unbound); + CHECK_FALSE(array == unbound); + CHECK_FALSE(array <= unbound); + CHECK_FALSE(array >= unbound); + CHECK_FALSE(array > unbound); + CHECK_FALSE(array < unbound); + + CHECK(unbound != array); + CHECK_FALSE(unbound == array); + CHECK_FALSE(unbound <= array); + CHECK_FALSE(unbound >= array); + CHECK_FALSE(unbound > array); + CHECK_FALSE(unbound < array); + } + + SECTION("Compare with self") { + JsonArray array = doc.to(); + array.add(1); + array.add("hello"); + + JsonVariantConst variant = array; + + CHECK(array == variant); + CHECK(array <= variant); + CHECK(array >= variant); + CHECK_FALSE(array != variant); + CHECK_FALSE(array > variant); + CHECK_FALSE(array < variant); + + CHECK(variant == array); + CHECK(variant <= array); + CHECK(variant >= array); + CHECK_FALSE(variant != array); + CHECK_FALSE(variant > array); + CHECK_FALSE(variant < array); + } + + SECTION("Compare with identical array") { + JsonArray array = doc.add(); + array.add(1); + array.add("hello"); + array.add(); + + JsonArray array2 = doc.add(); + array2.add(1); + array2.add("hello"); + array2.add(); + JsonVariantConst variant = array2; + + CHECK(array == variant); + CHECK(array <= variant); + CHECK(array >= variant); + CHECK_FALSE(array != variant); + CHECK_FALSE(array > variant); + CHECK_FALSE(array < variant); + + CHECK(variant == array); + CHECK(variant <= array); + CHECK(variant >= array); + CHECK_FALSE(variant != array); + CHECK_FALSE(variant > array); + CHECK_FALSE(variant < array); + } + + SECTION("Compare with different array") { + JsonArray array = doc.add(); + array.add(1); + array.add("hello1"); + array.add(); + + JsonArray array2 = doc.add(); + array2.add(1); + array2.add("hello2"); + array2.add(); + JsonVariantConst variant = array2; + + CHECK(array != variant); + CHECK_FALSE(array == variant); + CHECK_FALSE(array > variant); + CHECK_FALSE(array < variant); + CHECK_FALSE(array <= variant); + CHECK_FALSE(array >= variant); + } +} + +TEST_CASE("Compare JsonArray with JsonArrayConst") { + JsonDocument doc; + + SECTION("Compare with unbound") { + JsonArray array = doc.to(); + array.add(1); + array.add("hello"); + JsonArrayConst unbound; + + CHECK(array != unbound); + CHECK_FALSE(array == unbound); + CHECK_FALSE(array <= unbound); + CHECK_FALSE(array >= unbound); + CHECK_FALSE(array > unbound); + CHECK_FALSE(array < unbound); + + CHECK(unbound != array); + CHECK_FALSE(unbound == array); + CHECK_FALSE(unbound <= array); + CHECK_FALSE(unbound >= array); + CHECK_FALSE(unbound > array); + CHECK_FALSE(unbound < array); + } + + SECTION("Compare with self") { + JsonArray array = doc.to(); + array.add(1); + array.add("hello"); + JsonArrayConst carray = array; + + CHECK(array == carray); + CHECK(array <= carray); + CHECK(array >= carray); + CHECK_FALSE(array != carray); + CHECK_FALSE(array > carray); + CHECK_FALSE(array < carray); + + CHECK(carray == array); + CHECK(carray <= array); + CHECK(carray >= array); + CHECK_FALSE(carray != array); + CHECK_FALSE(carray > array); + CHECK_FALSE(carray < array); + } + + SECTION("Compare with identical array") { + JsonArray array1 = doc.add(); + array1.add(1); + array1.add("hello"); + array1.add(); + + JsonArray array2 = doc.add(); + array2.add(1); + array2.add("hello"); + array2.add(); + JsonArrayConst carray2 = array2; + + CHECK(array1 == carray2); + CHECK(array1 <= carray2); + CHECK(array1 >= carray2); + CHECK_FALSE(array1 != carray2); + CHECK_FALSE(array1 > carray2); + CHECK_FALSE(array1 < carray2); + + CHECK(carray2 == array1); + CHECK(carray2 <= array1); + CHECK(carray2 >= array1); + CHECK_FALSE(carray2 != array1); + CHECK_FALSE(carray2 > array1); + CHECK_FALSE(carray2 < array1); + } + + SECTION("Compare with different array") { + JsonArray array1 = doc.add(); + array1.add(1); + array1.add("hello1"); + array1.add(); + + JsonArray array2 = doc.add(); + array2.add(1); + array2.add("hello2"); + array2.add(); + JsonArrayConst carray2 = array2; + + CHECK(array1 != carray2); + CHECK_FALSE(array1 == carray2); + CHECK_FALSE(array1 > carray2); + CHECK_FALSE(array1 < carray2); + CHECK_FALSE(array1 <= carray2); + CHECK_FALSE(array1 >= carray2); + + CHECK(carray2 != array1); + CHECK_FALSE(carray2 == array1); + CHECK_FALSE(carray2 > array1); + CHECK_FALSE(carray2 < array1); + CHECK_FALSE(carray2 <= array1); + CHECK_FALSE(carray2 >= array1); + } +} + +TEST_CASE("Compare JsonArrayConst with JsonArrayConst") { + JsonDocument doc; + + SECTION("Compare with unbound") { + JsonArray array = doc.to(); + array.add(1); + array.add("hello"); + + JsonArrayConst carray = array; + JsonArrayConst unbound; + + CHECK(carray != unbound); + CHECK_FALSE(carray == unbound); + CHECK_FALSE(carray <= unbound); + CHECK_FALSE(carray >= unbound); + CHECK_FALSE(carray > unbound); + CHECK_FALSE(carray < unbound); + + CHECK(unbound != carray); + CHECK_FALSE(unbound == carray); + CHECK_FALSE(unbound <= carray); + CHECK_FALSE(unbound >= carray); + CHECK_FALSE(unbound > carray); + CHECK_FALSE(unbound < carray); + } + + SECTION("Compare with self") { + JsonArray array = doc.to(); + array.add(1); + array.add("hello"); + JsonArrayConst carray = array; + + CHECK(carray == carray); + CHECK(carray <= carray); + CHECK(carray >= carray); + CHECK_FALSE(carray != carray); + CHECK_FALSE(carray > carray); + CHECK_FALSE(carray < carray); + } + + SECTION("Compare with identical array") { + JsonArray array1 = doc.add(); + array1.add(1); + array1.add("hello"); + array1.add(); + JsonArrayConst carray1 = array1; + + JsonArray array2 = doc.add(); + array2.add(1); + array2.add("hello"); + array2.add(); + JsonArrayConst carray2 = array2; + + CHECK(carray1 == carray2); + CHECK(carray1 <= carray2); + CHECK(carray1 >= carray2); + CHECK_FALSE(carray1 != carray2); + CHECK_FALSE(carray1 > carray2); + CHECK_FALSE(carray1 < carray2); + } + + SECTION("Compare with different array") { + JsonArray array1 = doc.add(); + array1.add(1); + array1.add("hello1"); + array1.add(); + JsonArrayConst carray1 = array1; + + JsonArray array2 = doc.add(); + array2.add(1); + array2.add("hello2"); + array2.add(); + JsonArrayConst carray2 = array2; + + CHECK(carray1 != carray2); + CHECK_FALSE(carray1 == carray2); + CHECK_FALSE(carray1 > carray2); + CHECK_FALSE(carray1 < carray2); + CHECK_FALSE(carray1 <= carray2); + CHECK_FALSE(carray1 >= carray2); + } +} + +TEST_CASE("Compare JsonArrayConst with JsonVariant") { + JsonDocument doc; + + SECTION("Compare with self") { + JsonArray array = doc.to(); + array.add(1); + array.add("hello"); + JsonArrayConst carray = array; + JsonVariant variant = array; + + CHECK(carray == variant); + CHECK(carray <= variant); + CHECK(carray >= variant); + CHECK_FALSE(carray != variant); + CHECK_FALSE(carray > variant); + CHECK_FALSE(carray < variant); + + CHECK(variant == carray); + CHECK(variant <= carray); + CHECK(variant >= carray); + CHECK_FALSE(variant != carray); + CHECK_FALSE(variant > carray); + CHECK_FALSE(variant < carray); + } + + SECTION("Compare with identical array") { + JsonArray array1 = doc.add(); + array1.add(1); + array1.add("hello"); + array1.add(); + JsonArrayConst carray1 = array1; + + JsonArray array2 = doc.add(); + array2.add(1); + array2.add("hello"); + array2.add(); + JsonVariant variant2 = array2; + + CHECK(carray1 == variant2); + CHECK(carray1 <= variant2); + CHECK(carray1 >= variant2); + CHECK_FALSE(carray1 != variant2); + CHECK_FALSE(carray1 > variant2); + CHECK_FALSE(carray1 < variant2); + + CHECK(variant2 == carray1); + CHECK(variant2 <= carray1); + CHECK(variant2 >= carray1); + CHECK_FALSE(variant2 != carray1); + CHECK_FALSE(variant2 > carray1); + CHECK_FALSE(variant2 < carray1); + } + + SECTION("Compare with different array") { + JsonArray array1 = doc.add(); + array1.add(1); + array1.add("hello1"); + array1.add(); + JsonArrayConst carray1 = array1; + + JsonArray array2 = doc.add(); + array2.add(1); + array2.add("hello2"); + array2.add(); + JsonVariant variant2 = array2; + + CHECK(carray1 != variant2); + CHECK_FALSE(carray1 == variant2); + CHECK_FALSE(carray1 > variant2); + CHECK_FALSE(carray1 < variant2); + CHECK_FALSE(carray1 <= variant2); + CHECK_FALSE(carray1 >= variant2); + + CHECK(variant2 != carray1); + CHECK_FALSE(variant2 == carray1); + CHECK_FALSE(variant2 > carray1); + CHECK_FALSE(variant2 < carray1); + CHECK_FALSE(variant2 <= carray1); + CHECK_FALSE(variant2 >= carray1); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/copyArray.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/copyArray.cpp new file mode 100644 index 00000000..dd31cf64 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/copyArray.cpp @@ -0,0 +1,335 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("copyArray()") { + SECTION("int[] -> JsonArray") { + JsonDocument doc; + JsonArray array = doc.to(); + char json[32]; + int source[] = {1, 2, 3}; + + bool ok = copyArray(source, array); + CHECK(ok); + + serializeJson(array, json); + CHECK("[1,2,3]"_s == json); + } + + SECTION("std::string[] -> JsonArray") { + JsonDocument doc; + JsonArray array = doc.to(); + char json[32]; + std::string source[] = {"a", "b", "c"}; + + bool ok = copyArray(source, array); + CHECK(ok); + + serializeJson(array, json); + CHECK("[\"a\",\"b\",\"c\"]"_s == json); + } + + SECTION("const char*[] -> JsonArray") { + JsonDocument doc; + JsonArray array = doc.to(); + char json[32]; + const char* source[] = {"a", "b", "c"}; + + bool ok = copyArray(source, array); + CHECK(ok); + + serializeJson(array, json); + CHECK("[\"a\",\"b\",\"c\"]"_s == json); + } + + SECTION("const char[][] -> JsonArray") { + JsonDocument doc; + JsonArray array = doc.to(); + char json[32]; + char source[][2] = {"a", "b", "c"}; + + bool ok = copyArray(source, array); + CHECK(ok); + + serializeJson(array, json); + CHECK("[\"a\",\"b\",\"c\"]"_s == json); + } + + SECTION("const char[][] -> JsonDocument") { + JsonDocument doc; + char json[32]; + char source[][2] = {"a", "b", "c"}; + + bool ok = copyArray(source, doc); + CHECK(ok); + + serializeJson(doc, json); + CHECK("[\"a\",\"b\",\"c\"]"_s == json); + } + + SECTION("const char[][] -> MemberProxy") { + JsonDocument doc; + char json[32]; + char source[][2] = {"a", "b", "c"}; + + bool ok = copyArray(source, doc["data"]); + CHECK(ok); + + serializeJson(doc, json); + CHECK("{\"data\":[\"a\",\"b\",\"c\"]}"_s == json); + } + + SECTION("int[] -> JsonDocument") { + JsonDocument doc; + char json[32]; + int source[] = {1, 2, 3}; + + bool ok = copyArray(source, doc); + CHECK(ok); + + serializeJson(doc, json); + CHECK("[1,2,3]"_s == json); + } + + SECTION("int[] -> MemberProxy") { + JsonDocument doc; + char json[32]; + int source[] = {1, 2, 3}; + + bool ok = copyArray(source, doc["data"]); + CHECK(ok); + + serializeJson(doc, json); + CHECK("{\"data\":[1,2,3]}"_s == json); + } + + SECTION("int[] -> JsonArray, but not enough memory") { + JsonDocument doc(FailingAllocator::instance()); + JsonArray array = doc.to(); + int source[] = {1, 2, 3}; + + bool ok = copyArray(source, array); + REQUIRE_FALSE(ok); + } + + SECTION("int[][] -> JsonArray") { + JsonDocument doc; + JsonArray array = doc.to(); + char json[32]; + int source[][3] = {{1, 2, 3}, {4, 5, 6}}; + + bool ok = copyArray(source, array); + CHECK(ok); + + serializeJson(array, json); + CHECK("[[1,2,3],[4,5,6]]"_s == json); + } + + SECTION("int[][] -> MemberProxy") { + JsonDocument doc; + char json[32]; + int source[][3] = {{1, 2, 3}, {4, 5, 6}}; + + bool ok = copyArray(source, doc["data"]); + CHECK(ok); + + serializeJson(doc, json); + CHECK("{\"data\":[[1,2,3],[4,5,6]]}"_s == json); + } + + SECTION("int[][] -> JsonDocument") { + JsonDocument doc; + char json[32]; + int source[][3] = {{1, 2, 3}, {4, 5, 6}}; + + bool ok = copyArray(source, doc); + CHECK(ok); + + serializeJson(doc, json); + CHECK("[[1,2,3],[4,5,6]]"_s == json); + } + + SECTION("int[][] -> JsonArray, but not enough memory") { + JsonDocument doc(FailingAllocator::instance()); + JsonArray array = doc.to(); + int source[][3] = {{1, 2, 3}, {4, 5, 6}}; + + bool ok = copyArray(source, array); + REQUIRE(ok == false); + } + + SECTION("JsonArray -> int[], with more space than needed") { + JsonDocument doc; + char json[] = "[1,2,3]"; + DeserializationError err = deserializeJson(doc, json); + CHECK(err == DeserializationError::Ok); + JsonArray array = doc.as(); + + int destination[4] = {0}; + size_t result = copyArray(array, destination); + + CHECK(3 == result); + CHECK(1 == destination[0]); + CHECK(2 == destination[1]); + CHECK(3 == destination[2]); + CHECK(0 == destination[3]); + } + + SECTION("JsonArray -> int[], without enough space") { + JsonDocument doc; + char json[] = "[1,2,3]"; + DeserializationError err = deserializeJson(doc, json); + CHECK(err == DeserializationError::Ok); + JsonArray array = doc.as(); + + int destination[2] = {0}; + size_t result = copyArray(array, destination); + + CHECK(2 == result); + CHECK(1 == destination[0]); + CHECK(2 == destination[1]); + } + + SECTION("JsonArray -> std::string[]") { + JsonDocument doc; + char json[] = "[\"a\",\"b\",\"c\"]"; + DeserializationError err = deserializeJson(doc, json); + CHECK(err == DeserializationError::Ok); + JsonArray array = doc.as(); + + std::string destination[4]; + size_t result = copyArray(array, destination); + + CHECK(3 == result); + CHECK("a" == destination[0]); + CHECK("b" == destination[1]); + CHECK("c" == destination[2]); + CHECK("" == destination[3]); + } + + SECTION("JsonArray -> char[N][]") { + JsonDocument doc; + char json[] = "[\"a12345\",\"b123456\",\"c1234567\"]"; + DeserializationError err = deserializeJson(doc, json); + CHECK(err == DeserializationError::Ok); + JsonArray array = doc.as(); + + char destination[4][8] = {{0}}; + size_t result = copyArray(array, destination); + + CHECK(3 == result); + CHECK("a12345"_s == destination[0]); + CHECK("b123456"_s == destination[1]); + CHECK("c123456"_s == destination[2]); // truncated + CHECK(std::string("") == destination[3]); + } + + SECTION("JsonDocument -> int[]") { + JsonDocument doc; + char json[] = "[1,2,3]"; + DeserializationError err = deserializeJson(doc, json); + CHECK(err == DeserializationError::Ok); + + int destination[4] = {0}; + size_t result = copyArray(doc, destination); + + CHECK(3 == result); + CHECK(1 == destination[0]); + CHECK(2 == destination[1]); + CHECK(3 == destination[2]); + CHECK(0 == destination[3]); + } + + SECTION("MemberProxy -> int[]") { + JsonDocument doc; + char json[] = "{\"data\":[1,2,3]}"; + DeserializationError err = deserializeJson(doc, json); + CHECK(err == DeserializationError::Ok); + + int destination[4] = {0}; + size_t result = copyArray(doc["data"], destination); + + CHECK(3 == result); + CHECK(1 == destination[0]); + CHECK(2 == destination[1]); + CHECK(3 == destination[2]); + CHECK(0 == destination[3]); + } + + SECTION("ElementProxy -> int[]") { + JsonDocument doc; + char json[] = "[[1,2,3]]"; + DeserializationError err = deserializeJson(doc, json); + CHECK(err == DeserializationError::Ok); + + int destination[4] = {0}; + size_t result = copyArray(doc[0], destination); + + CHECK(3 == result); + CHECK(1 == destination[0]); + CHECK(2 == destination[1]); + CHECK(3 == destination[2]); + CHECK(0 == destination[3]); + } + + SECTION("JsonArray -> int[][]") { + JsonDocument doc; + char json[] = "[[1,2],[3],[4]]"; + + DeserializationError err = deserializeJson(doc, json); + CHECK(err == DeserializationError::Ok); + JsonArray array = doc.as(); + + int destination[3][2] = {{0}}; + copyArray(array, destination); + + CHECK(1 == destination[0][0]); + CHECK(2 == destination[0][1]); + CHECK(3 == destination[1][0]); + CHECK(0 == destination[1][1]); + CHECK(4 == destination[2][0]); + CHECK(0 == destination[2][1]); + } + + SECTION("JsonDocument -> int[][]") { + JsonDocument doc; + char json[] = "[[1,2],[3],[4]]"; + + DeserializationError err = deserializeJson(doc, json); + CHECK(err == DeserializationError::Ok); + + int destination[3][2] = {{0}}; + copyArray(doc, destination); + + CHECK(1 == destination[0][0]); + CHECK(2 == destination[0][1]); + CHECK(3 == destination[1][0]); + CHECK(0 == destination[1][1]); + CHECK(4 == destination[2][0]); + CHECK(0 == destination[2][1]); + } + + SECTION("MemberProxy -> int[][]") { + JsonDocument doc; + char json[] = "{\"data\":[[1,2],[3],[4]]}"; + + DeserializationError err = deserializeJson(doc, json); + CHECK(err == DeserializationError::Ok); + + int destination[3][2] = {{0}}; + copyArray(doc["data"], destination); + + CHECK(1 == destination[0][0]); + CHECK(2 == destination[0][1]); + CHECK(3 == destination[1][0]); + CHECK(0 == destination[1][1]); + CHECK(4 == destination[2][0]); + CHECK(0 == destination[2][1]); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/equals.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/equals.cpp new file mode 100644 index 00000000..241aa719 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/equals.cpp @@ -0,0 +1,63 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArray::operator==()") { + JsonDocument doc1; + JsonArray array1 = doc1.to(); + + JsonDocument doc2; + JsonArray array2 = doc2.to(); + + SECTION("should return false when arrays differ") { + array1.add("coucou"); + array2.add(1); + + REQUIRE_FALSE(array1 == array2); + } + + SECTION("should return false when LHS has more elements") { + array1.add(1); + array1.add(2); + array2.add(1); + + REQUIRE_FALSE(array1 == array2); + } + + SECTION("should return false when RHS has more elements") { + array1.add(1); + array2.add(1); + array2.add(2); + + REQUIRE_FALSE(array1 == array2); + } + + SECTION("should return true when arrays equal") { + array1.add("coucou"); + array2.add("coucou"); + + REQUIRE(array1 == array2); + } + + SECTION("should return false when RHS is null") { + JsonArray null; + + REQUIRE_FALSE(array1 == null); + } + + SECTION("should return false when LHS is null") { + JsonArray null; + + REQUIRE_FALSE(null == array1); + } + + SECTION("should return true when both are null") { + JsonArray null1; + JsonArray null2; + + REQUIRE(null1 == null2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/isNull.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/isNull.cpp new file mode 100644 index 00000000..77f15125 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/isNull.cpp @@ -0,0 +1,32 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArray::isNull()") { + SECTION("returns true") { + JsonArray arr; + REQUIRE(arr.isNull() == true); + } + + SECTION("returns false") { + JsonDocument doc; + JsonArray arr = doc.to(); + REQUIRE(arr.isNull() == false); + } +} + +TEST_CASE("JsonArray::operator bool()") { + SECTION("returns false") { + JsonArray arr; + REQUIRE(static_cast(arr) == false); + } + + SECTION("returns true") { + JsonDocument doc; + JsonArray arr = doc.to(); + REQUIRE(static_cast(arr) == true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/iterator.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/iterator.cpp new file mode 100644 index 00000000..f6bb3ef9 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/iterator.cpp @@ -0,0 +1,34 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArray::begin()/end()") { + SECTION("Non null JsonArray") { + JsonDocument doc; + JsonArray array = doc.to(); + array.add(12); + array.add(34); + + auto it = array.begin(); + auto end = array.end(); + + REQUIRE(end != it); + REQUIRE(12 == it->as()); + REQUIRE(12 == static_cast(*it)); + ++it; + REQUIRE(end != it); + REQUIRE(34 == it->as()); + REQUIRE(34 == static_cast(*it)); + ++it; + REQUIRE(end == it); + } + + SECTION("Null JsonArray") { + JsonArray array; + + REQUIRE(array.begin() == array.end()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/nesting.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/nesting.cpp new file mode 100644 index 00000000..434c4185 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/nesting.cpp @@ -0,0 +1,35 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArray::nesting()") { + JsonDocument doc; + JsonArray arr = doc.to(); + + SECTION("return 0 if uninitialized") { + JsonArray unitialized; + REQUIRE(unitialized.nesting() == 0); + } + + SECTION("returns 1 for empty array") { + REQUIRE(arr.nesting() == 1); + } + + SECTION("returns 1 for flat array") { + arr.add("hello"); + REQUIRE(arr.nesting() == 1); + } + + SECTION("returns 2 with nested array") { + arr.add(); + REQUIRE(arr.nesting() == 2); + } + + SECTION("returns 2 with nested object") { + arr.add(); + REQUIRE(arr.nesting() == 2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/remove.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/remove.cpp new file mode 100644 index 00000000..86911719 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/remove.cpp @@ -0,0 +1,126 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" + +TEST_CASE("JsonArray::remove()") { + JsonDocument doc; + JsonArray array = doc.to(); + array.add(1); + array.add(2); + array.add(3); + + SECTION("remove first by index") { + array.remove(0); + + REQUIRE(2 == array.size()); + REQUIRE(array[0] == 2); + REQUIRE(array[1] == 3); + } + + SECTION("remove middle by index") { + array.remove(1); + + REQUIRE(2 == array.size()); + REQUIRE(array[0] == 1); + REQUIRE(array[1] == 3); + } + + SECTION("remove last by index") { + array.remove(2); + + REQUIRE(2 == array.size()); + REQUIRE(array[0] == 1); + REQUIRE(array[1] == 2); + } + + SECTION("remove first by iterator") { + JsonArray::iterator it = array.begin(); + array.remove(it); + + REQUIRE(2 == array.size()); + REQUIRE(array[0] == 2); + REQUIRE(array[1] == 3); + } + + SECTION("remove middle by iterator") { + JsonArray::iterator it = array.begin(); + ++it; + array.remove(it); + + REQUIRE(2 == array.size()); + REQUIRE(array[0] == 1); + REQUIRE(array[1] == 3); + } + + SECTION("remove last bty iterator") { + JsonArray::iterator it = array.begin(); + ++it; + ++it; + array.remove(it); + + REQUIRE(2 == array.size()); + REQUIRE(array[0] == 1); + REQUIRE(array[1] == 2); + } + + SECTION("remove end()") { + array.remove(array.end()); + + REQUIRE(3 == array.size()); + } + + SECTION("In a loop") { + for (JsonArray::iterator it = array.begin(); it != array.end(); ++it) { + if (*it == 2) + array.remove(it); + } + + REQUIRE(2 == array.size()); + REQUIRE(array[0] == 1); + REQUIRE(array[1] == 3); + } + + SECTION("remove by index on unbound reference") { + JsonArray unboundArray; + unboundArray.remove(20); + } + + SECTION("remove by iterator on unbound reference") { + JsonArray unboundArray; + unboundArray.remove(unboundArray.begin()); + } + + SECTION("use JsonVariant as index") { + array.remove(array[3]); // no effect with null variant + array.remove(array[0]); // remove element at index 1 + + REQUIRE(2 == array.size()); + REQUIRE(array[0] == 1); + REQUIRE(array[1] == 3); + } +} + +TEST_CASE("Removed elements are recycled") { + SpyingAllocator spy; + JsonDocument doc(&spy); + JsonArray array = doc.to(); + + // fill the pool entirely + for (int i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++) + array.add(i); + + // free one slot in the pool + array.remove(0); + + // add one element; it should use the free slot + array.add(42); + + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), // only one pool + }); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/size.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/size.cpp new file mode 100644 index 00000000..63bf55dd --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/size.cpp @@ -0,0 +1,31 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArray::size()") { + JsonDocument doc; + JsonArray array = doc.to(); + + SECTION("returns 0 is empty") { + REQUIRE(0U == array.size()); + } + + SECTION("increases after add()") { + array.add("hello"); + REQUIRE(1U == array.size()); + + array.add("world"); + REQUIRE(2U == array.size()); + } + + SECTION("remains the same after replacing an element") { + array.add("hello"); + REQUIRE(1U == array.size()); + + array[0] = "hello"; + REQUIRE(1U == array.size()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/subscript.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/subscript.cpp new file mode 100644 index 00000000..fa0400ce --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/subscript.cpp @@ -0,0 +1,171 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonArray::operator[]") { + SpyingAllocator spy; + JsonDocument doc(&spy); + JsonArray array = doc.to(); + + SECTION("Pad with null") { + array[2] = 2; + array[5] = 5; + REQUIRE(array.size() == 6); + REQUIRE(array[0].isNull() == true); + REQUIRE(array[1].isNull() == true); + REQUIRE(array[2].isNull() == false); + REQUIRE(array[3].isNull() == true); + REQUIRE(array[4].isNull() == true); + REQUIRE(array[5].isNull() == false); + REQUIRE(array[2] == 2); + REQUIRE(array[5] == 5); + } + + SECTION("int") { + array[0] = 123; + REQUIRE(123 == array[0].as()); + REQUIRE(true == array[0].is()); + REQUIRE(false == array[0].is()); + } + +#if ARDUINOJSON_USE_LONG_LONG + SECTION("long long") { + array[0] = 9223372036854775807; + REQUIRE(9223372036854775807 == array[0].as()); + REQUIRE(true == array[0].is()); + REQUIRE(false == array[0].is()); + REQUIRE(false == array[0].is()); + } +#endif + + SECTION("double") { + array[0] = 123.45; + REQUIRE(123.45 == array[0].as()); + REQUIRE(true == array[0].is()); + REQUIRE(false == array[0].is()); + } + + SECTION("bool") { + array[0] = true; + REQUIRE(true == array[0].as()); + REQUIRE(true == array[0].is()); + REQUIRE(false == array[0].is()); + } + + SECTION("string literal") { + array[0] = "hello"; + + REQUIRE(array[0].as() == "hello"); + REQUIRE(true == array[0].is()); + REQUIRE(false == array[0].is()); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } + + SECTION("const char*") { + const char* str = "hello"; + array[0] = str; + + REQUIRE(array[0].as() == "hello"); + REQUIRE(true == array[0].is()); + REQUIRE(false == array[0].is()); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } + + SECTION("std::string") { + array[0] = "hello"_s; + + REQUIRE(array[0].as() == "hello"); + REQUIRE(true == array[0].is()); + REQUIRE(false == array[0].is()); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "world"); + + array.add("hello"); + array[0] = vla; + + REQUIRE(array[0] == "world"_s); + } +#endif + + SECTION("nested array") { + JsonDocument doc2; + JsonArray arr2 = doc2.to(); + + array[0] = arr2; + + REQUIRE(arr2 == array[0].as()); + REQUIRE(true == array[0].is()); + REQUIRE(false == array[0].is()); + } + + SECTION("nested object") { + JsonDocument doc2; + JsonObject obj = doc2.to(); + + array[0] = obj; + + REQUIRE(obj == array[0].as()); + REQUIRE(true == array[0].is()); + REQUIRE(false == array[0].is()); + } + + SECTION("array subscript") { + JsonDocument doc2; + JsonArray arr2 = doc2.to(); + const char* str = "hello"; + + arr2.add(str); + + array[0] = arr2[0]; + + REQUIRE(str == array[0]); + } + + SECTION("object subscript") { + const char* str = "hello"; + JsonDocument doc2; + JsonObject obj = doc2.to(); + + obj["x"] = str; + + array[0] = obj["x"]; + + REQUIRE(str == array[0]); + } + + SECTION("array[0].to()") { + JsonObject obj = array[0].to(); + REQUIRE(obj.isNull() == false); + } + + SECTION("Use a JsonVariant as index") { + array[0] = 1; + array[1] = 2; + array[2] = 3; + + REQUIRE(array[array[1]] == 3); + REQUIRE(array[array[3]] == nullptr); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArray/unbound.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/unbound.cpp new file mode 100644 index 00000000..ba800189 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArray/unbound.cpp @@ -0,0 +1,27 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +using namespace Catch::Matchers; + +TEST_CASE("Unbound JsonArray") { + JsonArray array; + + SECTION("SubscriptFails") { + REQUIRE(array[0].isNull()); + } + + SECTION("AddFails") { + array.add(1); + REQUIRE(0 == array.size()); + } + + SECTION("PrintToWritesBrackets") { + char buffer[32]; + serializeJson(array, buffer, sizeof(buffer)); + REQUIRE_THAT(buffer, Equals("null")); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/CMakeLists.txt new file mode 100644 index 00000000..4d69c716 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/CMakeLists.txt @@ -0,0 +1,19 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(JsonArrayConstTests + equals.cpp + isNull.cpp + iterator.cpp + nesting.cpp + size.cpp + subscript.cpp +) + +add_test(JsonArrayConst JsonArrayConstTests) + +set_tests_properties(JsonArrayConst + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/equals.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/equals.cpp new file mode 100644 index 00000000..de939cc0 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/equals.cpp @@ -0,0 +1,63 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArrayConst::operator==()") { + JsonDocument doc1; + JsonArrayConst array1 = doc1.to(); + + JsonDocument doc2; + JsonArrayConst array2 = doc2.to(); + + SECTION("should return false when arrays differ") { + doc1.add("coucou"); + doc2.add(1); + + REQUIRE_FALSE(array1 == array2); + } + + SECTION("should return false when LHS has more elements") { + doc1.add(1); + doc1.add(2); + doc2.add(1); + + REQUIRE_FALSE(array1 == array2); + } + + SECTION("should return false when RHS has more elements") { + doc1.add(1); + doc2.add(1); + doc2.add(2); + + REQUIRE_FALSE(array1 == array2); + } + + SECTION("should return true when arrays equal") { + doc1.add("coucou"); + doc2.add("coucou"); + + REQUIRE(array1 == array2); + } + + SECTION("should return false when RHS is null") { + JsonArrayConst null; + + REQUIRE_FALSE(array1 == null); + } + + SECTION("should return false when LHS is null") { + JsonArrayConst null; + + REQUIRE_FALSE(null == array1); + } + + SECTION("should return true when both are null") { + JsonArrayConst null1; + JsonArrayConst null2; + + REQUIRE(null1 == null2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/isNull.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/isNull.cpp new file mode 100644 index 00000000..d443a73e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/isNull.cpp @@ -0,0 +1,32 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArrayConst::isNull()") { + SECTION("returns true") { + JsonArrayConst arr; + REQUIRE(arr.isNull() == true); + } + + SECTION("returns false") { + JsonDocument doc; + JsonArrayConst arr = doc.to(); + REQUIRE(arr.isNull() == false); + } +} + +TEST_CASE("JsonArrayConst::operator bool()") { + SECTION("returns false") { + JsonArrayConst arr; + REQUIRE(static_cast(arr) == false); + } + + SECTION("returns true") { + JsonDocument doc; + JsonArrayConst arr = doc.to(); + REQUIRE(static_cast(arr) == true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/iterator.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/iterator.cpp new file mode 100644 index 00000000..0907af7e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/iterator.cpp @@ -0,0 +1,34 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArrayConst::begin()/end()") { + SECTION("Non null JsonArrayConst") { + JsonDocument doc; + JsonArrayConst array = doc.to(); + doc.add(12); + doc.add(34); + + auto it = array.begin(); + auto end = array.end(); + + REQUIRE(end != it); + REQUIRE(12 == it->as()); + REQUIRE(12 == static_cast(*it)); + ++it; + REQUIRE(end != it); + REQUIRE(34 == it->as()); + REQUIRE(34 == static_cast(*it)); + ++it; + REQUIRE(end == it); + } + + SECTION("Null JsonArrayConst") { + JsonArrayConst array; + + REQUIRE(array.begin() == array.end()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/nesting.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/nesting.cpp new file mode 100644 index 00000000..547d5d4b --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/nesting.cpp @@ -0,0 +1,35 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArrayConst::nesting()") { + JsonDocument doc; + JsonArrayConst arr = doc.to(); + + SECTION("return 0 if unbound") { + JsonArrayConst unbound; + REQUIRE(unbound.nesting() == 0); + } + + SECTION("returns 1 for empty array") { + REQUIRE(arr.nesting() == 1); + } + + SECTION("returns 1 for flat array") { + doc.add("hello"); + REQUIRE(arr.nesting() == 1); + } + + SECTION("returns 2 with nested array") { + doc.add(); + REQUIRE(arr.nesting() == 2); + } + + SECTION("returns 2 with nested object") { + doc.add(); + REQUIRE(arr.nesting() == 2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/size.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/size.cpp new file mode 100644 index 00000000..4bf000ff --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/size.cpp @@ -0,0 +1,27 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonArrayConst::size()") { + JsonDocument doc; + JsonArrayConst array = doc.to(); + + SECTION("returns 0 if unbound") { + JsonArrayConst unbound; + REQUIRE(0U == unbound.size()); + } + + SECTION("returns 0 is empty") { + REQUIRE(0U == array.size()); + } + + SECTION("return number of elements") { + doc.add("hello"); + doc.add("world"); + + REQUIRE(2U == array.size()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/subscript.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/subscript.cpp new file mode 100644 index 00000000..907cf319 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonArrayConst/subscript.cpp @@ -0,0 +1,27 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +TEST_CASE("JsonArrayConst::operator[]") { + JsonDocument doc; + JsonArrayConst arr = doc.to(); + doc.add(1); + doc.add(2); + doc.add(3); + + SECTION("int") { + REQUIRE(1 == arr[0].as()); + REQUIRE(2 == arr[1].as()); + REQUIRE(3 == arr[2].as()); + REQUIRE(0 == arr[3].as()); + } + + SECTION("JsonVariant") { + REQUIRE(2 == arr[arr[0]].as()); + REQUIRE(0 == arr[arr[3]].as()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/CMakeLists.txt new file mode 100644 index 00000000..6faaaa86 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/CMakeLists.txt @@ -0,0 +1,26 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(JsonDeserializerTests + array.cpp + DeserializationError.cpp + destination_types.cpp + errors.cpp + filter.cpp + input_types.cpp + misc.cpp + nestingLimit.cpp + number.cpp + object.cpp + string.cpp +) + +set_target_properties(JsonDeserializerTests PROPERTIES UNITY_BUILD OFF) + +add_test(JsonDeserializer JsonDeserializerTests) + +set_tests_properties(JsonDeserializer + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/DeserializationError.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/DeserializationError.cpp new file mode 100644 index 00000000..edfcd3a8 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/DeserializationError.cpp @@ -0,0 +1,122 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +void testStringification(DeserializationError error, std::string expected) { + REQUIRE(error.c_str() == expected); +} + +void testBoolification(DeserializationError error, bool expected) { + // DeserializationError on left-hand side + CHECK(bool(error) == expected); + CHECK(bool(error) != !expected); + CHECK(!bool(error) == !expected); + + // DeserializationError on right-hand side + CHECK(expected == bool(error)); + CHECK(!expected != bool(error)); + CHECK(!expected == !bool(error)); +} + +#define TEST_STRINGIFICATION(symbol) \ + testStringification(DeserializationError::symbol, #symbol) + +#define TEST_BOOLIFICATION(symbol, expected) \ + testBoolification(DeserializationError::symbol, expected) + +TEST_CASE("DeserializationError") { + SECTION("c_str()") { + TEST_STRINGIFICATION(Ok); + TEST_STRINGIFICATION(EmptyInput); + TEST_STRINGIFICATION(IncompleteInput); + TEST_STRINGIFICATION(InvalidInput); + TEST_STRINGIFICATION(NoMemory); + TEST_STRINGIFICATION(TooDeep); + } + + SECTION("as boolean") { + TEST_BOOLIFICATION(Ok, false); + TEST_BOOLIFICATION(EmptyInput, true); + TEST_BOOLIFICATION(IncompleteInput, true); + TEST_BOOLIFICATION(InvalidInput, true); + TEST_BOOLIFICATION(NoMemory, true); + TEST_BOOLIFICATION(TooDeep, true); + } + + SECTION("ostream DeserializationError") { + std::stringstream s; + s << DeserializationError(DeserializationError::InvalidInput); + REQUIRE(s.str() == "InvalidInput"); + } + + SECTION("ostream DeserializationError::Code") { + std::stringstream s; + s << DeserializationError::InvalidInput; + REQUIRE(s.str() == "InvalidInput"); + } + + SECTION("switch") { + DeserializationError err = DeserializationError::InvalidInput; + switch (err.code()) { + case DeserializationError::InvalidInput: + SUCCEED(); + break; + default: + FAIL(); + break; + } + } + + SECTION("Use in a condition") { + DeserializationError invalidInput(DeserializationError::InvalidInput); + DeserializationError ok(DeserializationError::Ok); + + SECTION("if (!err)") { + if (!invalidInput) + FAIL(); + } + + SECTION("if (err)") { + if (ok) + FAIL(); + } + } + + SECTION("Comparisons") { + DeserializationError invalidInput(DeserializationError::InvalidInput); + DeserializationError ok(DeserializationError::Ok); + + SECTION("DeserializationError == Code") { + REQUIRE(invalidInput == DeserializationError::InvalidInput); + REQUIRE(ok == DeserializationError::Ok); + } + + SECTION("Code == DeserializationError") { + REQUIRE(DeserializationError::InvalidInput == invalidInput); + REQUIRE(DeserializationError::Ok == ok); + } + + SECTION("DeserializationError != Code") { + REQUIRE(invalidInput != DeserializationError::Ok); + REQUIRE(ok != DeserializationError::InvalidInput); + } + + SECTION("Code != DeserializationError") { + REQUIRE(DeserializationError::Ok != invalidInput); + REQUIRE(DeserializationError::InvalidInput != ok); + } + + SECTION("DeserializationError == DeserializationError") { + REQUIRE_FALSE(invalidInput == ok); + } + + SECTION("DeserializationError != DeserializationError") { + REQUIRE(invalidInput != ok); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/array.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/array.cpp new file mode 100644 index 00000000..e6fb18d5 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/array.cpp @@ -0,0 +1,337 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" + +using ArduinoJson::detail::sizeofArray; + +TEST_CASE("deserialize JSON array") { + SpyingAllocator spy; + JsonDocument doc(&spy); + + SECTION("An empty array") { + DeserializationError err = deserializeJson(doc, "[]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(0 == arr.size()); + } + + SECTION("Spaces") { + SECTION("Before the opening bracket") { + DeserializationError err = deserializeJson(doc, " []"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(0 == arr.size()); + } + + SECTION("Before first value") { + DeserializationError err = deserializeJson(doc, "[ \t\r\n42]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == 42); + } + + SECTION("After first value") { + DeserializationError err = deserializeJson(doc, "[42 \t\r\n]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == 42); + } + } + + SECTION("Values types") { + SECTION("On integer") { + DeserializationError err = deserializeJson(doc, "[42]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == 42); + } + + SECTION("Two integers") { + DeserializationError err = deserializeJson(doc, "[42,84]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0] == 42); + REQUIRE(arr[1] == 84); + } + + SECTION("Float") { + DeserializationError err = deserializeJson(doc, "[4.2,1e2]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0].as() == Approx(4.2f)); + REQUIRE(arr[1] == 1e2f); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofPool(2)), + }); + } + + SECTION("Double") { + DeserializationError err = deserializeJson(doc, "[4.2123456,-7E89]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0].as() == Approx(4.2123456)); + REQUIRE(arr[1] == -7E89); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofPool(4)), + }); + } + + SECTION("Unsigned long") { + DeserializationError err = deserializeJson(doc, "[4294967295]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == 4294967295UL); + } + + SECTION("Boolean") { + DeserializationError err = deserializeJson(doc, "[true,false]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0] == true); + REQUIRE(arr[1] == false); + } + + SECTION("Null") { + DeserializationError err = deserializeJson(doc, "[null,null]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0].as() == 0); + REQUIRE(arr[1].as() == 0); + } + } + + SECTION("Quotes") { + SECTION("Double quotes") { + DeserializationError err = + deserializeJson(doc, "[ \"hello\" , \"world\" ]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0] == "hello"); + REQUIRE(arr[1] == "world"); + } + + SECTION("Single quotes") { + DeserializationError err = deserializeJson(doc, "[ 'hello' , 'world' ]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0] == "hello"); + REQUIRE(arr[1] == "world"); + } + + SECTION("No quotes") { + DeserializationError err = deserializeJson(doc, "[ hello , world ]"); + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("Double quotes (empty strings)") { + DeserializationError err = deserializeJson(doc, "[\"\",\"\"]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0] == ""); + REQUIRE(arr[1] == ""); + } + + SECTION("Single quotes (empty strings)") { + DeserializationError err = deserializeJson(doc, "[\'\',\'\']"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0] == ""); + REQUIRE(arr[1] == ""); + } + + SECTION("No quotes (empty strings)") { + DeserializationError err = deserializeJson(doc, "[,]"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("Closing single quotes missing") { + DeserializationError err = deserializeJson(doc, "[\"]"); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("Closing double quotes missing") { + DeserializationError err = deserializeJson(doc, "[\']"); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + } + + SECTION("Premature null-terminator") { + SECTION("After opening bracket") { + DeserializationError err = deserializeJson(doc, "["); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("After value") { + DeserializationError err = deserializeJson(doc, "[1"); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("After comma") { + DeserializationError err = deserializeJson(doc, "[1,"); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + } + + SECTION("Premature end of input") { + const char* input = "[1,2]"; + + SECTION("After opening bracket") { + DeserializationError err = deserializeJson(doc, input, 1); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("After value") { + DeserializationError err = deserializeJson(doc, input, 2); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("After comma") { + DeserializationError err = deserializeJson(doc, input, 3); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + } + + SECTION("Misc") { + SECTION("Nested objects") { + char jsonString[] = + " [ { \"a\" : 1 , \"b\" : 2 } , { \"c\" : 3 , \"d\" : 4 } ] "; + + DeserializationError err = deserializeJson(doc, jsonString); + JsonArray arr = doc.as(); + + JsonObject object1 = arr[0]; + const JsonObject object2 = arr[1]; + JsonObject object3 = arr[2]; + + REQUIRE(err == DeserializationError::Ok); + + REQUIRE(object1.isNull() == false); + REQUIRE(object2.isNull() == false); + REQUIRE(object3.isNull() == true); + + REQUIRE(2 == object1.size()); + REQUIRE(2 == object2.size()); + REQUIRE(0 == object3.size()); + + REQUIRE(1 == object1["a"].as()); + REQUIRE(2 == object1["b"].as()); + REQUIRE(3 == object2["c"].as()); + REQUIRE(4 == object2["d"].as()); + REQUIRE(0 == object3["e"].as()); + } + } + + SECTION("Should clear the JsonArray") { + deserializeJson(doc, "[1,2,3,4]"); + spy.clearLog(); + + deserializeJson(doc, "[]"); + + JsonArray arr = doc.as(); + REQUIRE(arr.size() == 0); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofArray(4)), + }); + } +} + +TEST_CASE("deserialize JSON array under memory constraints") { + TimebombAllocator timebomb(100); + SpyingAllocator spy(&timebomb); + JsonDocument doc(&spy); + + SECTION("empty array requires no allocation") { + timebomb.setCountdown(0); + char input[] = "[]"; + + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("allocation of pool list fails") { + timebomb.setCountdown(0); + char input[] = "[1]"; + + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + REQUIRE(doc.as() == "[]"); + } + + SECTION("allocation of pool fails") { + timebomb.setCountdown(0); + char input[] = "[1]"; + + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + REQUIRE(doc.as() == "[]"); + } + + SECTION("allocation of string fails in array") { + timebomb.setCountdown(1); + char input[] = "[0,\"hi!\"]"; + + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + REQUIRE(doc.as() == "[0,null]"); + } + + SECTION("don't store space characters") { + deserializeJson(doc, " [ \"1234567\" ] "); + + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("1234567")), + Reallocate(sizeofPool(), sizeofArray(1)), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/destination_types.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/destination_types.cpp new file mode 100644 index 00000000..0f96b23e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/destination_types.cpp @@ -0,0 +1,109 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofArray; +using ArduinoJson::detail::sizeofObject; + +TEST_CASE("deserializeJson(JsonDocument&)") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc.add("hello"_s); + spy.clearLog(); + + auto err = deserializeJson(doc, "[42]"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "[42]"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofPool()), + Deallocate(sizeofString("hello")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofArray(1)), + }); +} + +TEST_CASE("deserializeJson(JsonVariant)") { + SECTION("variant is bound") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc.add("hello"_s); + spy.clearLog(); + + JsonVariant variant = doc[0]; + + auto err = deserializeJson(variant, "[42]"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "[[42]]"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("hello")), + }); + } + + SECTION("variant is unbound") { + JsonVariant variant; + + auto err = deserializeJson(variant, "[42]"); + + REQUIRE(err == DeserializationError::NoMemory); + } +} + +TEST_CASE("deserializeJson(ElementProxy)") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc.add("hello"_s); + spy.clearLog(); + + SECTION("element already exists") { + auto err = deserializeJson(doc[0], "[42]"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "[[42]]"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("hello")), + }); + } + + SECTION("element must be created") { + auto err = deserializeJson(doc[1], "[42]"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "[\"hello\",[42]]"); + REQUIRE(spy.log() == AllocatorLog{}); + } +} + +TEST_CASE("deserializeJson(MemberProxy)") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc["hello"_s] = "world"_s; + spy.clearLog(); + + SECTION("member already exists") { + auto err = deserializeJson(doc["hello"], "[42]"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "{\"hello\":[42]}"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("world")), + }); + } + + SECTION("member must be created exists") { + auto err = deserializeJson(doc["value"], "[42]"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "{\"hello\":\"world\",\"value\":[42]}"); + REQUIRE(spy.log() == AllocatorLog{}); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/errors.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/errors.cpp new file mode 100644 index 00000000..35d3ca39 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/errors.cpp @@ -0,0 +1,162 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_DECODE_UNICODE 1 +#include +#include + +#include "Allocators.hpp" + +TEST_CASE("deserializeJson() returns IncompleteInput") { + const char* testCases[] = { + // strings + "\"\\", + "\"hello", + "\'hello", + // unicode + "'\\u", + "'\\u00", + "'\\u000", + // false + "f", + "fa", + "fal", + "fals", + // true + "t", + "tr", + "tru", + // null + "n", + "nu", + "nul", + // object + "{", + "{a", + "{a:", + "{a:1", + "{a:1,", + "{a:1,b", + "{a:1,b:", + }; + + for (auto input : testCases) { + SECTION(input) { + JsonDocument doc; + REQUIRE(deserializeJson(doc, input) == + DeserializationError::IncompleteInput); + } + } +} + +TEST_CASE("deserializeJson() returns InvalidInput") { + const char* testCases[] = { + // unicode + "'\\u'", "'\\u000g'", "'\\u000'", "'\\u000G'", "'\\u000/'", "\\x1234", + // numbers + "6a9", "1,", "2]", "3}", + // constants + "nulL", "tru3", "fals3", + // garbage + "%*$£¤"}; + + for (auto input : testCases) { + SECTION(input) { + JsonDocument doc; + REQUIRE(deserializeJson(doc, input) == + DeserializationError::InvalidInput); + } + } +} + +TEST_CASE("deserializeJson() oversees some edge cases") { + const char* testCases[] = { + "'\\ud83d'", // leading surrogate without a trailing surrogate + "'\\udda4'", // trailing surrogate without a leading surrogate + "'\\ud83d\\ud83d'", // two leading surrogates + }; + + for (auto input : testCases) { + SECTION(input) { + JsonDocument doc; + REQUIRE(deserializeJson(doc, input) == DeserializationError::Ok); + } + } +} + +TEST_CASE("deserializeJson() returns EmptyInput") { + JsonDocument doc; + + SECTION("null") { + auto err = deserializeJson(doc, static_cast(0)); + REQUIRE(err == DeserializationError::EmptyInput); + } + + SECTION("Empty string") { + auto err = deserializeJson(doc, ""); + REQUIRE(err == DeserializationError::EmptyInput); + } + + SECTION("Only spaces") { + auto err = deserializeJson(doc, " \t\n\r"); + REQUIRE(err == DeserializationError::EmptyInput); + } +} + +TEST_CASE("deserializeJson() returns NoMemory if string length overflows") { + JsonDocument doc; + auto maxLength = ArduinoJson::detail::StringNode::maxLength; + + SECTION("max length should succeed") { + auto err = deserializeJson(doc, "\"" + std::string(maxLength, 'a') + "\""); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("one above max length should fail") { + auto err = + deserializeJson(doc, "\"" + std::string(maxLength + 1, 'a') + "\""); + REQUIRE(err == DeserializationError::NoMemory); + } +} + +TEST_CASE("deserializeJson() returns NoMemory if extension allocation fails") { + JsonDocument doc(FailingAllocator::instance()); + + SECTION("uint32_t should pass") { + auto err = deserializeJson(doc, "4294967295"); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("uint64_t should fail") { + auto err = deserializeJson(doc, "18446744073709551615"); + + REQUIRE(err == DeserializationError::NoMemory); + } + + SECTION("int32_t should pass") { + auto err = deserializeJson(doc, "-2147483648"); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("int64_t should fail") { + auto err = deserializeJson(doc, "-9223372036854775808"); + + REQUIRE(err == DeserializationError::NoMemory); + } + + SECTION("float should pass") { + auto err = deserializeJson(doc, "3.402823e38"); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("double should fail") { + auto err = deserializeJson(doc, "1.7976931348623157e308"); + + REQUIRE(err == DeserializationError::NoMemory); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/filter.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/filter.cpp new file mode 100644 index 00000000..4f9d9b9b --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/filter.cpp @@ -0,0 +1,831 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_ENABLE_COMMENTS 1 +#include +#include + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofArray; +using ArduinoJson::detail::sizeofObject; + +TEST_CASE("Filtering") { + struct TestCase { + const char* description; + const char* input; + const char* filter; + uint8_t nestingLimit; + DeserializationError error; + const char* output; + size_t memoryUsage; + }; + + TestCase testCases[] = { + { + "Input is object, filter is null", // description + "{\"hello\":\"world\"}", // input + "null", // filter + 10, // nestingLimit + DeserializationError::Ok, // error + "null", // output + 0, // memoryUsage + }, + { + "Input is object, filter is false", + "{\"hello\":\"world\"}", + "false", + 10, + DeserializationError::Ok, + "null", + 0, + }, + { + "Input is object, filter is true", + "{\"abcdefg\":\"hijklmn\"}", + "true", + 10, + DeserializationError::Ok, + "{\"abcdefg\":\"hijklmn\"}", + sizeofObject(1) + sizeofString("abcdefg") + sizeofString("hijklmn"), + }, + { + "Input is object, filter is empty object", + "{\"hello\":\"world\"}", + "{}", + 10, + DeserializationError::Ok, + "{}", + sizeofObject(0), + }, + { + "Input in an object, but filter wants an array", + "{\"hello\":\"world\"}", + "[]", + 10, + DeserializationError::Ok, + "null", + 0, + }, + { + "Member is a string, but filter wants an array", + "{\"example\":\"example\"}", + "{\"example\":[true]}", + 10, + DeserializationError::Ok, + "{\"example\":null}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Member is a number, but filter wants an array", + "{\"example\":42}", + "{\"example\":[true]}", + 10, + DeserializationError::Ok, + "{\"example\":null}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Input is an array, but filter wants an object", + "[\"hello\",\"world\"]", + "{}", + 10, + DeserializationError::Ok, + "null", + 0, + }, + { + "Input is a bool, but filter wants an object", + "true", + "{}", + 10, + DeserializationError::Ok, + "null", + 0, + }, + { + "Input is a string, but filter wants an object", + "\"hello\"", + "{}", + 10, + DeserializationError::Ok, + "null", + 0, + }, + { + "Skip an integer", + "{\"an_integer\":666,example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip a float", + "{\"a_float\":12.34e-6,example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip false", + "{\"a_bool\":false,example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip true", + "{\"a_bool\":true,example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip null", + "{\"a_bool\":null,example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip a double-quoted string", + "{\"a_double_quoted_string\":\"hello\",example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip a single-quoted string", + "{\"a_single_quoted_string\":'hello',example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip an empty array", + "{\"an_empty_array\":[],example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip an empty array with spaces in it", + "{\"an_empty_array\":[\t],example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip an array", + "{\"an_array\":[1,2,3],example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip an array with spaces in it", + "{\"an_array\": [ 1 , 2 , 3 ] ,example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip an empty nested object", + "{\"an_empty_object\":{},example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip an empty nested object with spaces in it", + "{\"an_empty_object\":{ },example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip a nested object", + "{\"an_object\":{a:1,'b':2,\"c\":3},example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip an object with spaces in it", + "{\"an_object\" : { a : 1 , 'b' : 2 , \"c\" : 3 } ,example:42}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{\"example\":42}", + sizeofObject(1) + sizeofString("example"), + }, + { + "Skip a string in a nested object", + "{\"an_integer\": 0,\"example\":{\"type\":\"int\",\"outcome\":42}}", + "{\"example\":{\"outcome\":true}}", + 10, + DeserializationError::Ok, + "{\"example\":{\"outcome\":42}}", + 2 * sizeofObject(1) + 2 * sizeofString("example"), + }, + { + "wildcard", + "{\"example\":{\"type\":\"int\",\"outcome\":42}}", + "{\"*\":{\"outcome\":true}}", + 10, + DeserializationError::Ok, + "{\"example\":{\"outcome\":42}}", + 2 * sizeofObject(1) + 2 * sizeofString("example"), + }, + { + "exclusion filter (issue #1628)", + "{\"example\":1,\"ignored\":2}", + "{\"*\":true,\"ignored\":false}", + 10, + DeserializationError::Ok, + "{\"example\":1}", + sizeofObject(1) + sizeofString("example"), + }, + { + "only the first element of array counts", + "[1,2,3]", + "[true, false]", + 10, + DeserializationError::Ok, + "[1,2,3]", + sizeofArray(3), + }, + { + "only the first element of array counts", + "[1,2,3]", + "[false, true]", + 10, + DeserializationError::Ok, + "[]", + sizeofArray(0), + }, + { + "filter members of object in array", + "[{\"example\":1,\"ignore\":2},{\"example\":3,\"ignore\":4}]", + "[{\"example\":true}]", + 10, + DeserializationError::Ok, + "[{\"example\":1},{\"example\":3}]", + sizeofArray(2) + 2 * sizeofObject(1) + sizeofString("example"), + }, + { + "Unclosed single quote in skipped element", + "[',2,3]", + "[false,true]", + 10, + DeserializationError::IncompleteInput, + "[]", + sizeofArray(0), + }, + { + "Unclosed double quote in skipped element", + "[\",2,3]", + "[false,true]", + 10, + DeserializationError::IncompleteInput, + "[]", + sizeofArray(0), + }, + { + "Detect errors in skipped value", + "[!,2,\\]", + "[false]", + 10, + DeserializationError::InvalidInput, + "[]", + sizeofArray(0), + }, + { + "Detect incomplete string event if it's skipped", + "\"ABC", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Detect incomplete string event if it's skipped", + "'ABC", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Handle escaped quotes", + "'A\\'BC'", + "false", + 10, + DeserializationError::Ok, + "null", + 0, + }, + { + "Handle escaped quotes", + "\"A\\\"BC\"", + "false", + 10, + DeserializationError::Ok, + "null", + 0, + }, + { + "Detect incomplete string in presence of escaped quotes", + "'A\\'BC", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Detect incomplete string in presence of escaped quotes", + "\"A\\\"BC", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "skip empty array", + "[]", + "false", + 10, + DeserializationError::Ok, + "null", + 0, + }, + { + "Skip empty array with spaces", + " [ ] ", + "false", + 10, + DeserializationError::Ok, + "null", + 0, + }, + { + "Bubble up element error even if array is skipped", + "[1,'2,3]", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Bubble up member error even if object is skipped", + "{'hello':'worl}", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Bubble up colon error even if object is skipped", + "{'hello','world'}", + "false", + 10, + DeserializationError::InvalidInput, + "null", + 0, + }, + { + "Bubble up key error even if object is skipped", + "{'hello:1}", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Detect invalid value in skipped object", + "{'hello':!}", + "false", + 10, + DeserializationError::InvalidInput, + "null", + 0, + }, + { + "Ignore invalid value in skipped object", + "{'hello':\\}", + "false", + 10, + DeserializationError::InvalidInput, + "null", + 0, + }, + { + "Check nesting limit even for ignored objects", + "{}", + "false", + 0, + DeserializationError::TooDeep, + "null", + 0, + }, + { + "Check nesting limit even for ignored objects", + "{'hello':{}}", + "false", + 1, + DeserializationError::TooDeep, + "null", + 0, + }, + { + "Check nesting limit even for ignored values in objects", + "{'hello':{}}", + "{}", + 1, + DeserializationError::TooDeep, + "{}", + sizeofObject(0), + }, + { + "Check nesting limit even for ignored arrays", + "[]", + "false", + 0, + DeserializationError::TooDeep, + "null", + 0, + }, + { + "Check nesting limit even for ignored arrays", + "[[]]", + "false", + 1, + DeserializationError::TooDeep, + "null", + 0, + }, + { + "Check nesting limit even for ignored values in arrays", + "[[]]", + "[]", + 1, + DeserializationError::TooDeep, + "[]", + sizeofArray(0), + }, + { + "Supports back-slash at the end of skipped string", + "\"hell\\", + "false", + 1, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Invalid comment at after an element in a skipped array", + "[1/]", + "false", + 10, + DeserializationError::InvalidInput, + "null", + 0, + }, + { + "Incomplete comment at after an element in a skipped array", + "[1/*]", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Missing comma in a skipped array", + "[1 2]", + "false", + 10, + DeserializationError::InvalidInput, + "null", + 0, + }, + { + "Invalid comment at the beginning of array", + "[/1]", + "[false]", + 10, + DeserializationError::InvalidInput, + "[]", + sizeofArray(0), + }, + { + "Incomplete comment at the begining of an array", + "[/*]", + "[false]", + 10, + DeserializationError::IncompleteInput, + "[]", + sizeofArray(0), + }, + { + "Invalid comment before key", + "{/1:2}", + "{}", + 10, + DeserializationError::InvalidInput, + "{}", + sizeofObject(0), + }, + { + "Incomplete comment before key", + "{/*:2}", + "{}", + 10, + DeserializationError::IncompleteInput, + "{}", + sizeofObject(0), + }, + { + "Invalid comment after key", + "{\"example\"/1:2}", + "{}", + 10, + DeserializationError::InvalidInput, + "{}", + sizeofObject(0), + }, + { + "Incomplete comment after key", + "{\"example\"/*:2}", + "{}", + 10, + DeserializationError::IncompleteInput, + "{}", + sizeofObject(0), + }, + { + "Invalid comment after colon", + "{\"example\":/12}", + "{}", + 10, + DeserializationError::InvalidInput, + "{}", + sizeofObject(0), + }, + { + "Incomplete comment after colon", + "{\"example\":/*2}", + "{}", + 10, + DeserializationError::IncompleteInput, + "{}", + sizeofObject(0), + }, + { + "Comment next to an integer", + "{\"ignore\":1//,\"example\":2\n}", + "{\"example\":true}", + 10, + DeserializationError::Ok, + "{}", + sizeofObject(0), + }, + { + "Invalid comment after opening brace of a skipped object", + "{/1:2}", + "false", + 10, + DeserializationError::InvalidInput, + "null", + 0, + }, + { + "Incomplete after opening brace of a skipped object", + "{/*:2}", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Invalid comment after key of a skipped object", + "{\"example\"/:2}", + "false", + 10, + DeserializationError::InvalidInput, + "null", + 0, + }, + { + "Incomplete comment after key of a skipped object", + "{\"example\"/*:2}", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Invalid comment after value in a skipped object", + "{\"example\":2/}", + "false", + 10, + DeserializationError::InvalidInput, + "null", + 0, + }, + { + "Incomplete comment after value of a skipped object", + "{\"example\":2/*}", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "Incomplete comment after comma in skipped object", + "{\"example\":2,/*}", + "false", + 10, + DeserializationError::IncompleteInput, + "null", + 0, + }, + { + "NUL character in key", + "{\"x\":0,\"x\\u0000a\":1,\"x\\u0000b\":2}", + "{\"x\\u0000a\":true}", + 10, + DeserializationError::Ok, + "{\"x\\u0000a\":1}", + sizeofObject(1) + sizeofString("x?a"), + }, + }; + + for (auto& tc : testCases) { + SECTION(tc.description) { + SpyingAllocator spy; + JsonDocument filter; + JsonDocument doc(&spy); + + REQUIRE(deserializeJson(filter, tc.filter) == DeserializationError::Ok); + + CHECK(deserializeJson( + doc, tc.input, DeserializationOption::Filter(filter), + DeserializationOption::NestingLimit(tc.nestingLimit)) == + tc.error); + + CHECK(doc.as() == tc.output); + + doc.shrinkToFit(); + CHECK(spy.allocatedBytes() == tc.memoryUsage); + } + } +} + +TEST_CASE("Overloads") { + JsonDocument doc; + JsonDocument filter; + + using namespace DeserializationOption; + + // deserializeJson(..., Filter) + + SECTION("const char*, Filter") { + deserializeJson(doc, "{}", Filter(filter)); + } + + SECTION("const char*, size_t, Filter") { + deserializeJson(doc, "{}", 2, Filter(filter)); + } + + SECTION("const std::string&, Filter") { + deserializeJson(doc, "{}"_s, Filter(filter)); + } + + SECTION("std::istream&, Filter") { + std::stringstream s("{}"); + deserializeJson(doc, s, Filter(filter)); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("char[n], Filter") { + size_t i = 4; + char vla[i]; + strcpy(vla, "{}"); + deserializeJson(doc, vla, Filter(filter)); + } +#endif + + // deserializeJson(..., Filter, NestingLimit) + + SECTION("const char*, Filter, NestingLimit") { + deserializeJson(doc, "{}", Filter(filter), NestingLimit(5)); + } + + SECTION("const char*, size_t, Filter, NestingLimit") { + deserializeJson(doc, "{}", 2, Filter(filter), NestingLimit(5)); + } + + SECTION("const std::string&, Filter, NestingLimit") { + deserializeJson(doc, "{}"_s, Filter(filter), NestingLimit(5)); + } + + SECTION("std::istream&, Filter, NestingLimit") { + std::stringstream s("{}"); + deserializeJson(doc, s, Filter(filter), NestingLimit(5)); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("char[n], Filter, NestingLimit") { + size_t i = 4; + char vla[i]; + strcpy(vla, "{}"); + deserializeJson(doc, vla, Filter(filter), NestingLimit(5)); + } +#endif + + // deserializeJson(..., NestingLimit, Filter) + + SECTION("const char*, NestingLimit, Filter") { + deserializeJson(doc, "{}", NestingLimit(5), Filter(filter)); + } + + SECTION("const char*, size_t, NestingLimit, Filter") { + deserializeJson(doc, "{}", 2, NestingLimit(5), Filter(filter)); + } + + SECTION("const std::string&, NestingLimit, Filter") { + deserializeJson(doc, "{}"_s, NestingLimit(5), Filter(filter)); + } + + SECTION("std::istream&, NestingLimit, Filter") { + std::stringstream s("{}"); + deserializeJson(doc, s, NestingLimit(5), Filter(filter)); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("char[n], NestingLimit, Filter") { + size_t i = 4; + char vla[i]; + strcpy(vla, "{}"); + deserializeJson(doc, vla, NestingLimit(5), Filter(filter)); + } +#endif +} + +TEST_CASE("shrink filter") { + JsonDocument doc; + SpyingAllocator spy; + JsonDocument filter(&spy); + filter["a"] = true; + spy.clearLog(); + + deserializeJson(doc, "{}", DeserializationOption::Filter(filter)); + + REQUIRE(spy.log() == AllocatorLog{ + Reallocate(sizeofPool(), sizeofObject(1)), + }); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/input_types.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/input_types.cpp new file mode 100644 index 00000000..21e890cc --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/input_types.cpp @@ -0,0 +1,232 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +#include +#include + +#include "Allocators.hpp" +#include "CustomReader.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofObject; + +TEST_CASE("deserializeJson(char*)") { + SpyingAllocator spy; + JsonDocument doc(&spy); + + char input[] = "{\"hello\":\"world\"}"; + + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::Ok); + + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("hello")), + Allocate(sizeofPool()), + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("world")), + Reallocate(sizeofPool(), sizeofObject(1)), + }); +} + +TEST_CASE("deserializeJson(unsigned char*, unsigned int)") { // issue #1897 + JsonDocument doc; + + unsigned char input[] = "{\"hello\":\"world\"}"; + unsigned char* input_ptr = input; + unsigned int size = sizeof(input); + + DeserializationError err = deserializeJson(doc, input_ptr, size); + + REQUIRE(err == DeserializationError::Ok); +} + +TEST_CASE("deserializeJson(uint8_t*, size_t)") { // issue #1898 + JsonDocument doc; + + uint8_t input[] = "{\"hello\":\"world\"}"; + uint8_t* input_ptr = input; + size_t size = sizeof(input); + + DeserializationError err = deserializeJson(doc, input_ptr, size); + + REQUIRE(err == DeserializationError::Ok); +} + +TEST_CASE("deserializeJson(const std::string&)") { + JsonDocument doc; + + SECTION("should accept const string") { + const std::string input("[42]"); + + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("should accept temporary string") { + DeserializationError err = deserializeJson(doc, "[42]"_s); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("should duplicate content") { + std::string input("[\"hello\"]"); + + DeserializationError err = deserializeJson(doc, input); + input[2] = 'X'; // alter the string tomake sure we made a copy + + JsonArray array = doc.as(); + REQUIRE(err == DeserializationError::Ok); + REQUIRE("hello"_s == array[0]); + } +} + +TEST_CASE("deserializeJson(std::istream&)") { + JsonDocument doc; + + SECTION("array") { + std::istringstream json(" [ 42 ] "); + + DeserializationError err = deserializeJson(doc, json); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(42 == arr[0]); + } + + SECTION("object") { + std::istringstream json(" { hello : 'world' }"); + + DeserializationError err = deserializeJson(doc, json); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == obj.size()); + REQUIRE("world"_s == obj["hello"]); + } + + SECTION("Should not read after the closing brace of an empty object") { + std::istringstream json("{}123"); + + deserializeJson(doc, json); + + REQUIRE('1' == char(json.get())); + } + + SECTION("Should not read after the closing brace") { + std::istringstream json("{\"hello\":\"world\"}123"); + + deserializeJson(doc, json); + + REQUIRE('1' == char(json.get())); + } + + SECTION("Should not read after the closing bracket of an empty array") { + std::istringstream json("[]123"); + + deserializeJson(doc, json); + + REQUIRE('1' == char(json.get())); + } + + SECTION("Should not read after the closing bracket") { + std::istringstream json("[\"hello\",\"world\"]123"); + + deserializeJson(doc, json); + + REQUIRE('1' == char(json.get())); + } + + SECTION("Should not read after the closing quote") { + std::istringstream json("\"hello\"123"); + + deserializeJson(doc, json); + + REQUIRE('1' == char(json.get())); + } +} + +#ifdef HAS_VARIABLE_LENGTH_ARRAY +TEST_CASE("deserializeJson(VLA)") { + size_t i = 9; + char vla[i]; + strcpy(vla, "{\"a\":42}"); + + JsonDocument doc; + DeserializationError err = deserializeJson(doc, vla); + + REQUIRE(err == DeserializationError::Ok); +} +#endif + +TEST_CASE("deserializeJson(CustomReader)") { + JsonDocument doc; + CustomReader reader("[4,2]"); + DeserializationError err = deserializeJson(doc, reader); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.size() == 2); + REQUIRE(doc[0] == 4); + REQUIRE(doc[1] == 2); +} + +TEST_CASE("deserializeJson(JsonDocument&, MemberProxy)") { + JsonDocument doc1; + doc1["payload"] = "[4,2]"; + + JsonDocument doc2; + DeserializationError err = deserializeJson(doc2, doc1["payload"]); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc2.size() == 2); + REQUIRE(doc2[0] == 4); + REQUIRE(doc2[1] == 2); +} + +TEST_CASE("deserializeJson(JsonDocument&, JsonVariant)") { + JsonDocument doc1; + doc1["payload"] = "[4,2]"; + + JsonDocument doc2; + DeserializationError err = + deserializeJson(doc2, doc1["payload"].as()); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc2.size() == 2); + REQUIRE(doc2[0] == 4); + REQUIRE(doc2[1] == 2); +} + +TEST_CASE("deserializeJson(JsonDocument&, JsonVariantConst)") { + JsonDocument doc1; + doc1["payload"] = "[4,2]"; + + JsonDocument doc2; + DeserializationError err = + deserializeJson(doc2, doc1["payload"].as()); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc2.size() == 2); + REQUIRE(doc2[0] == 4); + REQUIRE(doc2[1] == 2); +} + +TEST_CASE("deserializeJson(JsonDocument&, ElementProxy)") { + JsonDocument doc1; + doc1[0] = "[4,2]"; + + JsonDocument doc2; + DeserializationError err = deserializeJson(doc2, doc1[0]); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc2.size() == 2); + REQUIRE(doc2[0] == 4); + REQUIRE(doc2[1] == 2); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/misc.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/misc.cpp new file mode 100644 index 00000000..c13956b5 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/misc.cpp @@ -0,0 +1,49 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" + +using ArduinoJson::detail::sizeofArray; + +TEST_CASE("deserializeJson() misc cases") { + SpyingAllocator spy; + JsonDocument doc(&spy); + + SECTION("null") { + DeserializationError err = deserializeJson(doc, "null"); + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == false); + } + + SECTION("true") { + DeserializationError err = deserializeJson(doc, "true"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(doc.as() == true); + } + + SECTION("false") { + DeserializationError err = deserializeJson(doc, "false"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(doc.as() == false); + } + + SECTION("Should clear the JsonVariant") { + deserializeJson(doc, "[1,2,3]"); + spy.clearLog(); + + deserializeJson(doc, "{}"); + + REQUIRE(doc.is()); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofArray(3)), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/nestingLimit.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/nestingLimit.cpp new file mode 100644 index 00000000..07f8f195 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/nestingLimit.cpp @@ -0,0 +1,105 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +#include "Literals.hpp" + +#define SHOULD_WORK(expression) REQUIRE(DeserializationError::Ok == expression); +#define SHOULD_FAIL(expression) \ + REQUIRE(DeserializationError::TooDeep == expression); + +TEST_CASE("JsonDeserializer nesting") { + JsonDocument doc; + + SECTION("Input = const char*") { + SECTION("limit = 0") { + DeserializationOption::NestingLimit nesting(0); + SHOULD_WORK(deserializeJson(doc, "\"toto\"", nesting)); + SHOULD_WORK(deserializeJson(doc, "123", nesting)); + SHOULD_WORK(deserializeJson(doc, "true", nesting)); + SHOULD_FAIL(deserializeJson(doc, "[]", nesting)); + SHOULD_FAIL(deserializeJson(doc, "{}", nesting)); + SHOULD_FAIL(deserializeJson(doc, "[\"toto\"]", nesting)); + SHOULD_FAIL(deserializeJson(doc, "{\"toto\":1}", nesting)); + } + + SECTION("limit = 1") { + DeserializationOption::NestingLimit nesting(1); + SHOULD_WORK(deserializeJson(doc, "[\"toto\"]", nesting)); + SHOULD_WORK(deserializeJson(doc, "{\"toto\":1}", nesting)); + SHOULD_FAIL(deserializeJson(doc, "{\"toto\":{}}", nesting)); + SHOULD_FAIL(deserializeJson(doc, "{\"toto\":[]}", nesting)); + SHOULD_FAIL(deserializeJson(doc, "[[\"toto\"]]", nesting)); + SHOULD_FAIL(deserializeJson(doc, "[{\"toto\":1}]", nesting)); + } + } + + SECTION("char* and size_t") { + SECTION("limit = 0") { + DeserializationOption::NestingLimit nesting(0); + SHOULD_WORK(deserializeJson(doc, "\"toto\"", 6, nesting)); + SHOULD_WORK(deserializeJson(doc, "123", 3, nesting)); + SHOULD_WORK(deserializeJson(doc, "true", 4, nesting)); + SHOULD_FAIL(deserializeJson(doc, "[]", 2, nesting)); + SHOULD_FAIL(deserializeJson(doc, "{}", 2, nesting)); + SHOULD_FAIL(deserializeJson(doc, "[\"toto\"]", 8, nesting)); + SHOULD_FAIL(deserializeJson(doc, "{\"toto\":1}", 10, nesting)); + } + + SECTION("limit = 1") { + DeserializationOption::NestingLimit nesting(1); + SHOULD_WORK(deserializeJson(doc, "[\"toto\"]", 8, nesting)); + SHOULD_WORK(deserializeJson(doc, "{\"toto\":1}", 10, nesting)); + SHOULD_FAIL(deserializeJson(doc, "{\"toto\":{}}", 11, nesting)); + SHOULD_FAIL(deserializeJson(doc, "{\"toto\":[]}", 11, nesting)); + SHOULD_FAIL(deserializeJson(doc, "[[\"toto\"]]", 10, nesting)); + SHOULD_FAIL(deserializeJson(doc, "[{\"toto\":1}]", 12, nesting)); + } + } + + SECTION("Input = std::string") { + SECTION("limit = 0") { + DeserializationOption::NestingLimit nesting(0); + SHOULD_WORK(deserializeJson(doc, "\"toto\""_s, nesting)); + SHOULD_WORK(deserializeJson(doc, "123"_s, nesting)); + SHOULD_WORK(deserializeJson(doc, "true"_s, nesting)); + SHOULD_FAIL(deserializeJson(doc, "[]"_s, nesting)); + SHOULD_FAIL(deserializeJson(doc, "{}"_s, nesting)); + SHOULD_FAIL(deserializeJson(doc, "[\"toto\"]"_s, nesting)); + SHOULD_FAIL(deserializeJson(doc, "{\"toto\":1}"_s, nesting)); + } + + SECTION("limit = 1") { + DeserializationOption::NestingLimit nesting(1); + SHOULD_WORK(deserializeJson(doc, "[\"toto\"]"_s, nesting)); + SHOULD_WORK(deserializeJson(doc, "{\"toto\":1}"_s, nesting)); + SHOULD_FAIL(deserializeJson(doc, "{\"toto\":{}}"_s, nesting)); + SHOULD_FAIL(deserializeJson(doc, "{\"toto\":[]}"_s, nesting)); + SHOULD_FAIL(deserializeJson(doc, "[[\"toto\"]]"_s, nesting)); + SHOULD_FAIL(deserializeJson(doc, "[{\"toto\":1}]"_s, nesting)); + } + } + + SECTION("Input = std::istream") { + SECTION("limit = 0") { + DeserializationOption::NestingLimit nesting(0); + std::istringstream good("true"); + std::istringstream bad("[]"); + SHOULD_WORK(deserializeJson(doc, good, nesting)); + SHOULD_FAIL(deserializeJson(doc, bad, nesting)); + } + + SECTION("limit = 1") { + DeserializationOption::NestingLimit nesting(1); + std::istringstream good("[\"toto\"]"); + std::istringstream bad("{\"toto\":{}}"); + SHOULD_WORK(deserializeJson(doc, good, nesting)); + SHOULD_FAIL(deserializeJson(doc, bad, nesting)); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/number.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/number.cpp new file mode 100644 index 00000000..a74e50bc --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/number.cpp @@ -0,0 +1,133 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_USE_LONG_LONG 0 +#define ARDUINOJSON_ENABLE_NAN 1 +#define ARDUINOJSON_ENABLE_INFINITY 1 + +#include +#include +#include + +namespace my { +using ArduinoJson::detail::isinf; +using ArduinoJson::detail::isnan; +} // namespace my + +TEST_CASE("deserialize an integer") { + JsonDocument doc; + + SECTION("Integer") { + SECTION("0") { + DeserializationError err = deserializeJson(doc, "0"); + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == true); + REQUIRE(doc.as() == 0); + REQUIRE(doc.as() == "0"); // issue #808 + } + + SECTION("Negative") { + DeserializationError err = deserializeJson(doc, "-42"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE_FALSE(doc.is()); + REQUIRE(doc.as() == -42); + } + +#if LONG_MAX == 2147483647 + SECTION("LONG_MAX") { + DeserializationError err = deserializeJson(doc, "2147483647"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == true); + REQUIRE(doc.as() == LONG_MAX); + } + + SECTION("LONG_MAX + 1") { + DeserializationError err = deserializeJson(doc, "2147483648"); + + CAPTURE(LONG_MIN); + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == false); + REQUIRE(doc.is() == true); + } +#endif + +#if LONG_MIN == -2147483648 + SECTION("LONG_MIN") { + DeserializationError err = deserializeJson(doc, "-2147483648"); + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == true); + REQUIRE(doc.as() == LONG_MIN); + } + + SECTION("LONG_MIN - 1") { + DeserializationError err = deserializeJson(doc, "-2147483649"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == false); + REQUIRE(doc.is() == true); + } +#endif + +#if ULONG_MAX == 4294967295 + SECTION("ULONG_MAX") { + DeserializationError err = deserializeJson(doc, "4294967295"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == true); + REQUIRE(doc.as() == ULONG_MAX); + REQUIRE(doc.is() == false); + } + + SECTION("ULONG_MAX + 1") { + DeserializationError err = deserializeJson(doc, "4294967296"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == false); + REQUIRE(doc.is() == true); + } +#endif + } + + SECTION("Floats") { + SECTION("Double") { + DeserializationError err = deserializeJson(doc, "-1.23e+4"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE_FALSE(doc.is()); + REQUIRE(doc.is()); + REQUIRE(doc.as() == Approx(-1.23e+4)); + } + + SECTION("NaN") { + DeserializationError err = deserializeJson(doc, "NaN"); + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == true); + REQUIRE(my::isnan(doc.as())); + } + + SECTION("Infinity") { + DeserializationError err = deserializeJson(doc, "Infinity"); + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == true); + REQUIRE(my::isinf(doc.as())); + } + + SECTION("+Infinity") { + DeserializationError err = deserializeJson(doc, "+Infinity"); + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == true); + REQUIRE(my::isinf(doc.as())); + } + + SECTION("-Infinity") { + DeserializationError err = deserializeJson(doc, "-Infinity"); + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is() == true); + REQUIRE(my::isinf(doc.as())); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/object.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/object.cpp new file mode 100644 index 00000000..d7936c95 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/object.cpp @@ -0,0 +1,399 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofObject; + +TEST_CASE("deserialize JSON object") { + SpyingAllocator spy; + JsonDocument doc(&spy); + + SECTION("An empty object") { + DeserializationError err = deserializeJson(doc, "{}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 0); + } + + SECTION("Quotes") { + SECTION("Double quotes") { + DeserializationError err = deserializeJson(doc, "{\"key\":\"value\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 1); + REQUIRE(obj["key"] == "value"); + } + + SECTION("Single quotes") { + DeserializationError err = deserializeJson(doc, "{'key':'value'}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 1); + REQUIRE(obj["key"] == "value"); + } + + SECTION("No quotes") { + DeserializationError err = deserializeJson(doc, "{key:'value'}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 1); + REQUIRE(obj["key"] == "value"); + } + + SECTION("No quotes, allow underscore in key") { + DeserializationError err = deserializeJson(doc, "{_k_e_y_:42}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 1); + REQUIRE(obj["_k_e_y_"] == 42); + } + } + + SECTION("Spaces") { + SECTION("Before the key") { + DeserializationError err = deserializeJson(doc, "{ \"key\":\"value\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 1); + REQUIRE(obj["key"] == "value"); + } + + SECTION("After the key") { + DeserializationError err = deserializeJson(doc, "{\"key\" :\"value\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 1); + REQUIRE(obj["key"] == "value"); + } + + SECTION("Before the value") { + DeserializationError err = deserializeJson(doc, "{\"key\": \"value\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 1); + REQUIRE(obj["key"] == "value"); + } + + SECTION("After the value") { + DeserializationError err = deserializeJson(doc, "{\"key\":\"value\" }"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 1); + REQUIRE(obj["key"] == "value"); + } + + SECTION("Before the comma") { + DeserializationError err = + deserializeJson(doc, "{\"key1\":\"value1\" ,\"key2\":\"value2\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["key1"] == "value1"); + REQUIRE(obj["key2"] == "value2"); + } + + SECTION("After the comma") { + DeserializationError err = + deserializeJson(doc, "{\"key1\":\"value1\", \"key2\":\"value2\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["key1"] == "value1"); + REQUIRE(obj["key2"] == "value2"); + } + } + + SECTION("Values types") { + SECTION("String") { + DeserializationError err = + deserializeJson(doc, "{\"key1\":\"value1\",\"key2\":\"value2\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["key1"] == "value1"); + REQUIRE(obj["key2"] == "value2"); + } + + SECTION("Integer") { + DeserializationError err = + deserializeJson(doc, "{\"key1\":42,\"key2\":-42}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["key1"] == 42); + REQUIRE(obj["key2"] == -42); + } + + SECTION("Float") { + DeserializationError err = + deserializeJson(doc, "{\"key1\":12.345,\"key2\":-7E3}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["key1"].as() == Approx(12.345f)); + REQUIRE(obj["key2"] == -7E3f); + } + + SECTION("Double") { + DeserializationError err = + deserializeJson(doc, "{\"key1\":12.3456789,\"key2\":-7E89}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["key1"].as() == Approx(12.3456789)); + REQUIRE(obj["key2"] == -7E89); + } + + SECTION("Booleans") { + DeserializationError err = + deserializeJson(doc, "{\"key1\":true,\"key2\":false}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["key1"] == true); + REQUIRE(obj["key2"] == false); + } + + SECTION("Null") { + DeserializationError err = + deserializeJson(doc, "{\"key1\":null,\"key2\":null}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["key1"].as() == 0); + REQUIRE(obj["key2"].as() == 0); + } + + SECTION("Array") { + char jsonString[] = " { \"ab\" : [ 1 , 2 ] , \"cd\" : [ 3 , 4 ] } "; + + DeserializationError err = deserializeJson(doc, jsonString); + JsonObject obj = doc.as(); + + JsonArray array1 = obj["ab"]; + const JsonArray array2 = obj["cd"]; + JsonArray array3 = obj["ef"]; + + REQUIRE(err == DeserializationError::Ok); + + REQUIRE(array1.isNull() == false); + REQUIRE(array2.isNull() == false); + REQUIRE(array3.isNull() == true); + + REQUIRE(2 == array1.size()); + REQUIRE(2 == array2.size()); + REQUIRE(0 == array3.size()); + + REQUIRE(1 == array1[0].as()); + REQUIRE(2 == array1[1].as()); + + REQUIRE(3 == array2[0].as()); + REQUIRE(4 == array2[1].as()); + + REQUIRE(0 == array3[0].as()); + } + } + + SECTION("Premature null terminator") { + SECTION("After opening brace") { + DeserializationError err = deserializeJson(doc, "{"); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("After key") { + DeserializationError err = deserializeJson(doc, "{\"hello\""); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("After colon") { + DeserializationError err = deserializeJson(doc, "{\"hello\":"); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("After value") { + DeserializationError err = deserializeJson(doc, "{\"hello\":\"world\""); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("After comma") { + DeserializationError err = deserializeJson(doc, "{\"hello\":\"world\","); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + } + + SECTION("Misc") { + SECTION("A quoted key without value") { + DeserializationError err = deserializeJson(doc, "{\"key\"}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("A non-quoted key without value") { + DeserializationError err = deserializeJson(doc, "{key}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("A dangling comma") { + DeserializationError err = deserializeJson(doc, "{\"key1\":\"value1\",}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("null as a key") { + DeserializationError err = deserializeJson(doc, "{null:\"value\"}"); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("Repeated key") { + DeserializationError err = deserializeJson(doc, "{a:{b:{c:1}},a:2}"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "{\"a\":2}"); + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("a")), + Allocate(sizeofPool()), + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("b")), + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("c")), + Allocate(sizeofStringBuffer()), + Deallocate(sizeofString("b")), + Deallocate(sizeofString("c")), + Deallocate(sizeofStringBuffer()), + Reallocate(sizeofPool(), sizeofObject(2) + sizeofObject(1)), + }); + } + + SECTION("Repeated key with zero copy mode") { // issue #1697 + char input[] = "{a:{b:{c:1}},a:2}"; + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc["a"] == 2); + } + + SECTION("NUL in keys") { + DeserializationError err = + deserializeJson(doc, "{\"x\":0,\"x\\u0000a\":1,\"x\\u0000b\":2}"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == + "{\"x\":0,\"x\\u0000a\":1,\"x\\u0000b\":2}"); + } + } + + SECTION("Should clear the JsonObject") { + deserializeJson(doc, "{\"hello\":\"world\"}"); + spy.clearLog(); + + deserializeJson(doc, "{}"); + + REQUIRE(doc.is()); + REQUIRE(doc.size() == 0); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofObject(1)), + Deallocate(sizeofString("hello")), + Deallocate(sizeofString("world")), + }); + } + + SECTION("Issue #1335") { + std::string json("{\"a\":{},\"b\":{}}"); + deserializeJson(doc, json); + CHECK(doc.as() == json); + } +} + +TEST_CASE("deserialize JSON object under memory constraints") { + TimebombAllocator timebomb(1024); + JsonDocument doc(&timebomb); + + SECTION("empty object requires no allocation") { + timebomb.setCountdown(0); + char input[] = "{}"; + + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "{}"); + } + + SECTION("key allocation fails") { + timebomb.setCountdown(0); + char input[] = "{\"a\":1}"; + + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + REQUIRE(doc.as() == "{}"); + } + + SECTION("pool allocation fails") { + timebomb.setCountdown(2); + char input[] = "{\"a\":1}"; + + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + REQUIRE(doc.as() == "{}"); + } + + SECTION("string allocation fails") { + timebomb.setCountdown(3); + char input[] = "{\"a\":\"b\"}"; + + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + REQUIRE(doc.as() == "{\"a\":null}"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/string.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/string.cpp new file mode 100644 index 00000000..5a5c372e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDeserializer/string.cpp @@ -0,0 +1,214 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_DECODE_UNICODE 1 +#include +#include + +#include "Allocators.hpp" + +using ArduinoJson::detail::sizeofArray; +using ArduinoJson::detail::sizeofObject; + +TEST_CASE("Valid JSON strings value") { + struct TestCase { + const char* input; + const char* expectedOutput; + }; + + TestCase testCases[] = { + {"\"hello world\"", "hello world"}, + {"\'hello world\'", "hello world"}, + {"'\"'", "\""}, + {"'\\\\'", "\\"}, + {"'\\/'", "/"}, + {"'\\b'", "\b"}, + {"'\\f'", "\f"}, + {"'\\n'", "\n"}, + {"'\\r'", "\r"}, + {"'\\t'", "\t"}, + {"\"1\\\"2\\\\3\\/4\\b5\\f6\\n7\\r8\\t9\"", "1\"2\\3/4\b5\f6\n7\r8\t9"}, + {"'\\u0041'", "A"}, + {"'\\u00e4'", "\xc3\xa4"}, // ä + {"'\\u00E4'", "\xc3\xa4"}, // ä + {"'\\u3042'", "\xe3\x81\x82"}, // ã‚ + {"'\\ud83d\\udda4'", "\xf0\x9f\x96\xa4"}, // 🖤 + {"'\\uF053'", "\xef\x81\x93"}, // issue #1173 + {"'\\uF015'", "\xef\x80\x95"}, // issue #1173 + {"'\\uF054'", "\xef\x81\x94"}, // issue #1173 + }; + const size_t testCount = sizeof(testCases) / sizeof(testCases[0]); + + JsonDocument doc; + + for (size_t i = 0; i < testCount; i++) { + const TestCase& testCase = testCases[i]; + CAPTURE(testCase.input); + DeserializationError err = deserializeJson(doc, testCase.input); + CHECK(err == DeserializationError::Ok); + CHECK(doc.as() == testCase.expectedOutput); + } +} + +TEST_CASE("\\u0000") { + JsonDocument doc; + + DeserializationError err = deserializeJson(doc, "\"wx\\u0000yz\""); + REQUIRE(err == DeserializationError::Ok); + + const char* result = doc.as(); + CHECK(result[0] == 'w'); + CHECK(result[1] == 'x'); + CHECK(result[2] == 0); + CHECK(result[3] == 'y'); + CHECK(result[4] == 'z'); + CHECK(result[5] == 0); + + CHECK(doc.as().size() == 5); + CHECK(doc.as().size() == 5); +} + +TEST_CASE("Truncated JSON string") { + const char* testCases[] = {"\"hello", "\'hello", "'\\u", "'\\u00", "'\\u000"}; + const size_t testCount = sizeof(testCases) / sizeof(testCases[0]); + + JsonDocument doc; + + for (size_t i = 0; i < testCount; i++) { + const char* input = testCases[i]; + CAPTURE(input); + REQUIRE(deserializeJson(doc, input) == + DeserializationError::IncompleteInput); + } +} + +TEST_CASE("Escape single quote in single quoted string") { + JsonDocument doc; + + DeserializationError err = deserializeJson(doc, "'ab\\\'cd'"); + REQUIRE(err == DeserializationError::Ok); + CHECK(doc.as() == "ab\'cd"); +} + +TEST_CASE("Escape double quote in double quoted string") { + JsonDocument doc; + + DeserializationError err = deserializeJson(doc, "'ab\\\"cd'"); + REQUIRE(err == DeserializationError::Ok); + CHECK(doc.as() == "ab\"cd"); +} + +TEST_CASE("Invalid JSON string") { + const char* testCases[] = {"'\\u'", "'\\u000g'", "'\\u000'", + "'\\u000G'", "'\\u000/'", "'\\x1234'"}; + const size_t testCount = sizeof(testCases) / sizeof(testCases[0]); + + JsonDocument doc; + + for (size_t i = 0; i < testCount; i++) { + const char* input = testCases[i]; + CAPTURE(input); + REQUIRE(deserializeJson(doc, input) == DeserializationError::InvalidInput); + } +} + +TEST_CASE("Allocation of the key fails") { + TimebombAllocator timebomb(0); + SpyingAllocator spy(&timebomb); + JsonDocument doc(&spy); + + SECTION("Quoted string, first member") { + REQUIRE(deserializeJson(doc, "{\"example\":1}") == + DeserializationError::NoMemory); + REQUIRE(spy.log() == AllocatorLog{ + AllocateFail(sizeofStringBuffer()), + }); + } + + SECTION("Quoted string, second member") { + timebomb.setCountdown(3); + REQUIRE(deserializeJson(doc, "{\"hello\":1,\"world\"}") == + DeserializationError::NoMemory); + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("hello")), + Allocate(sizeofPool()), + AllocateFail(sizeofStringBuffer()), + ReallocateFail(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("Non-Quoted string, first member") { + REQUIRE(deserializeJson(doc, "{example:1}") == + DeserializationError::NoMemory); + REQUIRE(spy.log() == AllocatorLog{ + AllocateFail(sizeofStringBuffer()), + }); + } + + SECTION("Non-Quoted string, second member") { + timebomb.setCountdown(3); + REQUIRE(deserializeJson(doc, "{hello:1,world}") == + DeserializationError::NoMemory); + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("hello")), + Allocate(sizeofPool()), + AllocateFail(sizeofStringBuffer()), + ReallocateFail(sizeofPool(), sizeofObject(1)), + }); + } +} + +TEST_CASE("String allocation fails") { + SpyingAllocator spy(FailingAllocator::instance()); + JsonDocument doc(&spy); + + SECTION("Input is const char*") { + REQUIRE(deserializeJson(doc, "\"hello\"") == + DeserializationError::NoMemory); + REQUIRE(spy.log() == AllocatorLog{ + AllocateFail(sizeofStringBuffer()), + }); + } +} + +TEST_CASE("Deduplicate values") { + SpyingAllocator spy; + JsonDocument doc(&spy); + deserializeJson(doc, "[\"example\",\"example\"]"); + + CHECK(doc[0].as() == doc[1].as()); + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("example")), + Allocate(sizeofStringBuffer()), + Deallocate(sizeofStringBuffer()), + Reallocate(sizeofPool(), sizeofArray(2)), + }); +} + +TEST_CASE("Deduplicate keys") { + SpyingAllocator spy; + JsonDocument doc(&spy); + deserializeJson(doc, "[{\"example\":1},{\"example\":2}]"); + + const char* key1 = doc[0].as().begin()->key().c_str(); + const char* key2 = doc[1].as().begin()->key().c_str(); + CHECK(key1 == key2); + + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("example")), + Allocate(sizeofStringBuffer()), + Deallocate(sizeofStringBuffer()), + Reallocate(sizeofPool(), sizeofArray(2) + 2 * sizeofObject(1)), + }); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/CMakeLists.txt new file mode 100644 index 00000000..dc8036af --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/CMakeLists.txt @@ -0,0 +1,31 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(JsonDocumentTests + add.cpp + assignment.cpp + cast.cpp + clear.cpp + compare.cpp + constructor.cpp + ElementProxy.cpp + isNull.cpp + issue1120.cpp + MemberProxy.cpp + nesting.cpp + overflowed.cpp + remove.cpp + set.cpp + shrinkToFit.cpp + size.cpp + subscript.cpp + swap.cpp +) + +add_test(JsonDocument JsonDocumentTests) + +set_tests_properties(JsonDocument + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/ElementProxy.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/ElementProxy.cpp new file mode 100644 index 00000000..9cf88551 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/ElementProxy.cpp @@ -0,0 +1,297 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ElementProxy = ArduinoJson::detail::ElementProxy; + +TEST_CASE("ElementProxy::add()") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc.add(); + const ElementProxy& ep = doc[0]; + + SECTION("integer") { + ep.add(42); + + REQUIRE(doc.as() == "[[42]]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("string literal") { + ep.add("world"); + + REQUIRE(doc.as() == "[[\"world\"]]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("const char*") { + const char* s = "world"; + ep.add(s); + + REQUIRE(doc.as() == "[[\"world\"]]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } + + SECTION("char[]") { + char s[] = "world"; + ep.add(s); + strcpy(s, "!!!!!"); + + REQUIRE(doc.as() == "[[\"world\"]]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("VLA") { + size_t i = 8; + char vla[i]; + strcpy(vla, "world"); + + ep.add(vla); + + REQUIRE(doc.as() == "[[\"world\"]]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } +#endif +} + +TEST_CASE("ElementProxy::clear()") { + JsonDocument doc; + doc.add(); + const ElementProxy& ep = doc[0]; + + SECTION("size goes back to zero") { + ep.add(42); + ep.clear(); + + REQUIRE(ep.size() == 0); + } + + SECTION("isNull() return true") { + ep.add("hello"); + ep.clear(); + + REQUIRE(ep.isNull() == true); + } +} + +TEST_CASE("ElementProxy::operator==()") { + JsonDocument doc; + + SECTION("1 vs 1") { + doc.add(1); + doc.add(1); + + REQUIRE(doc[0] <= doc[1]); + REQUIRE(doc[0] == doc[1]); + REQUIRE(doc[0] >= doc[1]); + REQUIRE_FALSE(doc[0] != doc[1]); + REQUIRE_FALSE(doc[0] < doc[1]); + REQUIRE_FALSE(doc[0] > doc[1]); + } + + SECTION("1 vs 2") { + doc.add(1); + doc.add(2); + + REQUIRE(doc[0] != doc[1]); + REQUIRE(doc[0] < doc[1]); + REQUIRE(doc[0] <= doc[1]); + REQUIRE_FALSE(doc[0] == doc[1]); + REQUIRE_FALSE(doc[0] > doc[1]); + REQUIRE_FALSE(doc[0] >= doc[1]); + } + + SECTION("'abc' vs 'bcd'") { + doc.add("abc"); + doc.add("bcd"); + + REQUIRE(doc[0] != doc[1]); + REQUIRE(doc[0] < doc[1]); + REQUIRE(doc[0] <= doc[1]); + REQUIRE_FALSE(doc[0] == doc[1]); + REQUIRE_FALSE(doc[0] > doc[1]); + REQUIRE_FALSE(doc[0] >= doc[1]); + } +} + +TEST_CASE("ElementProxy::remove()") { + JsonDocument doc; + doc.add(); + const ElementProxy& ep = doc[0]; + + SECTION("remove(int)") { + ep.add(1); + ep.add(2); + ep.add(3); + + ep.remove(1); + + REQUIRE(ep.as() == "[1,3]"); + } + + SECTION("remove(const char *)") { + ep["a"] = 1; + ep["b"] = 2; + + ep.remove("a"); + + REQUIRE(ep.as() == "{\"b\":2}"); + } + + SECTION("remove(std::string)") { + ep["a"] = 1; + ep["b"] = 2; + + ep.remove("b"_s); + + REQUIRE(ep.as() == "{\"a\":1}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("remove(vla)") { + ep["a"] = 1; + ep["b"] = 2; + + size_t i = 4; + char vla[i]; + strcpy(vla, "b"); + ep.remove(vla); + + REQUIRE(ep.as() == "{\"a\":1}"); + } +#endif +} + +TEST_CASE("ElementProxy::set()") { + JsonDocument doc; + const ElementProxy& ep = doc[0]; + + SECTION("set(int)") { + ep.set(42); + + REQUIRE(doc.as() == "[42]"); + } + + SECTION("set(const char*)") { + ep.set("world"); + + REQUIRE(doc.as() == "[\"world\"]"); + } + + SECTION("set(char[])") { + char s[] = "world"; + ep.set(s); + strcpy(s, "!!!!!"); + + REQUIRE(doc.as() == "[\"world\"]"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("set(VLA)") { + size_t i = 8; + char vla[i]; + strcpy(vla, "world"); + + ep.set(vla); + + REQUIRE(doc.as() == "[\"world\"]"); + } +#endif +} + +TEST_CASE("ElementProxy::size()") { + JsonDocument doc; + doc.add(); + const ElementProxy& ep = doc[0]; + + SECTION("returns 0") { + REQUIRE(ep.size() == 0); + } + + SECTION("as an array, returns 2") { + ep.add(1); + ep.add(2); + REQUIRE(ep.size() == 2); + } + + SECTION("as an object, returns 2") { + ep["a"] = 1; + ep["b"] = 2; + REQUIRE(ep.size() == 2); + } +} + +TEST_CASE("ElementProxy::operator[]") { + JsonDocument doc; + const ElementProxy& ep = doc[1]; + + SECTION("set member") { + ep["world"] = 42; + + REQUIRE(doc.as() == "[null,{\"world\":42}]"); + } + + SECTION("set element") { + ep[2] = 42; + + REQUIRE(doc.as() == "[null,[null,null,42]]"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("set VLA") { + size_t i = 8; + char vla[i]; + strcpy(vla, "world"); + + ep[0] = vla; + + REQUIRE(doc.as() == "[null,[\"world\"]]"); + } +#endif +} + +TEST_CASE("ElementProxy cast to JsonVariantConst") { + JsonDocument doc; + doc[0] = "world"; + + const ElementProxy& ep = doc[0]; + + JsonVariantConst var = ep; + + CHECK(var.as() == "world"); +} + +TEST_CASE("ElementProxy cast to JsonVariant") { + JsonDocument doc; + doc[0] = "world"; + + const ElementProxy& ep = doc[0]; + + JsonVariant var = ep; + + CHECK(var.as() == "world"); + + var.set("toto"); + + CHECK(doc.as() == "[\"toto\"]"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/MemberProxy.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/MemberProxy.cpp new file mode 100644 index 00000000..c42edcc1 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/MemberProxy.cpp @@ -0,0 +1,432 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1 +#define ARDUINOJSON_ENABLE_PROGMEM 1 +#include + +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofArray; +using ArduinoJson::detail::sizeofObject; + +TEST_CASE("MemberProxy::add()") { + SpyingAllocator spy; + JsonDocument doc(&spy); + const auto& mp = doc["hello"]; + + SECTION("integer") { + mp.add(42); + + REQUIRE(doc.as() == "{\"hello\":[42]}"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("string literal") { + mp.add("world"); + + REQUIRE(doc.as() == "{\"hello\":[\"world\"]}"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("const char*") { + const char* temp = "world"; + mp.add(temp); + + REQUIRE(doc.as() == "{\"hello\":[\"world\"]}"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } + + SECTION("char[]") { + char temp[] = "world"; + mp.add(temp); + + REQUIRE(doc.as() == "{\"hello\":[\"world\"]}"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + + }); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "world"); + + mp.add(vla); + + REQUIRE(doc.as() == "{\"hello\":[\"world\"]}"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } +#endif +} + +TEST_CASE("MemberProxy::clear()") { + JsonDocument doc; + const auto& mp = doc["hello"]; + + SECTION("size goes back to zero") { + mp.add(42); + mp.clear(); + + REQUIRE(mp.size() == 0); + } + + SECTION("isNull() return true") { + mp.add("hello"); + mp.clear(); + + REQUIRE(mp.isNull() == true); + } +} + +TEST_CASE("MemberProxy::operator==()") { + JsonDocument doc; + + SECTION("1 vs 1") { + doc["a"] = 1; + doc["b"] = 1; + + REQUIRE(doc["a"] <= doc["b"]); + REQUIRE(doc["a"] == doc["b"]); + REQUIRE(doc["a"] >= doc["b"]); + REQUIRE_FALSE(doc["a"] != doc["b"]); + REQUIRE_FALSE(doc["a"] < doc["b"]); + REQUIRE_FALSE(doc["a"] > doc["b"]); + } + + SECTION("1 vs 2") { + doc["a"] = 1; + doc["b"] = 2; + + REQUIRE(doc["a"] != doc["b"]); + REQUIRE(doc["a"] < doc["b"]); + REQUIRE(doc["a"] <= doc["b"]); + REQUIRE_FALSE(doc["a"] == doc["b"]); + REQUIRE_FALSE(doc["a"] > doc["b"]); + REQUIRE_FALSE(doc["a"] >= doc["b"]); + } + + SECTION("'abc' vs 'bcd'") { + doc["a"] = "abc"; + doc["b"] = "bcd"; + + REQUIRE(doc["a"] != doc["b"]); + REQUIRE(doc["a"] < doc["b"]); + REQUIRE(doc["a"] <= doc["b"]); + REQUIRE_FALSE(doc["a"] == doc["b"]); + REQUIRE_FALSE(doc["a"] > doc["b"]); + REQUIRE_FALSE(doc["a"] >= doc["b"]); + } +} + +TEST_CASE("MemberProxy::operator|()") { + JsonDocument doc; + + SECTION("const char*") { + doc["a"] = "hello"; + + REQUIRE((doc["a"] | "world") == "hello"_s); + REQUIRE((doc["b"] | "world") == "world"_s); + } + + SECTION("Issue #1411") { + doc["sensor"] = "gps"; + + const char* test = "test"; // <- the literal must be captured in a variable + // to trigger the bug + const char* sensor = doc["sensor"] | test; // "gps" + + REQUIRE(sensor == "gps"_s); + } + + SECTION("Issue #1415") { + JsonObject object = doc.to(); + object["hello"] = "world"; + + JsonDocument emptyDoc; + JsonObject anotherObject = object["hello"] | emptyDoc.to(); + + REQUIRE(anotherObject.isNull() == false); + REQUIRE(anotherObject.size() == 0); + } +} + +TEST_CASE("MemberProxy::remove()") { + JsonDocument doc; + const auto& mp = doc["hello"]; + + SECTION("remove(int)") { + mp.add(1); + mp.add(2); + mp.add(3); + + mp.remove(1); + + REQUIRE(mp.as() == "[1,3]"); + } + + SECTION("remove(const char *)") { + mp["a"] = 1; + mp["b"] = 2; + + mp.remove("a"); + + REQUIRE(mp.as() == "{\"b\":2}"); + } + + SECTION("remove(std::string)") { + mp["a"] = 1; + mp["b"] = 2; + + mp.remove("b"_s); + + REQUIRE(mp.as() == "{\"a\":1}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("remove(vla)") { + mp["a"] = 1; + mp["b"] = 2; + + size_t i = 4; + char vla[i]; + strcpy(vla, "b"); + mp.remove(vla); + + REQUIRE(mp.as() == "{\"a\":1}"); + } +#endif +} + +TEST_CASE("MemberProxy::set()") { + JsonDocument doc; + const auto& mp = doc["hello"]; + + SECTION("set(int)") { + mp.set(42); + + REQUIRE(doc.as() == "{\"hello\":42}"); + } + + SECTION("set(const char*)") { + mp.set("world"); + + REQUIRE(doc.as() == "{\"hello\":\"world\"}"); + } + + SECTION("set(char[])") { // issue #1191 + char s[] = "world"; + mp.set(s); + strcpy(s, "!!!!!"); + + REQUIRE(doc.as() == "{\"hello\":\"world\"}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("set(vla)") { + size_t i = 8; + char vla[i]; + strcpy(vla, "world"); + + mp.set(vla); + + REQUIRE(doc.as() == "{\"hello\":\"world\"}"); + } +#endif +} + +TEST_CASE("MemberProxy::size()") { + JsonDocument doc; + const auto& mp = doc["hello"]; + + SECTION("returns 0") { + REQUIRE(mp.size() == 0); + } + + SECTION("as an array, return 2") { + mp.add(1); + mp.add(2); + + REQUIRE(mp.size() == 2); + } + + SECTION("as an object, return 2") { + mp["a"] = 1; + mp["b"] = 2; + + REQUIRE(mp.size() == 2); + } +} + +TEST_CASE("MemberProxy::operator[]") { + JsonDocument doc; + const auto& mp = doc["hello"]; + + SECTION("set member") { + mp["world"] = 42; + + REQUIRE(doc.as() == "{\"hello\":{\"world\":42}}"); + } + + SECTION("set element") { + mp[2] = 42; + + REQUIRE(doc.as() == "{\"hello\":[null,null,42]}"); + } +} + +TEST_CASE("MemberProxy cast to JsonVariantConst") { + JsonDocument doc; + doc["hello"] = "world"; + + const auto& mp = doc["hello"]; + + JsonVariantConst var = mp; + + CHECK(var.as() == "world"); +} + +TEST_CASE("MemberProxy cast to JsonVariant") { + JsonDocument doc; + doc["hello"] = "world"; + + const auto& mp = doc["hello"]; + + JsonVariant var = mp; + + CHECK(var.as() == "world"); + + var.set("toto"); + + CHECK(doc.as() == "{\"hello\":\"toto\"}"); +} + +TEST_CASE("Deduplicate keys") { + SpyingAllocator spy; + JsonDocument doc(&spy); + + SECTION("std::string") { + doc[0]["example"_s] = 1; + doc[1]["example"_s] = 2; + + const char* key1 = doc[0].as().begin()->key().c_str(); + const char* key2 = doc[1].as().begin()->key().c_str(); + CHECK(key1 == key2); + + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("example")), + }); + } + + SECTION("char*") { + char key[] = "example"; + doc[0][key] = 1; + doc[1][key] = 2; + + const char* key1 = doc[0].as().begin()->key().c_str(); + const char* key2 = doc[1].as().begin()->key().c_str(); + CHECK(key1 == key2); + + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("example")), + }); + } + + SECTION("Arduino String") { + doc[0][String("example")] = 1; + doc[1][String("example")] = 2; + + const char* key1 = doc[0].as().begin()->key().c_str(); + const char* key2 = doc[1].as().begin()->key().c_str(); + CHECK(key1 == key2); + + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("example")), + }); + } + + SECTION("Flash string") { + doc[0][F("example")] = 1; + doc[1][F("example")] = 2; + + const char* key1 = doc[0].as().begin()->key().c_str(); + const char* key2 = doc[1].as().begin()->key().c_str(); + CHECK(key1 == key2); + + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("example")), + }); + } +} + +TEST_CASE("MemberProxy under memory constraints") { + TimebombAllocator timebomb(1); + SpyingAllocator spy(&timebomb); + JsonDocument doc(&spy); + + SECTION("key slot allocation fails") { + timebomb.setCountdown(0); + + doc["hello"_s] = "world"; + + REQUIRE(doc.is()); + REQUIRE(doc.size() == 0); + REQUIRE(doc.overflowed() == true); + REQUIRE(spy.log() == AllocatorLog{ + AllocateFail(sizeofPool()), + }); + } + + SECTION("value slot allocation fails") { + timebomb.setCountdown(1); + + // fill the pool entirely, but leave one slot for the key + doc["foo"][ARDUINOJSON_POOL_CAPACITY - 4] = 1; + REQUIRE(doc.overflowed() == false); + + doc["hello"_s] = "world"; + + REQUIRE(doc.is()); + REQUIRE(doc.size() == 1); + REQUIRE(doc.overflowed() == true); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + AllocateFail(sizeofPool()), + }); + } + + SECTION("key string allocation fails") { + timebomb.setCountdown(1); + + doc["hello"_s] = "world"; + + REQUIRE(doc.is()); + REQUIRE(doc.size() == 0); + REQUIRE(doc.overflowed() == true); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + AllocateFail(sizeofString("hello")), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/add.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/add.cpp new file mode 100644 index 00000000..da898e66 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/add.cpp @@ -0,0 +1,176 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1 +#define ARDUINOJSON_ENABLE_PROGMEM 1 +#include + +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofArray; + +TEST_CASE("JsonDocument::add(T)") { + SpyingAllocator spy; + JsonDocument doc(&spy); + + SECTION("integer") { + doc.add(42); + + REQUIRE(doc.as() == "[42]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("string literal") { + doc.add("hello"); + + REQUIRE(doc.as() == "[\"hello\"]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("const char*") { + const char* value = "hello"; + doc.add(value); + + REQUIRE(doc.as() == "[\"hello\"]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } + + SECTION("std::string") { + doc.add("example"_s); + doc.add("example"_s); + + CHECK(doc[0].as() == doc[1].as()); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("example")), + }); + } + + SECTION("char*") { + char value[] = "example"; + doc.add(value); + doc.add(value); + + CHECK(doc[0].as() == doc[1].as()); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("example")), + }); + } + + SECTION("Arduino String") { + doc.add(String("example")); + doc.add(String("example")); + + CHECK(doc[0].as() == doc[1].as()); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("example")), + }); + } + + SECTION("Flash string") { + doc.add(F("example")); + doc.add(F("example")); + + CHECK(doc[0].as() == doc[1].as()); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("example")), + }); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "example"); + + doc.add(vla); + doc.add(vla); + + CHECK(doc[0].as() == doc[1].as()); + REQUIRE("example"_s == doc[0]); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("example")), + }); + } +#endif +} + +TEST_CASE("JsonDocument::add()") { + JsonDocument doc; + + SECTION("JsonArray") { + JsonArray array = doc.add(); + array.add(1); + array.add(2); + REQUIRE(doc.as() == "[[1,2]]"); + } + + SECTION("JsonVariant") { + JsonVariant variant = doc.add(); + variant.set(42); + REQUIRE(doc.as() == "[42]"); + } +} + +TEST_CASE("JsonObject::add(JsonObject) ") { + JsonDocument doc1; + doc1["hello"_s] = "world"_s; + + TimebombAllocator allocator(10); + SpyingAllocator spy(&allocator); + JsonDocument doc2(&spy); + + SECTION("success") { + bool result = doc2.add(doc1.as()); + + REQUIRE(result == true); + REQUIRE(doc2.as() == "[{\"hello\":\"world\"}]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + Allocate(sizeofString("world")), + }); + } + + SECTION("partial failure") { // issue #2081 + allocator.setCountdown(2); + + bool result = doc2.add(doc1.as()); + + REQUIRE(result == false); + REQUIRE(doc2.as() == "[]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + AllocateFail(sizeofString("world")), + Deallocate(sizeofString("hello")), + }); + } + + SECTION("complete failure") { + allocator.setCountdown(0); + + bool result = doc2.add(doc1.as()); + + REQUIRE(result == false); + REQUIRE(doc2.as() == "[]"); + REQUIRE(spy.log() == AllocatorLog{ + AllocateFail(sizeofPool()), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/assignment.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/assignment.cpp new file mode 100644 index 00000000..4e59584c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/assignment.cpp @@ -0,0 +1,135 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonDocument assignment") { + SpyingAllocator spyingAllocator; + + SECTION("Copy assignment same capacity") { + JsonDocument doc1(&spyingAllocator); + deserializeJson(doc1, "{\"hello\":\"world\"}"); + JsonDocument doc2(&spyingAllocator); + spyingAllocator.clearLog(); + + doc2 = doc1; + + REQUIRE(doc2.as() == "{\"hello\":\"world\"}"); + + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + Allocate(sizeofString("world")), + }); + } + + SECTION("Copy assignment reallocates when capacity is smaller") { + JsonDocument doc1(&spyingAllocator); + deserializeJson(doc1, "[{\"hello\":\"world\"}]"); + JsonDocument doc2(&spyingAllocator); + spyingAllocator.clearLog(); + + doc2 = doc1; + + REQUIRE(doc2.as() == "[{\"hello\":\"world\"}]"); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + Allocate(sizeofString("world")), + }); + } + + SECTION("Copy assignment reallocates when capacity is larger") { + JsonDocument doc1(&spyingAllocator); + deserializeJson(doc1, "{\"hello\":\"world\"}"); + JsonDocument doc2(&spyingAllocator); + spyingAllocator.clearLog(); + + doc2 = doc1; + + REQUIRE(doc2.as() == "{\"hello\":\"world\"}"); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + Allocate(sizeofString("world")), + }); + } + + SECTION("Move assign") { + { + JsonDocument doc1(&spyingAllocator); + doc1["hello"_s] = "world"_s; + JsonDocument doc2(&spyingAllocator); + + doc2 = std::move(doc1); + + REQUIRE(doc2.as() == "{\"hello\":\"world\"}"); + REQUIRE(doc1.as() == "null"); + } + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + Allocate(sizeofString("world")), + Deallocate(sizeofString("hello")), + Deallocate(sizeofString("world")), + Deallocate(sizeofPool()), + }); + } + + SECTION("Assign from JsonObject") { + JsonDocument doc1; + JsonObject obj = doc1.to(); + obj["hello"] = "world"; + + JsonDocument doc2; + doc2 = obj; + + REQUIRE(doc2.as() == "{\"hello\":\"world\"}"); + } + + SECTION("Assign from JsonArray") { + JsonDocument doc1; + JsonArray arr = doc1.to(); + arr.add("hello"); + + JsonDocument doc2; + doc2 = arr; + + REQUIRE(doc2.as() == "[\"hello\"]"); + } + + SECTION("Assign from JsonVariant") { + JsonDocument doc1; + deserializeJson(doc1, "42"); + + JsonDocument doc2; + doc2 = doc1.as(); + + REQUIRE(doc2.as() == "42"); + } + + SECTION("Assign from MemberProxy") { + JsonDocument doc1; + doc1["value"] = 42; + + JsonDocument doc2; + doc2 = doc1["value"]; + + REQUIRE(doc2.as() == "42"); + } + + SECTION("Assign from ElementProxy") { + JsonDocument doc1; + doc1[0] = 42; + + JsonDocument doc2; + doc2 = doc1[0]; + + REQUIRE(doc2.as() == "42"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/cast.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/cast.cpp new file mode 100644 index 00000000..0bb9caaa --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/cast.cpp @@ -0,0 +1,18 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +TEST_CASE("Implicit cast to JsonVariant") { + JsonDocument doc; + + doc["hello"] = "world"; + + JsonVariant var = doc; + + CHECK(var.as() == "{\"hello\":\"world\"}"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/clear.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/clear.cpp new file mode 100644 index 00000000..98d24998 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/clear.cpp @@ -0,0 +1,48 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include // malloc, free +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonDocument::clear()") { + SpyingAllocator spy; + JsonDocument doc(&spy); + + SECTION("null") { + doc.clear(); + + REQUIRE(doc.isNull()); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("releases resources") { + doc["hello"_s] = "world"_s; + spy.clearLog(); + + doc.clear(); + + REQUIRE(doc.isNull()); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofPool()), + Deallocate(sizeofString("hello")), + Deallocate(sizeofString("world")), + }); + } + + SECTION("clear free list") { // issue #2034 + JsonObject obj = doc.to(); + obj["a"] = 1; + obj.clear(); // puts the slot in the free list + + doc.clear(); + + doc["b"] = 2; // will it pick from the free list? + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/compare.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/compare.cpp new file mode 100644 index 00000000..da7af58f --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/compare.cpp @@ -0,0 +1,29 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonDocument::operator==(const JsonDocument&)") { + JsonDocument doc1; + JsonDocument doc2; + + SECTION("Empty") { + REQUIRE(doc1 == doc2); + REQUIRE_FALSE(doc1 != doc2); + } + + SECTION("With same object") { + doc1["hello"] = "world"; + doc2["hello"] = "world"; + REQUIRE(doc1 == doc2); + REQUIRE_FALSE(doc1 != doc2); + } + SECTION("With different object") { + doc1["hello"] = "world"; + doc2["world"] = "hello"; + REQUIRE_FALSE(doc1 == doc2); + REQUIRE(doc1 != doc2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/constructor.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/constructor.cpp new file mode 100644 index 00000000..1eaec202 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/constructor.cpp @@ -0,0 +1,148 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::addPadding; + +TEST_CASE("JsonDocument constructor") { + SpyingAllocator spyingAllocator; + + SECTION("JsonDocument(size_t)") { + { JsonDocument doc(&spyingAllocator); } + REQUIRE(spyingAllocator.log() == AllocatorLog{}); + } + + SECTION("JsonDocument(const JsonDocument&)") { + { + JsonDocument doc1(&spyingAllocator); + doc1.set("The size of this string is 32!!"_s); + + JsonDocument doc2(doc1); + + REQUIRE(doc1.as() == "The size of this string is 32!!"); + REQUIRE(doc2.as() == "The size of this string is 32!!"); + } + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofStringBuffer()), + Allocate(sizeofStringBuffer()), + Deallocate(sizeofStringBuffer()), + Deallocate(sizeofStringBuffer()), + }); + } + + SECTION("JsonDocument(JsonDocument&&)") { + { + JsonDocument doc1(&spyingAllocator); + doc1.set("The size of this string is 32!!"_s); + + JsonDocument doc2(std::move(doc1)); + + REQUIRE(doc2.as() == "The size of this string is 32!!"); + REQUIRE(doc1.as() == "null"); + } + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofStringBuffer()), + Deallocate(sizeofStringBuffer()), + }); + } + + SECTION("JsonDocument(JsonObject, Allocator*)") { + JsonDocument doc1; + JsonObject obj = doc1.to(); + obj["hello"] = "world"; + + JsonDocument doc2(obj, &spyingAllocator); + + REQUIRE(doc2.as() == "{\"hello\":\"world\"}"); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("JsonDocument(JsonObject)") { + JsonDocument doc1; + JsonObject obj = doc1.to(); + obj["hello"] = "world"; + + JsonDocument doc2(obj); + + REQUIRE(doc2.as() == "{\"hello\":\"world\"}"); + } + + SECTION("JsonDocument(JsonArray, Allocator*)") { + JsonDocument doc1; + JsonArray arr = doc1.to(); + arr.add("hello"); + + JsonDocument doc2(arr, &spyingAllocator); + + REQUIRE(doc2.as() == "[\"hello\"]"); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("JsonDocument(JsonArray)") { + JsonDocument doc1; + JsonArray arr = doc1.to(); + arr.add("hello"); + + JsonDocument doc2(arr); + + REQUIRE(doc2.as() == "[\"hello\"]"); + } + + SECTION("JsonDocument(JsonVariant, Allocator*)") { + JsonDocument doc1; + deserializeJson(doc1, "\"hello\""); + + JsonDocument doc2(doc1.as(), &spyingAllocator); + + REQUIRE(doc2.as() == "hello"); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofString("hello")), + }); + } + + SECTION("JsonDocument(JsonVariant)") { + JsonDocument doc1; + deserializeJson(doc1, "\"hello\""); + + JsonDocument doc2(doc1.as()); + + REQUIRE(doc2.as() == "hello"); + } + + SECTION("JsonDocument(JsonVariantConst)") { + JsonDocument doc1; + deserializeJson(doc1, "\"hello\""); + + JsonDocument doc2(doc1.as()); + + REQUIRE(doc2.as() == "hello"); + } + + SECTION("JsonDocument(ElementProxy)") { + JsonDocument doc1; + deserializeJson(doc1, "[\"hello\",\"world\"]"); + + JsonDocument doc2(doc1[1]); + + REQUIRE(doc2.as() == "world"); + } + + SECTION("JsonDocument(MemberProxy)") { + JsonDocument doc1; + deserializeJson(doc1, "{\"hello\":\"world\"}"); + + JsonDocument doc2(doc1["hello"]); + + REQUIRE(doc2.as() == "world"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/isNull.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/isNull.cpp new file mode 100644 index 00000000..d030842c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/isNull.cpp @@ -0,0 +1,39 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonDocument::isNull()") { + JsonDocument doc; + + SECTION("returns true if uninitialized") { + REQUIRE(doc.isNull() == true); + } + + SECTION("returns false after to()") { + doc.to(); + REQUIRE(doc.isNull() == false); + } + + SECTION("returns false after to()") { + doc.to(); + REQUIRE(doc.isNull() == false); + } + + SECTION("returns true after to()") { + REQUIRE(doc.isNull() == true); + } + + SECTION("returns false after set()") { + doc.to().set(42); + REQUIRE(doc.isNull() == false); + } + + SECTION("returns true after clear()") { + doc.to(); + doc.clear(); + REQUIRE(doc.isNull() == true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/issue1120.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/issue1120.cpp new file mode 100644 index 00000000..aa3132f5 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/issue1120.cpp @@ -0,0 +1,52 @@ +#include + +#include + +#include "Literals.hpp" + +TEST_CASE("Issue #1120") { + JsonDocument doc; + constexpr char str[] = + "{\"contents\":[{\"module\":\"Packet\"},{\"module\":\"Analog\"}]}"; + deserializeJson(doc, str); + + SECTION("MemberProxy::isNull()") { + SECTION("returns false") { + CHECK(doc["contents"_s].isNull() == false); + } + + SECTION("returns true") { + CHECK(doc["zontents"_s].isNull() == true); + } + } + + SECTION("ElementProxy >::isNull()") { + SECTION("returns false") { // Issue #1120 + CHECK(doc["contents"][1].isNull() == false); + } + + SECTION("returns true") { + CHECK(doc["contents"][2].isNull() == true); + } + } + + SECTION("MemberProxy, const char*>::isNull()") { + SECTION("returns false") { + CHECK(doc["contents"][1]["module"].isNull() == false); + } + + SECTION("returns true") { + CHECK(doc["contents"][1]["zodule"].isNull() == true); + } + } + + SECTION("MemberProxy, std::string>::isNull()") { + SECTION("returns false") { + CHECK(doc["contents"][1]["module"_s].isNull() == false); + } + + SECTION("returns true") { + CHECK(doc["contents"][1]["zodule"_s].isNull() == true); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/nesting.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/nesting.cpp new file mode 100644 index 00000000..2fb86e1a --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/nesting.cpp @@ -0,0 +1,30 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonDocument::nesting()") { + JsonDocument doc; + + SECTION("return 0 if uninitialized") { + REQUIRE(doc.nesting() == 0); + } + + SECTION("returns 0 for string") { + JsonVariant var = doc.to(); + var.set("hello"); + REQUIRE(doc.nesting() == 0); + } + + SECTION("returns 1 for empty object") { + doc.to(); + REQUIRE(doc.nesting() == 1); + } + + SECTION("returns 1 for empty array") { + doc.to(); + REQUIRE(doc.nesting() == 1); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/overflowed.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/overflowed.cpp new file mode 100644 index 00000000..44003ebc --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/overflowed.cpp @@ -0,0 +1,96 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonDocument::overflowed()") { + TimebombAllocator timebomb(10); + JsonDocument doc(&timebomb); + + SECTION("returns false on a fresh object") { + timebomb.setCountdown(0); + CHECK(doc.overflowed() == false); + } + + SECTION("returns true after a failed insertion") { + timebomb.setCountdown(0); + doc.add(0); + CHECK(doc.overflowed() == true); + } + + SECTION("returns false after successful insertion") { + timebomb.setCountdown(2); + doc.add(0); + CHECK(doc.overflowed() == false); + } + + SECTION("returns true after a failed string copy") { + timebomb.setCountdown(0); + doc.add("example"_s); + CHECK(doc.overflowed() == true); + } + + SECTION("returns false after a successful string copy") { + timebomb.setCountdown(3); + doc.add("example"_s); + CHECK(doc.overflowed() == false); + } + + SECTION("returns true after a failed member add") { + timebomb.setCountdown(0); + doc["example"] = true; + CHECK(doc.overflowed() == true); + } + + SECTION("returns true after a failed deserialization") { + timebomb.setCountdown(0); + deserializeJson(doc, "[1, 2]"); + CHECK(doc.overflowed() == true); + } + + SECTION("returns false after a successful deserialization") { + timebomb.setCountdown(3); + deserializeJson(doc, "[\"example\"]"); + CHECK(doc.overflowed() == false); + } + + SECTION("returns false after clear()") { + timebomb.setCountdown(0); + doc.add(0); + doc.clear(); + CHECK(doc.overflowed() == false); + } + + SECTION("remains false after shrinkToFit()") { + timebomb.setCountdown(2); + doc.add(0); + timebomb.setCountdown(2); + doc.shrinkToFit(); + CHECK(doc.overflowed() == false); + } + + SECTION("remains true after shrinkToFit()") { + timebomb.setCountdown(0); + doc.add(0); + timebomb.setCountdown(2); + doc.shrinkToFit(); + CHECK(doc.overflowed() == true); + } + + SECTION("returns false when string length doesn't overflow") { + auto maxLength = ArduinoJson::detail::StringNode::maxLength; + CHECK(doc.set(std::string(maxLength, 'a')) == true); + CHECK(doc.overflowed() == false); + } + + SECTION("returns true when string length overflows") { + auto maxLength = ArduinoJson::detail::StringNode::maxLength; + CHECK(doc.set(std::string(maxLength + 1, 'a')) == false); + CHECK(doc.overflowed() == true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/remove.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/remove.cpp new file mode 100644 index 00000000..f017bb9a --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/remove.cpp @@ -0,0 +1,85 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Literals.hpp" + +TEST_CASE("JsonDocument::remove()") { + JsonDocument doc; + + SECTION("remove(int)") { + doc.add(1); + doc.add(2); + doc.add(3); + + doc.remove(1); + + REQUIRE(doc.as() == "[1,3]"); + } + + SECTION("string literal") { + doc["a"] = 1; + doc["a\0b"_s] = 2; + doc["b"] = 3; + + doc.remove("a\0b"); + + REQUIRE(doc.as() == "{\"a\":1,\"b\":3}"); + } + + SECTION("remove(const char *)") { + doc["a"] = 1; + doc["b"] = 2; + + doc.remove(static_cast("a")); + + REQUIRE(doc.as() == "{\"b\":2}"); + } + + SECTION("remove(std::string)") { + doc["a"] = 1; + doc["b"] = 2; + + doc.remove("b"_s); + + REQUIRE(doc.as() == "{\"a\":1}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("remove(vla)") { + doc["a"] = 1; + doc["b"] = 2; + + size_t i = 4; + char vla[i]; + strcpy(vla, "b"); + doc.remove(vla); + + REQUIRE(doc.as() == "{\"a\":1}"); + } +#endif + + SECTION("remove(JsonVariant) from object") { + doc["a"] = 1; + doc["b"] = 2; + doc["c"] = "b"; + + doc.remove(doc["c"]); + + REQUIRE(doc.as() == "{\"a\":1,\"c\":\"b\"}"); + } + + SECTION("remove(JsonVariant) from array") { + doc[0] = 3; + doc[1] = 2; + doc[2] = 1; + + doc.remove(doc[2]); + doc.remove(doc[3]); // noop + + REQUIRE(doc.as() == "[3,1]"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/set.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/set.cpp new file mode 100644 index 00000000..1205acf5 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/set.cpp @@ -0,0 +1,104 @@ +#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1 +#define ARDUINOJSON_ENABLE_PROGMEM 1 +#include + +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonDocument::set()") { + SpyingAllocator spy; + JsonDocument doc(&spy); + + SECTION("nullptr") { + doc.set(nullptr); + + REQUIRE(doc.isNull()); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("integer&") { + int toto = 42; + doc.set(toto); + + REQUIRE(doc.as() == "42"); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("integer") { + doc.set(42); + + REQUIRE(doc.as() == "42"); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("string literal") { + doc.set("example"); + + REQUIRE(doc.as() == "example"_s); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("const char*") { + const char* value = "example"; + doc.set(value); + + REQUIRE(doc.as() == "example"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("example")), + }); + } + + SECTION("std::string") { + doc.set("example"_s); + + REQUIRE(doc.as() == "example"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("example")), + }); + } + + SECTION("char*") { + char value[] = "example"; + doc.set(value); + + REQUIRE(doc.as() == "example"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("example")), + }); + } + + SECTION("Arduino String") { + doc.set(String("example")); + + REQUIRE(doc.as() == "example"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("example")), + }); + } + + SECTION("Flash string") { + doc.set(F("example")); + + REQUIRE(doc.as() == "example"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("example")), + }); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "example"); + + doc.set(vla); + + REQUIRE(doc.as() == "example"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("example")), + }); + } +#endif +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/shrinkToFit.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/shrinkToFit.cpp new file mode 100644 index 00000000..148b552d --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/shrinkToFit.cpp @@ -0,0 +1,184 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include // malloc, free +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofArray; +using ArduinoJson::detail::sizeofObject; + +class ArmoredAllocator : public Allocator { + public: + virtual ~ArmoredAllocator() {} + + void* allocate(size_t size) override { + return malloc(size); + } + + void deallocate(void* ptr) override { + free(ptr); + } + + void* reallocate(void* ptr, size_t new_size) override { + // don't call realloc, instead alloc a new buffer and erase the old one + // this way we make sure we support relocation + void* new_ptr = malloc(new_size); + memset(new_ptr, '#', new_size); // erase + if (ptr) { + memcpy(new_ptr, ptr, std::min(new_size, new_size)); + free(ptr); + } + return new_ptr; + } +}; + +TEST_CASE("JsonDocument::shrinkToFit()") { + ArmoredAllocator armoredAllocator; + SpyingAllocator spyingAllocator(&armoredAllocator); + JsonDocument doc(&spyingAllocator); + + SECTION("null") { + doc.shrinkToFit(); + + REQUIRE(doc.as() == "null"); + REQUIRE(spyingAllocator.log() == AllocatorLog{}); + } + + SECTION("empty object") { + deserializeJson(doc, "{}"); + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "{}"); + REQUIRE(spyingAllocator.log() == AllocatorLog{}); + } + + SECTION("empty array") { + deserializeJson(doc, "[]"); + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "[]"); + REQUIRE(spyingAllocator.log() == AllocatorLog{}); + } + + SECTION("linked string") { + doc.set("hello"); + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "hello"); + REQUIRE(spyingAllocator.log() == AllocatorLog{}); + } + + SECTION("owned string") { + doc.set("abcdefg"_s); + REQUIRE(doc.as() == "abcdefg"); + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "abcdefg"); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofString("abcdefg")), + }); + } + + SECTION("raw string") { + doc.set(serialized("[{},12]")); + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "[{},12]"); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofString("[{},12]")), + }); + } + + SECTION("linked key") { + doc["key"] = 42; + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "{\"key\":42}"); + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("owned key") { + doc["abcdefg"_s] = 42; + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "{\"abcdefg\":42}"); + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("abcdefg")), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("linked string in array") { + doc.add("hello"); + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "[\"hello\"]"); + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofArray(1)), + }); + } + + SECTION("owned string in array") { + doc.add("abcdefg"_s); + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "[\"abcdefg\"]"); + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("abcdefg")), + Reallocate(sizeofPool(), sizeofArray(1)), + }); + } + + SECTION("linked string in object") { + doc["key"] = "hello"; + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "{\"key\":\"hello\"}"); + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("owned string in object") { + doc["key"] = "abcdefg"_s; + + doc.shrinkToFit(); + + REQUIRE(doc.as() == "{\"key\":\"abcdefg\"}"); + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("abcdefg")), + Reallocate(sizeofPool(), sizeofPool(2)), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/size.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/size.cpp new file mode 100644 index 00000000..fad65843 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/size.cpp @@ -0,0 +1,28 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonDocument::size()") { + JsonDocument doc; + + SECTION("returns 0") { + REQUIRE(doc.size() == 0); + } + + SECTION("as an array, return 2") { + doc.add(1); + doc.add(2); + + REQUIRE(doc.size() == 2); + } + + SECTION("as an object, return 2") { + doc["a"] = 1; + doc["b"] = 2; + + REQUIRE(doc.size() == 2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/subscript.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/subscript.cpp new file mode 100644 index 00000000..17bdcc2e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/subscript.cpp @@ -0,0 +1,167 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonDocument::operator[]") { + JsonDocument doc; + const JsonDocument& cdoc = doc; + + SECTION("object") { + doc["abc"_s] = "ABC"; + doc["abc\0d"_s] = "ABCD"; + + SECTION("const char*") { + const char* key = "abc"; + REQUIRE(doc[key] == "ABC"); + REQUIRE(cdoc[key] == "ABC"); + } + + SECTION("string literal") { + REQUIRE(doc["abc"] == "ABC"); + REQUIRE(cdoc["abc"] == "ABC"); + REQUIRE(doc["abc\0d"] == "ABCD"); + REQUIRE(cdoc["abc\0d"] == "ABCD"); + } + + SECTION("std::string") { + REQUIRE(doc["abc"_s] == "ABC"); + REQUIRE(cdoc["abc"_s] == "ABC"); + REQUIRE(doc["abc\0d"_s] == "ABCD"); + REQUIRE(cdoc["abc\0d"_s] == "ABCD"); + } + + SECTION("JsonVariant") { + doc["key1"] = "abc"; + doc["key2"] = "abc\0d"_s; + doc["key3"] = "foo"; + + CHECK(doc[doc["key1"]] == "ABC"); + CHECK(doc[doc["key2"]] == "ABCD"); + CHECK(doc[doc["key3"]] == nullptr); + CHECK(doc[doc["key4"]] == nullptr); + + CHECK(cdoc[cdoc["key1"]] == "ABC"); + CHECK(cdoc[cdoc["key2"]] == "ABCD"); + CHECK(cdoc[cdoc["key3"]] == nullptr); + CHECK(cdoc[cdoc["key4"]] == nullptr); + } + + SECTION("supports operator|") { + REQUIRE((doc["abc"] | "nope") == "ABC"_s); + REQUIRE((doc["def"] | "nope") == "nope"_s); + } + +#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \ + !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR) + SECTION("supports VLAs") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + doc[vla] = "world"; + + REQUIRE(doc[vla] == "world"); + REQUIRE(cdoc[vla] == "world"); + } +#endif + } + + SECTION("array") { + deserializeJson(doc, "[\"hello\",\"world\"]"); + + SECTION("int") { + REQUIRE(doc[1] == "world"); + REQUIRE(cdoc[1] == "world"); + } + + SECTION("JsonVariant") { + doc[2] = 1; + REQUIRE(doc[doc[2]] == "world"); + REQUIRE(cdoc[doc[2]] == "world"); + } + } +} + +TEST_CASE("JsonDocument automatically promotes to object") { + JsonDocument doc; + + doc["one"]["two"]["three"] = 4; + + REQUIRE(doc["one"]["two"]["three"] == 4); +} + +TEST_CASE("JsonDocument automatically promotes to array") { + JsonDocument doc; + + doc[2] = 2; + + REQUIRE(doc.as() == "[null,null,2]"); +} + +TEST_CASE("JsonDocument::operator[] key storage") { + SpyingAllocator spy; + JsonDocument doc(&spy); + + SECTION("string literal") { + doc["hello"] = 0; + + REQUIRE(doc.as() == "{\"hello\":0}"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("const char*") { + const char* key = "hello"; + doc[key] = 0; + + REQUIRE(doc.as() == "{\"hello\":0}"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } + + SECTION("char[]") { + char key[] = "hello"; + doc[key] = 0; + + REQUIRE(doc.as() == "{\"hello\":0}"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } + + SECTION("std::string") { + doc["hello"_s] = 0; + + REQUIRE(doc.as() == "{\"hello\":0}"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } +#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \ + !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR) + SECTION("VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + doc[vla] = 0; + + REQUIRE(doc.as() == "{\"hello\":0}"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } +#endif +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/swap.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/swap.cpp new file mode 100644 index 00000000..35383089 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonDocument/swap.cpp @@ -0,0 +1,25 @@ +#include + +#include +#include +#include + +using namespace std; + +TEST_CASE("std::swap") { + SECTION("JsonDocument*") { + JsonDocument *p1, *p2; + swap(p1, p2); // issue #1678 + } + + SECTION("JsonDocument") { + JsonDocument doc1, doc2; + doc1.set("hello"); + doc2.set("world"); + + swap(doc1, doc2); + + CHECK(doc1.as() == "world"); + CHECK(doc2.as() == "hello"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/CMakeLists.txt new file mode 100644 index 00000000..3f44d986 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/CMakeLists.txt @@ -0,0 +1,25 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(JsonObjectTests + clear.cpp + compare.cpp + equals.cpp + isNull.cpp + iterator.cpp + nesting.cpp + remove.cpp + set.cpp + size.cpp + std_string.cpp + subscript.cpp + unbound.cpp +) + +add_test(JsonObject JsonObjectTests) + +set_tests_properties(JsonObject + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/clear.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/clear.cpp new file mode 100644 index 00000000..f6f8a221 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/clear.cpp @@ -0,0 +1,25 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonObject::clear()") { + SECTION("No-op on null JsonObject") { + JsonObject obj; + obj.clear(); + REQUIRE(obj.isNull() == true); + REQUIRE(obj.size() == 0); + } + + SECTION("Removes all elements") { + JsonDocument doc; + JsonObject obj = doc.to(); + obj["hello"] = 1; + obj["world"] = 2; + obj.clear(); + REQUIRE(obj.size() == 0); + REQUIRE(obj.isNull() == false); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/compare.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/compare.cpp new file mode 100644 index 00000000..faa0cbd0 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/compare.cpp @@ -0,0 +1,512 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("Compare JsonObject with JsonObject") { + JsonDocument doc; + + SECTION("Compare with unbound") { + JsonObject object = doc.to(); + object["a"] = 1; + object["b"] = "hello"; + JsonObject unbound; + + CHECK(object != unbound); + CHECK_FALSE(object == unbound); + CHECK_FALSE(object <= unbound); + CHECK_FALSE(object >= unbound); + CHECK_FALSE(object > unbound); + CHECK_FALSE(object < unbound); + + CHECK(unbound != object); + CHECK_FALSE(unbound == object); + CHECK_FALSE(unbound <= object); + CHECK_FALSE(unbound >= object); + CHECK_FALSE(unbound > object); + CHECK_FALSE(unbound < object); + } + + SECTION("Compare with self") { + JsonObject object = doc.to(); + object["a"] = 1; + object["b"] = "hello"; + + CHECK(object == object); + CHECK(object <= object); + CHECK(object >= object); + CHECK_FALSE(object != object); + CHECK_FALSE(object > object); + CHECK_FALSE(object < object); + } + + SECTION("Compare with identical object") { + JsonObject object1 = doc.add(); + object1["a"] = 1; + object1["b"] = "hello"; + object1["c"][0] = false; + + JsonObject object2 = doc.add(); + object2["a"] = 1; + object2["b"] = "hello"; + object2["c"][0] = false; + + CHECK(object1 == object2); + CHECK(object1 <= object2); + CHECK(object1 >= object2); + CHECK_FALSE(object1 != object2); + CHECK_FALSE(object1 > object2); + CHECK_FALSE(object1 < object2); + } + + SECTION("Compare with different object") { + JsonObject object1 = doc.add(); + object1["a"] = 1; + object1["b"] = "hello1"; + object1["c"][0] = false; + + JsonObject object2 = doc.add(); + object2["a"] = 1; + object2["b"] = "hello2"; + object2["c"][0] = false; + + CHECK(object1 != object2); + CHECK_FALSE(object1 == object2); + CHECK_FALSE(object1 > object2); + CHECK_FALSE(object1 < object2); + CHECK_FALSE(object1 <= object2); + CHECK_FALSE(object1 >= object2); + } +} + +TEST_CASE("Compare JsonObject with JsonVariant") { + JsonDocument doc; + + SECTION("Compare with self") { + JsonObject object = doc.to(); + object["a"] = 1; + object["b"] = "hello"; + + JsonVariant variant = object; + + CHECK(object == variant); + CHECK(object <= variant); + CHECK(object >= variant); + CHECK_FALSE(object != variant); + CHECK_FALSE(object > variant); + CHECK_FALSE(object < variant); + + CHECK(variant == object); + CHECK(variant <= object); + CHECK(variant >= object); + CHECK_FALSE(variant != object); + CHECK_FALSE(variant > object); + CHECK_FALSE(variant < object); + } + + SECTION("Compare with identical object") { + JsonObject object = doc.add(); + object["a"] = 1; + object["b"] = "hello"; + object["c"][0] = false; + + JsonVariant variant = doc.add(); + variant["a"] = 1; + variant["b"] = "hello"; + variant["c"][0] = false; + + CHECK(object == variant); + CHECK(object <= variant); + CHECK(object >= variant); + CHECK_FALSE(object != variant); + CHECK_FALSE(object > variant); + CHECK_FALSE(object < variant); + + CHECK(variant == object); + CHECK(variant <= object); + CHECK(variant >= object); + CHECK_FALSE(variant != object); + CHECK_FALSE(variant > object); + CHECK_FALSE(variant < object); + } + + SECTION("Compare with different object") { + JsonObject object = doc.add(); + object["a"] = 1; + object["b"] = "hello1"; + object["c"][0] = false; + + JsonVariant variant = doc.add(); + variant["a"] = 1; + variant["b"] = "hello2"; + variant["c"][0] = false; + + CHECK(object != variant); + CHECK_FALSE(object == variant); + CHECK_FALSE(object > variant); + CHECK_FALSE(object < variant); + CHECK_FALSE(object <= variant); + CHECK_FALSE(object >= variant); + } +} + +TEST_CASE("Compare JsonObject with JsonVariantConst") { + JsonDocument doc; + + SECTION("Compare with unbound") { + JsonObject object = doc.to(); + object["a"] = 1; + object["b"] = "hello"; + JsonVariantConst unbound; + + CHECK(object != unbound); + CHECK_FALSE(object == unbound); + CHECK_FALSE(object <= unbound); + CHECK_FALSE(object >= unbound); + CHECK_FALSE(object > unbound); + CHECK_FALSE(object < unbound); + + CHECK(unbound != object); + CHECK_FALSE(unbound == object); + CHECK_FALSE(unbound <= object); + CHECK_FALSE(unbound >= object); + CHECK_FALSE(unbound > object); + CHECK_FALSE(unbound < object); + } + + SECTION("Compare with self") { + JsonObject object = doc.to(); + object["a"] = 1; + object["b"] = "hello"; + + JsonVariantConst variant = object; + + CHECK(object == variant); + CHECK(object <= variant); + CHECK(object >= variant); + CHECK_FALSE(object != variant); + CHECK_FALSE(object > variant); + CHECK_FALSE(object < variant); + + CHECK(variant == object); + CHECK(variant <= object); + CHECK(variant >= object); + CHECK_FALSE(variant != object); + CHECK_FALSE(variant > object); + CHECK_FALSE(variant < object); + } + + SECTION("Compare with identical object") { + JsonObject object = doc.add(); + object["a"] = 1; + object["b"] = "hello"; + object["c"][0] = false; + + JsonObject object2 = doc.add(); + object2["a"] = 1; + object2["b"] = "hello"; + object2["c"][0] = false; + JsonVariantConst variant = object2; + + CHECK(object == variant); + CHECK(object <= variant); + CHECK(object >= variant); + CHECK_FALSE(object != variant); + CHECK_FALSE(object > variant); + CHECK_FALSE(object < variant); + + CHECK(variant == object); + CHECK(variant <= object); + CHECK(variant >= object); + CHECK_FALSE(variant != object); + CHECK_FALSE(variant > object); + CHECK_FALSE(variant < object); + } + + SECTION("Compare with different object") { + JsonObject object = doc.add(); + object["a"] = 1; + object["b"] = "hello1"; + object["c"][0] = false; + + JsonObject object2 = doc.add(); + object2["a"] = 1; + object2["b"] = "hello2"; + object2["c"][0] = false; + JsonVariantConst variant = object2; + + CHECK(object != variant); + CHECK_FALSE(object == variant); + CHECK_FALSE(object > variant); + CHECK_FALSE(object < variant); + CHECK_FALSE(object <= variant); + CHECK_FALSE(object >= variant); + } +} + +TEST_CASE("Compare JsonObject with JsonObjectConst") { + JsonDocument doc; + + SECTION("Compare with unbound") { + JsonObject object = doc.to(); + object["a"] = 1; + object["b"] = "hello"; + JsonObjectConst unbound; + + CHECK(object != unbound); + CHECK_FALSE(object == unbound); + CHECK_FALSE(object <= unbound); + CHECK_FALSE(object >= unbound); + CHECK_FALSE(object > unbound); + CHECK_FALSE(object < unbound); + + CHECK(unbound != object); + CHECK_FALSE(unbound == object); + CHECK_FALSE(unbound <= object); + CHECK_FALSE(unbound >= object); + CHECK_FALSE(unbound > object); + CHECK_FALSE(unbound < object); + } + + SECTION("Compare with self") { + JsonObject object = doc.to(); + object["a"] = 1; + object["b"] = "hello"; + JsonObjectConst cobject = object; + + CHECK(object == cobject); + CHECK(object <= cobject); + CHECK(object >= cobject); + CHECK_FALSE(object != cobject); + CHECK_FALSE(object > cobject); + CHECK_FALSE(object < cobject); + + CHECK(cobject == object); + CHECK(cobject <= object); + CHECK(cobject >= object); + CHECK_FALSE(cobject != object); + CHECK_FALSE(cobject > object); + CHECK_FALSE(cobject < object); + } + + SECTION("Compare with identical object") { + JsonObject object1 = doc.add(); + object1["a"] = 1; + object1["b"] = "hello"; + object1["c"][0] = false; + + JsonObject object2 = doc.add(); + object2["a"] = 1; + object2["b"] = "hello"; + object2["c"][0] = false; + JsonObjectConst carray2 = object2; + + CHECK(object1 == carray2); + CHECK(object1 <= carray2); + CHECK(object1 >= carray2); + CHECK_FALSE(object1 != carray2); + CHECK_FALSE(object1 > carray2); + CHECK_FALSE(object1 < carray2); + + CHECK(carray2 == object1); + CHECK(carray2 <= object1); + CHECK(carray2 >= object1); + CHECK_FALSE(carray2 != object1); + CHECK_FALSE(carray2 > object1); + CHECK_FALSE(carray2 < object1); + } + + SECTION("Compare with different object") { + JsonObject object1 = doc.add(); + object1["a"] = 1; + object1["b"] = "hello1"; + object1["c"][0] = false; + + JsonObject object2 = doc.add(); + object2["a"] = 1; + object2["b"] = "hello2"; + object2["c"][0] = false; + JsonObjectConst carray2 = object2; + + CHECK(object1 != carray2); + CHECK_FALSE(object1 == carray2); + CHECK_FALSE(object1 > carray2); + CHECK_FALSE(object1 < carray2); + CHECK_FALSE(object1 <= carray2); + CHECK_FALSE(object1 >= carray2); + + CHECK(carray2 != object1); + CHECK_FALSE(carray2 == object1); + CHECK_FALSE(carray2 > object1); + CHECK_FALSE(carray2 < object1); + CHECK_FALSE(carray2 <= object1); + CHECK_FALSE(carray2 >= object1); + } +} + +TEST_CASE("Compare JsonObjectConst with JsonObjectConst") { + JsonDocument doc; + + SECTION("Compare with unbound") { + JsonObject object = doc.to(); + object["a"] = 1; + object["b"] = "hello"; + + JsonObjectConst cobject = object; + JsonObjectConst unbound; + + CHECK(cobject != unbound); + CHECK_FALSE(cobject == unbound); + CHECK_FALSE(cobject <= unbound); + CHECK_FALSE(cobject >= unbound); + CHECK_FALSE(cobject > unbound); + CHECK_FALSE(cobject < unbound); + + CHECK(unbound != cobject); + CHECK_FALSE(unbound == cobject); + CHECK_FALSE(unbound <= cobject); + CHECK_FALSE(unbound >= cobject); + CHECK_FALSE(unbound > cobject); + CHECK_FALSE(unbound < cobject); + } + + SECTION("Compare with self") { + JsonObject object = doc.to(); + object["a"] = 1; + object["b"] = "hello"; + JsonObjectConst cobject = object; + + CHECK(cobject == cobject); + CHECK(cobject <= cobject); + CHECK(cobject >= cobject); + CHECK_FALSE(cobject != cobject); + CHECK_FALSE(cobject > cobject); + CHECK_FALSE(cobject < cobject); + } + + SECTION("Compare with identical object") { + JsonObject object1 = doc.add(); + object1["a"] = 1; + object1["b"] = "hello"; + object1["c"][0] = false; + JsonObjectConst carray1 = object1; + + JsonObject object2 = doc.add(); + object2["a"] = 1; + object2["b"] = "hello"; + object2["c"][0] = false; + JsonObjectConst carray2 = object2; + + CHECK(carray1 == carray2); + CHECK(carray1 <= carray2); + CHECK(carray1 >= carray2); + CHECK_FALSE(carray1 != carray2); + CHECK_FALSE(carray1 > carray2); + CHECK_FALSE(carray1 < carray2); + } + + SECTION("Compare with different object") { + JsonObject object1 = doc.add(); + object1["a"] = 1; + object1["b"] = "hello1"; + object1["c"][0] = false; + JsonObjectConst carray1 = object1; + + JsonObject object2 = doc.add(); + object2["a"] = 1; + object2["b"] = "hello2"; + object2["c"][0] = false; + JsonObjectConst carray2 = object2; + + CHECK(carray1 != carray2); + CHECK_FALSE(carray1 == carray2); + CHECK_FALSE(carray1 > carray2); + CHECK_FALSE(carray1 < carray2); + CHECK_FALSE(carray1 <= carray2); + CHECK_FALSE(carray1 >= carray2); + } +} + +TEST_CASE("Compare JsonObjectConst with JsonVariant") { + JsonDocument doc; + + SECTION("Compare with self") { + JsonObject object = doc.to(); + object["a"] = 1; + object["b"] = "hello"; + JsonObjectConst cobject = object; + JsonVariant variant = object; + + CHECK(cobject == variant); + CHECK(cobject <= variant); + CHECK(cobject >= variant); + CHECK_FALSE(cobject != variant); + CHECK_FALSE(cobject > variant); + CHECK_FALSE(cobject < variant); + + CHECK(variant == cobject); + CHECK(variant <= cobject); + CHECK(variant >= cobject); + CHECK_FALSE(variant != cobject); + CHECK_FALSE(variant > cobject); + CHECK_FALSE(variant < cobject); + } + + SECTION("Compare with identical object") { + JsonObject object1 = doc.add(); + object1["a"] = 1; + object1["b"] = "hello"; + object1["c"][0] = false; + JsonObjectConst carray1 = object1; + + JsonObject object2 = doc.add(); + object2["a"] = 1; + object2["b"] = "hello"; + object2["c"][0] = false; + JsonVariant variant2 = object2; + + CHECK(carray1 == variant2); + CHECK(carray1 <= variant2); + CHECK(carray1 >= variant2); + CHECK_FALSE(carray1 != variant2); + CHECK_FALSE(carray1 > variant2); + CHECK_FALSE(carray1 < variant2); + + CHECK(variant2 == carray1); + CHECK(variant2 <= carray1); + CHECK(variant2 >= carray1); + CHECK_FALSE(variant2 != carray1); + CHECK_FALSE(variant2 > carray1); + CHECK_FALSE(variant2 < carray1); + } + + SECTION("Compare with different object") { + JsonObject object1 = doc.add(); + object1["a"] = 1; + object1["b"] = "hello1"; + object1["c"][0] = false; + JsonObjectConst carray1 = object1; + + JsonObject object2 = doc.add(); + object2["a"] = 1; + object2["b"] = "hello2"; + object2["c"][0] = false; + JsonVariant variant2 = object2; + + CHECK(carray1 != variant2); + CHECK_FALSE(carray1 == variant2); + CHECK_FALSE(carray1 > variant2); + CHECK_FALSE(carray1 < variant2); + CHECK_FALSE(carray1 <= variant2); + CHECK_FALSE(carray1 >= variant2); + + CHECK(variant2 != carray1); + CHECK_FALSE(variant2 == carray1); + CHECK_FALSE(variant2 > carray1); + CHECK_FALSE(variant2 < carray1); + CHECK_FALSE(variant2 <= carray1); + CHECK_FALSE(variant2 >= carray1); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/equals.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/equals.cpp new file mode 100644 index 00000000..4a594a78 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/equals.cpp @@ -0,0 +1,59 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonObject::operator==()") { + JsonDocument doc1; + JsonObject obj1 = doc1.to(); + + JsonDocument doc2; + JsonObject obj2 = doc2.to(); + + SECTION("should return false when objs differ") { + obj1["hello"] = "coucou"; + obj2["world"] = 1; + + REQUIRE_FALSE(obj1 == obj2); + } + + SECTION("should return false when LHS has more elements") { + obj1["hello"] = "coucou"; + obj1["world"] = 666; + obj2["hello"] = "coucou"; + + REQUIRE_FALSE(obj1 == obj2); + } + + SECTION("should return false when RKS has more elements") { + obj1["hello"] = "coucou"; + obj2["hello"] = "coucou"; + obj2["world"] = 666; + + REQUIRE_FALSE(obj1 == obj2); + } + + SECTION("should return true when objs equal") { + obj1["hello"] = "world"; + obj1["anwser"] = 42; + // insert in different order + obj2["anwser"] = 42; + obj2["hello"] = "world"; + + REQUIRE(obj1 == obj2); + } + + SECTION("should return false when RHS is null") { + JsonObject null; + + REQUIRE_FALSE(obj1 == null); + } + + SECTION("should return false when LHS is null") { + JsonObject null; + + REQUIRE_FALSE(null == obj2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/isNull.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/isNull.cpp new file mode 100644 index 00000000..8ddb51c7 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/isNull.cpp @@ -0,0 +1,32 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonObject::isNull()") { + SECTION("returns true") { + JsonObject obj; + REQUIRE(obj.isNull() == true); + } + + SECTION("returns false") { + JsonDocument doc; + JsonObject obj = doc.to(); + REQUIRE(obj.isNull() == false); + } +} + +TEST_CASE("JsonObject::operator bool()") { + SECTION("returns false") { + JsonObject obj; + REQUIRE(static_cast(obj) == false); + } + + SECTION("returns true") { + JsonDocument doc; + JsonObject obj = doc.to(); + REQUIRE(static_cast(obj) == true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/iterator.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/iterator.cpp new file mode 100644 index 00000000..e22d72ad --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/iterator.cpp @@ -0,0 +1,36 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonObject::begin()/end()") { + JsonDocument doc; + JsonObject obj = doc.to(); + obj["ab"] = 12; + obj["cd"] = 34; + + SECTION("NonConstIterator") { + JsonObject::iterator it = obj.begin(); + REQUIRE(obj.end() != it); + REQUIRE(it->key() == "ab"); + REQUIRE(12 == it->value()); + ++it; + REQUIRE(obj.end() != it); + REQUIRE(it->key() == "cd"); + REQUIRE(34 == it->value()); + ++it; + REQUIRE(obj.end() == it); + } + + SECTION("Dereferencing end() is safe") { + REQUIRE(obj.end()->key().isNull()); + REQUIRE(obj.end()->value().isNull()); + } + + SECTION("null JsonObject") { + JsonObject null; + REQUIRE(null.begin() == null.end()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/nesting.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/nesting.cpp new file mode 100644 index 00000000..a3fdaea1 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/nesting.cpp @@ -0,0 +1,35 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonObject::nesting()") { + JsonDocument doc; + JsonObject obj = doc.to(); + + SECTION("return 0 if uninitialized") { + JsonObject unitialized; + REQUIRE(unitialized.nesting() == 0); + } + + SECTION("returns 1 for empty object") { + REQUIRE(obj.nesting() == 1); + } + + SECTION("returns 1 for flat object") { + obj["hello"] = "world"; + REQUIRE(obj.nesting() == 1); + } + + SECTION("returns 2 with nested array") { + obj["nested"].to(); + REQUIRE(obj.nesting() == 2); + } + + SECTION("returns 2 with nested object") { + obj["nested"].to(); + REQUIRE(obj.nesting() == 2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/remove.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/remove.cpp new file mode 100644 index 00000000..052433df --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/remove.cpp @@ -0,0 +1,89 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +TEST_CASE("JsonObject::remove()") { + JsonDocument doc; + JsonObject obj = doc.to(); + obj["a"] = 0; + obj["b"] = 1; + obj["c"] = 2; + std::string result; + + SECTION("remove(key)") { + SECTION("Remove first") { + obj.remove("a"); + serializeJson(obj, result); + REQUIRE("{\"b\":1,\"c\":2}" == result); + } + + SECTION("Remove middle") { + obj.remove("b"); + serializeJson(obj, result); + REQUIRE("{\"a\":0,\"c\":2}" == result); + } + + SECTION("Remove last") { + obj.remove("c"); + serializeJson(obj, result); + REQUIRE("{\"a\":0,\"b\":1}" == result); + } + } + + SECTION("remove(iterator)") { + JsonObject::iterator it = obj.begin(); + + SECTION("Remove first") { + obj.remove(it); + serializeJson(obj, result); + REQUIRE("{\"b\":1,\"c\":2}" == result); + } + + SECTION("Remove middle") { + ++it; + obj.remove(it); + serializeJson(obj, result); + REQUIRE("{\"a\":0,\"c\":2}" == result); + } + + SECTION("Remove last") { + ++it; + ++it; + obj.remove(it); + serializeJson(obj, result); + REQUIRE("{\"a\":0,\"b\":1}" == result); + } + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("key is a vla") { + size_t i = 16; + char vla[i]; + strcpy(vla, "b"); + obj.remove(vla); + + serializeJson(obj, result); + REQUIRE("{\"a\":0,\"c\":2}" == result); + } +#endif + + SECTION("remove by key on unbound reference") { + JsonObject unboundObject; + unboundObject.remove("key"); + } + + SECTION("remove by iterator on unbound reference") { + JsonObject unboundObject; + unboundObject.remove(unboundObject.begin()); + } + + SECTION("remove(JsonVariant)") { + obj["key"] = "b"; + obj.remove(obj["key"]); + REQUIRE("{\"a\":0,\"c\":2,\"key\":\"b\"}" == doc.as()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/set.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/set.cpp new file mode 100644 index 00000000..f58dae06 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/set.cpp @@ -0,0 +1,142 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonObject::set()") { + SpyingAllocator spy; + JsonDocument doc1(&spy); + JsonDocument doc2(&spy); + + JsonObject obj1 = doc1.to(); + JsonObject obj2 = doc2.to(); + + SECTION("doesn't copy static string in key or value") { + obj1["hello"] = "world"; + spy.clearLog(); + + bool success = obj2.set(obj1); + + REQUIRE(success == true); + REQUIRE(obj2["hello"] == "world"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("copy local string value") { + obj1["hello"] = "world"_s; + spy.clearLog(); + + bool success = obj2.set(obj1); + + REQUIRE(success == true); + REQUIRE(obj2["hello"] == "world"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } + + SECTION("copy local key") { + obj1["hello"_s] = "world"; + spy.clearLog(); + + bool success = obj2.set(obj1); + + REQUIRE(success == true); + REQUIRE(obj2["hello"] == "world"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } + + SECTION("copy string from deserializeJson()") { + deserializeJson(doc1, "{'hello':'world'}"); + spy.clearLog(); + + bool success = obj2.set(obj1); + + REQUIRE(success == true); + REQUIRE(obj2["hello"] == "world"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + Allocate(sizeofString("world")), + }); + } + + SECTION("copy string from deserializeMsgPack()") { + deserializeMsgPack(doc1, "\x81\xA5hello\xA5world"); + spy.clearLog(); + + bool success = obj2.set(obj1); + + REQUIRE(success == true); + REQUIRE(obj2["hello"] == "world"_s); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + Allocate(sizeofString("world")), + }); + } + + SECTION("should work with JsonObjectConst") { + obj1["hello"] = "world"; + + obj2.set(static_cast(obj1)); + + REQUIRE(obj2["hello"] == "world"_s); + } + + SECTION("copy fails in the middle of an object") { + TimebombAllocator timebomb(2); + JsonDocument doc3(&timebomb); + JsonObject obj3 = doc3.to(); + + obj1["a"_s] = 1; + obj1["b"_s] = 2; + + bool success = obj3.set(obj1); + + REQUIRE(success == false); + REQUIRE(doc3.as() == "{\"a\":1}"); + } + + SECTION("copy fails in the middle of an array") { + TimebombAllocator timebomb(1); + JsonDocument doc3(&timebomb); + JsonObject obj3 = doc3.to(); + + obj1["hello"][0] = "world"_s; + + bool success = obj3.set(obj1); + + REQUIRE(success == false); + REQUIRE(doc3.as() == "{\"hello\":[]}"); + } + + SECTION("destination is null") { + JsonObject null; + obj1["hello"] = "world"; + + bool success = null.set(obj1); + + REQUIRE(success == false); + } + + SECTION("source is null") { + JsonObject null; + obj1["hello"] = "world"; + + bool success = obj1.set(null); + + REQUIRE(success == false); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/size.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/size.cpp new file mode 100644 index 00000000..5c5258e7 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/size.cpp @@ -0,0 +1,39 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +TEST_CASE("JsonObject::size()") { + JsonDocument doc; + JsonObject obj = doc.to(); + + SECTION("initial size is zero") { + REQUIRE(0 == obj.size()); + } + + SECTION("increases when values are added") { + obj["hello"] = 42; + REQUIRE(1 == obj.size()); + } + + SECTION("decreases when values are removed") { + obj["hello"] = 42; + obj.remove("hello"); + REQUIRE(0 == obj.size()); + } + + SECTION("doesn't increase when the same key is added twice") { + obj["hello"] = 1; + obj["hello"] = 2; + REQUIRE(1 == obj.size()); + } + + SECTION("doesn't decrease when another key is removed") { + obj["hello"] = 1; + obj.remove("world"); + REQUIRE(1 == obj.size()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/std_string.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/std_string.cpp new file mode 100644 index 00000000..82b87b98 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/std_string.cpp @@ -0,0 +1,61 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Literals.hpp" + +static void eraseString(std::string& str) { + char* p = const_cast(str.c_str()); + while (*p) + *p++ = '*'; +} + +TEST_CASE("std::string") { + JsonDocument doc; + + SECTION("operator[]") { + char json[] = "{\"key\":\"value\"}"; + + deserializeJson(doc, json); + JsonObject obj = doc.as(); + + REQUIRE("value"_s == obj["key"_s]); + } + + SECTION("operator[] const") { + char json[] = "{\"key\":\"value\"}"; + + deserializeJson(doc, json); + JsonObject obj = doc.as(); + + REQUIRE("value"_s == obj["key"_s]); + } + + SECTION("remove()") { + JsonObject obj = doc.to(); + obj["key"] = "value"; + + obj.remove("key"_s); + + REQUIRE(0 == obj.size()); + } + + SECTION("operator[], set key") { + std::string key("hello"); + JsonObject obj = doc.to(); + obj[key] = "world"; + eraseString(key); + REQUIRE("world"_s == obj["hello"]); + } + + SECTION("operator[], set value") { + std::string value("world"); + JsonObject obj = doc.to(); + obj["hello"] = value; + eraseString(value); + REQUIRE("world"_s == obj["hello"]); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/subscript.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/subscript.cpp new file mode 100644 index 00000000..bdf900f9 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/subscript.cpp @@ -0,0 +1,267 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonObject::operator[]") { + SpyingAllocator spy; + JsonDocument doc(&spy); + JsonObject obj = doc.to(); + + SECTION("int") { + obj["hello"] = 123; + + REQUIRE(123 == obj["hello"].as()); + REQUIRE(true == obj["hello"].is()); + REQUIRE(false == obj["hello"].is()); + } + + SECTION("volatile int") { // issue #415 + volatile int i = 123; + obj["hello"] = i; + + REQUIRE(123 == obj["hello"].as()); + REQUIRE(true == obj["hello"].is()); + REQUIRE(false == obj["hello"].is()); + } + + SECTION("double") { + obj["hello"] = 123.45; + + REQUIRE(true == obj["hello"].is()); + REQUIRE(false == obj["hello"].is()); + REQUIRE(123.45 == obj["hello"].as()); + } + + SECTION("bool") { + obj["hello"] = true; + + REQUIRE(true == obj["hello"].is()); + REQUIRE(false == obj["hello"].is()); + REQUIRE(true == obj["hello"].as()); + } + + SECTION("const char*") { + obj["hello"] = "h3110"; + + REQUIRE(true == obj["hello"].is()); + REQUIRE(false == obj["hello"].is()); + REQUIRE("h3110"_s == obj["hello"].as()); + } + + SECTION("array") { + JsonDocument doc2; + JsonArray arr = doc2.to(); + + obj["hello"] = arr; + + REQUIRE(arr == obj["hello"].as()); + REQUIRE(true == obj["hello"].is()); + REQUIRE(false == obj["hello"].is()); + } + + SECTION("object") { + JsonDocument doc2; + JsonObject obj2 = doc2.to(); + + obj["hello"] = obj2; + + REQUIRE(obj2 == obj["hello"].as()); + REQUIRE(true == obj["hello"].is()); + REQUIRE(false == obj["hello"].is()); + } + + SECTION("array subscript") { + JsonDocument doc2; + JsonArray arr = doc2.to(); + arr.add(42); + + obj["a"] = arr[0]; + + REQUIRE(42 == obj["a"]); + } + + SECTION("object subscript") { + JsonDocument doc2; + JsonObject obj2 = doc2.to(); + obj2["x"] = 42; + + obj["a"] = obj2["x"]; + + REQUIRE(42 == obj["a"]); + } + + SECTION("char key[]") { // issue #423 + char key[] = "hello"; + obj[key] = 42; + REQUIRE(42 == obj[key]); + } + + SECTION("should not duplicate const char*") { + obj["hello"] = "world"; + REQUIRE(spy.log() == AllocatorLog{Allocate(sizeofPool())}); + } + + SECTION("should duplicate char* value") { + obj["hello"] = const_cast("world"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } + + SECTION("should duplicate char* key") { + obj[const_cast("hello")] = "world"; + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } + + SECTION("should duplicate char* key&value") { + obj[const_cast("hello")] = const_cast("world"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + Allocate(sizeofString("world")), + }); + } + + SECTION("should duplicate std::string value") { + obj["hello"] = "world"_s; + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("world")), + }); + } + + SECTION("should duplicate std::string key") { + obj["hello"_s] = "world"; + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } + + SECTION("should duplicate std::string key&value") { + obj["hello"_s] = "world"_s; + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + Allocate(sizeofString("world")), + }); + } + + SECTION("should duplicate a non-static JsonString key") { + obj[JsonString("hello", false)] = "world"; + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + }); + } + + SECTION("should not duplicate a static JsonString key") { + obj[JsonString("hello", true)] = "world"; + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + }); + } + + SECTION("should ignore null key") { + // object must have a value to make a call to strcmp() + obj["dummy"] = 42; + + const char* null = 0; + obj[null] = 666; + + REQUIRE(obj.size() == 1); + REQUIRE(obj[null] == null); + } + + SECTION("obj[key].to()") { + JsonArray arr = obj["hello"].to(); + + REQUIRE(arr.isNull() == false); + } + +#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \ + !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR) + SECTION("obj[VLA] = str") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + obj[vla] = "world"; + + REQUIRE("world"_s == obj["hello"]); + } + + SECTION("obj[str] = VLA") { // issue #416 + size_t i = 32; + char vla[i]; + strcpy(vla, "world"); + + obj["hello"] = vla; + + REQUIRE("world"_s == obj["hello"].as()); + } + + SECTION("obj.set(VLA, str)") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + obj[vla] = "world"; + + REQUIRE("world"_s == obj["hello"]); + } + + SECTION("obj.set(str, VLA)") { + size_t i = 32; + char vla[i]; + strcpy(vla, "world"); + + obj["hello"].set(vla); + + REQUIRE("world"_s == obj["hello"].as()); + } + + SECTION("obj[VLA]") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + deserializeJson(doc, "{\"hello\":\"world\"}"); + + obj = doc.as(); + REQUIRE("world"_s == obj[vla]); + } +#endif + + SECTION("chain") { + obj["hello"]["world"] = 123; + + REQUIRE(123 == obj["hello"]["world"].as()); + REQUIRE(true == obj["hello"]["world"].is()); + REQUIRE(false == obj["hello"]["world"].is()); + } + + SECTION("JsonVariant") { + obj["hello"] = "world"; + obj["a\0b"_s] = "ABC"; + + doc["key1"] = "hello"; + doc["key2"] = "a\0b"_s; + doc["key3"] = "foo"; + + REQUIRE(obj[obj["key1"]] == "world"); + REQUIRE(obj[obj["key2"]] == "ABC"); + REQUIRE(obj[obj["key3"]] == nullptr); + REQUIRE(obj[obj["key4"]] == nullptr); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObject/unbound.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/unbound.cpp new file mode 100644 index 00000000..03005021 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObject/unbound.cpp @@ -0,0 +1,27 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +using namespace Catch::Matchers; + +TEST_CASE("Unbound JsonObject") { + JsonObject obj; + + SECTION("retrieve member") { + REQUIRE(obj["key"].isNull()); + } + + SECTION("add member") { + obj["hello"] = "world"; + REQUIRE(0 == obj.size()); + } + + SECTION("serialize") { + char buffer[32]; + serializeJson(obj, buffer, sizeof(buffer)); + REQUIRE_THAT(buffer, Equals("null")); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/CMakeLists.txt new file mode 100644 index 00000000..9eb11442 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/CMakeLists.txt @@ -0,0 +1,19 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(JsonObjectConstTests + equals.cpp + isNull.cpp + iterator.cpp + nesting.cpp + size.cpp + subscript.cpp +) + +add_test(JsonObjectConst JsonObjectConstTests) + +set_tests_properties(JsonObjectConst + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/equals.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/equals.cpp new file mode 100644 index 00000000..c1ad6ff3 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/equals.cpp @@ -0,0 +1,65 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonObjectConst::operator==()") { + JsonDocument doc1; + JsonObjectConst obj1 = doc1.to(); + + JsonDocument doc2; + JsonObjectConst obj2 = doc2.to(); + + SECTION("should return false when objs differ") { + doc1["hello"] = "coucou"; + doc2["world"] = 1; + + REQUIRE_FALSE(obj1 == obj2); + } + + SECTION("should return false when LHS has more elements") { + doc1["hello"] = "coucou"; + doc1["world"] = 666; + doc2["hello"] = "coucou"; + + REQUIRE_FALSE(obj1 == obj2); + } + + SECTION("should return false when RKS has more elements") { + doc1["hello"] = "coucou"; + doc2["hello"] = "coucou"; + doc2["world"] = 666; + + REQUIRE_FALSE(obj1 == obj2); + } + + SECTION("should return true when objs equal") { + doc1["hello"] = "world"; + doc1["anwser"] = 42; + // insert in different order + doc2["anwser"] = 42; + doc2["hello"] = "world"; + + REQUIRE(obj1 == obj2); + } + + SECTION("should return false when RHS is null") { + JsonObjectConst null; + + REQUIRE_FALSE(obj1 == null); + } + + SECTION("should return false when LHS is null") { + JsonObjectConst null; + + REQUIRE_FALSE(null == obj2); + } + + SECTION("should return true when both are null") { + JsonObjectConst null1, null2; + + REQUIRE(null1 == null2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/isNull.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/isNull.cpp new file mode 100644 index 00000000..c88b9d73 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/isNull.cpp @@ -0,0 +1,32 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonObjectConst::isNull()") { + SECTION("returns true") { + JsonObjectConst obj; + REQUIRE(obj.isNull() == true); + } + + SECTION("returns false") { + JsonDocument doc; + JsonObjectConst obj = doc.to(); + REQUIRE(obj.isNull() == false); + } +} + +TEST_CASE("JsonObjectConst::operator bool()") { + SECTION("returns false") { + JsonObjectConst obj; + REQUIRE(static_cast(obj) == false); + } + + SECTION("returns true") { + JsonDocument doc; + JsonObjectConst obj = doc.to(); + REQUIRE(static_cast(obj) == true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/iterator.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/iterator.cpp new file mode 100644 index 00000000..3b474f4f --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/iterator.cpp @@ -0,0 +1,39 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonObjectConst::begin()/end()") { + JsonDocument doc; + JsonObjectConst obj = doc.to(); + doc["ab"] = 12; + doc["cd"] = 34; + + SECTION("Iteration") { + JsonObjectConst::iterator it = obj.begin(); + REQUIRE(obj.end() != it); + REQUIRE(it->key() == "ab"); + REQUIRE(12 == it->value()); + + ++it; + REQUIRE(obj.end() != it); + JsonPairConst pair = *it; + REQUIRE(pair.key() == "cd"); + REQUIRE(34 == pair.value()); + + ++it; + REQUIRE(obj.end() == it); + } + + SECTION("Dereferencing end() is safe") { + REQUIRE(obj.end()->key().isNull()); + REQUIRE(obj.end()->value().isNull()); + } + + SECTION("null JsonObjectConst") { + JsonObjectConst null; + REQUIRE(null.begin() == null.end()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/nesting.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/nesting.cpp new file mode 100644 index 00000000..6d72cdfb --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/nesting.cpp @@ -0,0 +1,35 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonObjectConst::nesting()") { + JsonDocument doc; + JsonObjectConst obj = doc.to(); + + SECTION("return 0 if unbound") { + JsonObjectConst unbound; + REQUIRE(unbound.nesting() == 0); + } + + SECTION("returns 1 for empty object") { + REQUIRE(obj.nesting() == 1); + } + + SECTION("returns 1 for flat object") { + doc["hello"] = "world"; + REQUIRE(obj.nesting() == 1); + } + + SECTION("returns 2 with nested array") { + doc["nested"].to(); + REQUIRE(obj.nesting() == 2); + } + + SECTION("returns 2 with nested object") { + doc["nested"].to(); + REQUIRE(obj.nesting() == 2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/size.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/size.cpp new file mode 100644 index 00000000..10e1e13c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/size.cpp @@ -0,0 +1,22 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +TEST_CASE("JsonObjectConst::size()") { + JsonDocument doc; + JsonObjectConst obj = doc.to(); + + SECTION("returns 0 when empty") { + REQUIRE(0 == obj.size()); + } + + SECTION("returns the number of members") { + doc["hello"] = 1; + doc["world"] = 2; + REQUIRE(2 == obj.size()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/subscript.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/subscript.cpp new file mode 100644 index 00000000..d611b3c2 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonObjectConst/subscript.cpp @@ -0,0 +1,46 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonObjectConst::operator[]") { + JsonDocument doc; + doc["hello"] = "world"; + doc["a\0b"_s] = "ABC"; + JsonObjectConst obj = doc.as(); + + SECTION("supports const char*") { + REQUIRE(obj["hello"] == "world"); // issue #2019 + } + + SECTION("supports std::string") { + REQUIRE(obj["hello"_s] == "world"); // issue #2019 + REQUIRE(obj["a\0b"_s] == "ABC"); + } + +#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \ + !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR) + SECTION("supports VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + REQUIRE(obj[vla] == "world"_s); + } +#endif + + SECTION("supports JsonVariant") { + doc["key1"] = "hello"; + doc["key2"] = "a\0b"_s; + doc["key3"] = "foo"; + REQUIRE(obj[obj["key1"]] == "world"); + REQUIRE(obj[obj["key2"]] == "ABC"); + REQUIRE(obj[obj["key3"]] == nullptr); + REQUIRE(obj[obj["key4"]] == nullptr); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/CMakeLists.txt new file mode 100644 index 00000000..28ba51e2 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/CMakeLists.txt @@ -0,0 +1,22 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(JsonSerializerTests + CustomWriter.cpp + JsonArray.cpp + JsonArrayPretty.cpp + JsonObject.cpp + JsonObjectPretty.cpp + JsonVariant.cpp + misc.cpp + std_stream.cpp + std_string.cpp +) + +add_test(JsonSerializer JsonSerializerTests) + +set_tests_properties(JsonSerializer + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/CustomWriter.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/CustomWriter.cpp new file mode 100644 index 00000000..8e7f1de6 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/CustomWriter.cpp @@ -0,0 +1,51 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +class CustomWriter { + public: + CustomWriter() {} + CustomWriter(const CustomWriter&) = delete; + CustomWriter& operator=(const CustomWriter&) = delete; + + size_t write(uint8_t c) { + str_.append(1, static_cast(c)); + return 1; + } + + size_t write(const uint8_t* s, size_t n) { + str_.append(reinterpret_cast(s), n); + return n; + } + + const std::string& str() const { + return str_; + } + + private: + std::string str_; +}; + +TEST_CASE("CustomWriter") { + JsonDocument doc; + JsonArray array = doc.to(); + array.add(4); + array.add(2); + + SECTION("serializeJson()") { + CustomWriter writer; + serializeJson(array, writer); + + REQUIRE("[4,2]" == writer.str()); + } + + SECTION("serializeJsonPretty") { + CustomWriter writer; + serializeJsonPretty(array, writer); + + REQUIRE("[\r\n 4,\r\n 2\r\n]" == writer.str()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArray.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArray.cpp new file mode 100644 index 00000000..f33c1523 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArray.cpp @@ -0,0 +1,105 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +static void check(JsonArray array, std::string expected) { + std::string actual; + size_t actualLen = serializeJson(array, actual); + REQUIRE(expected == actual); + REQUIRE(actualLen == expected.size()); + size_t measuredLen = measureJson(array); + REQUIRE(measuredLen == expected.size()); +} + +TEST_CASE("serializeJson(JsonArray)") { + JsonDocument doc; + JsonArray array = doc.to(); + + SECTION("Empty") { + check(array, "[]"); + } + + SECTION("Null") { + array.add(static_cast(0)); + + check(array, "[null]"); + } + + SECTION("OneString") { + array.add("hello"); + + check(array, "[\"hello\"]"); + } + + SECTION("TwoStrings") { + array.add("hello"); + array.add("world"); + + check(array, "[\"hello\",\"world\"]"); + } + + SECTION("One double") { + array.add(3.1415927); + check(array, "[3.1415927]"); + } + + SECTION("OneInteger") { + array.add(1); + + check(array, "[1]"); + } + + SECTION("TwoIntegers") { + array.add(1); + array.add(2); + + check(array, "[1,2]"); + } + + SECTION("serialized(const char*)") { + array.add(serialized("{\"key\":\"value\"}")); + + check(array, "[{\"key\":\"value\"}]"); + } + + SECTION("serialized(char*)") { + char tmp[] = "{\"key\":\"value\"}"; + array.add(serialized(tmp)); + + check(array, "[{\"key\":\"value\"}]"); + } + + SECTION("OneTrue") { + array.add(true); + + check(array, "[true]"); + } + + SECTION("OneFalse") { + array.add(false); + + check(array, "[false]"); + } + + SECTION("TwoBooleans") { + array.add(false); + array.add(true); + + check(array, "[false,true]"); + } + + SECTION("OneEmptyNestedArray") { + array.add(); + + check(array, "[[]]"); + } + + SECTION("OneEmptyNestedHash") { + array.add(); + + check(array, "[{}]"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArrayPretty.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArrayPretty.cpp new file mode 100644 index 00000000..7939bd99 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonArrayPretty.cpp @@ -0,0 +1,75 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +static void checkArray(JsonArray array, std::string expected) { + std::string actual; + size_t actualLen = serializeJsonPretty(array, actual); + size_t measuredLen = measureJsonPretty(array); + CHECK(actualLen == expected.size()); + CHECK(measuredLen == expected.size()); + REQUIRE(expected == actual); +} + +TEST_CASE("serializeJsonPretty(JsonArray)") { + JsonDocument doc; + JsonArray array = doc.to(); + + SECTION("Empty") { + checkArray(array, "[]"); + } + + SECTION("OneElement") { + array.add(1); + + checkArray(array, + "[\r\n" + " 1\r\n" + "]"); + } + + SECTION("TwoElements") { + array.add(1); + array.add(2); + + checkArray(array, + "[\r\n" + " 1,\r\n" + " 2\r\n" + "]"); + } + + SECTION("EmptyNestedArrays") { + array.add(); + array.add(); + + checkArray(array, + "[\r\n" + " [],\r\n" + " []\r\n" + "]"); + } + + SECTION("NestedArrays") { + JsonArray nested1 = array.add(); + nested1.add(1); + nested1.add(2); + + JsonObject nested2 = array.add(); + nested2["key"] = 3; + + checkArray(array, + "[\r\n" + " [\r\n" + " 1,\r\n" + " 2\r\n" + " ],\r\n" + " {\r\n" + " \"key\": 3\r\n" + " }\r\n" + "]"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObject.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObject.cpp new file mode 100644 index 00000000..c21d16d1 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObject.cpp @@ -0,0 +1,119 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +static void checkObject(const JsonObject obj, const std::string& expected) { + char actual[256]; + memset(actual, '!', sizeof(actual)); + + size_t actualLen = serializeJson(obj, actual); + size_t measuredLen = measureJson(obj); + + REQUIRE(expected.size() == measuredLen); + REQUIRE(expected.size() == actualLen); + REQUIRE(actual[actualLen] == 0); // serializeJson() adds a null terminator + REQUIRE(expected == actual); +} + +TEST_CASE("serializeJson(JsonObject)") { + JsonDocument doc; + JsonObject obj = doc.to(); + + SECTION("EmptyObject") { + checkObject(obj, "{}"); + } + + SECTION("TwoStrings") { + obj["key1"] = "value1"; + obj["key2"] = "value2"; + + checkObject(obj, "{\"key1\":\"value1\",\"key2\":\"value2\"}"); + } + + SECTION("RemoveFirst") { + obj["key1"] = "value1"; + obj["key2"] = "value2"; + obj.remove("key1"); + + checkObject(obj, "{\"key2\":\"value2\"}"); + } + + SECTION("RemoveLast") { + obj["key1"] = "value1"; + obj["key2"] = "value2"; + obj.remove("key2"); + + checkObject(obj, "{\"key1\":\"value1\"}"); + } + + SECTION("RemoveUnexistingKey") { + obj["key1"] = "value1"; + obj["key2"] = "value2"; + obj.remove("key3"); + + checkObject(obj, "{\"key1\":\"value1\",\"key2\":\"value2\"}"); + } + + SECTION("ReplaceExistingKey") { + obj["key"] = "value1"; + obj["key"] = "value2"; + + checkObject(obj, "{\"key\":\"value2\"}"); + } + + SECTION("TwoIntegers") { + obj["a"] = 1; + obj["b"] = 2; + checkObject(obj, "{\"a\":1,\"b\":2}"); + } + + SECTION("serialized(const char*)") { + obj["a"] = serialized("[1,2]"); + obj["b"] = serialized("[4,5]"); + checkObject(obj, "{\"a\":[1,2],\"b\":[4,5]}"); + } + + SECTION("Two doubles") { + obj["a"] = 12.34; + obj["b"] = 56.78; + checkObject(obj, "{\"a\":12.34,\"b\":56.78}"); + } + + SECTION("TwoNull") { + obj["a"] = static_cast(0); + obj["b"] = static_cast(0); + checkObject(obj, "{\"a\":null,\"b\":null}"); + } + + SECTION("TwoBooleans") { + obj["a"] = true; + obj["b"] = false; + checkObject(obj, "{\"a\":true,\"b\":false}"); + } + + SECTION("ThreeNestedArrays") { + JsonDocument b; + JsonDocument c; + + obj["a"].to(); + obj["b"] = b.to(); + obj["c"] = c.to(); + + checkObject(obj, "{\"a\":[],\"b\":[],\"c\":[]}"); + } + + SECTION("ThreeNestedObjects") { + JsonDocument b; + JsonDocument c; + + obj["a"].to(); + obj["b"] = b.to(); + obj["c"] = c.to(); + + checkObject(obj, "{\"a\":{},\"b\":{},\"c\":{}}"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObjectPretty.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObjectPretty.cpp new file mode 100644 index 00000000..24e32fbd --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonObjectPretty.cpp @@ -0,0 +1,77 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +static void checkObjectPretty(const JsonObject obj, + const std::string expected) { + char json[256]; + + size_t actualLen = serializeJsonPretty(obj, json); + size_t measuredLen = measureJsonPretty(obj); + + REQUIRE(json == expected); + REQUIRE(expected.size() == actualLen); + REQUIRE(expected.size() == measuredLen); +} + +TEST_CASE("serializeJsonPretty(JsonObject)") { + JsonDocument doc; + JsonObject obj = doc.to(); + + SECTION("EmptyObject") { + checkObjectPretty(obj, "{}"); + } + + SECTION("OneMember") { + obj["key"] = "value"; + + checkObjectPretty(obj, + "{\r\n" + " \"key\": \"value\"\r\n" + "}"); + } + + SECTION("TwoMembers") { + obj["key1"] = "value1"; + obj["key2"] = "value2"; + + checkObjectPretty(obj, + "{\r\n" + " \"key1\": \"value1\",\r\n" + " \"key2\": \"value2\"\r\n" + "}"); + } + + SECTION("EmptyNestedContainers") { + obj["key1"].to(); + obj["key2"].to(); + + checkObjectPretty(obj, + "{\r\n" + " \"key1\": {},\r\n" + " \"key2\": []\r\n" + "}"); + } + + SECTION("NestedContainers") { + JsonObject nested1 = obj["key1"].to(); + nested1["a"] = 1; + + JsonArray nested2 = obj["key2"].to(); + nested2.add(2); + + checkObjectPretty(obj, + "{\r\n" + " \"key1\": {\r\n" + " \"a\": 1\r\n" + " },\r\n" + " \"key2\": [\r\n" + " 2\r\n" + " ]\r\n" + "}"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonVariant.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonVariant.cpp new file mode 100644 index 00000000..dcb8aeea --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/JsonVariant.cpp @@ -0,0 +1,132 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Literals.hpp" + +template +void check(T value, const std::string& expected) { + JsonDocument doc; + doc.to().set(value); + char buffer[256] = ""; + size_t returnValue = serializeJson(doc, buffer, sizeof(buffer)); + REQUIRE(expected == buffer); + REQUIRE(expected.size() == returnValue); +} + +TEST_CASE("serializeJson(JsonVariant)") { + SECTION("Undefined") { + check(JsonVariant(), "null"); + } + + SECTION("Null string") { + check(static_cast(0), "null"); + } + + SECTION("const char*") { + check("hello", "\"hello\""); + } + + SECTION("string") { + check("hello"_s, "\"hello\""); + + SECTION("Escape quotation mark") { + check("hello \"world\""_s, "\"hello \\\"world\\\"\""); + } + + SECTION("Escape reverse solidus") { + check("hello\\world"_s, "\"hello\\\\world\""); + } + + SECTION("Don't escape solidus") { + check("fifty/fifty"_s, "\"fifty/fifty\""); + } + + SECTION("Don't escape single quote") { + check("hello'world"_s, "\"hello'world\""); + } + + SECTION("Escape backspace") { + check("hello\bworld"_s, "\"hello\\bworld\""); + } + + SECTION("Escape formfeed") { + check("hello\fworld"_s, "\"hello\\fworld\""); + } + + SECTION("Escape linefeed") { + check("hello\nworld"_s, "\"hello\\nworld\""); + } + + SECTION("Escape carriage return") { + check("hello\rworld"_s, "\"hello\\rworld\""); + } + + SECTION("Escape tab") { + check("hello\tworld"_s, "\"hello\\tworld\""); + } + + SECTION("NUL char") { + check("hello\0world"_s, "\"hello\\u0000world\""); + } + } + + SECTION("SerializedValue") { + check(serialized("[1,2]"), "[1,2]"); + } + + SECTION("SerializedValue") { + check(serialized("[1,2]"_s), "[1,2]"); + } + + SECTION("Double") { + check(3.1415927, "3.1415927"); + } + + SECTION("Float") { + REQUIRE(sizeof(float) == 4); + check(3.1415927f, "3.141593"); + } + + SECTION("Zero") { + check(0, "0"); + } + + SECTION("Integer") { + check(42, "42"); + } + + SECTION("NegativeLong") { + check(-42, "-42"); + } + + SECTION("UnsignedLong") { + check(4294967295UL, "4294967295"); + } + + SECTION("True") { + check(true, "true"); + } + + SECTION("OneFalse") { + check(false, "false"); + } + +#if ARDUINOJSON_USE_LONG_LONG + SECTION("NegativeInt64") { + check(-9223372036854775807 - 1, "-9223372036854775808"); + } + + SECTION("PositiveInt64") { + check(9223372036854775807, "9223372036854775807"); + } + + SECTION("UInt64") { + check(18446744073709551615U, "18446744073709551615"); + } +#endif +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/misc.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/misc.cpp new file mode 100644 index 00000000..46d7da5a --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/misc.cpp @@ -0,0 +1,36 @@ +#include +#include +#include + +TEST_CASE("serializeJson(MemberProxy)") { + JsonDocument doc; + deserializeJson(doc, "{\"hello\":42}"); + JsonObject obj = doc.as(); + std::string result; + + serializeJson(obj["hello"], result); + + REQUIRE(result == "42"); +} + +TEST_CASE("serializeJson(ElementProxy)") { + JsonDocument doc; + deserializeJson(doc, "[42]"); + JsonArray arr = doc.as(); + std::string result; + + serializeJson(arr[0], result); + + REQUIRE(result == "42"); +} + +TEST_CASE("serializeJson(JsonVariantSubscript)") { + JsonDocument doc; + deserializeJson(doc, "[42]"); + JsonVariant var = doc.as(); + std::string result; + + serializeJson(var[0], result); + + REQUIRE(result == "42"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/std_stream.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/std_stream.cpp new file mode 100644 index 00000000..28fd6f7f --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/std_stream.cpp @@ -0,0 +1,66 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +TEST_CASE("operator<<(std::ostream)") { + JsonDocument doc; + std::ostringstream os; + + SECTION("JsonVariant containing false") { + JsonVariant variant = doc.to(); + + variant.set(false); + os << variant; + + REQUIRE("false" == os.str()); + } + + SECTION("JsonVariant containing string") { + JsonVariant variant = doc.to(); + + variant.set("coucou"); + os << variant; + + REQUIRE("\"coucou\"" == os.str()); + } + + SECTION("JsonObject") { + JsonObject object = doc.to(); + object["key"] = "value"; + + os << object; + + REQUIRE("{\"key\":\"value\"}" == os.str()); + } + + SECTION("MemberProxy") { + JsonObject object = doc.to(); + object["key"] = "value"; + + os << object["key"]; + + REQUIRE("\"value\"" == os.str()); + } + + SECTION("JsonArray") { + JsonArray array = doc.to(); + array.add("value"); + + os << array; + + REQUIRE("[\"value\"]" == os.str()); + } + + SECTION("ElementProxy") { + JsonArray array = doc.to(); + array.add("value"); + + os << array[0]; + + REQUIRE("\"value\"" == os.str()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/std_string.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/std_string.cpp new file mode 100644 index 00000000..0d234290 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonSerializer/std_string.cpp @@ -0,0 +1,58 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Literals.hpp" + +TEST_CASE("serialize JsonArray to std::string") { + JsonDocument doc; + JsonArray array = doc.to(); + array.add(4); + array.add(2); + + SECTION("serializeJson()") { + std::string json = "erase me"; + serializeJson(array, json); + + REQUIRE("[4,2]" == json); + } + + SECTION("serializeJsonPretty") { + std::string json = "erase me"; + serializeJsonPretty(array, json); + + REQUIRE("[\r\n 4,\r\n 2\r\n]" == json); + } +} + +TEST_CASE("serialize JsonObject to std::string") { + JsonDocument doc; + JsonObject obj = doc.to(); + obj["key"] = "value"; + + SECTION("object") { + std::string json = "erase me"; + serializeJson(doc, json); + + REQUIRE("{\"key\":\"value\"}" == json); + } + + SECTION("serializeJsonPretty") { + std::string json = "erase me"; + serializeJsonPretty(doc, json); + + REQUIRE("{\r\n \"key\": \"value\"\r\n}" == json); + } +} + +TEST_CASE("serialize an std::string containing a NUL") { + JsonDocument doc; + doc.set("hello\0world"_s); + + std::string json = "erase me"; + serializeJson(doc, json); + CHECK("\"hello\\u0000world\"" == json); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/CMakeLists.txt new file mode 100644 index 00000000..6aec75fc --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/CMakeLists.txt @@ -0,0 +1,33 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(JsonVariantTests + add.cpp + as.cpp + clear.cpp + compare.cpp + converters.cpp + copy.cpp + is.cpp + isnull.cpp + misc.cpp + nesting.cpp + nullptr.cpp + or.cpp + overflow.cpp + remove.cpp + set.cpp + size.cpp + stl_containers.cpp + subscript.cpp + types.cpp + unbound.cpp +) + +add_test(JsonVariant JsonVariantTests) + +set_tests_properties(JsonVariant + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/add.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/add.cpp new file mode 100644 index 00000000..3aaa7244 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/add.cpp @@ -0,0 +1,128 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonVariant::add(T)") { + JsonDocument doc; + JsonVariant var = doc.to(); + + SECTION("add integer to new variant") { + var.add(42); + + REQUIRE(var.as() == "[42]"); + } + + SECTION("add const char* to new variant") { + var.add("hello"); + + REQUIRE(var.as() == "[\"hello\"]"); + } + + SECTION("add std::string to new variant") { + var.add("hello"_s); + + REQUIRE(var.as() == "[\"hello\"]"); + } + + SECTION("add integer to integer") { + var.set(123); + + var.add(456); // no-op + + REQUIRE(var.as() == "123"); + } + + SECTION("add integer to object") { + var["val"] = 123; + + var.add(456); // no-op + + REQUIRE(var.as() == "{\"val\":123}"); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("supports VLAs") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + var.add(vla); + + REQUIRE(var.as() == "[\"hello\"]"); + } +#endif +} + +TEST_CASE("JsonVariant::add()") { + JsonDocument doc; + JsonVariant var = doc.to(); + + SECTION("JsonArray") { + JsonArray array = var.add(); + array.add(1); + array.add(2); + REQUIRE(doc.as() == "[[1,2]]"); + } + + SECTION("JsonVariant") { + JsonVariant variant = var.add(); + variant.set(42); + REQUIRE(doc.as() == "[42]"); + } +} + +TEST_CASE("JsonObject::add(JsonObject) ") { + JsonDocument doc1; + doc1["hello"_s] = "world"_s; + + TimebombAllocator allocator(10); + SpyingAllocator spy(&allocator); + JsonDocument doc2(&spy); + JsonVariant variant = doc2.to(); + + SECTION("success") { + bool result = variant.add(doc1.as()); + + REQUIRE(result == true); + REQUIRE(doc2.as() == "[{\"hello\":\"world\"}]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + Allocate(sizeofString("world")), + }); + } + + SECTION("partial failure") { // issue #2081 + allocator.setCountdown(2); + + bool result = variant.add(doc1.as()); + + REQUIRE(result == false); + REQUIRE(doc2.as() == "[]"); + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofString("hello")), + AllocateFail(sizeofString("world")), + Deallocate(sizeofString("hello")), + }); + } + + SECTION("complete failure") { + allocator.setCountdown(0); + + bool result = variant.add(doc1.as()); + + REQUIRE(result == false); + REQUIRE(doc2.as() == "[]"); + REQUIRE(spy.log() == AllocatorLog{ + AllocateFail(sizeofPool()), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/as.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/as.cpp new file mode 100644 index 00000000..65d5d6cf --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/as.cpp @@ -0,0 +1,315 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Literals.hpp" + +namespace my { +using ArduinoJson::detail::isinf; +} // namespace my + +enum MY_ENUM { ONE = 1, TWO = 2 }; + +TEST_CASE("JsonVariant::as()") { + static const char* null = 0; + + JsonDocument doc; + JsonVariant variant = doc.to(); + + SECTION("not set") { + REQUIRE(false == variant.as()); + REQUIRE(0 == variant.as()); + REQUIRE(0.0f == variant.as()); + REQUIRE(0 == variant.as()); + REQUIRE("null" == variant.as()); + REQUIRE(variant.as().isNull()); + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("set(float)") { + variant.set(4.2f); + + REQUIRE(variant.as()); + REQUIRE(0 == variant.as()); + REQUIRE(variant.as() == "4.2"); + REQUIRE(variant.as() == 4L); + REQUIRE(variant.as() == 4.2f); + REQUIRE(variant.as() == 4U); + REQUIRE(variant.as().isNull()); + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("set(double)") { + variant.set(4.2); + + REQUIRE(variant.as()); + REQUIRE(0 == variant.as()); + REQUIRE(variant.as() == "4.2"); + REQUIRE(variant.as() == 4L); + REQUIRE(variant.as() == 4.2); + REQUIRE(variant.as() == 4U); + REQUIRE(variant.as().isNull()); + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("set(0.0)") { + variant.set(0.0); + + REQUIRE(variant.as() == false); + REQUIRE(variant.as() == 0L); + REQUIRE(variant.as().isNull()); + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("set(false)") { + variant.set(false); + + REQUIRE(false == variant.as()); + REQUIRE(variant.as() == 0.0); + REQUIRE(variant.as() == 0L); + REQUIRE(variant.as() == "false"); + REQUIRE(variant.as().isNull()); + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("set(true)") { + variant.set(true); + + REQUIRE(variant.as()); + REQUIRE(variant.as() == 1.0); + REQUIRE(variant.as() == 1L); + REQUIRE(variant.as() == "true"); + REQUIRE(variant.as().isNull()); + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("set(uint32_t)") { + variant.set(4294967295U); + + REQUIRE(variant.as() == true); + REQUIRE(variant.as() == 4294967295.0); + REQUIRE(variant.as() == 0); + REQUIRE(variant.as() == 4294967295U); + REQUIRE(variant.as() == 4294967295U); + REQUIRE(variant.as() == "4294967295"); + REQUIRE(variant.as().isNull()); + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("set(int32_t)") { + variant.set(-2147483648LL); + + REQUIRE(variant.as() == true); + REQUIRE(variant.as() == -2147483648LL); + REQUIRE(variant.as() == -2147483648LL); + REQUIRE(variant.as() == -2147483648LL); + REQUIRE(variant.as() == 0); + REQUIRE(variant.as() == 0); + REQUIRE(variant.as() == "-2147483648"); + REQUIRE(variant.as().isNull()); + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("set(uint64_t)") { + variant.set(4294967296U); + + REQUIRE(variant.as() == true); + REQUIRE(variant.as() == 4294967296.0); + REQUIRE(variant.as() == 0); + REQUIRE(variant.as() == 0); + REQUIRE(variant.as() == 4294967296U); + REQUIRE(variant.as() == "4294967296"); + REQUIRE(variant.as().isNull()); + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("set(int64_t)") { + variant.set(-2147483649LL); + + REQUIRE(variant.as() == true); + REQUIRE(variant.as() == -2147483649LL); + REQUIRE(variant.as() == 0); + REQUIRE(variant.as() == -2147483649LL); + REQUIRE(variant.as() == 0); + REQUIRE(variant.as() == 0); + REQUIRE(variant.as() == "-2147483649"); + REQUIRE(variant.as().isNull()); + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("set(0L)") { + variant.set(0L); + + REQUIRE(variant.as() == false); + REQUIRE(variant.as() == 0.0); + REQUIRE(variant.as() == "0"); + REQUIRE(variant.as().isNull()); + } + + SECTION("set(0UL)") { + variant.set(0UL); + + REQUIRE(variant.as() == false); + REQUIRE(variant.as() == 0.0); + REQUIRE(variant.as() == "0"); + REQUIRE(variant.as().isNull()); + } + + SECTION("set(null)") { + variant.set(null); + + REQUIRE(variant.as() == false); + REQUIRE(variant.as() == 0.0); + REQUIRE(variant.as() == 0L); + REQUIRE(variant.as() == "null"); + REQUIRE(variant.as().isNull()); + } + + SECTION("set(\"42\")") { + variant.set("42"); + + REQUIRE(variant.as() == 42L); + REQUIRE(variant.as() == 42); + REQUIRE(variant.as() == "42"); + REQUIRE(variant.as().isStatic() == true); + } + + SECTION("set(\"hello\")") { + variant.set("hello"); + + REQUIRE(variant.as() == true); + REQUIRE(variant.as() == 0L); + REQUIRE(variant.as() == "hello"_s); + REQUIRE(variant.as() == "hello"_s); + REQUIRE(variant.as() == "hello"_s); + REQUIRE(variant.as() == "hello"); + } + + SECTION("set(std::string(\"4.2\"))") { + variant.set("4.2"_s); + + REQUIRE(variant.as() == true); + REQUIRE(variant.as() == 4L); + REQUIRE(variant.as() == Approx(4.2)); + REQUIRE(variant.as() == "4.2"_s); + REQUIRE(variant.as() == "4.2"_s); + REQUIRE(variant.as() == "4.2"); + REQUIRE(variant.as().isStatic() == false); + } + + SECTION("set(\"true\")") { + variant.set("true"); + + REQUIRE(variant.as() == true); + REQUIRE(variant.as() == 0); + REQUIRE(variant.as() == "true"); + } + + SECTION("set(-1e300)") { + variant.set(-1e300); + + REQUIRE(variant.as() == true); + REQUIRE(variant.as() == -1e300); + REQUIRE(variant.as() < 0); + REQUIRE(my::isinf(variant.as())); + REQUIRE(variant.as().isNull()); + } + + SECTION("set(1e300)") { + variant.set(1e300); + + REQUIRE(variant.as() == true); + REQUIRE(variant.as() == 1e300); + REQUIRE(variant.as() > 0); + REQUIRE(my::isinf(variant.as())); + REQUIRE(variant.as().isNull()); + } + + SECTION("set(1e-300)") { + variant.set(1e-300); + + REQUIRE(variant.as() == true); + REQUIRE(variant.as() == 1e-300); + REQUIRE(variant.as() == 0); + REQUIRE(variant.as().isNull()); + } + + SECTION("set(serialized(\"hello\"))") { + variant.set(serialized("hello")); + + REQUIRE(variant.as().data() == nullptr); + REQUIRE(variant.as().data() == nullptr); + } + + SECTION("to()") { + JsonObject obj = variant.to(); + obj["key"] = "value"; + + SECTION("as()") { + REQUIRE(variant.as() == true); + } + + SECTION("as()") { + REQUIRE(variant.as() == "{\"key\":\"value\"}"_s); + } + + SECTION("ObjectAsJsonObject") { + JsonObject o = variant.as(); + REQUIRE(o.size() == 1); + REQUIRE(o["key"] == "value"_s); + } + } + + SECTION("to()") { + JsonArray arr = variant.to(); + arr.add(4); + arr.add(2); + + SECTION("as()") { + REQUIRE(variant.as() == true); + } + + SECTION("as()") { + REQUIRE(variant.as() == "[4,2]"_s); + } + + SECTION("as()") { + JsonArray a = variant.as(); + REQUIRE(a.size() == 2); + REQUIRE(a[0] == 4); + REQUIRE(a[1] == 2); + } + } + +#if ARDUINOJSON_USE_LONG_LONG + SECTION("Smallest int64 negative") { + variant.set("-9223372036854775808"); + REQUIRE(variant.as() == -9223372036854775807 - 1); + } + + SECTION("Biggest int64 positive") { + variant.set("9223372036854775807"); + REQUIRE(variant.as() == 9223372036854775807); + } +#endif + + SECTION("as()") { + variant.set(1); + + REQUIRE(variant.as() == ONE); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/clear.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/clear.cpp new file mode 100644 index 00000000..6078d6b3 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/clear.cpp @@ -0,0 +1,40 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +TEST_CASE("JsonVariant::clear()") { + SpyingAllocator spy; + JsonDocument doc(&spy); + JsonVariant var = doc.to(); + + SECTION("size goes back to zero") { + var.add(42); + var.clear(); + + REQUIRE(var.size() == 0); + } + + SECTION("isNull() return true") { + var.add("hello"); + var.clear(); + + REQUIRE(var.isNull() == true); + } + + SECTION("releases owned string") { + var.set("hello"_s); + var.clear(); + + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("hello")), + Deallocate(sizeofString("hello")), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/compare.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/compare.cpp new file mode 100644 index 00000000..719566ed --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/compare.cpp @@ -0,0 +1,352 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +// Most code is already covered by arithmeticCompare.cpp. +// Here, we're just filling the holes + +TEST_CASE("Compare JsonVariant with value") { + JsonDocument doc; + JsonVariant a = doc.add(); + + SECTION("null vs (char*)0") { + char* b = 0; + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("42 vs 42") { + a.set(42); + int b = 42; + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } +} + +TEST_CASE("Compare JsonVariant with JsonVariant") { + JsonDocument doc; + JsonVariant a = doc.add(); + JsonVariant b = doc.add(); + + SECTION("'abc' vs 'abc'") { + a.set("abc"); + b.set("abc"); + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("'abc' vs 'bcd'") { + a.set("abc"); + b.set("bcd"); + + CHECK(a != b); + CHECK(a < b); + CHECK(a <= b); + CHECK_FALSE(a == b); + CHECK_FALSE(a > b); + CHECK_FALSE(a >= b); + } + + SECTION("'bcd' vs 'abc'") { + a.set("bcd"); + b.set("abc"); + + CHECK(a != b); + CHECK(a > b); + CHECK(a >= b); + CHECK_FALSE(a < b); + CHECK_FALSE(a <= b); + CHECK_FALSE(a == b); + } + + SECTION("serialized('abc') vs serialized('abc')") { + a.set(serialized("abc")); + b.set(serialized("abc")); + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("serialized('abc') vs serialized('bcd')") { + a.set(serialized("abc")); + b.set(serialized("bcd")); + + CHECK(a != b); + CHECK(a < b); + CHECK(a <= b); + CHECK_FALSE(a == b); + CHECK_FALSE(a > b); + CHECK_FALSE(a >= b); + } + + SECTION("serialized('bcd') vs serialized('abc')") { + a.set(serialized("bcd")); + b.set(serialized("abc")); + + CHECK(a != b); + CHECK(a > b); + CHECK(a >= b); + CHECK_FALSE(a < b); + CHECK_FALSE(a <= b); + CHECK_FALSE(a == b); + } + + SECTION("MsgPackBinary('abc') vs MsgPackBinary('abc')") { + a.set(MsgPackBinary("abc", 4)); + b.set(MsgPackBinary("abc", 4)); + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("MsgPackBinary('abc') vs MsgPackBinary('bcd')") { + a.set(MsgPackBinary("abc", 4)); + b.set(MsgPackBinary("bcd", 4)); + + CHECK(a != b); + CHECK(a < b); + CHECK(a <= b); + CHECK_FALSE(a == b); + CHECK_FALSE(a > b); + CHECK_FALSE(a >= b); + } + + SECTION("MsgPackBinary('bcd') vs MsgPackBinary('abc')") { + a.set(MsgPackBinary("bcd", 4)); + b.set(MsgPackBinary("abc", 4)); + + CHECK(a != b); + CHECK(a > b); + CHECK(a >= b); + CHECK_FALSE(a < b); + CHECK_FALSE(a <= b); + CHECK_FALSE(a == b); + } + + SECTION("false vs true") { + a.set(false); + b.set(true); + + CHECK(a != b); + CHECK(a < b); + CHECK(a <= b); + CHECK_FALSE(a == b); + CHECK_FALSE(a > b); + CHECK_FALSE(a >= b); + } + + SECTION("false vs -1") { + a.set(false); + b.set(-1); + + CHECK(a != b); + CHECK(a > b); + CHECK(a >= b); + CHECK_FALSE(a < b); + CHECK_FALSE(a <= b); + CHECK_FALSE(a == b); + } + + SECTION("null vs null") { + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("42 vs 42") { + a.set(42); + b.set(42); + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("42 vs 42U") { + a.set(42); + b.set(42U); + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("42 vs 42.0") { + a.set(42); + b.set(42.0); + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("42.0 vs 42") { + a.set(42.0); + b.set(42); + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("-42 vs -42") { + a.set(-42); + b.set(-42); + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("-42 vs 42") { + a.set(-42); + b.set(42); + + CHECK(a != b); + CHECK(a < b); + CHECK(a <= b); + CHECK_FALSE(a == b); + CHECK_FALSE(a > b); + CHECK_FALSE(a >= b); + } + + SECTION("42 vs -42") { + a.set(42); + b.set(-42); + + CHECK(a != b); + CHECK(a > b); + CHECK(a >= b); + CHECK_FALSE(a < b); + CHECK_FALSE(a <= b); + CHECK_FALSE(a == b); + } + + SECTION("42.0 vs -42") { + a.set(42.0); + b.set(-42); + + CHECK(a != b); + CHECK(a > b); + CHECK(a >= b); + CHECK_FALSE(a < b); + CHECK_FALSE(a <= b); + CHECK_FALSE(a == b); + } + + SECTION("42U vs 42U") { + a.set(42U); + b.set(42U); + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("42U vs 42") { + a.set(42U); + b.set(42); + + CHECK(a == b); + CHECK(a <= b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("[1] vs [1]") { + a.add(1); + b.add(1); + + CHECK(a <= b); + CHECK(a == b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("[1] vs [2]") { + a.add(1); + b.add(2); + + CHECK(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a <= b); + CHECK_FALSE(a == b); + CHECK_FALSE(a > b); + CHECK_FALSE(a >= b); + } + + SECTION("{x:1} vs {x:1}") { + a["x"] = 1; + b["x"] = 1; + + CHECK(a <= b); + CHECK(a == b); + CHECK(a >= b); + CHECK_FALSE(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a > b); + } + + SECTION("{x:1} vs {x:2}") { + a["x"] = 1; + b["x"] = 2; + + CHECK(a != b); + CHECK_FALSE(a < b); + CHECK_FALSE(a <= b); + CHECK_FALSE(a == b); + CHECK_FALSE(a > b); + CHECK_FALSE(a >= b); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/converters.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/converters.cpp new file mode 100644 index 00000000..10d73854 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/converters.cpp @@ -0,0 +1,142 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +namespace { +struct Date { + int day; + int month; + int year; +}; + +void convertToJson(const Date& src, JsonVariant dst) { + dst["day"] = src.day; + dst["month"] = src.month; + dst["year"] = src.year; +} + +void convertFromJson(JsonVariantConst src, Date& dst) { + dst.day = src["day"]; + dst.month = src["month"]; + dst.year = src["year"]; +} + +bool canConvertFromJson(JsonVariantConst src, const Date&) { + return src["day"].is() && src["month"].is() && + src["year"].is(); +} +} // namespace + +TEST_CASE("Custom converter with overloading") { + JsonDocument doc; + + SECTION("convert JSON to Date") { + doc["date"]["day"] = 2; + doc["date"]["month"] = 3; + doc["date"]["year"] = 2021; + + Date date = doc["date"]; + + REQUIRE(date.day == 2); + REQUIRE(date.month == 3); + REQUIRE(date.year == 2021); + } + + SECTION("is() returns true") { + doc["date"]["day"] = 2; + doc["date"]["month"] = 3; + doc["date"]["year"] = 2021; + + REQUIRE(doc["date"].is()); + } + + SECTION("is() returns false") { + doc["date"]["day"] = 2; + doc["date"]["month"] = 3; + doc["date"]["year"] = "2021"; + + REQUIRE(doc["date"].is() == false); + } + + SECTION("convert Date to JSON") { + Date date = {19, 3, 2021}; + doc["date"] = date; + + REQUIRE(doc["date"]["day"] == 19); + REQUIRE(doc["date"]["month"] == 3); + REQUIRE(doc["date"]["year"] == 2021); + } +} + +class Complex { + public: + explicit Complex(double r, double i) : real_(r), imag_(i) {} + + double real() const { + return real_; + } + + double imag() const { + return imag_; + } + + private: + double real_, imag_; +}; + +namespace ArduinoJson { +template <> +struct Converter { + static void toJson(const Complex& src, JsonVariant dst) { + dst["real"] = src.real(); + dst["imag"] = src.imag(); + } + + static Complex fromJson(JsonVariantConst src) { + return Complex(src["real"], src["imag"]); + } + + static bool checkJson(JsonVariantConst src) { + return src["real"].is() && src["imag"].is(); + } +}; +} // namespace ArduinoJson + +TEST_CASE("Custom converter with specialization") { + JsonDocument doc; + + SECTION("convert JSON to Complex") { + doc["value"]["real"] = 2; + doc["value"]["imag"] = 3; + + Complex value = doc["value"]; + + REQUIRE(value.real() == 2); + REQUIRE(value.imag() == 3); + } + + SECTION("is() returns true") { + doc["value"]["real"] = 2; + doc["value"]["imag"] = 3; + + REQUIRE(doc["value"].is()); + } + + SECTION("is() returns false") { + doc["value"]["real"] = 2; + doc["value"]["imag"] = "3"; + + REQUIRE(doc["value"].is() == false); + } + + SECTION("convert value to JSON") { + doc["value"] = Complex(19, 3); + + REQUIRE(doc["value"]["real"] == 19); + REQUIRE(doc["value"]["imag"] == 3); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/copy.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/copy.cpp new file mode 100644 index 00000000..b5da71f5 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/copy.cpp @@ -0,0 +1,142 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include "Allocators.hpp" + +#include "Literals.hpp" + +TEST_CASE("JsonVariant::set(JsonVariant)") { + KillswitchAllocator killswitch; + SpyingAllocator spyingAllocator(&killswitch); + JsonDocument doc1(&spyingAllocator); + JsonDocument doc2(&spyingAllocator); + JsonVariant var1 = doc1.to(); + JsonVariant var2 = doc2.to(); + + SECTION("stores JsonArray by copy") { + JsonArray arr = doc2.to(); + JsonObject obj = arr.add(); + obj["hello"] = "world"; + + var1.set(arr); + + arr[0] = 666; + REQUIRE(var1.as() == "[{\"hello\":\"world\"}]"); + } + + SECTION("stores JsonObject by copy") { + JsonObject obj = doc2.to(); + JsonArray arr = obj["value"].to(); + arr.add(42); + + var1.set(obj); + + obj["value"] = 666; + REQUIRE(var1.as() == "{\"value\":[42]}"); + } + + SECTION("stores const char* by reference") { + var1.set("hello!!"); + spyingAllocator.clearLog(); + + var2.set(var1); + + REQUIRE(spyingAllocator.log() == AllocatorLog{}); + } + + SECTION("stores char* by copy") { + char str[] = "hello!!"; + var1.set(str); + spyingAllocator.clearLog(); + + var2.set(var1); + + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofString("hello!!")), + }); + } + + SECTION("fails gracefully if string allocation fails") { + char str[] = "hello!!"; + var1.set(str); + killswitch.on(); + spyingAllocator.clearLog(); + + var2.set(var1); + + REQUIRE(doc2.overflowed() == true); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + AllocateFail(sizeofString("hello!!")), + }); + } + + SECTION("stores std::string by copy") { + var1.set("hello!!"_s); + spyingAllocator.clearLog(); + + var2.set(var1); + + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofString("hello!!")), + }); + } + + SECTION("stores Serialized by copy") { + var1.set(serialized("hello!!", 7)); + spyingAllocator.clearLog(); + + var2.set(var1); + + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofString("hello!!")), + }); + } + + SECTION("stores Serialized by copy") { + char str[] = "hello!!"; + var1.set(serialized(str, 7)); + spyingAllocator.clearLog(); + + var2.set(var1); + + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofString("hello!!")), + }); + } + + SECTION("stores Serialized by copy") { + var1.set(serialized("hello!!"_s)); + spyingAllocator.clearLog(); + + var2.set(var1); + + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofString("hello!!")), + }); + } + + SECTION("fails gracefully if raw string allocation fails") { + var1.set(serialized("hello!!"_s)); + killswitch.on(); + spyingAllocator.clearLog(); + + var2.set(var1); + + REQUIRE(doc2.overflowed() == true); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + AllocateFail(sizeofString("hello!!")), + }); + } + + SECTION("destination is unbound") { + JsonVariant unboundVariant; + + unboundVariant.set(var1); + + REQUIRE(unboundVariant.isUnbound()); + REQUIRE(unboundVariant.isNull()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/is.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/is.cpp new file mode 100644 index 00000000..9e38b7be --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/is.cpp @@ -0,0 +1,164 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +enum MYENUM2 { ONE = 1, TWO = 2 }; + +TEST_CASE("JsonVariant::is()") { + JsonDocument doc; + JsonVariant variant = doc.to(); + + SECTION("unbound") { + variant = JsonVariant(); + + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + } + + SECTION("null") { + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + } + + SECTION("true") { + variant.set(true); + + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + } + + SECTION("false") { + variant.set(false); + + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + } + + SECTION("int") { + variant.set(42); + + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + } + + SECTION("double") { + variant.set(4.2); + + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + } + + SECTION("const char*") { + variant.set("4.2"); + + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + } + + SECTION("JsonArray") { + variant.to(); + + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + } + + SECTION("JsonObject") { + variant.to(); + + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == false); + CHECK(variant.is() == true); + CHECK(variant.is() == true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/isnull.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/isnull.cpp new file mode 100644 index 00000000..7683eb8f --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/isnull.cpp @@ -0,0 +1,72 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonVariant::isNull()") { + JsonDocument doc; + JsonVariant variant = doc.to(); + + SECTION("returns true when Undefined") { + REQUIRE(variant.isNull() == true); + } + + SECTION("returns false when Integer") { + variant.set(42); + + REQUIRE(variant.isNull() == false); + } + + SECTION("returns false when EmptyArray") { + JsonDocument doc2; + JsonArray array = doc2.to(); + + variant.set(array); + REQUIRE(variant.isNull() == false); + } + + SECTION("returns false when EmptyObject") { + JsonDocument doc2; + JsonObject obj = doc2.to(); + + variant.set(obj); + REQUIRE(variant.isNull() == false); + } + + SECTION("returns true after set(JsonArray())") { + variant.set(JsonArray()); + REQUIRE(variant.isNull() == true); + } + + SECTION("returns true after set(JsonObject())") { + variant.set(JsonObject()); + REQUIRE(variant.isNull() == true); + } + + SECTION("returns false after set('hello')") { + variant.set("hello"); + REQUIRE(variant.isNull() == false); + } + + SECTION("returns true after set((char*)0)") { + variant.set(static_cast(0)); + REQUIRE(variant.isNull() == true); + } + + SECTION("returns true after set((const char*)0)") { + variant.set(static_cast(0)); + REQUIRE(variant.isNull() == true); + } + + SECTION("returns true after set(serialized((char*)0))") { + variant.set(serialized(static_cast(0))); + REQUIRE(variant.isNull() == true); + } + + SECTION("returns true after set(serialized((const char*)0))") { + variant.set(serialized(static_cast(0))); + REQUIRE(variant.isNull() == true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/misc.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/misc.cpp new file mode 100644 index 00000000..62983442 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/misc.cpp @@ -0,0 +1,60 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("VariantData") { + REQUIRE(std::is_standard_layout::value == + true); +} + +TEST_CASE("StringNode") { + REQUIRE(std::is_standard_layout::value == + true); +} + +TEST_CASE("JsonVariant from JsonArray") { + SECTION("JsonArray is null") { + JsonArray arr; + JsonVariant v = arr; + REQUIRE(v.isNull() == true); + } + + SECTION("JsonArray is not null") { + JsonDocument doc; + JsonArray arr = doc.to(); + arr.add(12); + arr.add(34); + + JsonVariant v = arr; + + REQUIRE(v.is() == true); + REQUIRE(v.size() == 2); + REQUIRE(v[0] == 12); + REQUIRE(v[1] == 34); + } +} + +TEST_CASE("JsonVariant from JsonObject") { + SECTION("JsonObject is null") { + JsonObject obj; + JsonVariant v = obj; + REQUIRE(v.isNull() == true); + } + + SECTION("JsonObject is not null") { + JsonDocument doc; + JsonObject obj = doc.to(); + obj["a"] = 12; + obj["b"] = 34; + + JsonVariant v = obj; + + REQUIRE(v.is() == true); + REQUIRE(v.size() == 2); + REQUIRE(v["a"] == 12); + REQUIRE(v["b"] == 34); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/nesting.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/nesting.cpp new file mode 100644 index 00000000..cb4e3516 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/nesting.cpp @@ -0,0 +1,31 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonVariant::nesting()") { + JsonDocument doc; + JsonVariant var = doc.to(); + + SECTION("return 0 if uninitialized") { + JsonVariant unitialized; + REQUIRE(unitialized.nesting() == 0); + } + + SECTION("returns 0 for string") { + var.set("hello"); + REQUIRE(var.nesting() == 0); + } + + SECTION("returns 1 for empty object") { + var.to(); + REQUIRE(var.nesting() == 1); + } + + SECTION("returns 1 for empty array") { + var.to(); + REQUIRE(var.nesting() == 1); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/nullptr.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/nullptr.cpp new file mode 100644 index 00000000..434ba5c8 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/nullptr.cpp @@ -0,0 +1,43 @@ +#include + +#include + +TEST_CASE("nullptr") { + JsonDocument doc; + JsonVariant variant = doc.to(); + + SECTION("JsonVariant == nullptr") { + REQUIRE(variant == nullptr); + REQUIRE_FALSE(variant != nullptr); + } + + SECTION("JsonVariant != nullptr") { + variant.set(42); + + REQUIRE_FALSE(variant == nullptr); + REQUIRE(variant != nullptr); + } + + SECTION("JsonVariant.set(nullptr)") { + variant.set(42); + variant.set(nullptr); + + REQUIRE(variant.isNull()); + } + + SECTION("JsonVariant.set(nullptr) with unbound reference") { + JsonVariant unboundReference; + + unboundReference.set(nullptr); + + REQUIRE(variant.isNull()); + } + + SECTION("JsonVariant.is()") { + variant.set(42); + REQUIRE(variant.is() == false); + + variant.clear(); + REQUIRE(variant.is() == true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/or.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/or.cpp new file mode 100644 index 00000000..58868993 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/or.cpp @@ -0,0 +1,159 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonVariant::operator|()") { + JsonDocument doc; + JsonVariant variant = doc["value"].to(); + + SECTION("null") { + SECTION("null | const char*") { + std::string result = variant | "default"; + REQUIRE(result == "default"); + } + + SECTION("null | int") { + int result = variant | 42; + REQUIRE(result == 42); + } + + SECTION("null | bool") { + bool result = variant | true; + REQUIRE(result == true); + } + + SECTION("null | ElementProxy") { + doc["array"][0] = 42; + + JsonVariantConst result = variant | doc["array"][0]; + REQUIRE(result == 42); + } + + SECTION("null | MemberProxy") { + doc["other"] = 42; + + JsonVariantConst result = variant | doc["other"]; + REQUIRE(result == 42); + } + + SECTION("ElementProxy | ElementProxy") { + doc["array"][0] = 42; + + JsonVariantConst result = doc["array"][1] | doc["array"][0]; + REQUIRE(result == 42); + } + } + + SECTION("null") { + variant.set(static_cast(0)); + + SECTION("null | const char*") { + std::string result = variant | "default"; + REQUIRE(result == "default"); + } + + SECTION("null | int") { + int result = variant | 42; + REQUIRE(result == 42); + } + + SECTION("null | bool") { + bool result = variant | true; + REQUIRE(result == true); + } + + SECTION("null | ElementProxy") { + doc["array"][0] = 42; + + JsonVariantConst result = variant | doc["array"][0]; + REQUIRE(result == 42); + } + + SECTION("null | MemberProxy") { + doc["other"] = 42; + + JsonVariantConst result = variant | doc["other"]; + REQUIRE(result == 42); + } + } + + SECTION("int | const char*") { + variant.set(42); + std::string result = variant | "default"; + REQUIRE(result == "default"); + } + + SECTION("int | uint8_t (out of range)") { + variant.set(666); + uint8_t result = variant | static_cast(42); + REQUIRE(result == 42); + } + + SECTION("int | ElementProxy") { + variant.set(42); + doc["array"][0] = 666; + JsonVariantConst result = variant | doc["array"][0]; + REQUIRE(result == 42); + } + + SECTION("int | MemberProxy") { + variant.set(42); + doc["other"] = 666; + JsonVariantConst result = variant | doc["other"]; + REQUIRE(result == 42); + } + + SECTION("int | int") { + variant.set(0); + int result = variant | 666; + REQUIRE(result == 0); + } + + SECTION("double | int") { + // NOTE: changed the behavior to fix #981 + variant.set(666.0); + int result = variant | 42; + REQUIRE(result == 42); + } + + SECTION("bool | bool") { + variant.set(false); + bool result = variant | true; + REQUIRE(result == false); + } + + SECTION("int | bool") { + variant.set(0); + bool result = variant | true; + REQUIRE(result == true); + } + + SECTION("const char* | const char*") { + variant.set("not default"); + std::string result = variant | "default"; + REQUIRE(result == "not default"); + } + + SECTION("const char* | char*") { + char dflt[] = "default"; + variant.set("not default"); + std::string result = variant | dflt; + REQUIRE(result == "not default"); + } + + SECTION("int | char*") { + char dflt[] = "default"; + variant.set(42); + std::string result = variant | dflt; + REQUIRE(result == "default"); + } + + SECTION("const char* | int") { + variant.set("not default"); + int result = variant | 42; + REQUIRE(result == 42); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/overflow.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/overflow.cpp new file mode 100644 index 00000000..00dbed70 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/overflow.cpp @@ -0,0 +1,72 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +template +void shouldBeOk(TIn value) { + JsonDocument doc; + JsonVariant var = doc.to(); + var.set(value); + REQUIRE(var.as() == TOut(value)); +} + +template +void shouldOverflow(TIn value) { + JsonDocument doc; + JsonVariant var = doc.to(); + var.set(value); + REQUIRE(var.as() == 0); + REQUIRE(var.is() == false); +} + +TEST_CASE("Handle integer overflow in stored integer") { + SECTION("int8_t") { + // ok + shouldBeOk(-128); + shouldBeOk(42.0); + shouldBeOk(127); + + // too low + shouldOverflow(-128.1); + shouldOverflow(-129); + + // too high + shouldOverflow(128); + shouldOverflow(127.1); + } + + SECTION("int16_t") { + // ok + shouldBeOk(-32768); + shouldBeOk(-32767.9); + shouldBeOk(32766.9); + shouldBeOk(32767); + + // too low + shouldOverflow(-32768.1); + shouldOverflow(-32769); + + // too high + shouldOverflow(32767.1); + shouldOverflow(32768); + } + + SECTION("uint8_t") { + // ok + shouldBeOk(1); + shouldBeOk(42.0); + shouldBeOk(255); + + // too low + shouldOverflow(-1); + shouldOverflow(-0.1); + + // to high + shouldOverflow(255.1); + shouldOverflow(256); + shouldOverflow(257); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/remove.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/remove.cpp new file mode 100644 index 00000000..2926cfef --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/remove.cpp @@ -0,0 +1,128 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofArray; + +TEST_CASE("JsonVariant::remove(int)") { + SpyingAllocator spy; + JsonDocument doc(&spy); + + SECTION("release top level strings") { + doc.add("hello"_s); + doc.add("hello"_s); + doc.add("world"_s); + + JsonVariant var = doc.as(); + REQUIRE(var.as() == "[\"hello\",\"hello\",\"world\"]"); + + spy.clearLog(); + var.remove(1); + REQUIRE(var.as() == "[\"hello\",\"world\"]"); + REQUIRE(spy.log() == AllocatorLog{}); + + spy.clearLog(); + var.remove(1); + REQUIRE(var.as() == "[\"hello\"]"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("world")), + }); + + spy.clearLog(); + var.remove(0); + REQUIRE(var.as() == "[]"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("hello")), + }); + } + + SECTION("release strings in nested array") { + doc[0][0] = "hello"_s; + + JsonVariant var = doc.as(); + REQUIRE(var.as() == "[[\"hello\"]]"); + + spy.clearLog(); + var.remove(0); + + REQUIRE(var.as() == "[]"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("hello")), + }); + } +} + +TEST_CASE("JsonVariant::remove(const char *)") { + JsonDocument doc; + JsonVariant var = doc.to(); + + var["a"] = 1; + var["b"] = 2; + + var.remove("a"); + + REQUIRE(var.as() == "{\"b\":2}"); +} + +TEST_CASE("JsonVariant::remove(std::string)") { + JsonDocument doc; + JsonVariant var = doc.to(); + + var["a"] = 1; + var["b"] = 2; + + var.remove("b"_s); + + REQUIRE(var.as() == "{\"a\":1}"); +} + +#ifdef HAS_VARIABLE_LENGTH_ARRAY +TEST_CASE("JsonVariant::remove(VLA)") { + JsonDocument doc; + JsonVariant var = doc.to(); + + var["a"] = 1; + var["b"] = 2; + size_t i = 16; + char vla[i]; + strcpy(vla, "b"); + + var.remove("b"_s); + + REQUIRE(var.as() == "{\"a\":1}"); +} +#endif + +TEST_CASE("JsonVariant::remove(JsonVariant) from object") { + JsonDocument doc; + JsonVariant var = doc.to(); + + var["a"] = "a"; + var["b"] = 2; + var["c"] = "b"; + + var.remove(var["c"]); + + REQUIRE(var.as() == "{\"a\":\"a\",\"c\":\"b\"}"); +} + +TEST_CASE("JsonVariant::remove(JsonVariant) from array") { + JsonDocument doc; + JsonVariant var = doc.to(); + + var[0] = 3; + var[1] = 2; + var[2] = 1; + + var.remove(var[2]); + var.remove(var[3]); // noop + + REQUIRE(var.as() == "[3,1]"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/set.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/set.cpp new file mode 100644 index 00000000..a8eafe6c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/set.cpp @@ -0,0 +1,395 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofObject; + +enum ErrorCode { ERROR_01 = 1, ERROR_10 = 10 }; + +TEST_CASE("JsonVariant::set() when there is enough memory") { + SpyingAllocator spy; + JsonDocument doc(&spy); + JsonVariant variant = doc.to(); + + SECTION("string literal") { + bool result = variant.set("hello\0world"); + + REQUIRE(result == true); + CHECK(variant == + "hello"_s); // linked string cannot contain '\0' at the moment + CHECK(spy.log() == AllocatorLog{}); + } + + SECTION("const char*") { + char str[16]; + + strcpy(str, "hello"); + bool result = variant.set(static_cast(str)); + strcpy(str, "world"); + + REQUIRE(result == true); + REQUIRE(variant == "hello"); // stores by copy + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("hello")), + }); + } + + SECTION("(const char*)0") { + bool result = variant.set(static_cast(0)); + + REQUIRE(result == true); + REQUIRE(variant.isNull()); + REQUIRE(variant.as() == nullptr); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("char*") { + char str[16]; + + strcpy(str, "hello"); + bool result = variant.set(str); + strcpy(str, "world"); + + REQUIRE(result == true); + REQUIRE(variant == "hello"); // stores by copy + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("hello")), + }); + } + + SECTION("(char*)0") { + bool result = variant.set(static_cast(0)); + + REQUIRE(result == true); + REQUIRE(variant.isNull()); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("unsigned char*") { + char str[16]; + + strcpy(str, "hello"); + bool result = variant.set(reinterpret_cast(str)); + strcpy(str, "world"); + + REQUIRE(result == true); + REQUIRE(variant == "hello"); // stores by copy + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("hello")), + }); + } + + SECTION("signed char*") { + char str[16]; + + strcpy(str, "hello"); + bool result = variant.set(reinterpret_cast(str)); + strcpy(str, "world"); + + REQUIRE(result == true); + REQUIRE(variant == "hello"); // stores by copy + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("hello")), + }); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("VLA") { + size_t n = 16; + char str[n]; + + strcpy(str, "hello"); + bool result = variant.set(str); + strcpy(str, "world"); + + REQUIRE(result == true); + REQUIRE(variant == "hello"); // stores by copy + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("hello")), + }); + } +#endif + + SECTION("std::string") { + std::string str = "hello\0world"_s; + bool result = variant.set(str); + str.replace(0, 5, "world"); + + REQUIRE(result == true); + REQUIRE(variant == "hello\0world"_s); // stores by copy + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("hello?world")), + }); + } + + SECTION("static JsonString") { + char str[16]; + + strcpy(str, "hello"); + bool result = variant.set(JsonString(str, true)); + strcpy(str, "world"); + + REQUIRE(result == true); + REQUIRE(variant == "world"); // stores by pointer + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("non-static JsonString") { + char str[16]; + + strcpy(str, "hello"); + bool result = variant.set(JsonString(str)); + strcpy(str, "world"); + + REQUIRE(result == true); + REQUIRE(variant == "hello"); // stores by copy + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofString("hello")), + }); + } + + SECTION("enum") { + ErrorCode code = ERROR_10; + + bool result = variant.set(code); + + REQUIRE(result == true); + REQUIRE(variant.is() == true); + REQUIRE(variant.as() == 10); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("float") { + bool result = variant.set(1.2f); + + REQUIRE(result == true); + REQUIRE(variant.is() == true); + REQUIRE(variant.as() == 1.2f); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("double") { + bool result = variant.set(1.2); + doc.shrinkToFit(); + + REQUIRE(result == true); + REQUIRE(variant.is() == true); + REQUIRE(variant.as() == 1.2); + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofPool(1)), // one extension slot + }); + } + + SECTION("int32_t") { + bool result = variant.set(int32_t(42)); + + REQUIRE(result == true); + REQUIRE(variant.is() == true); + REQUIRE(variant.as() == 42); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("int64_t") { + bool result = variant.set(int64_t(-2147483649LL)); + doc.shrinkToFit(); + + REQUIRE(result == true); + REQUIRE(variant.is() == true); + REQUIRE(variant.as() == -2147483649LL); + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofPool(1)), // one extension slot + }); + } + + SECTION("uint32_t") { + bool result = variant.set(uint32_t(42)); + + REQUIRE(result == true); + REQUIRE(variant.is() == true); + REQUIRE(variant.as() == 42); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("uint64_t") { + bool result = variant.set(uint64_t(4294967296)); + doc.shrinkToFit(); + + REQUIRE(result == true); + REQUIRE(variant.is() == true); + REQUIRE(variant.as() == 4294967296); + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofPool(1)), // one extension slot + }); + } + + SECTION("JsonDocument") { + JsonDocument doc1; + doc1["hello"] = "world"; + + // Should copy the doc + variant.set(doc1); + doc1.clear(); + + std::string json; + serializeJson(doc, json); + REQUIRE(json == "{\"hello\":\"world\"}"); + } +} + +TEST_CASE("JsonVariant::set() with not enough memory") { + JsonDocument doc(FailingAllocator::instance()); + + JsonVariant v = doc.to(); + + SECTION("std::string") { + bool result = v.set("hello world!!"_s); + + REQUIRE(result == false); + REQUIRE(v.isNull()); + } + + SECTION("Serialized") { + bool result = v.set(serialized("hello world!!"_s)); + + REQUIRE(result == false); + REQUIRE(v.isNull()); + } + + SECTION("char*") { + char s[] = "hello world!!"; + bool result = v.set(s); + + REQUIRE(result == false); + REQUIRE(v.isNull()); + } + + SECTION("float") { + bool result = v.set(1.2f); + + REQUIRE(result == true); + REQUIRE(v.is()); + } + + SECTION("double") { + bool result = v.set(1.2); + + REQUIRE(result == false); + REQUIRE(v.isNull()); + } + + SECTION("int32_t") { + bool result = v.set(-42); + + REQUIRE(result == true); + REQUIRE(v.is()); + } + + SECTION("int64_t") { + bool result = v.set(-2147483649LL); + + REQUIRE(result == false); + REQUIRE(v.isNull()); + } + + SECTION("uint32_t") { + bool result = v.set(42); + + REQUIRE(result == true); + REQUIRE(v.is()); + } + + SECTION("uint64_t") { + bool result = v.set(4294967296U); + + REQUIRE(result == false); + REQUIRE(v.isNull()); + } +} + +TEST_CASE("JsonVariant::set() releases the previous value") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc["hello"] = "world"_s; + spy.clearLog(); + + JsonVariant v = doc["hello"]; + + SECTION("int") { + v.set(42); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("world")), + }); + } + + SECTION("bool") { + v.set(false); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("world")), + }); + } + + SECTION("const char*") { + v.set("hello"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("world")), + }); + } + + SECTION("float") { + v.set(1.2); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("world")), + }); + } + + SECTION("Serialized") { + v.set(serialized("[]")); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("world")), + Allocate(sizeofString("[]")), + }); + } +} + +TEST_CASE("JsonVariant::set() reuses extension slot") { + SpyingAllocator spy; + JsonDocument doc(&spy); + JsonVariant variant = doc.to(); + + variant.set(1.2); + doc.shrinkToFit(); + spy.clearLog(); + + SECTION("double") { + bool result = variant.set(3.4); + + REQUIRE(result == true); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("int64_t") { + bool result = variant.set(-2147483649LL); + + REQUIRE(result == true); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("uint64_t") { + bool result = variant.set(4294967296U); + + REQUIRE(result == true); + REQUIRE(spy.log() == AllocatorLog{}); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/size.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/size.cpp new file mode 100644 index 00000000..e0c5bb42 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/size.cpp @@ -0,0 +1,36 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonVariant::size()") { + JsonDocument doc; + JsonVariant variant = doc.to(); + + SECTION("unbound reference") { + JsonVariant unbound; + + CHECK(unbound.size() == 0); + } + + SECTION("int") { + variant.set(42); + + CHECK(variant.size() == 0); + } + + SECTION("string") { + variant.set("hello"); + + CHECK(variant.size() == 0); + } + + SECTION("object") { + variant["a"] = 1; + variant["b"] = 2; + + CHECK(variant.size() == 2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/stl_containers.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/stl_containers.cpp new file mode 100644 index 00000000..53a23fdc --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/stl_containers.cpp @@ -0,0 +1,138 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include +#include +#include + +namespace ArduinoJson { +template +struct Converter> { + static void toJson(const std::vector& src, JsonVariant dst) { + JsonArray array = dst.to(); + for (T item : src) + array.add(item); + } + + static std::vector fromJson(JsonVariantConst src) { + std::vector dst; + for (T item : src.as()) + dst.push_back(item); + return dst; + } + + static bool checkJson(JsonVariantConst src) { + JsonArrayConst array = src; + bool result = array; + for (JsonVariantConst item : array) + result &= item.is(); + return result; + } +}; + +template +struct Converter> { + static void toJson(const std::array& src, JsonVariant dst) { + JsonArray array = dst.to(); + for (T item : src) + array.add(item); + } + + static std::array fromJson(JsonVariantConst src) { + std::array dst; + dst.fill(0); + size_t idx = 0; + for (T item : src.as()) + dst[idx++] = item; + return dst; + } + + static bool checkJson(JsonVariantConst src) { + JsonArrayConst array = src; + bool result = array; + size_t size = 0; + for (JsonVariantConst item : array) { + result &= item.is(); + size++; + } + return result && size == N; + } +}; +} // namespace ArduinoJson + +TEST_CASE("vector") { + SECTION("toJson") { + std::vector v = {1, 2}; + + JsonDocument doc; + doc.set(v); + REQUIRE(doc.as() == "[1,2]"); + } + + SECTION("fromJson") { + JsonDocument doc; + doc.add(1); + doc.add(2); + + auto v = doc.as>(); + REQUIRE(v.size() == 2); + CHECK(v[0] == 1); + CHECK(v[1] == 2); + } + + SECTION("checkJson") { + JsonDocument doc; + CHECK(doc.is>() == false); + + doc.add(1); + doc.add(2); + CHECK(doc.is>() == true); + + doc.add("foo"); + CHECK(doc.is>() == false); + } +} + +TEST_CASE("array") { + using array_type = std::array; + + SECTION("toJson") { + array_type v; + v[0] = 1; + v[1] = 2; + + JsonDocument doc; + doc.set(v); + REQUIRE(doc.as() == "[1,2]"); + } + + SECTION("fromJson") { + JsonDocument doc; + doc.add(1); + doc.add(2); + + auto v = doc.as(); + REQUIRE(v.size() == 2); + CHECK(v[0] == 1); + CHECK(v[1] == 2); + } + + SECTION("checkJson") { + JsonDocument doc; + CHECK(doc.is() == false); + + doc.add(1); + CHECK(doc.is() == false); + + doc.add(2); + CHECK(doc.is() == true); + + doc[0] = "foo"; + CHECK(doc.is() == false); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/subscript.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/subscript.cpp new file mode 100644 index 00000000..0f9509c9 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/subscript.cpp @@ -0,0 +1,159 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Literals.hpp" + +TEST_CASE("JsonVariant::operator[]") { + JsonDocument doc; + JsonVariant var = doc.to(); + + SECTION("The JsonVariant is null") { + REQUIRE(0 == var.size()); + REQUIRE(var["0"].isNull()); + REQUIRE(var[0].isNull()); + } + + SECTION("The JsonVariant is a string") { + var.set("hello world"); + REQUIRE(0 == var.size()); + REQUIRE(var["0"].isNull()); + REQUIRE(var[0].isNull()); + } + + SECTION("The JsonVariant is a JsonArray") { + JsonArray array = var.to(); + + SECTION("get value") { + array.add("element at index 0"); + array.add("element at index 1"); + + REQUIRE(2 == var.size()); + var[0].as(); + // REQUIRE("element at index 0"_s == ); + REQUIRE("element at index 1"_s == var[1]); + REQUIRE("element at index 0"_s == + var[static_cast(0)]); // issue #381 + REQUIRE(var[666].isNull()); + REQUIRE(var[3].isNull()); + REQUIRE(var["0"].isNull()); + } + + SECTION("set value") { + array.add("hello"); + + var[1] = "world"; + + REQUIRE(var.size() == 2); + REQUIRE("world"_s == var[1]); + } + + SECTION("set value in a nested object") { + array.add(); + + var[0]["hello"] = "world"; + + REQUIRE(1 == var.size()); + REQUIRE(1 == var[0].size()); + REQUIRE("world"_s == var[0]["hello"]); + } + + SECTION("variant[0] when variant contains an integer") { + var.set(123); + + var[0] = 345; // no-op + + REQUIRE(var.is()); + REQUIRE(var.as() == 123); + } + + SECTION("use JsonVariant as index") { + array.add("A"); + array.add("B"); + array.add(1); + + REQUIRE(var[var[2]] == "B"); + REQUIRE(var[var[3]].isNull()); + } + } + + SECTION("The JsonVariant is a JsonObject") { + JsonObject object = var.to(); + + SECTION("get value") { + object["a"] = "element at key \"a\""; + object["b"] = "element at key \"b\""; + + REQUIRE(2 == var.size()); + REQUIRE("element at key \"a\""_s == var["a"]); + REQUIRE("element at key \"b\""_s == var["b"]); + REQUIRE(var["c"].isNull()); + REQUIRE(var[0].isNull()); + } + + SECTION("set value, key is a const char*") { + var["hello"] = "world"; + + REQUIRE(1 == var.size()); + REQUIRE("world"_s == var["hello"]); + } + + SECTION("set value, key is a char[]") { + char key[] = "hello"; + var[key] = "world"; + key[0] = '!'; // make sure the key is duplicated + + REQUIRE(1 == var.size()); + REQUIRE("world"_s == var["hello"]); + } + + SECTION("var[key].to()") { + JsonArray arr = var["hello"].to(); + REQUIRE(arr.isNull() == false); + } + + SECTION("use JsonVariant as key") { + object["a"] = "A"; + object["ab"] = "AB"; + object["ab\0c"_s] = "ABC"; + object["key1"] = "a"; + object["key2"] = "ab"; + object["key3"] = "ab\0c"_s; + object["key4"] = "foo"; + + REQUIRE(var[var["key1"]] == "A"); + REQUIRE(var[var["key2"]] == "AB"); + REQUIRE(var[var["key3"]] == "ABC"); + REQUIRE(var[var["key4"]].isNull()); + REQUIRE(var[var["key5"]].isNull()); + } + } + +#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \ + !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR) + SECTION("key is a VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + deserializeJson(doc, "{\"hello\":\"world\"}"); + JsonVariant variant = doc.as(); + + REQUIRE("world"_s == variant[vla]); + } + + SECTION("key is a VLA, const JsonVariant") { + size_t i = 16; + char vla[i]; + strcpy(vla, "hello"); + + deserializeJson(doc, "{\"hello\":\"world\"}"); + const JsonVariant variant = doc.as(); + + REQUIRE("world"_s == variant[vla]); + } +#endif +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/types.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/types.cpp new file mode 100644 index 00000000..26a6265e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/types.cpp @@ -0,0 +1,168 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +template +void checkReference(T& expected) { + JsonVariant variant = expected; + REQUIRE(expected == variant.as()); +} + +template +void checkNumericType() { + JsonDocument docMin, docMax; + JsonVariant variantMin = docMin.to(); + JsonVariant variantMax = docMax.to(); + + T min = std::numeric_limits::min(); + T max = std::numeric_limits::max(); + + variantMin.set(min); + variantMax.set(max); + + REQUIRE(min == variantMin.as()); + REQUIRE(max == variantMax.as()); +} + +TEST_CASE("JsonVariant set()/get()") { + SpyingAllocator spy; + JsonDocument doc(&spy); + JsonVariant variant = doc.to(); + +#if ARDUINOJSON_USE_LONG_LONG + SECTION("SizeOfJsonInteger") { + REQUIRE(8 == sizeof(JsonInteger)); + } +#endif + + // /!\ Most test were moved to `JsonVariant/set.cpp` + // TODO: move the remaining tests too + + SECTION("False") { + variant.set(false); + REQUIRE(variant.as() == false); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("True") { + variant.set(true); + REQUIRE(variant.as() == true); + REQUIRE(spy.log() == AllocatorLog{}); + } + + SECTION("Double") { + checkNumericType(); + } + SECTION("Float") { + checkNumericType(); + } + SECTION("SChar") { + checkNumericType(); + } + SECTION("SInt") { + checkNumericType(); + } + SECTION("SLong") { + checkNumericType(); + } + SECTION("SShort") { + checkNumericType(); + } + SECTION("UChar") { + checkNumericType(); + } + SECTION("UInt") { + checkNumericType(); + } + SECTION("ULong") { + checkNumericType(); + } + SECTION("UShort") { + checkNumericType(); + } +#if ARDUINOJSON_USE_LONG_LONG + SECTION("LongLong") { + checkNumericType(); + } + SECTION("ULongLong") { + checkNumericType(); + } +#endif + + SECTION("Int8") { + checkNumericType(); + } + SECTION("Uint8") { + checkNumericType(); + } + SECTION("Int16") { + checkNumericType(); + } + SECTION("Uint16") { + checkNumericType(); + } + SECTION("Int32") { + checkNumericType(); + } + SECTION("Uint32") { + checkNumericType(); + } +#if ARDUINOJSON_USE_LONG_LONG + SECTION("Int64") { + checkNumericType(); + } + SECTION("Uint64") { + checkNumericType(); + } +#endif + + SECTION("CanStoreObject") { + JsonDocument doc2; + JsonObject object = doc2.to(); + + variant.set(object); + REQUIRE(variant.is()); + REQUIRE(variant.as() == object); + } +} + +TEST_CASE("volatile") { + JsonDocument doc; + JsonVariant variant = doc.to(); + + SECTION("volatile bool") { // issue #2029 + volatile bool f = true; + variant.set(f); + CHECK(variant.is() == true); + CHECK(variant.as() == true); + } + + SECTION("volatile int") { + volatile int f = 42; + variant.set(f); + CHECK(variant.is() == true); + CHECK(variant.as() == 42); + } + + SECTION("volatile float") { // issue #1557 + volatile float f = 3.14f; + variant.set(f); + CHECK(variant.is() == true); + CHECK(variant.as() == 3.14f); + } + + SECTION("volatile double") { + volatile double f = 3.14; + variant.set(f); + CHECK(variant.is() == true); + CHECK(variant.as() == 3.14); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/unbound.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/unbound.cpp new file mode 100644 index 00000000..a19a8c41 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariant/unbound.cpp @@ -0,0 +1,80 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Literals.hpp" + +TEST_CASE("Unbound JsonVariant") { + JsonVariant variant; + + SECTION("as()") { + CHECK(variant.as() == false); + CHECK(variant.as() == 0); + CHECK(variant.as() == 0.0f); + CHECK(variant.as() == 0); + CHECK(variant.as() == "null"); + CHECK(variant.as().isNull()); + CHECK(variant.as().isNull()); + CHECK(variant.as().isNull()); + CHECK(variant.as().isNull()); + CHECK(variant.as().isNull()); + CHECK(variant.as().isNull()); + CHECK(variant.as().isNull()); + CHECK(variant.as().data() == nullptr); + CHECK(variant.as().size() == 0); + CHECK(variant.as().data() == nullptr); + CHECK(variant.as().size() == 0); + } + + SECTION("is()") { + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + CHECK_FALSE(variant.is()); + } + + SECTION("set()") { + CHECK_FALSE(variant.set("42")); + CHECK_FALSE(variant.set(42.0)); + CHECK_FALSE(variant.set(42L)); + CHECK_FALSE(variant.set(42U)); + CHECK_FALSE(variant.set(serialized("42"))); + CHECK_FALSE(variant.set(serialized("42"_s))); + CHECK_FALSE(variant.set(true)); + CHECK_FALSE(variant.set(MsgPackBinary("hello", 5))); + CHECK_FALSE(variant.set(MsgPackExtension(1, "hello", 5))); + } + + SECTION("add()") { + CHECK_FALSE(variant.add("42")); + CHECK_FALSE(variant.add(42.0)); + CHECK_FALSE(variant.add(42L)); + CHECK_FALSE(variant.add(42U)); + CHECK_FALSE(variant.add(serialized("42"))); + CHECK_FALSE(variant.add(true)); + } + + SECTION("operator[]") { + CHECK(variant[0].isNull()); + CHECK(variant["key"].isNull()); + CHECK_FALSE(variant[0].set(1)); + CHECK_FALSE(variant["key"].set(1)); + CHECK_FALSE(variant["key"_s].set(1)); + } + + SECTION("remove()") { + variant.remove(0); + variant.remove("hello"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/CMakeLists.txt new file mode 100644 index 00000000..1cff558c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/CMakeLists.txt @@ -0,0 +1,19 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(JsonVariantConstTests + as.cpp + is.cpp + isnull.cpp + nesting.cpp + size.cpp + subscript.cpp +) + +add_test(JsonVariantConst JsonVariantConstTests) + +set_tests_properties(JsonVariantConst + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/as.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/as.cpp new file mode 100644 index 00000000..8584ff5f --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/as.cpp @@ -0,0 +1,42 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Literals.hpp" + +TEST_CASE("JsonVariantConst::as()") { + JsonDocument doc; + JsonVariantConst var = doc.to(); + + doc.set("hello"); + + REQUIRE(var.as() == true); + REQUIRE(var.as() == 0L); + REQUIRE(var.as() == "hello"_s); + REQUIRE(var.as() == "hello"_s); +} + +TEST_CASE("Invalid conversions") { + using namespace ArduinoJson::detail; + + JsonVariantConst variant; + + CHECK(is_same()), int>::value); + CHECK(is_same()), float>::value); + CHECK(is_same()), + JsonVariantConst>::value); + CHECK( + is_same()), JsonObjectConst>::value); + CHECK(is_same()), JsonArrayConst>::value); + + CHECK(is_same()), + InvalidConversion>::value); + CHECK(is_same()), + InvalidConversion>::value); + CHECK(is_same()), + InvalidConversion>::value); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/is.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/is.cpp new file mode 100644 index 00000000..32c16ac5 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/is.cpp @@ -0,0 +1,162 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +enum MYENUM2 { ONE = 1, TWO = 2 }; + +TEST_CASE("JsonVariantConst::is()") { + JsonDocument doc; + JsonVariantConst var = doc.to(); + + SECTION("unbound") { + var = JsonVariantConst(); + + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + } + + SECTION("null") { + CHECK(var.is() == true); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + } + + SECTION("true") { + doc.set(true); + + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + } + + SECTION("false") { + doc.set(false); + + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + } + + SECTION("int") { + doc.set(42); + + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + } + + SECTION("double") { + doc.set(4.2); + + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + } + + SECTION("const char*") { + doc.set("4.2"); + + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + } + + SECTION("JsonArray") { + doc.to(); + + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + } + + SECTION("JsonObject") { + doc.to(); + + CHECK(var.is() == true); + CHECK(var.is() == true); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + CHECK(var.is() == false); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/isnull.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/isnull.cpp new file mode 100644 index 00000000..30996db1 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/isnull.cpp @@ -0,0 +1,21 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonVariantConst::isNull()") { + JsonDocument doc; + JsonVariantConst variant = doc.to(); + + SECTION("returns true when undefined") { + REQUIRE(variant.isNull() == true); + } + + SECTION("returns false if value is integer") { + doc.set(42); + + REQUIRE(variant.isNull() == false); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/nesting.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/nesting.cpp new file mode 100644 index 00000000..4f035db1 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/nesting.cpp @@ -0,0 +1,31 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonVariantConst::nesting()") { + JsonDocument doc; + JsonVariantConst var = doc.to(); + + SECTION("return 0 if unbound") { + JsonVariantConst unbound; + REQUIRE(unbound.nesting() == 0); + } + + SECTION("returns 0 for string") { + doc.set("hello"); + REQUIRE(var.nesting() == 0); + } + + SECTION("returns 1 for empty object") { + doc.to(); + REQUIRE(var.nesting() == 1); + } + + SECTION("returns 1 for empty array") { + doc.to(); + REQUIRE(var.nesting() == 1); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/size.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/size.cpp new file mode 100644 index 00000000..9a6943e3 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/size.cpp @@ -0,0 +1,36 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("JsonVariantConst::size()") { + JsonDocument doc; + JsonVariantConst variant = doc.to(); + + SECTION("unbound reference") { + JsonVariantConst unbound; + + CHECK(unbound.size() == 0); + } + + SECTION("int") { + doc.set(42); + + CHECK(variant.size() == 0); + } + + SECTION("string") { + doc.set("hello"); + + CHECK(variant.size() == 0); + } + + SECTION("object") { + doc["a"] = 1; + doc["b"] = 2; + + CHECK(variant.size() == 2); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/subscript.cpp b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/subscript.cpp new file mode 100644 index 00000000..281e3d95 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/JsonVariantConst/subscript.cpp @@ -0,0 +1,104 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Literals.hpp" + +TEST_CASE("JsonVariantConst::operator[]") { + JsonDocument doc; + JsonVariantConst var = doc.to(); + + SECTION("null") { + REQUIRE(0 == var.size()); + REQUIRE(var["0"].isNull()); + REQUIRE(var[0].isNull()); + } + + SECTION("string") { + doc.set("hello world"); + REQUIRE(0 == var.size()); + REQUIRE(var["0"].isNull()); + REQUIRE(var[0].isNull()); + } + + SECTION("array") { + JsonArray array = doc.to(); + array.add("A"); + array.add("B"); + + SECTION("int") { + REQUIRE("A"_s == var[0]); + REQUIRE("B"_s == var[1]); + REQUIRE("A"_s == var[static_cast(0)]); // issue #381 + REQUIRE(var[666].isNull()); + REQUIRE(var[3].isNull()); + } + + SECTION("const char*") { + REQUIRE(var["0"].isNull()); + } + + SECTION("JsonVariant") { + array.add(1); + REQUIRE(var[var[2]] == "B"_s); + REQUIRE(var[var[3]].isNull()); + } + } + + SECTION("object") { + JsonObject object = doc.to(); + object["ab"_s] = "AB"; + object["abc"_s] = "ABC"; + object["abc\0d"_s] = "ABCD"; + + SECTION("string literal") { + REQUIRE(var["ab"] == "AB"_s); + REQUIRE(var["abc"] == "ABC"_s); + REQUIRE(var["abc\0d"] == "ABCD"_s); + REQUIRE(var["def"].isNull()); + REQUIRE(var[0].isNull()); + } + + SECTION("const char*") { + REQUIRE(var[static_cast("ab")] == "AB"_s); + REQUIRE(var[static_cast("abc")] == "ABC"_s); + REQUIRE(var[static_cast("abc\0d")] == "ABC"_s); + REQUIRE(var[static_cast("def")].isNull()); + REQUIRE(var[static_cast(0)].isNull()); + } + + SECTION("supports std::string") { + REQUIRE(var["ab"_s] == "AB"_s); + REQUIRE(var["abc"_s] == "ABC"_s); + REQUIRE(var["abc\0d"_s] == "ABCD"_s); + REQUIRE(var["def"_s].isNull()); + } + +#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \ + !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR) + SECTION("supports VLA") { + size_t i = 16; + char vla[i]; + strcpy(vla, "abc"); + + REQUIRE(var[vla] == "ABC"_s); + } +#endif + + SECTION("supports JsonVariant") { + object["key1"] = "ab"; + object["key2"] = "abc"; + object["key3"] = "abc\0d"_s; + object["key4"] = "foo"; + + REQUIRE(var[var["key1"]] == "AB"_s); + REQUIRE(var[var["key2"]] == "ABC"_s); + REQUIRE(var[var["key3"]] == "ABCD"_s); + REQUIRE(var[var["key4"]].isNull()); + REQUIRE(var[var["key5"]].isNull()); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/Misc/CMakeLists.txt new file mode 100644 index 00000000..4edd2ba5 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/CMakeLists.txt @@ -0,0 +1,30 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(MiscTests + arithmeticCompare.cpp + conflicts.cpp + issue1967.cpp + issue2129.cpp + JsonString.cpp + NoArduinoHeader.cpp + printable.cpp + Readers.cpp + StringAdapters.cpp + StringWriter.cpp + TypeTraits.cpp + unsigned_char.cpp + Utf16.cpp + Utf8.cpp + version.cpp +) + +set_target_properties(MiscTests PROPERTIES UNITY_BUILD OFF) + +add_test(Misc MiscTests) + +set_tests_properties(Misc + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/JsonString.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/JsonString.cpp new file mode 100644 index 00000000..a66f7710 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/JsonString.cpp @@ -0,0 +1,103 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +TEST_CASE("JsonString") { + SECTION("Default constructor creates a null JsonString") { + JsonString s; + + CHECK(s.isNull() == true); + CHECK(s.c_str() == 0); + CHECK(s.isStatic() == true); + CHECK(s == JsonString()); + CHECK(s != ""); + } + + SECTION("Null converts to false") { + JsonString s; + + CHECK(bool(s) == false); + } + + SECTION("Empty string converts to true") { + JsonString s(""); + + CHECK(bool(s) == true); + } + + SECTION("Non-empty string converts to true") { + JsonString s(""); + + CHECK(bool(s) == true); + } + + SECTION("Null strings equals each others") { + JsonString a, b; + + CHECK(a == b); + CHECK_FALSE(a != b); + } + + SECTION("Null and empty strings differ") { + JsonString a, b(""); + + CHECK_FALSE(a == b); + CHECK(a != b); + + CHECK_FALSE(b == a); + CHECK(b != a); + } + + SECTION("Null and non-empty strings differ") { + JsonString a, b("hello"); + + CHECK_FALSE(a == b); + CHECK(a != b); + + CHECK_FALSE(b == a); + CHECK(b != a); + } + + SECTION("Compare different strings") { + JsonString a("hello"), b("world"); + + CHECK_FALSE(a == b); + CHECK(a != b); + } + + SECTION("Compare identical by pointer") { + JsonString a("hello"), b("hello"); + + CHECK(a == b); + CHECK_FALSE(a != b); + } + + SECTION("Compare identical by value") { + char s1[] = "hello"; + char s2[] = "hello"; + JsonString a(s1), b(s2); + + CHECK(a == b); + CHECK_FALSE(a != b); + } + + SECTION("std::stream") { + std::stringstream ss; + ss << JsonString("hello world!"); + CHECK(ss.str() == "hello world!"); + } + + SECTION("Construct with a size") { + JsonString s("hello world", 5); + + CHECK(s.size() == 5); + CHECK(s.isStatic() == false); + CHECK(s == "hello"); + CHECK(s != "hello world"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/NoArduinoHeader.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/NoArduinoHeader.cpp new file mode 100644 index 00000000..efcd8e45 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/NoArduinoHeader.cpp @@ -0,0 +1,20 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINO 1 +#define ARDUINOJSON_ENABLE_PROGMEM 0 +#define ARDUINOJSON_ENABLE_ARDUINO_STRING 0 +#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0 +#define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0 +#include + +#include + +TEST_CASE("Arduino.h") { +#ifdef ARDUINO_H_INCLUDED + FAIL("Arduino.h should not be included"); +#else + INFO("Arduino.h not included"); +#endif +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/Readers.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/Readers.cpp new file mode 100644 index 00000000..40772430 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/Readers.cpp @@ -0,0 +1,227 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include + +using namespace ArduinoJson::detail; + +TEST_CASE("Reader") { + SECTION("read()") { + std::istringstream src("\x01\xFF"); + Reader reader(src); + + REQUIRE(reader.read() == 0x01); + REQUIRE(reader.read() == 0xFF); + REQUIRE(reader.read() == -1); + } + + SECTION("readBytes() all at once") { + std::istringstream src("ABC"); + Reader reader(src); + + char buffer[8] = "abcd"; + REQUIRE(reader.readBytes(buffer, 4) == 3); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'd'); + } + + SECTION("readBytes() in two parts") { + std::istringstream src("ABCDEF"); + Reader reader(src); + + char buffer[12] = "abcdefg"; + REQUIRE(reader.readBytes(buffer, 4) == 4); + REQUIRE(reader.readBytes(buffer + 4, 4) == 2); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'D'); + REQUIRE(buffer[4] == 'E'); + REQUIRE(buffer[5] == 'F'); + REQUIRE(buffer[6] == 'g'); + } +} + +TEST_CASE("BoundedReader") { + SECTION("read") { + BoundedReader reader("\x01\xFF", 2); + REQUIRE(reader.read() == 0x01); + REQUIRE(reader.read() == 0xFF); + REQUIRE(reader.read() == -1); + REQUIRE(reader.read() == -1); + } + + SECTION("readBytes() all at once") { + BoundedReader reader("ABCD", 3); + + char buffer[8] = "abcd"; + REQUIRE(reader.readBytes(buffer, 4) == 3); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'd'); + } + + SECTION("readBytes() in two parts") { + BoundedReader reader("ABCDEF", 6); + + char buffer[8] = "abcdefg"; + REQUIRE(reader.readBytes(buffer, 4) == 4); + REQUIRE(reader.readBytes(buffer + 4, 4) == 2); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'D'); + REQUIRE(buffer[4] == 'E'); + REQUIRE(buffer[5] == 'F'); + REQUIRE(buffer[6] == 'g'); + } +} + +TEST_CASE("Reader") { + SECTION("read()") { + Reader reader("\x01\xFF\x00\x12"); + REQUIRE(reader.read() == 0x01); + REQUIRE(reader.read() == 0xFF); + REQUIRE(reader.read() == 0); + REQUIRE(reader.read() == 0x12); + } + + SECTION("readBytes() all at once") { + Reader reader("ABCD"); + + char buffer[8] = "abcd"; + REQUIRE(reader.readBytes(buffer, 3) == 3); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'd'); + } + + SECTION("readBytes() in two parts") { + Reader reader("ABCDEF"); + + char buffer[8] = "abcdefg"; + REQUIRE(reader.readBytes(buffer, 4) == 4); + REQUIRE(reader.readBytes(buffer + 4, 2) == 2); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'D'); + REQUIRE(buffer[4] == 'E'); + REQUIRE(buffer[5] == 'F'); + REQUIRE(buffer[6] == 'g'); + } +} + +TEST_CASE("IteratorReader") { + SECTION("read()") { + std::string src("\x01\xFF"); + IteratorReader reader(src.begin(), src.end()); + + REQUIRE(reader.read() == 0x01); + REQUIRE(reader.read() == 0xFF); + REQUIRE(reader.read() == -1); + } + + SECTION("readBytes() all at once") { + std::string src("ABC"); + IteratorReader reader(src.begin(), src.end()); + + char buffer[8] = "abcd"; + REQUIRE(reader.readBytes(buffer, 4) == 3); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'd'); + } + + SECTION("readBytes() in two parts") { + std::string src("ABCDEF"); + IteratorReader reader(src.begin(), src.end()); + + char buffer[12] = "abcdefg"; + REQUIRE(reader.readBytes(buffer, 4) == 4); + REQUIRE(reader.readBytes(buffer + 4, 4) == 2); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'D'); + REQUIRE(buffer[4] == 'E'); + REQUIRE(buffer[5] == 'F'); + REQUIRE(buffer[6] == 'g'); + } +} + +class StreamStub : public Stream { + public: + StreamStub(const char* s) : stream_(s) {} + + int read() { + return stream_.get(); + } + + size_t readBytes(char* buffer, size_t length) { + stream_.read(buffer, static_cast(length)); + return static_cast(stream_.gcount()); + } + + private: + std::istringstream stream_; +}; + +TEST_CASE("Reader") { + SECTION("read()") { + StreamStub src("\x01\xFF"); + Reader reader(src); + + REQUIRE(reader.read() == 0x01); + REQUIRE(reader.read() == 0xFF); + REQUIRE(reader.read() == -1); + } + + SECTION("readBytes() all at once") { + StreamStub src("ABC"); + Reader reader(src); + + char buffer[8] = "abcd"; + REQUIRE(reader.readBytes(buffer, 4) == 3); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'd'); + } + + SECTION("readBytes() in two parts") { + StreamStub src("ABCDEF"); + Reader reader(src); + + char buffer[12] = "abcdefg"; + REQUIRE(reader.readBytes(buffer, 4) == 4); + REQUIRE(reader.readBytes(buffer + 4, 4) == 2); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'D'); + REQUIRE(buffer[4] == 'E'); + REQUIRE(buffer[5] == 'F'); + REQUIRE(buffer[6] == 'g'); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/StringAdapters.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/StringAdapters.cpp new file mode 100644 index 00000000..c2ebf1fd --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/StringAdapters.cpp @@ -0,0 +1,225 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +#include +#include +#include + +#include + +#include "custom_string.hpp" +#include "weird_strcmp.hpp" + +using ArduinoJson::JsonString; +using namespace ArduinoJson::detail; + +TEST_CASE("adaptString()") { + SECTION("string literal") { + auto s = adaptString("bravo\0alpha"); + + CHECK(s.isNull() == false); + CHECK(s.size() == 11); + CHECK(s.isStatic() == true); + } + + SECTION("null const char*") { + auto s = adaptString(static_cast(0)); + + CHECK(s.isNull() == true); + CHECK(s.size() == 0); + } + + SECTION("non-null const char*") { + const char* p = "bravo"; + auto s = adaptString(p); + + CHECK(s.isNull() == false); + CHECK(s.size() == 5); + CHECK(s.isStatic() == false); + CHECK(s.data() == p); + } + + SECTION("null const char* + size") { + auto s = adaptString(static_cast(0), 10); + + CHECK(s.isNull() == true); + CHECK(s.isStatic() == false); + } + + SECTION("non-null const char* + size") { + auto s = adaptString("bravo", 5); + + CHECK(s.isNull() == false); + CHECK(s.size() == 5); + CHECK(s.isStatic() == false); + } + + SECTION("null Flash string") { + auto s = adaptString(static_cast(0)); + + CHECK(s.isNull() == true); + CHECK(s.size() == 0); + CHECK(s.isStatic() == false); + } + + SECTION("non-null Flash string") { + auto s = adaptString(F("bravo")); + + CHECK(s.isNull() == false); + CHECK(s.size() == 5); + CHECK(s.isStatic() == false); + } + + SECTION("std::string") { + std::string orig("bravo"); + auto s = adaptString(orig); + + CHECK(s.isNull() == false); + CHECK(s.size() == 5); + CHECK(s.isStatic() == false); + } + + SECTION("Arduino String") { + ::String orig("bravo"); + auto s = adaptString(orig); + + CHECK(s.isNull() == false); + CHECK(s.size() == 5); + CHECK(s.isStatic() == false); + } + + SECTION("custom_string") { + custom_string orig("bravo"); + auto s = adaptString(orig); + + CHECK(s.isNull() == false); + CHECK(s.size() == 5); + CHECK(s.isStatic() == false); + } + + SECTION("JsonString linked") { + JsonString orig("hello", true); + auto s = adaptString(orig); + + CHECK(s.isNull() == false); + CHECK(s.size() == 5); + CHECK(s.isStatic() == true); + } + + SECTION("JsonString copied") { + JsonString orig("hello", false); + auto s = adaptString(orig); + + CHECK(s.isNull() == false); + CHECK(s.size() == 5); + CHECK(s.isStatic() == false); + } +} + +struct EmptyStruct {}; + +TEST_CASE("IsString") { + CHECK(IsString::value == true); + CHECK(IsString>::value == false); + CHECK(IsString::value == true); + CHECK(IsString::value == true); + CHECK(IsString::value == true); + CHECK(IsString::value == true); + CHECK(IsString<::String>::value == true); + CHECK(IsString<::StringSumHelper>::value == true); + CHECK(IsString::value == false); + CHECK(IsString::value == true); +} + +TEST_CASE("stringCompare") { + SECTION("ZeroTerminatedRamString vs ZeroTerminatedRamString") { + CHECK(stringCompare(adaptString("bravo"), adaptString("alpha")) > 0); + CHECK(stringCompare(adaptString("bravo"), adaptString("bravo")) == 0); + CHECK(stringCompare(adaptString("bravo"), adaptString("charlie")) < 0); + } + + SECTION("ZeroTerminatedRamString vs SizedRamString") { + CHECK(stringCompare(adaptString("bravo"), adaptString("alpha?", 5)) > 0); + CHECK(stringCompare(adaptString("bravo"), adaptString("bravo?", 4)) > 0); + CHECK(stringCompare(adaptString("bravo"), adaptString("bravo?", 5)) == 0); + CHECK(stringCompare(adaptString("bravo"), adaptString("bravo?", 6)) < 0); + CHECK(stringCompare(adaptString("bravo"), adaptString("charlie?", 7)) < 0); + } + + SECTION("SizedRamString vs SizedRamString") { + // clang-format off + CHECK(stringCompare(adaptString("bravo!", 5), adaptString("alpha?", 5)) > 0); + CHECK(stringCompare(adaptString("bravo!", 5), adaptString("bravo?", 5)) == 0); + CHECK(stringCompare(adaptString("bravo!", 5), adaptString("charlie?", 7)) < 0); + + CHECK(stringCompare(adaptString("bravo!", 5), adaptString("bravo!", 4)) > 0); + CHECK(stringCompare(adaptString("bravo!", 5), adaptString("bravo!", 5)) == 0); + CHECK(stringCompare(adaptString("bravo!", 5), adaptString("bravo!", 6)) < 0); + // clang-format on + } + + SECTION("FlashString vs FlashString") { + // clang-format off + CHECK(stringCompare(adaptString(F("bravo")), adaptString(F("alpha"))) > 0); + CHECK(stringCompare(adaptString(F("bravo")), adaptString(F("bravo"))) == 0); + CHECK(stringCompare(adaptString(F("bravo")), adaptString(F("charlie"))) < 0); + // clang-format on + } + + SECTION("FlashString vs SizedRamString") { + // clang-format off + CHECK(stringCompare(adaptString(F("bravo")), adaptString("alpha?", 5)) > 0); + CHECK(stringCompare(adaptString(F("bravo")), adaptString("bravo?", 5)) == 0); + CHECK(stringCompare(adaptString(F("bravo")), adaptString("charlie?", 7)) < 0); + + CHECK(stringCompare(adaptString(F("bravo")), adaptString("bravo!", 4)) > 0); + CHECK(stringCompare(adaptString(F("bravo")), adaptString("bravo!", 5)) == 0); + CHECK(stringCompare(adaptString(F("bravo")), adaptString("bravo!", 6)) < 0); + // clang-format on + } + + SECTION("ZeroTerminatedRamString vs FlashString") { + // clang-format off + CHECK(stringCompare(adaptString("bravo"), adaptString(F("alpha?"), 5)) > 0); + CHECK(stringCompare(adaptString("bravo"), adaptString(F("bravo?"), 4)) > 0); + CHECK(stringCompare(adaptString("bravo"), adaptString(F("bravo?"), 5)) == 0); + CHECK(stringCompare(adaptString("bravo"), adaptString(F("bravo?"), 6)) < 0); + CHECK(stringCompare(adaptString("bravo"), adaptString(F("charlie?"), 7)) < 0); + // clang-format on + } +} + +TEST_CASE("stringEquals()") { + SECTION("ZeroTerminatedRamString vs ZeroTerminatedRamString") { + CHECK(stringEquals(adaptString("bravo"), adaptString("brav")) == false); + CHECK(stringEquals(adaptString("bravo"), adaptString("bravo")) == true); + CHECK(stringEquals(adaptString("bravo"), adaptString("bravo!")) == false); + } + + SECTION("ZeroTerminatedRamString vs SizedRamString") { + // clang-format off + CHECK(stringEquals(adaptString("bravo"), adaptString("bravo!", 4)) == false); + CHECK(stringEquals(adaptString("bravo"), adaptString("bravo!", 5)) == true); + CHECK(stringEquals(adaptString("bravo"), adaptString("bravo!", 6)) == false); + // clang-format on + } + + SECTION("FlashString vs SizedRamString") { + // clang-format off + CHECK(stringEquals(adaptString(F("bravo")), adaptString("bravo!", 4)) == false); + CHECK(stringEquals(adaptString(F("bravo")), adaptString("bravo!", 5)) == true); + CHECK(stringEquals(adaptString(F("bravo")), adaptString("bravo!", 6)) == false); + // clang-format on + } + + SECTION("SizedRamString vs SizedRamString") { + // clang-format off + CHECK(stringEquals(adaptString("bravo?", 5), adaptString("bravo!", 4)) == false); + CHECK(stringEquals(adaptString("bravo?", 5), adaptString("bravo!", 5)) == true); + CHECK(stringEquals(adaptString("bravo?", 5), adaptString("bravo!", 6)) == false); + // clang-format on + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/StringWriter.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/StringWriter.cpp new file mode 100644 index 00000000..6c22720b --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/StringWriter.cpp @@ -0,0 +1,157 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +#define ARDUINOJSON_STRING_BUFFER_SIZE 5 +#include + +#include + +#include "Literals.hpp" +#include "custom_string.hpp" + +using namespace ArduinoJson::detail; + +template +static size_t print(StringWriter& writer, const char* s) { + return writer.write(reinterpret_cast(s), strlen(s)); +} + +template +static size_t print(StringWriter& writer, char c) { + return writer.write(static_cast(c)); +} + +template +void common_tests(StringWriter& writer, const String& output) { + SECTION("InitialState") { + REQUIRE(std::string("") == output); + } + + SECTION("EmptyString") { + REQUIRE(0 == print(writer, "")); + REQUIRE(std::string("") == output); + } + + SECTION("OneString") { + REQUIRE(4 == print(writer, "ABCD")); + REQUIRE("ABCD"_s == output); + } + + SECTION("TwoStrings") { + REQUIRE(4 == print(writer, "ABCD")); + REQUIRE(4 == print(writer, "EFGH")); + REQUIRE("ABCDEFGH"_s == output); + } +} + +TEST_CASE("StaticStringWriter") { + char output[20] = {0}; + StaticStringWriter writer(output, sizeof(output)); + + common_tests(writer, static_cast(output)); + + SECTION("OverCapacity") { + REQUIRE(20 == print(writer, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")); + REQUIRE(0 == print(writer, "ABC")); + REQUIRE(0 == print(writer, 'D')); + REQUIRE("ABCDEFGHIJKLMNOPQRST" == std::string(output, 20)); + } +} + +TEST_CASE("Writer") { + std::string output; + Writer writer(output); + common_tests(writer, output); +} + +TEST_CASE("Writer") { + ::String output; + Writer<::String> writer(output); + + SECTION("write(char)") { + SECTION("writes to temporary buffer") { + // accumulate in buffer + writer.write('a'); + writer.write('b'); + writer.write('c'); + writer.write('d'); + REQUIRE(output == ""); + + // flush when full + writer.write('e'); + REQUIRE(output == "abcd"); + + // flush on destruction + writer.write('f'); + writer.~Writer(); + REQUIRE(output == "abcdef"); + } + + SECTION("returns 1 on success") { + for (int i = 0; i < ARDUINOJSON_STRING_BUFFER_SIZE; i++) { + REQUIRE(writer.write('x') == 1); + } + } + + SECTION("returns 0 on error") { + output.limitCapacityTo(1); + + REQUIRE(writer.write('a') == 1); + REQUIRE(writer.write('b') == 1); + REQUIRE(writer.write('c') == 1); + REQUIRE(writer.write('d') == 1); + REQUIRE(writer.write('e') == 0); + REQUIRE(writer.write('f') == 0); + } + } + + SECTION("write(char*, size_t)") { + SECTION("empty string") { + REQUIRE(0 == print(writer, "")); + writer.flush(); + REQUIRE(output == ""); + } + + SECTION("writes to temporary buffer") { + // accumulate in buffer + print(writer, "abc"); + REQUIRE(output == ""); + + // flush when full, and continue to accumulate + print(writer, "de"); + REQUIRE(output == "abcd"); + + // flush on destruction + writer.~Writer(); + REQUIRE(output == "abcde"); + } + } +} + +TEST_CASE("Writer") { + custom_string output; + Writer writer(output); + + REQUIRE(4 == print(writer, "ABCD")); + REQUIRE("ABCD" == output); +} + +TEST_CASE("serializeJson(doc, String)") { + JsonDocument doc; + doc["hello"] = "world"; + ::String output = "erase me"; + + SECTION("sufficient capacity") { + serializeJson(doc, output); + REQUIRE(output == "{\"hello\":\"world\"}"); + } + + SECTION("unsufficient capacity") { // issue #1561 + output.limitCapacityTo(10); + serializeJson(doc, output); + REQUIRE(output == "{\"hello\""); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/TypeTraits.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/TypeTraits.cpp new file mode 100644 index 00000000..4fad7992 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/TypeTraits.cpp @@ -0,0 +1,236 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +using namespace ArduinoJson::detail; + +class EmptyClass {}; +enum EmptyEnum {}; + +TEST_CASE("Polyfills/type_traits") { + SECTION("is_base_of") { + REQUIRE_FALSE( + static_cast(is_base_of::value)); + REQUIRE( + static_cast(is_base_of::value)); + } + + SECTION("is_array") { + REQUIRE_FALSE(is_array::value); + REQUIRE(is_array::value); + REQUIRE(is_array::value); + } + + SECTION("is_const") { + CHECK(is_const::value == false); + CHECK(is_const::value == true); + } + + SECTION("is_integral") { + CHECK(is_integral::value == false); + CHECK(is_integral::value == false); + CHECK(is_integral::value == false); + CHECK(is_integral::value == false); + CHECK(is_integral::value == false); + CHECK(is_integral::value == false); + CHECK(is_integral::value == false); + CHECK(is_integral::value == false); + + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + CHECK(is_integral::value == true); + + CHECK(is_integral::value == true); + } + + SECTION("is_signed") { + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == false); + + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == false); + + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == false); + + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == true); + CHECK(is_signed::value == false); + } + + SECTION("is_unsigned") { + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == false); + CHECK(is_unsigned::value == false); + CHECK(is_unsigned::value == false); + + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == false); + CHECK(is_unsigned::value == false); + CHECK(is_unsigned::value == false); + + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == false); + CHECK(is_unsigned::value == false); + CHECK(is_unsigned::value == false); + + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == true); + CHECK(is_unsigned::value == false); + CHECK(is_unsigned::value == false); + CHECK(is_unsigned::value == false); + } + + SECTION("is_floating_point") { + CHECK(is_floating_point::value == false); + CHECK(is_floating_point::value == true); + CHECK(is_floating_point::value == true); + CHECK(is_floating_point::value == true); + CHECK(is_floating_point::value == true); + CHECK(is_floating_point::value == true); + CHECK(is_floating_point::value == true); + CHECK(is_floating_point::value == true); + CHECK(is_floating_point::value == true); + } + + SECTION("is_convertible") { + CHECK(is_convertible::value == true); + CHECK(is_convertible::value == true); + CHECK(is_convertible::value == true); + CHECK(is_convertible::value == false); + CHECK(is_convertible::value == false); + + CHECK(is_convertible::value == + false); + CHECK(is_convertible::value == false); + CHECK(is_convertible::value == true); + CHECK(is_convertible::value == true); + CHECK(is_convertible::value == true); + CHECK(is_convertible, JsonVariantConst>::value == + true); + CHECK(is_convertible::value == true); + CHECK(is_convertible::value == true); + CHECK(is_convertible, + JsonVariantConst>::value == true); + CHECK(is_convertible::value == true); + CHECK(is_convertible::value == true); + } + + SECTION("is_class") { + CHECK(is_class::value == false); + CHECK(is_class::value == false); + CHECK(is_class::value == false); + CHECK(is_class::value == true); + } + + SECTION("is_enum") { + CHECK(is_enum::value == false); + CHECK(is_enum::value == true); + CHECK(is_enum::value == false); + CHECK(is_enum::value == false); + CHECK(is_enum::value == false); + CHECK(is_enum::value == false); + } + + SECTION("remove_cv") { + CHECK(is_same, int>::value); + CHECK(is_same, int>::value); + CHECK(is_same, int>::value); + CHECK(is_same, int>::value); + CHECK(is_same, decltype("toto")>::value); + } + + SECTION("decay") { + CHECK(is_same, int>::value); + CHECK(is_same, int>::value); + CHECK(is_same, int>::value); + CHECK(is_same, int*>::value); + CHECK(is_same, int*>::value); + CHECK(is_same, const char*>::value); + } +} + +TEST_CASE("is_std_string") { + REQUIRE(is_std_string::value == true); + REQUIRE(is_std_string::value == false); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/Utf16.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/Utf16.cpp new file mode 100644 index 00000000..39fbe3c9 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/Utf16.cpp @@ -0,0 +1,68 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +using namespace ArduinoJson::detail; + +static void testUtf16Codepoint(uint16_t codeunit, uint32_t expectedCodepoint) { + Utf16::Codepoint cp; + REQUIRE(cp.append(codeunit) == true); + REQUIRE(cp.value() == expectedCodepoint); +} + +static void testUtf16Codepoint(uint16_t codeunit1, uint16_t codeunit2, + uint32_t expectedCodepoint) { + Utf16::Codepoint cp; + REQUIRE(cp.append(codeunit1) == false); + REQUIRE(cp.append(codeunit2) == true); + REQUIRE(cp.value() == expectedCodepoint); +} + +TEST_CASE("Utf16::Codepoint()") { + SECTION("U+0000") { + testUtf16Codepoint(0x0000, 0x000000); + } + + SECTION("U+0001") { + testUtf16Codepoint(0x0001, 0x000001); + } + + SECTION("U+D7FF") { + testUtf16Codepoint(0xD7FF, 0x00D7FF); + } + + SECTION("U+E000") { + testUtf16Codepoint(0xE000, 0x00E000); + } + + SECTION("U+FFFF") { + testUtf16Codepoint(0xFFFF, 0x00FFFF); + } + + SECTION("U+010000") { + testUtf16Codepoint(0xD800, 0xDC00, 0x010000); + } + + SECTION("U+010001") { + testUtf16Codepoint(0xD800, 0xDC01, 0x010001); + } + + SECTION("U+0103FF") { + testUtf16Codepoint(0xD800, 0xDFFF, 0x0103FF); + } + + SECTION("U+010400") { + testUtf16Codepoint(0xD801, 0xDC00, 0x010400); + } + + SECTION("U+010400") { + testUtf16Codepoint(0xDBFF, 0xDC00, 0x10FC00); + } + + SECTION("U+10FFFF") { + testUtf16Codepoint(0xDBFF, 0xDFFF, 0x10FFFF); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/Utf8.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/Utf8.cpp new file mode 100644 index 00000000..740046d0 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/Utf8.cpp @@ -0,0 +1,59 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +using namespace ArduinoJson::detail; + +static void testCodepoint(uint32_t codepoint, std::string expected) { + ResourceManager resources; + StringBuilder str(&resources); + str.startString(); + + CAPTURE(codepoint); + Utf8::encodeCodepoint(codepoint, str); + + REQUIRE(str.str().c_str() == expected); +} + +TEST_CASE("Utf8::encodeCodepoint()") { + SECTION("U+0000") { + testCodepoint(0x0000, ""); + } + + SECTION("U+0001") { + testCodepoint(0x0001, "\x01"); + } + + SECTION("U+007F") { + testCodepoint(0x007F, "\x7f"); + } + + SECTION("U+0080") { + testCodepoint(0x0080, "\xc2\x80"); + } + + SECTION("U+07FF") { + testCodepoint(0x07FF, "\xdf\xbf"); + } + + SECTION("U+0800") { + testCodepoint(0x0800, "\xe0\xa0\x80"); + } + + SECTION("U+FFFF") { + testCodepoint(0xFFFF, "\xef\xbf\xbf"); + } + + SECTION("U+10000") { + testCodepoint(0x10000, "\xf0\x90\x80\x80"); + } + + SECTION("U+10FFFF") { + testCodepoint(0x10FFFF, "\xf4\x8f\xbf\xbf"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/arithmeticCompare.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/arithmeticCompare.cpp new file mode 100644 index 00000000..e955194d --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/arithmeticCompare.cpp @@ -0,0 +1,97 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +using namespace ArduinoJson::detail; + +TEST_CASE("arithmeticCompare()") { + SECTION("int vs uint8_t") { + CHECK(arithmeticCompare(256, 1) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompare(41, 42) == COMPARE_RESULT_LESS); + CHECK(arithmeticCompare(42, 42) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(43, 42) == COMPARE_RESULT_GREATER); + } + + SECTION("unsigned vs int") { + CHECK(arithmeticCompare(0, -1) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompare(42, 41) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompare(42, 42) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(42, 43) == COMPARE_RESULT_LESS); + } + + SECTION("float vs int") { + CHECK(arithmeticCompare(42, 41) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompare(42, 42) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(42, 43) == COMPARE_RESULT_LESS); + } + + SECTION("int vs unsigned") { + CHECK(arithmeticCompare(-1, 0) == COMPARE_RESULT_LESS); + CHECK(arithmeticCompare(0, 0) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(1, 0) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompare(42, 41) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompare(42, 42) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(42, 43) == COMPARE_RESULT_LESS); + } + + SECTION("unsigned vs unsigned") { + CHECK(arithmeticCompare(42, 41) == + COMPARE_RESULT_GREATER); + CHECK(arithmeticCompare(42, 42) == + COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(42, 43) == COMPARE_RESULT_LESS); + } + + SECTION("bool vs bool") { + CHECK(arithmeticCompare(false, false) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(true, true) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(false, true) == COMPARE_RESULT_LESS); + CHECK(arithmeticCompare(true, false) == COMPARE_RESULT_GREATER); + } + + SECTION("bool vs int") { + CHECK(arithmeticCompare(false, -1) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompare(false, 0) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(false, 1) == COMPARE_RESULT_LESS); + CHECK(arithmeticCompare(true, 0) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompare(true, 1) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(true, 2) == COMPARE_RESULT_LESS); + } + + SECTION("bool vs int") { + CHECK(arithmeticCompare(0, false) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(1, true) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompare(1, false) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompare(0, true) == COMPARE_RESULT_LESS); + } +} + +TEST_CASE("arithmeticCompareNegateLeft()") { + SECTION("unsigned vs int") { + CHECK(arithmeticCompareNegateLeft(0, 1) == COMPARE_RESULT_LESS); + CHECK(arithmeticCompareNegateLeft(42, -41) == COMPARE_RESULT_LESS); + CHECK(arithmeticCompareNegateLeft(42, -42) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompareNegateLeft(42, -43) == COMPARE_RESULT_GREATER); + } + + SECTION("unsigned vs unsigned") { + CHECK(arithmeticCompareNegateLeft(42, 42) == COMPARE_RESULT_LESS); + } +} + +TEST_CASE("arithmeticCompareNegateRight()") { + SECTION("int vs unsigned") { + CHECK(arithmeticCompareNegateRight(1, 0) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompareNegateRight(-41, 42) == COMPARE_RESULT_GREATER); + CHECK(arithmeticCompareNegateRight(-42, 42) == COMPARE_RESULT_EQUAL); + CHECK(arithmeticCompareNegateRight(-43, 42) == COMPARE_RESULT_LESS); + } + + SECTION("unsigned vs unsigned") { + CHECK(arithmeticCompareNegateRight(42, 42) == + COMPARE_RESULT_GREATER); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/conflicts.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/conflicts.cpp new file mode 100644 index 00000000..a00d0196 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/conflicts.cpp @@ -0,0 +1,67 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +// Include any header that might use the conflicting macros +#include +#include +#include + +// All cores +#define bit() +#define constrain() +#define DEFAULT +#define DISABLED +#define HIGH +#define INPUT +#define LOW +#define max() +#define min() +#define OUTPUT +#define round() +#define sq() +#define word() +#define bitRead() +#define bitSet() +#define bitClear() +#define bitWrite() +#define interrupts() +#define lowByte() +#define highByte() +#define DEC +#define HEX +#define OCT +#define BIN +#define cbi() +#define sbi() + +// ESP8266 +#define _max() +#define _min() + +// Realtek Ameba +#define isdigit(c) (((c) >= '0') && ((c) <= '9')) +#define isprint(c) +#define isxdigit(c) +#define isspace(c) +#define isupper(c) +#define islower(c) +#define isalpha(c) + +// issue #839 +#define BLOCKSIZE +#define CAPACITY + +// issue #1905 +#define _current + +// issue #1914 +#define V7 7 + +// STM32, Mbed, Particle +#define A0 16 +#define A1 17 +#define A2 18 + +// catch.hpp mutes several warnings, this file also allows to detect them +#include "ArduinoJson.h" diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/custom_string.hpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/custom_string.hpp new file mode 100644 index 00000000..9982040f --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/custom_string.hpp @@ -0,0 +1,11 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#pragma once + +#include + +struct custom_char_traits : std::char_traits {}; + +using custom_string = std::basic_string; diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/issue1967.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/issue1967.cpp new file mode 100644 index 00000000..bb067f05 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/issue1967.cpp @@ -0,0 +1,13 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +// we expect ArduinoJson.h to include +#define ARDUINOJSON_ENABLE_STD_STRING 1 + +// but we don't want it to included accidentally +#undef ARDUINO +#define ARDUINOJSON_ENABLE_STD_STREAM 0 +#define ARDUINOJSON_ENABLE_STRING_VIEW 0 + +#include diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/issue2129.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/issue2129.cpp new file mode 100644 index 00000000..022e2326 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/issue2129.cpp @@ -0,0 +1,55 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +template +class Nullable { + public: + Nullable() : value_{} {} + Nullable(T value) : value_{value} {} + + operator T() const { + return value_; + } + + operator T&() { + return value_; + } + + bool is_valid() const { + return value_ != invalid_value_; + } + + T value() const { + return value_; + } + + private: + T value_; + static T invalid_value_; +}; + +template <> +float Nullable::invalid_value_ = std::numeric_limits::lowest(); + +template +void convertToJson(const Nullable& src, JsonVariant dst) { + if (src.is_valid()) { + dst.set(src.value()); + } else { + dst.clear(); + } +} + +TEST_CASE("Issue #2129") { + Nullable nullable_value = Nullable{123.4f}; + + JsonDocument doc; + + doc["value"] = nullable_value; + + REQUIRE(doc["value"].as() == Approx(123.4f)); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/printable.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/printable.cpp new file mode 100644 index 00000000..3e20a5ba --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/printable.cpp @@ -0,0 +1,192 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1 +#include + +#include "Allocators.hpp" + +using ArduinoJson::detail::sizeofArray; + +struct PrintOneCharacterAtATime { + static size_t printStringTo(const std::string& s, Print& p) { + size_t result = 0; + for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) { + size_t n = p.write(uint8_t(*it)); + if (n == 0) + break; + result += n; + } + return result; + } +}; + +struct PrintAllAtOnce { + static size_t printStringTo(const std::string& s, Print& p) { + return p.write(s.data(), s.size()); + } +}; + +template +struct PrintableString : public Printable { + PrintableString(const char* s) : str_(s), total_(0) {} + + virtual size_t printTo(Print& p) const { + size_t result = PrintPolicy::printStringTo(str_, p); + total_ += result; + return result; + } + + size_t totalBytesWritten() const { + return total_; + } + + private: + std::string str_; + mutable size_t total_; +}; + +TEST_CASE("Printable") { + SECTION("Doesn't overflow") { + SpyingAllocator spy; + JsonDocument doc(&spy); + const char* value = "example"; + + doc.set(666); // to make sure we override the value + + SECTION("Via Print::write(char)") { + PrintableString printable(value); + CHECK(doc.set(printable) == true); + CHECK(doc.as() == value); + CHECK(printable.totalBytesWritten() == 7); + CHECK(doc.overflowed() == false); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("example")), + }); + } + + SECTION("Via Print::write(const char* size_t)") { + PrintableString printable(value); + CHECK(doc.set(printable) == true); + CHECK(doc.as() == value); + CHECK(printable.totalBytesWritten() == 7); + CHECK(doc.overflowed() == false); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("example")), + }); + } + } + + SECTION("First allocation fails") { + SpyingAllocator spy(FailingAllocator::instance()); + JsonDocument doc(&spy); + const char* value = "hello world"; + + doc.set(666); // to make sure we override the value + + SECTION("Via Print::write(char)") { + PrintableString printable(value); + + bool success = doc.set(printable); + + CHECK(success == false); + CHECK(doc.isNull()); + CHECK(printable.totalBytesWritten() == 0); + CHECK(doc.overflowed() == true); + CHECK(spy.log() == AllocatorLog{ + AllocateFail(sizeofStringBuffer()), + }); + } + + SECTION("Via Print::write(const char*, size_t)") { + PrintableString printable(value); + + bool success = doc.set(printable); + + CHECK(success == false); + CHECK(doc.isNull()); + CHECK(printable.totalBytesWritten() == 0); + CHECK(doc.overflowed() == true); + CHECK(spy.log() == AllocatorLog{ + AllocateFail(sizeofStringBuffer()), + }); + } + } + + SECTION("Reallocation fails") { + TimebombAllocator timebomb(1); + SpyingAllocator spy(&timebomb); + JsonDocument doc(&spy); + const char* value = "Lorem ipsum dolor sit amet, cons"; // > 31 chars + + doc.set(666); // to make sure we override the value + + SECTION("Via Print::write(char)") { + PrintableString printable(value); + + bool success = doc.set(printable); + + CHECK(success == false); + CHECK(doc.isNull()); + CHECK(printable.totalBytesWritten() == 31); + CHECK(doc.overflowed() == true); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer()), + ReallocateFail(sizeofStringBuffer(), sizeofStringBuffer(2)), + Deallocate(sizeofStringBuffer()), + }); + } + + SECTION("Via Print::write(const char*, size_t)") { + PrintableString printable(value); + + bool success = doc.set(printable); + + CHECK(success == false); + CHECK(doc.isNull()); + CHECK(printable.totalBytesWritten() == 31); + CHECK(doc.overflowed() == true); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer()), + ReallocateFail(sizeofStringBuffer(), sizeofStringBuffer(2)), + Deallocate(sizeofStringBuffer()), + }); + } + } + + SECTION("Null variant") { + JsonVariant var; + PrintableString printable = "Hello World!"; + CHECK(var.set(printable) == false); + CHECK(var.isNull()); + CHECK(printable.totalBytesWritten() == 0); + } + + SECTION("String deduplication") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc.add(PrintableString("Hello World!")); + doc.add(PrintableString("Hello World!")); + REQUIRE(doc.size() == 2); + CHECK(doc[0] == "Hello World!"); + CHECK(doc[1] == "Hello World!"); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("Hello World!")), + Allocate(sizeofStringBuffer()), + Deallocate(sizeofStringBuffer()), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/unsigned_char.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/unsigned_char.cpp new file mode 100644 index 00000000..3e950274 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/unsigned_char.cpp @@ -0,0 +1,248 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Literals.hpp" + +#if defined(__clang__) +# define CONFLICTS_WITH_BUILTIN_OPERATOR +#endif + +TEST_CASE("unsigned char[]") { + SECTION("deserializeJson()") { + unsigned char input[] = "{\"a\":42}"; + + JsonDocument doc; + DeserializationError err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("deserializeMsgPack()") { + unsigned char input[] = "\xDE\x00\x01\xA5Hello\xA5world"; + + JsonDocument doc; + DeserializationError err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("serializeMsgPack(unsigned char[])") { + unsigned char buffer[32]; + JsonDocument doc; + doc["hello"] = "world"; + + size_t n = serializeMsgPack(doc, buffer); + + REQUIRE(n == 13); + REQUIRE(memcmp(buffer, "\x81\xA5hello\xA5world", 13) == 0); + } + + SECTION("serializeMsgPack(unsigned char*)") { + unsigned char buffer[32]; + JsonDocument doc; + doc["hello"] = "world"; + + size_t n = serializeMsgPack(doc, buffer, sizeof(buffer)); + + REQUIRE(n == 13); + REQUIRE(memcmp(buffer, "\x81\xA5hello\xA5world", 13) == 0); + } + + SECTION("serializeJson(unsigned char[])") { + unsigned char buffer[32]; + JsonDocument doc; + doc["hello"] = "world"; + + size_t n = serializeJson(doc, buffer); + + REQUIRE(n == 17); + REQUIRE(memcmp(buffer, "{\"hello\":\"world\"}", n) == 0); + } + + SECTION("serializeJson(unsigned char*)") { + unsigned char buffer[32]; + JsonDocument doc; + doc["hello"] = "world"; + + size_t n = serializeJson(doc, buffer, sizeof(buffer)); + + REQUIRE(n == 17); + REQUIRE(memcmp(buffer, "{\"hello\":\"world\"}", n) == 0); + } + + SECTION("serializeJsonPretty(unsigned char[])") { + unsigned char buffer[32]; + JsonDocument doc; + doc["hello"] = "world"; + + size_t n = serializeJsonPretty(doc, buffer); + + REQUIRE(n == 24); + } + + SECTION("serializeJsonPretty(unsigned char*)") { + unsigned char buffer[32]; + JsonDocument doc; + doc["hello"] = "world"; + + size_t n = serializeJsonPretty(doc, buffer, sizeof(buffer)); + + REQUIRE(n == 24); + } + + SECTION("JsonVariant") { + JsonDocument doc; + + SECTION("set") { + unsigned char value[] = "42"; + + JsonVariant variant = doc.to(); + variant.set(value); + + REQUIRE(42 == variant.as()); + } + +#ifndef CONFLICTS_WITH_BUILTIN_OPERATOR + SECTION("operator[]") { + unsigned char key[] = "hello"; + + deserializeJson(doc, "{\"hello\":\"world\"}"); + JsonVariant variant = doc.as(); + + REQUIRE("world"_s == variant[key]); + } +#endif + +#ifndef CONFLICTS_WITH_BUILTIN_OPERATOR + SECTION("operator[] const") { + unsigned char key[] = "hello"; + + deserializeJson(doc, "{\"hello\":\"world\"}"); + const JsonVariant variant = doc.as(); + + REQUIRE("world"_s == variant[key]); + } +#endif + + SECTION("operator==") { + unsigned char comparand[] = "hello"; + + JsonVariant variant = doc.to(); + variant.set("hello"); + + REQUIRE(comparand == variant); + REQUIRE(variant == comparand); + REQUIRE_FALSE(comparand != variant); + REQUIRE_FALSE(variant != comparand); + } + + SECTION("operator!=") { + unsigned char comparand[] = "hello"; + + JsonVariant variant = doc.to(); + variant.set("world"); + + REQUIRE(comparand != variant); + REQUIRE(variant != comparand); + REQUIRE_FALSE(comparand == variant); + REQUIRE_FALSE(variant == comparand); + } + } + + SECTION("JsonObject") { +#ifndef CONFLICTS_WITH_BUILTIN_OPERATOR + SECTION("operator[]") { + unsigned char key[] = "hello"; + + JsonDocument doc; + JsonObject obj = doc.to(); + obj[key] = "world"; + + REQUIRE("world"_s == obj["hello"]); + } + + SECTION("JsonObject::operator[] const") { + unsigned char key[] = "hello"; + + JsonDocument doc; + deserializeJson(doc, "{\"hello\":\"world\"}"); + + JsonObject obj = doc.as(); + REQUIRE("world"_s == obj[key]); + } +#endif + + SECTION("remove()") { + unsigned char key[] = "hello"; + + JsonDocument doc; + deserializeJson(doc, "{\"hello\":\"world\"}"); + JsonObject obj = doc.as(); + obj.remove(key); + + REQUIRE(0 == obj.size()); + } + } + + SECTION("MemberProxy") { + SECTION("operator=") { // issue #416 + unsigned char value[] = "world"; + + JsonDocument doc; + JsonObject obj = doc.to(); + obj["hello"] = value; + + REQUIRE("world"_s == obj["hello"]); + } + + SECTION("set()") { + unsigned char value[] = "world"; + + JsonDocument doc; + JsonObject obj = doc.to(); + obj["hello"].set(value); + + REQUIRE("world"_s == obj["hello"]); + } + } + + SECTION("JsonArray") { + SECTION("add()") { + unsigned char value[] = "world"; + + JsonDocument doc; + JsonArray arr = doc.to(); + arr.add(value); + + REQUIRE("world"_s == arr[0]); + } + } + + SECTION("ElementProxy") { + SECTION("set()") { + unsigned char value[] = "world"; + + JsonDocument doc; + JsonArray arr = doc.to(); + arr.add("hello"); + arr[0].set(value); + + REQUIRE("world"_s == arr[0]); + } + + SECTION("operator=") { + unsigned char value[] = "world"; + + JsonDocument doc; + JsonArray arr = doc.to(); + arr.add("hello"); + arr[0] = value; + + REQUIRE("world"_s == arr[0]); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/version.cpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/version.cpp new file mode 100644 index 00000000..136dbf3a --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/version.cpp @@ -0,0 +1,18 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +using Catch::Matchers::StartsWith; + +TEST_CASE("ARDUINOJSON_VERSION") { + std::stringstream version; + + version << ARDUINOJSON_VERSION_MAJOR << "." << ARDUINOJSON_VERSION_MINOR + << "." << ARDUINOJSON_VERSION_REVISION; + + REQUIRE_THAT(ARDUINOJSON_VERSION, StartsWith(version.str())); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Misc/weird_strcmp.hpp b/mb-script/lib/ArduinoJson/extras/tests/Misc/weird_strcmp.hpp new file mode 100644 index 00000000..dbe122f6 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Misc/weird_strcmp.hpp @@ -0,0 +1,31 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +#include // strcmp, strncmp + +// Issue #1198: strcmp() implementation that returns a value larger than 8-bit + +ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE + +int strcmp(const char* a, const char* b) { + int result = ::strcmp(a, b); + if (result > 0) + return 2147483647; + if (result < 0) + return -214748364; + return 0; +} + +int strncmp(const char* a, const char* b, size_t n) { + int result = ::strncmp(a, b, n); + if (result > 0) + return 2147483647; + if (result < 0) + return -214748364; + return 0; +} + +ARDUINOJSON_END_PRIVATE_NAMESPACE diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/CMakeLists.txt new file mode 100644 index 00000000..08d88883 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/CMakeLists.txt @@ -0,0 +1,34 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(MixedConfigurationTests + decode_unicode_0.cpp + decode_unicode_1.cpp + enable_alignment_0.cpp + enable_alignment_1.cpp + enable_comments_0.cpp + enable_comments_1.cpp + enable_infinity_0.cpp + enable_infinity_1.cpp + enable_nan_0.cpp + enable_nan_1.cpp + enable_progmem_1.cpp + issue1707.cpp + string_length_size_1.cpp + string_length_size_2.cpp + string_length_size_4.cpp + use_double_0.cpp + use_double_1.cpp + use_long_long_0.cpp + use_long_long_1.cpp +) + +set_target_properties(MixedConfigurationTests PROPERTIES UNITY_BUILD OFF) + +add_test(MixedConfiguration MixedConfigurationTests) + +set_tests_properties(MixedConfiguration + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_0.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_0.cpp new file mode 100644 index 00000000..91b03bb8 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_0.cpp @@ -0,0 +1,12 @@ +#define ARDUINOJSON_DECODE_UNICODE 0 +#include + +#include + +TEST_CASE("ARDUINOJSON_DECODE_UNICODE == 0") { + JsonDocument doc; + DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\""); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "\\uD834\\uDD1E"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_1.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_1.cpp new file mode 100644 index 00000000..0568ab53 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/decode_unicode_1.cpp @@ -0,0 +1,11 @@ +#define ARDUINOJSON_DECODE_UNICODE 1 +#include + +#include + +TEST_CASE("ARDUINOJSON_DECODE_UNICODE == 1") { + JsonDocument doc; + DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\""); + + REQUIRE(err == DeserializationError::Ok); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_0.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_0.cpp new file mode 100644 index 00000000..569f84aa --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_0.cpp @@ -0,0 +1,41 @@ +#define ARDUINOJSON_VERSION_NAMESPACE NoAlignment +#define ARDUINOJSON_ENABLE_ALIGNMENT 0 +#include + +#include + +TEST_CASE("ARDUINOJSON_ENABLE_ALIGNMENT == 0") { + using namespace ArduinoJson::detail; + + const size_t N = sizeof(void*); + + SECTION("isAligned()") { + CHECK(isAligned(0) == true); + CHECK(isAligned(1) == true); + CHECK(isAligned(N) == true); + CHECK(isAligned(N + 1) == true); + CHECK(isAligned(2 * N) == true); + CHECK(isAligned(2 * N + 1) == true); + } + + SECTION("addPadding()") { + CHECK(addPadding(0) == 0); + CHECK(addPadding(1) == 1); + CHECK(addPadding(N) == N); + CHECK(addPadding(N + 1) == N + 1); + } + + SECTION("AddPadding<>") { + const size_t a = AddPadding<0>::value; + CHECK(a == 0); + + const size_t b = AddPadding<1>::value; + CHECK(b == 1); + + const size_t c = AddPadding::value; + CHECK(c == N); + + const size_t d = AddPadding::value; + CHECK(d == N + 1); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_1.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_1.cpp new file mode 100644 index 00000000..56d48169 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_1.cpp @@ -0,0 +1,40 @@ +#define ARDUINOJSON_ENABLE_ALIGNMENT 1 +#include + +#include + +TEST_CASE("ARDUINOJSON_ENABLE_ALIGNMENT == 1") { + using namespace ArduinoJson::detail; + + const size_t N = sizeof(void*); + + SECTION("isAligned()") { + CHECK(isAligned(0) == true); + CHECK(isAligned(1) == false); + CHECK(isAligned(N) == true); + CHECK(isAligned(N + 1) == false); + CHECK(isAligned(2 * N) == true); + CHECK(isAligned(2 * N + 1) == false); + } + + SECTION("addPadding()") { + CHECK(addPadding(0) == 0); + CHECK(addPadding(1) == N); + CHECK(addPadding(N) == N); + CHECK(addPadding(N + 1) == 2 * N); + } + + SECTION("AddPadding<>") { + const size_t a = AddPadding<0>::value; + CHECK(a == 0); + + const size_t b = AddPadding<1>::value; + CHECK(b == N); + + const size_t c = AddPadding::value; + CHECK(c == N); + + const size_t d = AddPadding::value; + CHECK(d == 2 * N); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_0.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_0.cpp new file mode 100644 index 00000000..f0904c58 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_0.cpp @@ -0,0 +1,54 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_ENABLE_COMMENTS 0 +#include + +#include + +TEST_CASE("Comments should produce InvalidInput") { + JsonDocument doc; + + const char* testCases[] = { + "/*COMMENT*/ [\"hello\"]", + "[/*COMMENT*/ \"hello\"]", + "[\"hello\"/*COMMENT*/]", + "[\"hello\"/*COMMENT*/,\"world\"]", + "[\"hello\",/*COMMENT*/ \"world\"]", + "[/*/\n]", + "[/*COMMENT]", + "[/*COMMENT*]", + "//COMMENT\n\t[\"hello\"]", + "[//COMMENT\n\"hello\"]", + "[\"hello\"//COMMENT\r\n]", + "[\"hello\"//COMMENT\n,\"world\"]", + "[\"hello\",//COMMENT\n\"world\"]", + "[/COMMENT\n]", + "[//COMMENT", + "/*COMMENT*/ {\"hello\":\"world\"}", + "{/*COMMENT*/\"hello\":\"world\"}", + "{\"hello\"/*COMMENT*/:\"world\"}", + "{\"hello\":/*COMMENT*/\"world\"}", + "{\"hello\":\"world\"/*COMMENT*/}", + "//COMMENT\n {\"hello\":\"world\"}", + "{//COMMENT\n\"hello\":\"world\"}", + "{\"hello\"//COMMENT\n:\"world\"}", + "{\"hello\"://COMMENT\n\"world\"}", + "{\"hello\":\"world\"//COMMENT\n}", + "/{\"hello\":\"world\"}", + "{/\"hello\":\"world\"}", + "{\"hello\"/:\"world\"}", + "{\"hello\":/\"world\"}", + "{\"hello\":\"world\"/}", + "{\"hello\":\"world\"/,\"answer\":42}", + "{\"hello\":\"world\",/\"answer\":42}", + }; + const size_t testCount = sizeof(testCases) / sizeof(testCases[0]); + + for (size_t i = 0; i < testCount; i++) { + const char* input = testCases[i]; + CAPTURE(input); + REQUIRE(deserializeJson(doc, input) == DeserializationError::InvalidInput); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_1.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_1.cpp new file mode 100644 index 00000000..7e135dfa --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_comments_1.cpp @@ -0,0 +1,411 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_ENABLE_COMMENTS 1 +#include + +#include + +TEST_CASE("Comments in arrays") { + JsonDocument doc; + + SECTION("Block comments") { + SECTION("Before opening bracket") { + DeserializationError err = + deserializeJson(doc, "/*COMMENT*/ [\"hello\"]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == "hello"); + } + + SECTION("After opening bracket") { + DeserializationError err = + deserializeJson(doc, "[/*COMMENT*/ \"hello\"]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == "hello"); + } + + SECTION("Before closing bracket") { + DeserializationError err = deserializeJson(doc, "[\"hello\"/*COMMENT*/]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == "hello"); + } + + SECTION("After closing bracket") { + DeserializationError err = deserializeJson(doc, "[\"hello\"]/*COMMENT*/"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == "hello"); + } + + SECTION("Before comma") { + DeserializationError err = + deserializeJson(doc, "[\"hello\"/*COMMENT*/,\"world\"]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0] == "hello"); + REQUIRE(arr[1] == "world"); + } + + SECTION("After comma") { + DeserializationError err = + deserializeJson(doc, "[\"hello\",/*COMMENT*/ \"world\"]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0] == "hello"); + REQUIRE(arr[1] == "world"); + } + + SECTION("/*/") { + DeserializationError err = deserializeJson(doc, "[/*/\n]"); + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("Unfinished comment") { + DeserializationError err = deserializeJson(doc, "[/*COMMENT]"); + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("Final slash missing") { + DeserializationError err = deserializeJson(doc, "[/*COMMENT*]"); + REQUIRE(err == DeserializationError::IncompleteInput); + } + } + + SECTION("Trailing comments") { + SECTION("Before opening bracket") { + DeserializationError err = + deserializeJson(doc, "//COMMENT\n\t[\"hello\"]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == "hello"); + } + + SECTION("After opening bracket") { + DeserializationError err = deserializeJson(doc, "[//COMMENT\n\"hello\"]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == "hello"); + } + + SECTION("Before closing bracket") { + DeserializationError err = + deserializeJson(doc, "[\"hello\"//COMMENT\r\n]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == "hello"); + } + + SECTION("After closing bracket") { + DeserializationError err = deserializeJson(doc, "[\"hello\"]//COMMENT\n"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(1 == arr.size()); + REQUIRE(arr[0] == "hello"); + } + + SECTION("Before comma") { + DeserializationError err = + deserializeJson(doc, "[\"hello\"//COMMENT\n,\"world\"]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0] == "hello"); + REQUIRE(arr[1] == "world"); + } + + SECTION("After comma") { + DeserializationError err = + deserializeJson(doc, "[\"hello\",//COMMENT\n\"world\"]"); + JsonArray arr = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(2 == arr.size()); + REQUIRE(arr[0] == "hello"); + REQUIRE(arr[1] == "world"); + } + + SECTION("Invalid comment") { + DeserializationError err = deserializeJson(doc, "[/COMMENT\n]"); + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("End document with comment") { + DeserializationError err = deserializeJson(doc, "[//COMMENT"); + REQUIRE(err == DeserializationError::IncompleteInput); + } + } +} + +TEST_CASE("Comments in objects") { + JsonDocument doc; + + SECTION("Block comments") { + SECTION("Before opening brace") { + DeserializationError err = + deserializeJson(doc, "/*COMMENT*/ {\"hello\":\"world\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("After opening brace") { + DeserializationError err = + deserializeJson(doc, "{/*COMMENT*/\"hello\":\"world\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("Before colon") { + DeserializationError err = + deserializeJson(doc, "{\"hello\"/*COMMENT*/:\"world\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("After colon") { + DeserializationError err = + deserializeJson(doc, "{\"hello\":/*COMMENT*/\"world\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("Before closing brace") { + DeserializationError err = + deserializeJson(doc, "{\"hello\":\"world\"/*COMMENT*/}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("After closing brace") { + DeserializationError err = + deserializeJson(doc, "{\"hello\":\"world\"}/*COMMENT*/"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("Before comma") { + DeserializationError err = deserializeJson( + doc, "{\"hello\":\"world\"/*COMMENT*/,\"answer\":42}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + REQUIRE(obj["answer"] == 42); + } + + SECTION("After comma") { + DeserializationError err = deserializeJson( + doc, "{\"hello\":\"world\",/*COMMENT*/\"answer\":42}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + REQUIRE(obj["answer"] == 42); + } + } + + SECTION("Trailing comments") { + SECTION("Before opening brace") { + DeserializationError err = + deserializeJson(doc, "//COMMENT\n {\"hello\":\"world\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("After opening brace") { + DeserializationError err = + deserializeJson(doc, "{//COMMENT\n\"hello\":\"world\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("Before colon") { + DeserializationError err = + deserializeJson(doc, "{\"hello\"//COMMENT\n:\"world\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("After colon") { + DeserializationError err = + deserializeJson(doc, "{\"hello\"://COMMENT\n\"world\"}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("Before closing brace") { + DeserializationError err = + deserializeJson(doc, "{\"hello\":\"world\"//COMMENT\n}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("After closing brace") { + DeserializationError err = + deserializeJson(doc, "{\"hello\":\"world\"}//COMMENT\n"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("Before comma") { + DeserializationError err = deserializeJson( + doc, "{\"hello\":\"world\"//COMMENT\n,\"answer\":42}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + REQUIRE(obj["answer"] == 42); + } + + SECTION("After comma") { + DeserializationError err = deserializeJson( + doc, "{\"hello\":\"world\",//COMMENT\n\"answer\":42}"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + REQUIRE(obj["answer"] == 42); + } + } + + SECTION("Dangling slash") { + SECTION("Before opening brace") { + DeserializationError err = deserializeJson(doc, "/{\"hello\":\"world\"}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("After opening brace") { + DeserializationError err = deserializeJson(doc, "{/\"hello\":\"world\"}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("Before colon") { + DeserializationError err = deserializeJson(doc, "{\"hello\"/:\"world\"}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("After colon") { + DeserializationError err = deserializeJson(doc, "{\"hello\":/\"world\"}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("Before closing brace") { + DeserializationError err = deserializeJson(doc, "{\"hello\":\"world\"/}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("After closing brace") { + DeserializationError err = deserializeJson(doc, "{\"hello\":\"world\"}/"); + JsonObject obj = doc.as(); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(obj["hello"] == "world"); + } + + SECTION("Before comma") { + DeserializationError err = + deserializeJson(doc, "{\"hello\":\"world\"/,\"answer\":42}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("After comma") { + DeserializationError err = + deserializeJson(doc, "{\"hello\":\"world\",/\"answer\":42}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + } +} + +TEST_CASE("Comments alone") { + JsonDocument doc; + + SECTION("Just a trailing comment with no line break") { + DeserializationError err = deserializeJson(doc, "// comment"); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("Just a trailing comment with no a break") { + DeserializationError err = deserializeJson(doc, "// comment\n"); + + REQUIRE(err == DeserializationError::EmptyInput); + } + + SECTION("Just a block comment") { + DeserializationError err = deserializeJson(doc, "/*comment*/"); + + REQUIRE(err == DeserializationError::EmptyInput); + } + + SECTION("Just a slash") { + DeserializationError err = deserializeJson(doc, "/"); + + REQUIRE(err == DeserializationError::InvalidInput); + } + + SECTION("Premature terminator") { + DeserializationError err = deserializeJson(doc, "/* comment"); + + REQUIRE(err == DeserializationError::IncompleteInput); + } + + SECTION("Premature end on sized input") { + DeserializationError err = deserializeJson(doc, "/* comment */", 10); + + REQUIRE(err == DeserializationError::IncompleteInput); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_0.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_0.cpp new file mode 100644 index 00000000..41566e24 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_0.cpp @@ -0,0 +1,35 @@ +#define ARDUINOJSON_ENABLE_INFINITY 0 +#include + +#include +#include + +static void assertParseFails(const char* json) { + JsonDocument doc; + DeserializationError err = deserializeJson(doc, json); + + REQUIRE(err == DeserializationError::InvalidInput); +} + +static void assertJsonEquals(const JsonDocument& doc, + std::string expectedJson) { + std::string actualJson; + serializeJson(doc, actualJson); + REQUIRE(actualJson == expectedJson); +} + +TEST_CASE("ARDUINOJSON_ENABLE_INFINITY == 0") { + SECTION("serializeJson()") { + JsonDocument doc; + doc.add(std::numeric_limits::infinity()); + doc.add(-std::numeric_limits::infinity()); + + assertJsonEquals(doc, "[null,null]"); + } + + SECTION("deserializeJson()") { + assertParseFails("{\"X\":Infinity}"); + assertParseFails("{\"X\":-Infinity}"); + assertParseFails("{\"X\":+Infinity}"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_1.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_1.cpp new file mode 100644 index 00000000..99ab3fe7 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_infinity_1.cpp @@ -0,0 +1,39 @@ +#define ARDUINOJSON_ENABLE_INFINITY 1 +#include + +#include +#include + +namespace my { +using ArduinoJson::detail::isinf; +} // namespace my + +TEST_CASE("ARDUINOJSON_ENABLE_INFINITY == 1") { + JsonDocument doc; + + SECTION("serializeJson()") { + doc.add(std::numeric_limits::infinity()); + doc.add(-std::numeric_limits::infinity()); + + std::string json; + serializeJson(doc, json); + + REQUIRE(json == "[Infinity,-Infinity]"); + } + + SECTION("deserializeJson()") { + DeserializationError err = + deserializeJson(doc, "[Infinity,-Infinity,+Infinity]"); + float a = doc[0]; + float b = doc[1]; + float c = doc[2]; + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(my::isinf(a)); + REQUIRE(a > 0); + REQUIRE(my::isinf(b)); + REQUIRE(b < 0); + REQUIRE(my::isinf(c)); + REQUIRE(c > 0); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_0.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_0.cpp new file mode 100644 index 00000000..7491e4a3 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_0.cpp @@ -0,0 +1,25 @@ +#define ARDUINOJSON_ENABLE_NAN 0 +#include + +#include +#include + +TEST_CASE("ARDUINOJSON_ENABLE_NAN == 0") { + JsonDocument doc; + JsonObject root = doc.to(); + + SECTION("serializeJson()") { + root["X"] = std::numeric_limits::signaling_NaN(); + + std::string json; + serializeJson(doc, json); + + REQUIRE(json == "{\"X\":null}"); + } + + SECTION("deserializeJson()") { + DeserializationError err = deserializeJson(doc, "{\"X\":NaN}"); + + REQUIRE(err == DeserializationError::InvalidInput); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_1.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_1.cpp new file mode 100644 index 00000000..20d0874e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_nan_1.cpp @@ -0,0 +1,31 @@ +#define ARDUINOJSON_ENABLE_NAN 1 +#include + +#include +#include + +namespace my { +using ArduinoJson::detail::isnan; +} // namespace my + +TEST_CASE("ARDUINOJSON_ENABLE_NAN == 1") { + JsonDocument doc; + JsonObject root = doc.to(); + + SECTION("serializeJson()") { + root["X"] = std::numeric_limits::signaling_NaN(); + + std::string json; + serializeJson(doc, json); + + REQUIRE(json == "{\"X\":NaN}"); + } + + SECTION("deserializeJson()") { + DeserializationError err = deserializeJson(doc, "{\"X\":NaN}"); + float x = doc["X"]; + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(my::isnan(x)); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_progmem_1.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_progmem_1.cpp new file mode 100644 index 00000000..312a87ff --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/enable_progmem_1.cpp @@ -0,0 +1,191 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_ENABLE_PROGMEM 1 +#include + +#include + +TEST_CASE("Flash strings") { + JsonDocument doc; + + SECTION("deserializeJson()") { + DeserializationError err = deserializeJson(doc, F("{'hello':'world'}")); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc["hello"] == "world"); + } + + SECTION("JsonDocument::operator[]") { + doc[F("hello")] = F("world"); + + REQUIRE(doc["hello"] == "world"); + } + + SECTION("JsonDocument::add()") { + doc.add(F("world")); + + REQUIRE(doc[0] == "world"); + } + + SECTION("JsonVariant::set()") { + JsonVariant var = doc.to(); + + var.set(F("world")); + + REQUIRE(var == "world"); + } + + SECTION("MemberProxy::operator==") { + doc["hello"] = "world"; + + REQUIRE(doc["hello"] == F("world")); + } + + SECTION("ElementProxy::operator==") { + doc.add("world"); + + REQUIRE(doc[0] == F("world")); + } +} + +TEST_CASE("parseNumber()") { // tables are in Flash + using ArduinoJson::detail::parseNumber; + + CHECK(parseNumber("1") == 1.f); + CHECK(parseNumber("1.23") == 1.23f); + CHECK(parseNumber("-1.23e34") == -1.23e34f); +} + +TEST_CASE("strlen_P") { + CHECK(strlen_P(PSTR("")) == 0); + CHECK(strlen_P(PSTR("a")) == 1); + CHECK(strlen_P(PSTR("ac")) == 2); +} + +TEST_CASE("strncmp_P") { + CHECK(strncmp_P("a", PSTR("b"), 0) == 0); + CHECK(strncmp_P("a", PSTR("b"), 1) == -1); + CHECK(strncmp_P("b", PSTR("a"), 1) == 1); + CHECK(strncmp_P("a", PSTR("a"), 0) == 0); + CHECK(strncmp_P("a", PSTR("b"), 2) == -1); + CHECK(strncmp_P("b", PSTR("a"), 2) == 1); + CHECK(strncmp_P("a", PSTR("a"), 2) == 0); +} + +TEST_CASE("strcmp_P") { + CHECK(strcmp_P("a", PSTR("b")) == -1); + CHECK(strcmp_P("b", PSTR("a")) == 1); + CHECK(strcmp_P("a", PSTR("a")) == 0); + CHECK(strcmp_P("aa", PSTR("ab")) == -1); + CHECK(strcmp_P("ab", PSTR("aa")) == 1); + CHECK(strcmp_P("aa", PSTR("aa")) == 0); +} + +TEST_CASE("memcpy_P") { + char dst[4]; + CHECK(memcpy_P(dst, PSTR("ABC"), 4) == dst); + CHECK(dst[0] == 'A'); + CHECK(dst[1] == 'B'); + CHECK(dst[2] == 'C'); + CHECK(dst[3] == 0); +} + +TEST_CASE("BoundedReader") { + using namespace ArduinoJson::detail; + + SECTION("read") { + BoundedReader reader(F("\x01\xFF"), 2); + REQUIRE(reader.read() == 0x01); + REQUIRE(reader.read() == 0xFF); + REQUIRE(reader.read() == -1); + REQUIRE(reader.read() == -1); + } + + SECTION("readBytes() all at once") { + BoundedReader reader(F("ABCD"), 3); + + char buffer[8] = "abcd"; + REQUIRE(reader.readBytes(buffer, 4) == 3); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'd'); + } + + SECTION("readBytes() in two parts") { + BoundedReader reader(F("ABCDEF"), 6); + + char buffer[8] = "abcdefg"; + REQUIRE(reader.readBytes(buffer, 4) == 4); + REQUIRE(reader.readBytes(buffer + 4, 4) == 2); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'D'); + REQUIRE(buffer[4] == 'E'); + REQUIRE(buffer[5] == 'F'); + REQUIRE(buffer[6] == 'g'); + } +} + +TEST_CASE("Reader") { + using namespace ArduinoJson::detail; + + SECTION("read()") { + Reader reader(F("\x01\xFF\x00\x12")); + REQUIRE(reader.read() == 0x01); + REQUIRE(reader.read() == 0xFF); + REQUIRE(reader.read() == 0); + REQUIRE(reader.read() == 0x12); + } + + SECTION("readBytes() all at once") { + Reader reader(F("ABCD")); + + char buffer[8] = "abcd"; + REQUIRE(reader.readBytes(buffer, 3) == 3); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'd'); + } + + SECTION("readBytes() in two parts") { + Reader reader(F("ABCDEF")); + + char buffer[8] = "abcdefg"; + REQUIRE(reader.readBytes(buffer, 4) == 4); + REQUIRE(reader.readBytes(buffer + 4, 2) == 2); + + REQUIRE(buffer[0] == 'A'); + REQUIRE(buffer[1] == 'B'); + REQUIRE(buffer[2] == 'C'); + REQUIRE(buffer[3] == 'D'); + REQUIRE(buffer[4] == 'E'); + REQUIRE(buffer[5] == 'F'); + REQUIRE(buffer[6] == 'g'); + } +} + +static void testStringification(DeserializationError error, + std::string expected) { + const __FlashStringHelper* s = error.f_str(); + CHECK(reinterpret_cast(convertFlashToPtr(s)) == expected); +} + +#define TEST_STRINGIFICATION(symbol) \ + testStringification(DeserializationError::symbol, #symbol) + +TEST_CASE("DeserializationError::f_str()") { + TEST_STRINGIFICATION(Ok); + TEST_STRINGIFICATION(EmptyInput); + TEST_STRINGIFICATION(IncompleteInput); + TEST_STRINGIFICATION(InvalidInput); + TEST_STRINGIFICATION(NoMemory); + TEST_STRINGIFICATION(TooDeep); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/issue1707.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/issue1707.cpp new file mode 100644 index 00000000..ff8d2bac --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/issue1707.cpp @@ -0,0 +1,17 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINO +#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) + +#include + +#include + +TEST_CASE("Issue1707") { + JsonDocument doc; + + DeserializationError err = deserializeJson(doc, F("{\"hello\":12}")); + REQUIRE(err == DeserializationError::Ok); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_1.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_1.cpp new file mode 100644 index 00000000..32636867 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_1.cpp @@ -0,0 +1,131 @@ +#define ARDUINOJSON_STRING_LENGTH_SIZE 1 +#include + +#include +#include + +#include "Literals.hpp" + +TEST_CASE("ARDUINOJSON_STRING_LENGTH_SIZE == 1") { + JsonDocument doc; + + SECTION("set(std::string)") { + SECTION("returns true if len <= 255") { + auto result = doc.set(std::string(255, '?')); + + REQUIRE(result == true); + REQUIRE(doc.overflowed() == false); + } + + SECTION("returns false if len >= 256") { + auto result = doc.set(std::string(256, '?')); + + REQUIRE(result == false); + REQUIRE(doc.overflowed() == true); + } + } + + SECTION("set(MsgPackBinary)") { + SECTION("returns true if size <= 253") { + auto str = std::string(253, '?'); + auto result = doc.set(MsgPackBinary(str.data(), str.size())); + + REQUIRE(result == true); + REQUIRE(doc.overflowed() == false); + } + + SECTION("returns false if size >= 254") { + auto str = std::string(254, '?'); + auto result = doc.set(MsgPackBinary(str.data(), str.size())); + + REQUIRE(result == false); + REQUIRE(doc.overflowed() == true); + } + } + + SECTION("set(MsgPackExtension)") { + SECTION("returns true if size <= 252") { + auto str = std::string(252, '?'); + auto result = doc.set(MsgPackExtension(1, str.data(), str.size())); + + REQUIRE(result == true); + REQUIRE(doc.overflowed() == false); + } + + SECTION("returns false if size >= 253") { + auto str = std::string(253, '?'); + auto result = doc.set(MsgPackExtension(1, str.data(), str.size())); + + REQUIRE(result == false); + REQUIRE(doc.overflowed() == true); + } + } + + SECTION("deserializeJson()") { + SECTION("returns Ok if string length <= 255") { + auto input = "\"" + std::string(255, '?') + "\""; + + auto err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("returns NoMemory if string length >= 256") { + auto input = "\"" + std::string(256, '?') + "\""; + + auto err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + } + } + + SECTION("deserializeMsgPack()") { + SECTION("returns Ok if string length <= 255") { + auto input = "\xd9\xff" + std::string(255, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("returns NoMemory if string length >= 256") { + auto input = "\xda\x01\x00"_s + std::string(256, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + } + + SECTION("returns Ok if binary size <= 253") { + auto input = "\xc4\xfd" + std::string(253, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("returns NoMemory if binary size >= 254") { + auto input = "\xc4\xfe" + std::string(254, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + } + + SECTION("returns Ok if extension size <= 252") { + auto input = "\xc7\xfc\x01" + std::string(252, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("returns NoMemory if binary size >= 253") { + auto input = "\xc7\xfd\x01" + std::string(253, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_2.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_2.cpp new file mode 100644 index 00000000..2c1315b0 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_2.cpp @@ -0,0 +1,140 @@ +#define ARDUINOJSON_STRING_LENGTH_SIZE 2 +#include + +#include +#include + +#include "Literals.hpp" + +TEST_CASE("ARDUINOJSON_STRING_LENGTH_SIZE == 2") { + JsonDocument doc; + + SECTION("set(std::string)") { + SECTION("returns true if len <= 65535") { + auto result = doc.set(std::string(65535, '?')); + + REQUIRE(result == true); + REQUIRE(doc.overflowed() == false); + } + + SECTION("returns false if len >= 65536") { + auto result = doc.set(std::string(65536, '?')); + + REQUIRE(result == false); + REQUIRE(doc.overflowed() == true); + } + } + + SECTION("set(MsgPackBinary)") { + SECTION("returns true if size <= 65532") { + auto str = std::string(65532, '?'); + auto result = doc.set(MsgPackBinary(str.data(), str.size())); + + REQUIRE(result == true); + REQUIRE(doc.overflowed() == false); + } + + SECTION("returns false if size >= 65533") { + auto str = std::string(65533, '?'); + auto result = doc.set(MsgPackBinary(str.data(), str.size())); + + REQUIRE(result == false); + REQUIRE(doc.overflowed() == true); + } + } + + SECTION("set(MsgPackExtension)") { + SECTION("returns true if size <= 65531") { + auto str = std::string(65531, '?'); + auto result = doc.set(MsgPackExtension(1, str.data(), str.size())); + + REQUIRE(result == true); + REQUIRE(doc.overflowed() == false); + } + + SECTION("returns false if size >= 65532") { + auto str = std::string(65532, '?'); + auto result = doc.set(MsgPackExtension(1, str.data(), str.size())); + + REQUIRE(result == false); + REQUIRE(doc.overflowed() == true); + } + } + + SECTION("deserializeJson()") { + SECTION("returns Ok if string length <= 65535") { + auto input = "\"" + std::string(65535, '?') + "\""; + + auto err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("returns NoMemory if string length >= 65536") { + auto input = "\"" + std::string(65536, '?') + "\""; + + auto err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + } + } + + SECTION("deserializeMsgPack()") { + SECTION("returns Ok if string length <= 65535") { + auto input = "\xda\xff\xff" + std::string(65535, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("returns NoMemory if string length >= 65536") { + auto input = "\xdb\x00\x01\x00\x00"_s + std::string(65536, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + } + + SECTION("returns Ok if binary size <= 65532") { + auto input = "\xc5\xff\xfc" + std::string(65532, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("returns NoMemory if binary size >= 65534") { + auto input = "\xc5\xff\xfd" + std::string(65534, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + } + + // https://oss-fuzz.com/testcase?key=5354792971993088 + SECTION("doesn't overflow if binary size == 0xFFFF") { + auto input = "\xc5\xff\xff"_s; + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + } + + SECTION("returns Ok if extension size <= 65531") { + auto input = "\xc8\xff\xfb\x01" + std::string(65531, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("returns NoMemory if extension size >= 65532") { + auto input = "\xc8\xff\xfc\x01" + std::string(65532, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_4.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_4.cpp new file mode 100644 index 00000000..4059c3d4 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/string_length_size_4.cpp @@ -0,0 +1,146 @@ +#define ARDUINOJSON_STRING_LENGTH_SIZE 4 +#include + +#include +#include + +#include "Literals.hpp" + +TEST_CASE("ARDUINOJSON_STRING_LENGTH_SIZE == 4") { + JsonDocument doc; + + SECTION("set(std::string)") { + SECTION("returns true if string length >= 65536") { + auto result = doc.set(std::string(65536, '?')); + + REQUIRE(result == true); + REQUIRE(doc.overflowed() == false); + } + } + + SECTION("set(MsgPackBinary)") { + SECTION("returns true if size >= 65536") { + auto str = std::string(65536, '?'); + auto result = doc.set(MsgPackBinary(str.data(), str.size())); + + REQUIRE(result == true); + REQUIRE(doc.overflowed() == false); + } + } + + SECTION("set(MsgPackExtension)") { + SECTION("returns true if size >= 65532") { + auto str = std::string(65532, '?'); + auto result = doc.set(MsgPackExtension(1, str.data(), str.size())); + + REQUIRE(result == true); + REQUIRE(doc.overflowed() == false); + } + } + + SECTION("deserializeJson()") { + SECTION("returns Ok if string length >= 65536") { + auto input = "\"" + std::string(65536, '?') + "\""; + + auto err = deserializeJson(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + } + + SECTION("deserializeMsgPack()") { + SECTION("returns Ok if string size >= 65536") { + auto input = "\xda\xff\xff" + std::string(65536, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("returns Ok if binary size >= 65536") { + auto input = "\xc5\xff\xff" + std::string(65536, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("returns Ok if extension size >= 65532") { + auto input = "\xc8\xff\xfb\x01" + std::string(65532, '?'); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + // https://oss-fuzz.com/testcase?key=5354792971993088 + SECTION("doesn't overflow if binary size == 0xFFFFFFFF") { + auto input = "\xc6\xff\xff\xff\xff"_s; + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::NoMemory); + } + + SECTION("doesn't overflow if string size == 0xFFFFFFFF") { + auto input = "\xdb\xff\xff\xff\xff???????????????????"_s; + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err != DeserializationError::Ok); + } + } + + SECTION("bin 32 deserialization") { + auto str = std::string(65536, '?'); + auto input = "\xc6\x00\x01\x00\x00"_s + str; + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + auto binary = doc.as(); + REQUIRE(binary.size() == 65536); + REQUIRE(binary.data() != nullptr); + REQUIRE(std::string(reinterpret_cast(binary.data()), + binary.size()) == str); + } + + SECTION("bin 32 serialization") { + auto str = std::string(65536, '?'); + doc.set(MsgPackBinary(str.data(), str.size())); + + std::string output; + auto result = serializeMsgPack(doc, output); + + REQUIRE(result == 5 + str.size()); + REQUIRE(output == "\xc6\x00\x01\x00\x00"_s + str); + } + + SECTION("ext 32 deserialization") { + auto str = std::string(65536, '?'); + auto input = "\xc9\x00\x01\x00\x00\x2a"_s + str; + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.is()); + auto value = doc.as(); + REQUIRE(value.type() == 42); + REQUIRE(value.size() == 65536); + REQUIRE(value.data() != nullptr); + REQUIRE(std::string(reinterpret_cast(value.data()), + value.size()) == str); + } + + SECTION("ext 32 serialization") { + auto str = std::string(65536, '?'); + doc.set(MsgPackExtension(42, str.data(), str.size())); + + std::string output; + auto result = serializeMsgPack(doc, output); + + REQUIRE(result == 6 + str.size()); + REQUIRE(output == "\xc9\x00\x01\x00\x00\x2a"_s + str); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_0.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_0.cpp new file mode 100644 index 00000000..6958bc06 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_0.cpp @@ -0,0 +1,67 @@ +#define ARDUINOJSON_USE_DOUBLE 0 +#include + +#include + +namespace my { +using ArduinoJson::detail::isinf; +} // namespace my + +void checkFloat(const char* input, float expected) { + using ArduinoJson::detail::NumberType; + using ArduinoJson::detail::parseNumber; + CAPTURE(input); + auto result = parseNumber(input); + REQUIRE(result.type() == NumberType::Float); + REQUIRE(result.asFloat() == Approx(expected)); +} + +TEST_CASE("ARDUINOJSON_USE_DOUBLE == 0") { + SECTION("serializeJson()") { + JsonDocument doc; + JsonObject root = doc.to(); + + root["pi"] = 3.14; + root["e"] = 2.72; + + std::string json; + serializeJson(doc, json); + + REQUIRE(json == "{\"pi\":3.14,\"e\":2.72}"); + } + + SECTION("parseNumber()") { + using ArduinoJson::detail::NumberType; + using ArduinoJson::detail::parseNumber; + + SECTION("Large positive number") { + auto result = parseNumber("1e300"); + REQUIRE(result.type() == NumberType::Float); + REQUIRE(result.asFloat() > 0); + REQUIRE(my::isinf(result.asFloat())); + } + + SECTION("Large negative number") { + auto result = parseNumber("-1e300"); + REQUIRE(result.type() == NumberType::Float); + REQUIRE(result.asFloat() < 0); + REQUIRE(my::isinf(result.asFloat())); + } + + SECTION("Too small to be represented") { + auto result = parseNumber("1e-300"); + REQUIRE(result.type() == NumberType::Float); + REQUIRE(result.asFloat() == 0); + } + + SECTION("MantissaTooLongToFit") { + checkFloat("0.340282346638528861111111111111", 0.34028234663852886f); + checkFloat("34028234663852886.11111111111111", 34028234663852886.0f); + checkFloat("34028234.66385288611111111111111", 34028234.663852886f); + + checkFloat("-0.340282346638528861111111111111", -0.34028234663852886f); + checkFloat("-34028234663852886.11111111111111", -34028234663852886.0f); + checkFloat("-34028234.66385288611111111111111", -34028234.663852886f); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_1.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_1.cpp new file mode 100644 index 00000000..15c4849c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_double_1.cpp @@ -0,0 +1,17 @@ +#define ARDUINOJSON_USE_DOUBLE 1 +#include + +#include + +TEST_CASE("ARDUINOJSON_USE_DOUBLE == 1") { + JsonDocument doc; + JsonObject root = doc.to(); + + root["pi"] = 3.14; + root["e"] = 2.72; + + std::string json; + serializeJson(doc, json); + + REQUIRE(json == "{\"pi\":3.14,\"e\":2.72}"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_0.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_0.cpp new file mode 100644 index 00000000..16c07db1 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_0.cpp @@ -0,0 +1,38 @@ +#define ARDUINOJSON_USE_LONG_LONG 0 +#include + +#include + +#include "Literals.hpp" + +TEST_CASE("ARDUINOJSON_USE_LONG_LONG == 0") { + JsonDocument doc; + + SECTION("smoke test") { + doc["A"] = 42; + doc["B"] = 84; + + std::string json; + serializeJson(doc, json); + + REQUIRE(json == "{\"A\":42,\"B\":84}"); + } + + SECTION("deserializeMsgPack()") { + SECTION("cf 00 00 00 00 ff ff ff ff") { + auto err = + deserializeMsgPack(doc, "\xcf\x00\x00\x00\x00\xff\xff\xff\xff"_s); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == 0xFFFFFFFF); + } + + SECTION("cf 00 00 00 01 00 00 00 00") { + auto err = + deserializeMsgPack(doc, "\xcf\x00\x00\x00\x01\x00\x00\x00\x00"_s); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.isNull()); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_1.cpp b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_1.cpp new file mode 100644 index 00000000..a2c4fd8e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_1.cpp @@ -0,0 +1,17 @@ +#define ARDUINOJSON_USE_LONG_LONG 1 +#include + +#include + +TEST_CASE("ARDUINOJSON_USE_LONG_LONG == 1") { + JsonDocument doc; + JsonObject root = doc.to(); + + root["A"] = 123456789123456789; + root["B"] = 987654321987654321; + + std::string json; + serializeJson(doc, json); + + REQUIRE(json == "{\"A\":123456789123456789,\"B\":987654321987654321}"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/CMakeLists.txt new file mode 100644 index 00000000..96b4584c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/CMakeLists.txt @@ -0,0 +1,22 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(MsgPackDeserializerTests + deserializeArray.cpp + deserializeObject.cpp + deserializeVariant.cpp + destination_types.cpp + doubleToFloat.cpp + errors.cpp + filter.cpp + input_types.cpp + nestingLimit.cpp +) + +add_test(MsgPackDeserializer MsgPackDeserializerTests) + +set_tests_properties(MsgPackDeserializer + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeArray.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeArray.cpp new file mode 100644 index 00000000..9aef088c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeArray.cpp @@ -0,0 +1,83 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("deserialize MsgPack array") { + JsonDocument doc; + + SECTION("fixarray") { + SECTION("empty") { + const char* input = "\x90"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonArray array = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(array.size() == 0); + } + + SECTION("two integers") { + const char* input = "\x92\x01\x02"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonArray array = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(array.size() == 2); + REQUIRE(array[0] == 1); + REQUIRE(array[1] == 2); + } + } + + SECTION("array 16") { + SECTION("empty") { + const char* input = "\xDC\x00\x00"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonArray array = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(array.size() == 0); + } + + SECTION("two strings") { + const char* input = "\xDC\x00\x02\xA5hello\xA5world"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonArray array = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(array.size() == 2); + REQUIRE(array[0] == "hello"); + REQUIRE(array[1] == "world"); + } + } + + SECTION("array 32") { + SECTION("empty") { + const char* input = "\xDD\x00\x00\x00\x00"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonArray array = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(array.size() == 0); + } + + SECTION("two floats") { + const char* input = + "\xDD\x00\x00\x00\x02\xCA\x00\x00\x00\x00\xCA\x40\x48\xF5\xC3"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonArray array = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(array.size() == 2); + REQUIRE(array[0] == 0.0f); + REQUIRE(array[1] == 3.14f); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeObject.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeObject.cpp new file mode 100644 index 00000000..75266f29 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeObject.cpp @@ -0,0 +1,130 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("deserialize MsgPack object") { + JsonDocument doc; + + SECTION("fixmap") { + SECTION("empty") { + const char* input = "\x80"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonObject obj = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 0); + } + + SECTION("two integers") { + const char* input = "\x82\xA3one\x01\xA3two\x02"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonObject obj = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["one"] == 1); + REQUIRE(obj["two"] == 2); + } + + SECTION("key is str 8") { + const char* input = "\x82\xd9\x03one\x01\xd9\x03two\x02"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonObject obj = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["one"] == 1); + REQUIRE(obj["two"] == 2); + } + + SECTION("key is str 16") { + const char* input = "\x82\xda\x00\x03one\x01\xda\x00\x03two\x02"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonObject obj = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["one"] == 1); + REQUIRE(obj["two"] == 2); + } + + SECTION("key is str 32") { + const char* input = + "\x82\xdb\x00\x00\x00\x03one\x01\xdb\x00\x00\x00\x03two\x02"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonObject obj = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["one"] == 1); + REQUIRE(obj["two"] == 2); + } + } + + SECTION("map 16") { + SECTION("empty") { + const char* input = "\xDE\x00\x00"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonObject obj = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 0); + } + + SECTION("two strings") { + const char* input = "\xDE\x00\x02\xA1H\xA5hello\xA1W\xA5world"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonObject obj = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["H"] == "hello"); + REQUIRE(obj["W"] == "world"); + } + } + + SECTION("map 32") { + SECTION("empty") { + const char* input = "\xDF\x00\x00\x00\x00"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonObject obj = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 0); + } + + SECTION("two floats") { + const char* input = + "\xDF\x00\x00\x00\x02\xA4zero\xCA\x00\x00\x00\x00\xA2pi\xCA\x40\x48" + "\xF5\xC3"; + + DeserializationError error = deserializeMsgPack(doc, input); + JsonObject obj = doc.as(); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(obj.size() == 2); + REQUIRE(obj["zero"] == 0.0f); + REQUIRE(obj["pi"] == 3.14f); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeVariant.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeVariant.cpp new file mode 100644 index 00000000..24f36c41 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/deserializeVariant.cpp @@ -0,0 +1,392 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +template +static void checkValue(const char* input, T expected) { + JsonDocument doc; + + DeserializationError error = deserializeMsgPack(doc, input); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + REQUIRE(doc.as() == expected); +} + +static void checkError(size_t timebombCountDown, const char* input, + DeserializationError expected) { + TimebombAllocator timebomb(timebombCountDown); + JsonDocument doc(&timebomb); + + DeserializationError error = deserializeMsgPack(doc, input); + + CAPTURE(input); + REQUIRE(error == expected); +} + +TEST_CASE("deserialize MsgPack value") { + SECTION("nil") { + checkValue("\xc0", nullptr); + } + + SECTION("bool") { + checkValue("\xc2", false); + checkValue("\xc3", true); + } + + SECTION("positive fixint") { + checkValue("\x00", 0); + checkValue("\x7F", 127); + } + + SECTION("negative fixint") { + checkValue("\xe0", -32); + checkValue("\xff", -1); + } + + SECTION("uint 8") { + checkValue("\xcc\x00", 0); + checkValue("\xcc\xff", 255); + } + + SECTION("uint 16") { + checkValue("\xcd\x00\x00", 0); + checkValue("\xcd\xFF\xFF", 65535); + checkValue("\xcd\x30\x39", 12345); + } + + SECTION("uint 32") { + checkValue("\xCE\x00\x00\x00\x00", 0x00000000U); + checkValue("\xCE\xFF\xFF\xFF\xFF", 0xFFFFFFFFU); + checkValue("\xCE\x12\x34\x56\x78", 0x12345678U); + } + + SECTION("uint 64") { +#if ARDUINOJSON_USE_LONG_LONG + checkValue("\xCF\x00\x00\x00\x00\x00\x00\x00\x00", 0U); + checkValue("\xCF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", + 0xFFFFFFFFFFFFFFFFU); + checkValue("\xCF\x12\x34\x56\x78\x9A\xBC\xDE\xF0", + 0x123456789ABCDEF0U); +#else + checkValue("\xCF\x00\x00\x00\x00\x00\x00\x00\x00", nullptr); + checkValue("\xCF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", nullptr); + checkValue("\xCF\x12\x34\x56\x78\x9A\xBC\xDE\xF0", nullptr); +#endif + } + + SECTION("int 8") { + checkValue("\xd0\x00", 0); + checkValue("\xd0\xff", -1); + } + + SECTION("int 16") { + checkValue("\xD1\x00\x00", 0); + checkValue("\xD1\xFF\xFF", -1); + checkValue("\xD1\xCF\xC7", -12345); + } + + SECTION("int 32") { + checkValue("\xD2\x00\x00\x00\x00", 0); + checkValue("\xD2\xFF\xFF\xFF\xFF", -1); + checkValue("\xD2\xB6\x69\xFD\x2E", -1234567890); + } + + SECTION("int 64") { +#if ARDUINOJSON_USE_LONG_LONG + checkValue("\xD3\x00\x00\x00\x00\x00\x00\x00\x00", int64_t(0U)); + checkValue("\xD3\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", + int64_t(0xFFFFFFFFFFFFFFFFU)); + checkValue("\xD3\x12\x34\x56\x78\x9A\xBC\xDE\xF0", + int64_t(0x123456789ABCDEF0)); +#else + checkValue("\xD3\x00\x00\x00\x00\x00\x00\x00\x00", nullptr); + checkValue("\xD3\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", nullptr); + checkValue("\xD3\x12\x34\x56\x78\x9A\xBC\xDE\xF0", nullptr); +#endif + } + + SECTION("float 32") { + checkValue("\xCA\x00\x00\x00\x00", 0.0f); + checkValue("\xCA\x40\x48\xF5\xC3", 3.14f); + } + + SECTION("float 64") { + checkValue("\xCB\x00\x00\x00\x00\x00\x00\x00\x00", 0.0); + checkValue("\xCB\x40\x09\x21\xCA\xC0\x83\x12\x6F", 3.1415); + } + + SECTION("fixstr") { + checkValue("\xA0", std::string("")); + checkValue("\xABhello world", "hello world"_s); + checkValue("\xBFhello world hello world hello !", + "hello world hello world hello !"_s); + } + + SECTION("str 8") { + checkValue("\xd9\x05hello", "hello"_s); + } + + SECTION("str 16") { + checkValue("\xda\x00\x05hello", "hello"_s); + } + + SECTION("str 32") { + checkValue("\xdb\x00\x00\x00\x05hello", "hello"_s); + } + + SECTION("bin 8") { + JsonDocument doc; + + DeserializationError error = deserializeMsgPack(doc, "\xc4\x01?"); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + auto binary = doc.as(); + REQUIRE(binary.size() == 1); + REQUIRE(binary.data() != nullptr); + REQUIRE(reinterpret_cast(binary.data())[0] == '?'); + } + + SECTION("bin 16") { + JsonDocument doc; + auto str = std::string(256, '?'); + auto input = "\xc5\x01\x00"_s + str; + + DeserializationError error = deserializeMsgPack(doc, input); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + auto binary = doc.as(); + REQUIRE(binary.size() == 0x100); + REQUIRE(binary.data() != nullptr); + REQUIRE(std::string(reinterpret_cast(binary.data()), + binary.size()) == str); + } + + SECTION("fixext 1") { + JsonDocument doc; + + auto error = deserializeMsgPack(doc, "\xd4\x01\x02"); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + auto ext = doc.as(); + REQUIRE(ext.type() == 1); + REQUIRE(ext.size() == 1); + auto data = reinterpret_cast(ext.data()); + REQUIRE(data[0] == 2); + } + + SECTION("fixext 2") { + JsonDocument doc; + + auto error = deserializeMsgPack(doc, "\xd5\x01\x02\x03"); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + auto ext = doc.as(); + REQUIRE(ext.type() == 1); + REQUIRE(ext.size() == 2); + auto data = reinterpret_cast(ext.data()); + REQUIRE(data[0] == 2); + REQUIRE(data[1] == 3); + } + + SECTION("fixext 4") { + JsonDocument doc; + + auto error = deserializeMsgPack(doc, "\xd6\x01\x02\x03\x04\x05"); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + auto ext = doc.as(); + REQUIRE(ext.type() == 1); + REQUIRE(ext.size() == 4); + auto data = reinterpret_cast(ext.data()); + REQUIRE(data[0] == 2); + REQUIRE(data[1] == 3); + REQUIRE(data[2] == 4); + REQUIRE(data[3] == 5); + } + + SECTION("fixext 8") { + JsonDocument doc; + + auto error = deserializeMsgPack(doc, "\xd7\x01????????"); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + auto ext = doc.as(); + REQUIRE(ext.type() == 1); + REQUIRE(ext.size() == 8); + auto data = reinterpret_cast(ext.data()); + REQUIRE(data[0] == '?'); + REQUIRE(data[7] == '?'); + } + + SECTION("fixext 16") { + JsonDocument doc; + + auto error = deserializeMsgPack(doc, "\xd8\x01?????????????????"); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + auto ext = doc.as(); + REQUIRE(ext.type() == 1); + REQUIRE(ext.size() == 16); + auto data = reinterpret_cast(ext.data()); + REQUIRE(data[0] == '?'); + REQUIRE(data[15] == '?'); + } + + SECTION("ext 8") { + JsonDocument doc; + + auto error = deserializeMsgPack(doc, "\xc7\x02\x01\x03\x04"); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + auto ext = doc.as(); + REQUIRE(ext.type() == 1); + REQUIRE(ext.size() == 2); + auto data = reinterpret_cast(ext.data()); + REQUIRE(data[0] == 3); + REQUIRE(data[1] == 4); + } + + SECTION("ext 16") { + JsonDocument doc; + + auto error = deserializeMsgPack(doc, "\xc8\x00\x02\x01\x03\x04"); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + auto ext = doc.as(); + REQUIRE(ext.type() == 1); + REQUIRE(ext.size() == 2); + auto data = reinterpret_cast(ext.data()); + REQUIRE(data[0] == 3); + REQUIRE(data[1] == 4); + } + + SECTION("ext 32") { + JsonDocument doc; + + auto error = deserializeMsgPack(doc, "\xc9\x00\x00\x00\x02\x01\x03\x04"); + + REQUIRE(error == DeserializationError::Ok); + REQUIRE(doc.is()); + auto ext = doc.as(); + REQUIRE(ext.type() == 1); + REQUIRE(ext.size() == 2); + auto data = reinterpret_cast(ext.data()); + REQUIRE(data[0] == 3); + REQUIRE(data[1] == 4); + } +} + +TEST_CASE("deserializeMsgPack() under memory constaints") { + SECTION("single values always fit") { + checkError(0, "\xc0", DeserializationError::Ok); // nil + checkError(0, "\xc2", DeserializationError::Ok); // false + checkError(0, "\xc3", DeserializationError::Ok); // true + checkError(0, "\xcc\x00", DeserializationError::Ok); // uint 8 + checkError(0, "\xcd\x30\x39", DeserializationError::Ok); // uint 16 + checkError(0, "\xCE\x12\x34\x56\x78", + DeserializationError::Ok); // uint 32 + } + + SECTION("fixstr") { + checkError(2, "\xA7ZZZZZZZ", DeserializationError::Ok); + checkError(0, "\xA7ZZZZZZZ", DeserializationError::NoMemory); + } + + SECTION("str 8") { + checkError(2, "\xD9\x07ZZZZZZZ", DeserializationError::Ok); + checkError(0, "\xD9\x07ZZZZZZZ", DeserializationError::NoMemory); + } + + SECTION("str 16") { + checkError(2, "\xDA\x00\x07ZZZZZZZ", DeserializationError::Ok); + checkError(0, "\xDA\x00\x07ZZZZZZZ", DeserializationError::NoMemory); + } + + SECTION("str 32") { + checkError(2, "\xDB\x00\x00\x00\x07ZZZZZZZ", DeserializationError::Ok); + checkError(0, "\xDB\x00\x00\x00\x07ZZZZZZZ", + DeserializationError::NoMemory); + } + + SECTION("fixarray") { + checkError(0, "\x90", DeserializationError::Ok); // [] + checkError(0, "\x91\x01", + DeserializationError::NoMemory); // [1] + checkError(1, "\x91\x01", + DeserializationError::Ok); // [1] + } + + SECTION("array 16") { + checkError(0, "\xDC\x00\x00", DeserializationError::Ok); + checkError(0, "\xDC\x00\x01\x01", DeserializationError::NoMemory); + checkError(1, "\xDC\x00\x01\x01", DeserializationError::Ok); + } + + SECTION("array 32") { + checkError(0, "\xDD\x00\x00\x00\x00", DeserializationError::Ok); + checkError(0, "\xDD\x00\x00\x00\x01\x01", DeserializationError::NoMemory); + checkError(1, "\xDD\x00\x00\x00\x01\x01", DeserializationError::Ok); + } + + SECTION("fixmap") { + SECTION("{}") { + checkError(0, "\x80", DeserializationError::Ok); + } + SECTION("{H:1}") { + checkError(1, "\x81\xA1H\x01", DeserializationError::NoMemory); + checkError(2, "\x81\xA1H\x01", DeserializationError::Ok); + } + SECTION("{H:1,W:2}") { + checkError(2, "\x82\xA1H\x01\xA1W\x02", DeserializationError::NoMemory); + checkError(3, "\x82\xA1H\x01\xA1W\x02", DeserializationError::Ok); + } + } + + SECTION("map 16") { + SECTION("{}") { + checkError(0, "\xDE\x00\x00", DeserializationError::Ok); + } + SECTION("{H:1}") { + checkError(1, "\xDE\x00\x01\xA1H\x01", DeserializationError::NoMemory); + checkError(2, "\xDE\x00\x01\xA1H\x01", DeserializationError::Ok); + } + SECTION("{H:1,W:2}") { + checkError(2, "\xDE\x00\x02\xA1H\x01\xA1W\x02", + DeserializationError::NoMemory); + checkError(3, "\xDE\x00\x02\xA1H\x01\xA1W\x02", DeserializationError::Ok); + } + } + + SECTION("map 32") { + SECTION("{}") { + checkError(0, "\xDF\x00\x00\x00\x00", DeserializationError::Ok); + } + SECTION("{H:1}") { + checkError(1, "\xDF\x00\x00\x00\x01\xA1H\x01", + DeserializationError::NoMemory); + checkError(2, "\xDF\x00\x00\x00\x01\xA1H\x01", DeserializationError::Ok); + } + SECTION("{H:1,W:2}") { + checkError(2, "\xDF\x00\x00\x00\x02\xA1H\x01\xA1W\x02", + DeserializationError::NoMemory); + checkError(3, "\xDF\x00\x00\x00\x02\xA1H\x01\xA1W\x02", + DeserializationError::Ok); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/destination_types.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/destination_types.cpp new file mode 100644 index 00000000..6b437ec7 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/destination_types.cpp @@ -0,0 +1,109 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +#include +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofArray; +using ArduinoJson::detail::sizeofObject; + +TEST_CASE("deserializeMsgPack(JsonDocument&)") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc.add("hello"_s); + spy.clearLog(); + + auto err = deserializeMsgPack(doc, "\x91\x2A"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "[42]"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofPool()), + Deallocate(sizeofString("hello")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofArray(1)), + }); +} + +TEST_CASE("deserializeMsgPack(JsonVariant)") { + SECTION("variant is bound") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc.add("hello"_s); + spy.clearLog(); + + JsonVariant variant = doc[0]; + + auto err = deserializeMsgPack(variant, "\x91\x2A"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "[[42]]"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("hello")), + }); + } + + SECTION("variant is unbound") { + JsonVariant variant; + + auto err = deserializeMsgPack(variant, "\x91\x2A"); + + REQUIRE(err == DeserializationError::NoMemory); + } +} + +TEST_CASE("deserializeMsgPack(ElementProxy)") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc.add("hello"_s); + spy.clearLog(); + + SECTION("element already exists") { + auto err = deserializeMsgPack(doc[0], "\x91\x2A"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "[[42]]"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("hello")), + }); + } + + SECTION("element must be created exists") { + auto err = deserializeMsgPack(doc[1], "\x91\x2A"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "[\"hello\",[42]]"); + REQUIRE(spy.log() == AllocatorLog{}); + } +} + +TEST_CASE("deserializeMsgPack(MemberProxy)") { + SpyingAllocator spy; + JsonDocument doc(&spy); + doc["hello"_s] = "world"_s; + spy.clearLog(); + + SECTION("member already exists") { + auto err = deserializeMsgPack(doc["hello"], "\x91\x2A"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "{\"hello\":[42]}"); + REQUIRE(spy.log() == AllocatorLog{ + Deallocate(sizeofString("world")), + }); + } + + SECTION("member must be created") { + auto err = deserializeMsgPack(doc["value"], "\x91\x2A"); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.as() == "{\"hello\":\"world\",\"value\":[42]}"); + REQUIRE(spy.log() == AllocatorLog{}); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/doubleToFloat.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/doubleToFloat.cpp new file mode 100644 index 00000000..6eadd0ee --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/doubleToFloat.cpp @@ -0,0 +1,25 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +using namespace ArduinoJson::detail; + +template +static void check(const char* input, T expected) { + T actual; + uint8_t* f = reinterpret_cast(&actual); + const uint8_t* d = reinterpret_cast(input); + doubleToFloat(d, f); + fixEndianness(actual); + CHECK(actual == expected); +} + +TEST_CASE("doubleToFloat()") { + check("\x40\x09\x21\xCA\xC0\x83\x12\x6F", 3.1415f); + check("\x00\x00\x00\x00\x00\x00\x00\x00", 0.0f); + check("\x80\x00\x00\x00\x00\x00\x00\x00", -0.0f); + check("\xC0\x5E\xDC\xCC\xCC\xCC\xCC\xCD", -123.45f); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/errors.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/errors.cpp new file mode 100644 index 00000000..9a8119e2 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/errors.cpp @@ -0,0 +1,242 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +#include "Allocators.hpp" + +TEST_CASE("deserializeMsgPack() returns InvalidInput") { + JsonDocument doc; + + SECTION("integer as key") { + auto err = deserializeMsgPack(doc, "\x81\x01\xA1H", 3); + REQUIRE(err == DeserializationError::InvalidInput); + } +} + +TEST_CASE("deserializeMsgPack() returns EmptyInput") { + JsonDocument doc; + + SECTION("from sized buffer") { + auto err = deserializeMsgPack(doc, "", 0); + + REQUIRE(err == DeserializationError::EmptyInput); + } + + SECTION("from stream") { + std::istringstream input(""); + + auto err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::EmptyInput); + } +} + +static void testIncompleteInput(const char* input, size_t len) { + JsonDocument doc; + REQUIRE(deserializeMsgPack(doc, input, len) == DeserializationError::Ok); + + while (--len) { + REQUIRE(deserializeMsgPack(doc, input, len) == + DeserializationError::IncompleteInput); + } +} + +TEST_CASE("deserializeMsgPack() returns IncompleteInput") { + SECTION("empty input") { + testIncompleteInput("\x00", 1); + } + + SECTION("fixarray") { + testIncompleteInput("\x91\x01", 2); + } + + SECTION("array 16") { + testIncompleteInput("\xDC\x00\x01\x01", 4); + } + + SECTION("array 32") { + testIncompleteInput("\xDD\x00\x00\x00\x01\x01", 6); + } + + SECTION("fixmap") { + testIncompleteInput("\x81\xA3one\x01", 6); + } + + SECTION("map 16") { + testIncompleteInput("\xDE\x00\x01\xA3one\x01", 8); + } + + SECTION("map 32") { + testIncompleteInput("\xDF\x00\x00\x00\x01\xA3one\x01", 10); + testIncompleteInput("\xDF\x00\x00\x00\x01\xd9\x03one\x01", 11); + } + + SECTION("uint 8") { + testIncompleteInput("\xcc\x01", 2); + } + + SECTION("uint 16") { + testIncompleteInput("\xcd\x00\x01", 3); + } + + SECTION("uint 32") { + testIncompleteInput("\xCE\x00\x00\x00\x01", 5); + } + +#if ARDUINOJSON_USE_LONG_LONG + SECTION("uint 64") { + testIncompleteInput("\xCF\x00\x00\x00\x00\x00\x00\x00\x00", 9); + } +#endif + + SECTION("int 8") { + testIncompleteInput("\xD0\x01", 2); + } + + SECTION("int 16") { + testIncompleteInput("\xD1\x00\x01", 3); + } + + SECTION("int 32") { + testIncompleteInput("\xD2\x00\x00\x00\x01", 5); + } + +#if ARDUINOJSON_USE_LONG_LONG + SECTION("int 64") { + testIncompleteInput("\xD3\x00\x00\x00\x00\x00\x00\x00\x00", 9); + } +#endif + + SECTION("float 32") { + testIncompleteInput("\xCA\x40\x48\xF5\xC3", 5); + } + + SECTION("float 64") { + testIncompleteInput("\xCB\x40\x09\x21\xCA\xC0\x83\x12\x6F", 9); + } + + SECTION("fixstr") { + testIncompleteInput("\xABhello world", 12); + } + + SECTION("str 8") { + testIncompleteInput("\xd9\x05hello", 7); + } + + SECTION("str 16") { + testIncompleteInput("\xda\x00\x05hello", 8); + } + + SECTION("str 32") { + testIncompleteInput("\xdb\x00\x00\x00\x05hello", 10); + } + + SECTION("bin 8") { + testIncompleteInput("\xc4\x01X", 3); + } + + SECTION("bin 16") { + testIncompleteInput("\xc5\x00\x01X", 4); + } + + SECTION("bin 32") { + testIncompleteInput("\xc6\x00\x00\x00\x01X", 6); + } + + SECTION("ext 8") { + testIncompleteInput("\xc7\x01\x01\x01", 4); + } + + SECTION("ext 16") { + testIncompleteInput("\xc8\x00\x01\x01\x01", 5); + } + + SECTION("ext 32") { + testIncompleteInput("\xc9\x00\x00\x00\x01\x01\x01", 7); + } + + SECTION("fixext 1") { + testIncompleteInput("\xd4\x01\x01", 3); + } + + SECTION("fixext 2") { + testIncompleteInput("\xd5\x01\x01\x02", 4); + } + + SECTION("fixext 4") { + testIncompleteInput("\xd6\x01\x01\x02\x03\x04", 6); + } + + SECTION("fixext 8") { + testIncompleteInput("\xd7\x01\x01\x02\x03\x04\x05\x06\x07\x08", 10); + } + + SECTION("fixext 16") { + testIncompleteInput( + "\xd8\x01\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E" + "\x0F\x10", + 18); + } +} + +TEST_CASE( + "deserializeMsgPack() returns NoMemory when string allocation fails") { + TimebombAllocator allocator(0); + JsonDocument doc(&allocator); + + SECTION("fixstr") { + DeserializationError err = deserializeMsgPack(doc, "\xA5hello", 9); + REQUIRE(err == DeserializationError::NoMemory); + } + + SECTION("bin 8") { + DeserializationError err = deserializeMsgPack(doc, "\xC4\x01X", 3); + REQUIRE(err == DeserializationError::NoMemory); + } +} + +TEST_CASE( + "deserializeMsgPack() returns NoMemory if extension allocation fails") { + JsonDocument doc(FailingAllocator::instance()); + + SECTION("uint32_t should pass") { + auto err = deserializeMsgPack(doc, "\xceXXXX"); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("uint64_t should fail") { + auto err = deserializeMsgPack(doc, "\xcfXXXXXXXX"); + + REQUIRE(err == DeserializationError::NoMemory); + } + + SECTION("int32_t should pass") { + auto err = deserializeMsgPack(doc, "\xd2XXXX"); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("int64_t should fail") { + auto err = deserializeMsgPack(doc, "\xd3XXXXXXXX"); + + REQUIRE(err == DeserializationError::NoMemory); + } + + SECTION("float should pass") { + auto err = deserializeMsgPack(doc, "\xcaXXXX"); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("double should fail") { + auto err = deserializeMsgPack(doc, "\xcbXXXXXXXX"); + + REQUIRE(err == DeserializationError::NoMemory); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/filter.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/filter.cpp new file mode 100644 index 00000000..6bcd7b1c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/filter.cpp @@ -0,0 +1,1628 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +#include "Allocators.hpp" +#include "Literals.hpp" + +using namespace ArduinoJson::detail; + +TEST_CASE("deserializeMsgPack() filter") { + SpyingAllocator spy; + JsonDocument doc(&spy); + DeserializationError error; + + JsonDocument filter; + DeserializationOption::Filter filterOpt(filter); + + SECTION("root is fixmap") { + SECTION("filter = {include:true,ignore:false)") { + filter["include"] = true; + filter["ignore"] = false; + + SECTION("input truncated after ignored key") { + error = deserializeMsgPack(doc, "\x82\xA6ignore", 8, filterOpt); + + CHECK(error == DeserializationError::IncompleteInput); + CHECK(doc.as() == "{}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + }); + } + + SECTION("input truncated after inside skipped uint 8") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\xCC\x2A\xA7include\x2A", + 9, filterOpt); + + CHECK(error == DeserializationError::IncompleteInput); + CHECK(doc.as() == "{}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + }); + } + + SECTION("input truncated after before skipped string size") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\xd9", 9, filterOpt); + + CHECK(error == DeserializationError::IncompleteInput); + CHECK(doc.as() == "{}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + }); + } + + SECTION("input truncated after before skipped ext size") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\xC7", 9, filterOpt); + + CHECK(error == DeserializationError::IncompleteInput); + CHECK(doc.as() == "{}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + }); + } + + SECTION("skip nil") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\xC0\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("reject 0xc1") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\xC1\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::InvalidInput); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + }); + } + + SECTION("skip false") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\xC2\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip true") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\xC3\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip positive fixint") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\x2A\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip negative fixint") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\xFF\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip uint 8") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\xCC\x2A\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip int 8") { + error = deserializeMsgPack(doc, "\x82\xA6ignore\xD0\x2A\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip uint 16") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xcd\x30\x39\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip int 16") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xD1\xCF\xC7\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip uint 32") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xCE\x12\x34\x56\x78\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip int 32") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xD2\xB6\x69\xFD\x2E\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip uint 64") { + error = deserializeMsgPack( + doc, + "\x82\xA6ignore\xCF\x12\x34\x56\x78\x9A\xBC\xDE\xF0\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip int 64") { + error = deserializeMsgPack( + doc, + "\x82\xA6ignore\xD3\x12\x34\x56\x78\x9A\xBC\xDE\xF0\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip float 32") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xCA\x40\x48\xF5\xC3\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip float 64") { + error = deserializeMsgPack( + doc, + "\x82\xA6ignore\xCB\x40\x09\x21\xCA\xC0\x83\x12\x6F\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip fixstr") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xABhello world\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip str 8") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xd9\x05hello\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip str 16") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xda\x00\x05hello\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip str 32") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xdb\x00\x00\x00\x05hello\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip bin 8") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xC4\x05hello\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip bin 16") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xC5\x00\x05hello\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip bin 32") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xC6\x00\x00\x00\x05hello\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip fixarray") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\x92\x01\x02\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip array 16") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\xDC\x00\x02\xA5hello\xA5world\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip array 32") { + error = deserializeMsgPack( + doc, + "\x82\xA6ignore" + "\xDD\x00\x00\x00\x02\xCA\x00\x00\x00\x00\xCA\x40\x48\xF5\xC3" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip fixmap") { + error = deserializeMsgPack( + doc, "\x82\xA6ignore\x82\xA3one\x01\xA3two\x02\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip map 16") { + error = deserializeMsgPack(doc, + "\x82\xA6ignore" + "\xDE\x00\x02\xA1H\xA5hello\xA1W\xA5world" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip map 32") { + error = deserializeMsgPack(doc, + "\x82\xA6ignore" + "\xDF\x00\x00\x00\x02" + "\xA4zero\xCA\x00\x00\x00\x00" + "\xA2pi\xCA\x40\x48\xF5\xC3" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip fixext 1") { + error = deserializeMsgPack(doc, + "\x82\xA6ignore" + "\xd4\x01\x02" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip fixext 2") { + error = deserializeMsgPack(doc, + "\x82\xA6ignore" + "\xd5\x01\x02\x03" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip fixext 4") { + error = deserializeMsgPack(doc, + "\x82\xA6ignore" + "\xd6\x01\x02\x03\x04\x05" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip fixext 8") { + error = deserializeMsgPack(doc, + "\x82\xA6ignore" + "\xd7\x01\x02\x03\x04\x05\x06\x07\x08\x09" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip fixext 16") { + error = + deserializeMsgPack(doc, + "\x82\xA6ignore" + "\xd8\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A" + "\x0B\x0C\x0D\x0E\x0F\x10\x11" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip ext 8") { + error = deserializeMsgPack(doc, + "\x82\xA6ignore" + "\xc7\x02\x00\x01\x02" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip ext 16") { + error = deserializeMsgPack(doc, + "\x82\xA6ignore" + "\xc8\x00\x02\x00\x01\x02" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + + SECTION("skip ext 32") { + error = deserializeMsgPack(doc, + "\x82\xA6ignore" + "\xc9\x00\x00\x00\x02\x00\x01\x02" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("ignore")), + Deallocate(sizeofString("ignore")), + Allocate(sizeofString("include")), + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofObject(1)), + }); + } + } + + SECTION("Filter = {arronly:[{measure:true}],include:true}") { + filter["onlyarr"][0]["measure"] = true; + filter["include"] = true; + + CAPTURE(filter.as()); + + SECTION("include fixarray") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyarr\x92" + "\x82\xA8location\x01\xA7measure\x02" + "\x82\xA8location\x02\xA7measure\x04" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == + "{\"onlyarr\":[{\"measure\":2},{\"measure\":4}],\"include\":42}"); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("location")), + Reallocate(sizeofString("location"), sizeofString("measure")), + Allocate(sizeofString("location")), + Reallocate(sizeofString("location"), sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2) + sizeofArray(2) + + 2 * sizeofObject(1)), + }); + } + + SECTION("include array 16") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyarr" + "\xDC\x00\x02" + "\x82\xA8location\x01\xA7measure\x02" + "\x82\xA8location\x02\xA7measure\x04" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == + "{\"onlyarr\":[{\"measure\":2},{\"measure\":4}],\"include\":42}"); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("location")), + Reallocate(sizeofString("location"), sizeofString("measure")), + Allocate(sizeofString("location")), + Reallocate(sizeofString("location"), sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2) + sizeofArray(2) + + 2 * sizeofObject(1)), + }); + } + + SECTION("include array 32") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyarr" + "\xDD\x00\x00\x00\x02" + "\x82\xA8location\x01\xA7measure\x02" + "\x82\xA8location\x02\xA7measure\x04" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == + "{\"onlyarr\":[{\"measure\":2},{\"measure\":4}],\"include\":42}"); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("location")), + Reallocate(sizeofString("location"), sizeofString("measure")), + Allocate(sizeofString("location")), + Reallocate(sizeofString("location"), sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2) + sizeofArray(2) + + 2 * sizeofObject(1)), + }); + } + + SECTION("skip null") { + error = deserializeMsgPack(doc, "\x82\xA7onlyarr\xC0\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip false") { + error = deserializeMsgPack(doc, "\x82\xA7onlyarr\xC2\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip true") { + error = deserializeMsgPack(doc, "\x82\xA7onlyarr\xC3\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip positive fixint") { + error = deserializeMsgPack(doc, "\x82\xA7onlyarr\x2A\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip negative fixint") { + error = deserializeMsgPack(doc, "\x82\xA7onlyarr\xFF\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip uint 8") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xCC\x2A\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip uint 16") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xcd\x30\x39\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip uint 32") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xCE\x12\x34\x56\x78\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip uint 64") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyarr\xCF\x12\x34\x56\x78\x9A\xBC" + "\xDE\xF0\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip int 8") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xD0\x2A\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip int 16") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xD1\xCF\xC7\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip int 32") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xD2\xB6\x69\xFD\x2E\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip int 64") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyarr\xD3\x12\x34\x56\x78\x9A\xBC" + "\xDE\xF0\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip float 32") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xCA\x40\x48\xF5\xC3\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip float 64") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyarr\xCB\x40\x09\x21\xCA\xC0\x83" + "\x12\x6F\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip fixstr") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xABhello world\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip str 8") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xd9\x05hello\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + } + + SECTION("skip str 16") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xda\x00\x05hello\xA7include\x2A", filterOpt); + + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + } + + SECTION("skip str 32") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\xdb\x00\x00\x00\x05hello\xA7include\x2A", + filterOpt); + + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip fixmap") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyarr\x82\xA3one\x01\xA3two\x02\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("one")), + Deallocate(sizeofString("one")), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip map 16") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyarr" + "\xDE\x00\x02\xA1H\xA5hello\xA1W\xA5world" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("H")), + Deallocate(sizeofString("H")), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip map 32") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyarr" + "\xDF\x00\x00\x00\x02" + "\xA4zero\xCA\x00\x00\x00\x00" + "\xA2pi\xCA\x40\x48\xF5\xC3" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyarr\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("zero")), + Deallocate(sizeofString("zero")), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + } + } + + SECTION("root is fixarray") { + SECTION("filter = [false, true]") { + filter[0] = false; // only the first elment of the filter matters + filter[1] = true; // so this one is ignored + + SECTION("input = [1,2,3]") { + error = deserializeMsgPack(doc, "\x93\x01\x02\x03", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "[]"); + CHECK(spy.log() == AllocatorLog()); + } + } + + SECTION("filter = [true, false]") { + filter[0] = true; // only the first elment of the filter matters + filter[1] = false; // so this one is ignored + + SECTION("input = [1,2,3]") { + error = deserializeMsgPack(doc, "\x93\x01\x02\x03", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "[1,2,3]"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofArray(3)), + }); + } + } + } + + SECTION("Filter = {onlyobj:{measure:true},include:true}") { + filter["onlyobj"]["measure"] = true; + filter["include"] = true; + + CAPTURE(filter.as()); + + SECTION("include fixmap") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyobj" + "\x82\xA8location\x01\xA7measure\x02" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == + "{\"onlyobj\":{\"measure\":2},\"include\":42}"); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofString("onlyobj")), + Allocate(sizeofPool()), + Allocate(sizeofString("location")), + Reallocate(sizeofString("location"), sizeofString("measure")), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2) + sizeofObject(1)), + }); + } + + SECTION("include map 16") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyobj" + "\xDE\x00\x02\xA8location\x01\xA7measure\x02" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == + "{\"onlyobj\":{\"measure\":2},\"include\":42}"); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofString("onlyobj")), + Allocate(sizeofPool()), + Allocate(sizeofString("location")), + Reallocate(sizeofString("location"), sizeofString("measure")), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2) + sizeofObject(1)), + }); + } + + SECTION("include map 32") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyobj" + "\xDF\x00\x00\x00\x02" + "\xA8location\x01\xA7measure\x02" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == + "{\"onlyobj\":{\"measure\":2},\"include\":42}"); + CHECK(spy.log() == + AllocatorLog{ + Allocate(sizeofString("onlyobj")), + Allocate(sizeofPool()), + Allocate(sizeofString("location")), + Reallocate(sizeofString("location"), sizeofString("measure")), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2) + sizeofObject(1)), + }); + } + + SECTION("skip null") { + error = deserializeMsgPack(doc, "\x82\xA7onlyobj\xC0\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip false") { + error = deserializeMsgPack(doc, "\x82\xA7onlyobj\xC2\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip true") { + error = deserializeMsgPack(doc, "\x82\xA7onlyobj\xC3\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip positive fixint") { + error = deserializeMsgPack(doc, "\x82\xA7onlyobj\x2A\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip negative fixint") { + error = deserializeMsgPack(doc, "\x82\xA7onlyobj\xFF\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip uint 8") { + error = deserializeMsgPack(doc, "\x82\xA7onlyobj\xCC\x2A\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip uint 16") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyobj\xcd\x30\x39\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip uint 32") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyobj\xCE\x12\x34\x56\x78\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip uint 64") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyobj\xCF\x12\x34\x56\x78\x9A\xBC" + "\xDE\xF0\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip int 8") { + error = deserializeMsgPack(doc, "\x82\xA7onlyobj\xD0\x2A\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip int 16") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyobj\xD1\xCF\xC7\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip int 32") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyobj\xD2\xB6\x69\xFD\x2E\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip int 64") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyobj\xD3\x12\x34\x56\x78\x9A\xBC" + "\xDE\xF0\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip float 32") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyobj\xCA\x40\x48\xF5\xC3\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip float 64") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyobj\xCB\x40\x09\x21\xCA\xC0\x83" + "\x12\x6F\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip fixstr") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyobj\xABhello world\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip str 8") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyobj\xd9\x05hello\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + } + + SECTION("skip str 16") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyobj\xda\x00\x05hello\xA7include\x2A", filterOpt); + + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + } + + SECTION("skip str 32") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyobj\xdb\x00\x00\x00\x05hello\xA7include\x2A", + filterOpt); + + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip fixarray") { + error = deserializeMsgPack( + doc, "\x82\xA7onlyobj\x92\x01\x02\xA7include\x2A", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip array 16") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyobj\xDC\x00\x01\xA7" + "example\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + + SECTION("skip array 32") { + error = deserializeMsgPack(doc, + "\x82\xA7onlyobj" + "\xDD\x00\x00\x00\x02\x01\x02" + "\xA7include\x2A", + filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.as() == "{\"onlyobj\":null,\"include\":42}"); + CHECK(spy.log() == AllocatorLog{ + Allocate(sizeofString("onlyarr")), + Allocate(sizeofPool()), + Allocate(sizeofString("include")), + Reallocate(sizeofPool(), sizeofObject(2)), + }); + } + } + + SECTION("filter = true") { + filter.set(true); + + error = deserializeMsgPack(doc, "\x90", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.is() == true); + CHECK(doc.size() == 0); + } + + SECTION("filter = false") { + filter.set(false); + + SECTION("input = fixarray") { + error = deserializeMsgPack(doc, "\x92\x01\x02", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.isNull() == true); + } + + SECTION("input = array 16") { + error = deserializeMsgPack(doc, "\xDC\x00\x02\x01\x02", filterOpt); + + CHECK(error == DeserializationError::Ok); + CHECK(doc.isNull() == true); + } + + SECTION("array too deep") { + error = deserializeMsgPack(doc, "\x91\x91\x91\x91\x91", 5, filterOpt, + DeserializationOption::NestingLimit(4)); + + CHECK(error == DeserializationError::TooDeep); + } + + SECTION("object too deep") { + error = deserializeMsgPack( + doc, "\x81\xA1z\x81\xA1z\x81\xA1z\x81\xA1z\x81\xA1z", 15, filterOpt, + DeserializationOption::NestingLimit(4)); + + CHECK(error == DeserializationError::TooDeep); + } + } +} + +TEST_CASE("Zero-copy mode") { // issue #1697 + char input[] = "\x82\xA7include\x01\xA6ignore\x02"; + + JsonDocument filter; + filter["include"] = true; + + JsonDocument doc; + DeserializationError err = + deserializeMsgPack(doc, input, 18, DeserializationOption::Filter(filter)); + + CHECK(err == DeserializationError::Ok); + CHECK(doc.as() == "{\"include\":1}"); +} + +TEST_CASE("Overloads") { + JsonDocument doc; + JsonDocument filter; + + using namespace DeserializationOption; + + // deserializeMsgPack(..., Filter) + + SECTION("const char*, Filter") { + deserializeMsgPack(doc, "{}", Filter(filter)); + } + + SECTION("const char*, size_t, Filter") { + deserializeMsgPack(doc, "{}", 2, Filter(filter)); + } + + SECTION("const std::string&, Filter") { + deserializeMsgPack(doc, "{}"_s, Filter(filter)); + } + + SECTION("std::istream&, Filter") { + std::stringstream s("{}"); + deserializeMsgPack(doc, s, Filter(filter)); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("char[n], Filter") { + size_t i = 4; + char vla[i]; + strcpy(vla, "{}"); + deserializeMsgPack(doc, vla, Filter(filter)); + } +#endif + + // deserializeMsgPack(..., Filter, NestingLimit) + + SECTION("const char*, Filter, NestingLimit") { + deserializeMsgPack(doc, "{}", Filter(filter), NestingLimit(5)); + } + + SECTION("const char*, size_t, Filter, NestingLimit") { + deserializeMsgPack(doc, "{}", 2, Filter(filter), NestingLimit(5)); + } + + SECTION("const std::string&, Filter, NestingLimit") { + deserializeMsgPack(doc, "{}"_s, Filter(filter), NestingLimit(5)); + } + + SECTION("std::istream&, Filter, NestingLimit") { + std::stringstream s("{}"); + deserializeMsgPack(doc, s, Filter(filter), NestingLimit(5)); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("char[n], Filter, NestingLimit") { + size_t i = 4; + char vla[i]; + strcpy(vla, "{}"); + deserializeMsgPack(doc, vla, Filter(filter), NestingLimit(5)); + } +#endif + + // deserializeMsgPack(..., NestingLimit, Filter) + + SECTION("const char*, NestingLimit, Filter") { + deserializeMsgPack(doc, "{}", NestingLimit(5), Filter(filter)); + } + + SECTION("const char*, size_t, NestingLimit, Filter") { + deserializeMsgPack(doc, "{}", 2, NestingLimit(5), Filter(filter)); + } + + SECTION("const std::string&, NestingLimit, Filter") { + deserializeMsgPack(doc, "{}"_s, NestingLimit(5), Filter(filter)); + } + + SECTION("std::istream&, NestingLimit, Filter") { + std::stringstream s("{}"); + deserializeMsgPack(doc, s, NestingLimit(5), Filter(filter)); + } + +#ifdef HAS_VARIABLE_LENGTH_ARRAY + SECTION("char[n], NestingLimit, Filter") { + size_t i = 4; + char vla[i]; + strcpy(vla, "{}"); + deserializeMsgPack(doc, vla, NestingLimit(5), Filter(filter)); + } +#endif +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/input_types.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/input_types.cpp new file mode 100644 index 00000000..42f61378 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/input_types.cpp @@ -0,0 +1,96 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "CustomReader.hpp" +#include "Literals.hpp" + +using ArduinoJson::detail::sizeofObject; + +TEST_CASE("deserializeMsgPack(const std::string&)") { + JsonDocument doc; + + SECTION("should accept const string") { + const std::string input("\x92\x01\x02"); + + DeserializationError err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("should accept temporary string") { + DeserializationError err = deserializeMsgPack(doc, "\x92\x01\x02"_s); + + REQUIRE(err == DeserializationError::Ok); + } + + SECTION("should duplicate content") { + std::string input("\x91\xA5hello"); + + DeserializationError err = deserializeMsgPack(doc, input); + input[2] = 'X'; // alter the string tomake sure we made a copy + + JsonArray array = doc.as(); + REQUIRE(err == DeserializationError::Ok); + REQUIRE("hello"_s == array[0]); + } + + SECTION("should accept a zero in input") { + DeserializationError err = deserializeMsgPack(doc, "\x92\x00\x02"_s); + + REQUIRE(err == DeserializationError::Ok); + JsonArray arr = doc.as(); + REQUIRE(arr[0] == 0); + REQUIRE(arr[1] == 2); + } +} + +TEST_CASE("deserializeMsgPack(std::istream&)") { + JsonDocument doc; + + SECTION("should accept a zero in input") { + std::istringstream input("\x92\x00\x02"_s); + + DeserializationError err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::Ok); + JsonArray arr = doc.as(); + REQUIRE(arr[0] == 0); + REQUIRE(arr[1] == 2); + } + + SECTION("should detect incomplete input") { + std::istringstream input("\x92\x00\x02"); + + DeserializationError err = deserializeMsgPack(doc, input); + + REQUIRE(err == DeserializationError::IncompleteInput); + } +} + +#ifdef HAS_VARIABLE_LENGTH_ARRAY +TEST_CASE("deserializeMsgPack(VLA)") { + size_t i = 16; + char vla[i]; + memcpy(vla, "\xDE\x00\x01\xA5Hello\xA5world", 15); + + JsonDocument doc; + DeserializationError err = deserializeMsgPack(doc, vla); + + REQUIRE(err == DeserializationError::Ok); +} +#endif + +TEST_CASE("deserializeMsgPack(CustomReader)") { + JsonDocument doc; + CustomReader reader("\x92\xA5Hello\xA5world"); + DeserializationError err = deserializeMsgPack(doc, reader); + + REQUIRE(err == DeserializationError::Ok); + REQUIRE(doc.size() == 2); + REQUIRE(doc[0] == "Hello"); + REQUIRE(doc[1] == "world"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/nestingLimit.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/nestingLimit.cpp new file mode 100644 index 00000000..a41ea0a4 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackDeserializer/nestingLimit.cpp @@ -0,0 +1,87 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include + +#define SHOULD_WORK(expression) REQUIRE(DeserializationError::Ok == expression); +#define SHOULD_FAIL(expression) \ + REQUIRE(DeserializationError::TooDeep == expression); + +TEST_CASE("JsonDeserializer nesting") { + JsonDocument doc; + + SECTION("Input = const char*") { + SECTION("limit = 0") { + DeserializationOption::NestingLimit nesting(0); + SHOULD_WORK(deserializeMsgPack(doc, "\xA1H", nesting)); // "H" + SHOULD_FAIL(deserializeMsgPack(doc, "\x90", nesting)); // [] + SHOULD_FAIL(deserializeMsgPack(doc, "\x80", nesting)); // {} + } + + SECTION("limit = 1") { + DeserializationOption::NestingLimit nesting(1); + SHOULD_WORK(deserializeMsgPack(doc, "\x90", nesting)); // {} + SHOULD_WORK(deserializeMsgPack(doc, "\x80", nesting)); // [] + SHOULD_FAIL(deserializeMsgPack(doc, "\x81\xA1H\x80", nesting)); // {H:{}} + SHOULD_FAIL(deserializeMsgPack(doc, "\x91\x90", nesting)); // [[]] + } + } + + SECTION("char* and size_t") { + SECTION("limit = 0") { + DeserializationOption::NestingLimit nesting(0); + SHOULD_WORK(deserializeMsgPack(doc, "\xA1H", 2, nesting)); + SHOULD_FAIL(deserializeMsgPack(doc, "\x90", 1, nesting)); + SHOULD_FAIL(deserializeMsgPack(doc, "\x80", 1, nesting)); + } + + SECTION("limit = 1") { + DeserializationOption::NestingLimit nesting(1); + SHOULD_WORK(deserializeMsgPack(doc, "\x90", 1, nesting)); + SHOULD_WORK(deserializeMsgPack(doc, "\x80", 1, nesting)); + SHOULD_FAIL(deserializeMsgPack(doc, "\x81\xA1H\x80", 4, nesting)); + SHOULD_FAIL(deserializeMsgPack(doc, "\x91\x90", 2, nesting)); + } + } + + SECTION("Input = std::string") { + using std::string; + + SECTION("limit = 0") { + DeserializationOption::NestingLimit nesting(0); + SHOULD_WORK(deserializeMsgPack(doc, string("\xA1H"), nesting)); + SHOULD_FAIL(deserializeMsgPack(doc, string("\x90"), nesting)); + SHOULD_FAIL(deserializeMsgPack(doc, string("\x80"), nesting)); + } + + SECTION("limit = 1") { + DeserializationOption::NestingLimit nesting(1); + SHOULD_WORK(deserializeMsgPack(doc, string("\x90"), nesting)); + SHOULD_WORK(deserializeMsgPack(doc, string("\x80"), nesting)); + SHOULD_FAIL(deserializeMsgPack(doc, string("\x81\xA1H\x80"), nesting)); + SHOULD_FAIL(deserializeMsgPack(doc, string("\x91\x90"), nesting)); + } + } + + SECTION("Input = std::istream") { + SECTION("limit = 0") { + DeserializationOption::NestingLimit nesting(0); + std::istringstream good("\xA1H"); // "H" + std::istringstream bad("\x90"); // [] + SHOULD_WORK(deserializeMsgPack(doc, good, nesting)); + SHOULD_FAIL(deserializeMsgPack(doc, bad, nesting)); + } + + SECTION("limit = 1") { + DeserializationOption::NestingLimit nesting(1); + std::istringstream good("\x90"); // [] + std::istringstream bad("\x91\x90"); // [[]] + SHOULD_WORK(deserializeMsgPack(doc, good, nesting)); + SHOULD_FAIL(deserializeMsgPack(doc, bad, nesting)); + } + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/CMakeLists.txt new file mode 100644 index 00000000..8f484bbe --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/CMakeLists.txt @@ -0,0 +1,19 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(MsgPackSerializerTests + destination_types.cpp + measure.cpp + misc.cpp + serializeArray.cpp + serializeObject.cpp + serializeVariant.cpp +) + +add_test(MsgPackSerializer MsgPackSerializerTests) + +set_tests_properties(MsgPackSerializer + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/destination_types.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/destination_types.cpp new file mode 100644 index 00000000..160ca8a5 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/destination_types.cpp @@ -0,0 +1,59 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("serialize MsgPack to various destination types") { + JsonDocument doc; + JsonObject object = doc.to(); + object["hello"] = "world"; + const char* expected_result = "\x81\xA5hello\xA5world"; + const size_t expected_length = 13; + + SECTION("std::string") { + std::string result; + size_t len = serializeMsgPack(object, result); + + REQUIRE(expected_result == result); + REQUIRE(expected_length == len); + } + + /* SECTION("std::vector") { + std::vector result; + size_t len = serializeMsgPack(object, result); + + REQUIRE(std::vector(expected_result, expected_result + 13) == + result); + REQUIRE(expected_length == len); + } */ + + SECTION("char[] larger than needed") { + char result[64]; + memset(result, 42, sizeof(result)); + size_t len = serializeMsgPack(object, result); + + REQUIRE(expected_length == len); + REQUIRE(std::string(expected_result, len) == std::string(result, len)); + REQUIRE(result[len] == 42); + } + + SECTION("char[] of the right size") { // #1545 + char result[13]; + size_t len = serializeMsgPack(object, result); + + REQUIRE(expected_length == len); + REQUIRE(std::string(expected_result, len) == std::string(result, len)); + } + + SECTION("char*") { + char result[64]; + memset(result, 42, sizeof(result)); + size_t len = serializeMsgPack(object, result, 64); + + REQUIRE(expected_length == len); + REQUIRE(std::string(expected_result, len) == std::string(result, len)); + REQUIRE(result[len] == 42); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/measure.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/measure.cpp new file mode 100644 index 00000000..882069bc --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/measure.cpp @@ -0,0 +1,14 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +TEST_CASE("measureMsgPack()") { + JsonDocument doc; + JsonObject object = doc.to(); + object["hello"] = "world"; + + REQUIRE(measureMsgPack(doc) == 13); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/misc.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/misc.cpp new file mode 100644 index 00000000..bea9b242 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/misc.cpp @@ -0,0 +1,46 @@ +#include +#include +#include + +template +void check(T value, const std::string& expected) { + JsonDocument doc; + doc.to().set(value); + char buffer[256] = ""; + size_t returnValue = serializeMsgPack(doc, buffer, sizeof(buffer)); + REQUIRE(expected == buffer); + REQUIRE(expected.size() == returnValue); +} + +TEST_CASE("serializeMsgPack(MemberProxy)") { + JsonDocument doc; + deserializeJson(doc, "{\"hello\":42}"); + JsonObject obj = doc.as(); + std::string result; + + serializeMsgPack(obj["hello"], result); + + REQUIRE(result == "*"); +} + +TEST_CASE("serializeMsgPack(ElementProxy)") { + JsonDocument doc; + deserializeJson(doc, "[42]"); + JsonArray arr = doc.as(); + std::string result; + + serializeMsgPack(arr[0], result); + + REQUIRE(result == "*"); +} + +TEST_CASE("serializeMsgPack(JsonVariantSubscript)") { + JsonDocument doc; + deserializeJson(doc, "[42]"); + JsonVariant var = doc.as(); + std::string result; + + serializeMsgPack(var[0], result); + + REQUIRE(result == "*"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeArray.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeArray.cpp new file mode 100644 index 00000000..95390419 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeArray.cpp @@ -0,0 +1,64 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_SLOT_ID_SIZE 4 // required to reach 65536 elements + +#include +#include + +#include "Literals.hpp" + +static void check(const JsonArray array, const char* expected_data, + size_t expected_len) { + std::string expected(expected_data, expected_data + expected_len); + std::string actual; + size_t len = serializeMsgPack(array, actual); + CAPTURE(array); + REQUIRE(len == expected_len); + REQUIRE(actual == expected); +} + +template +static void check(const JsonArray array, const char (&expected_data)[N]) { + const size_t expected_len = N - 1; + check(array, expected_data, expected_len); +} + +static void check(const JsonArray array, const std::string& expected) { + check(array, expected.data(), expected.length()); +} + +TEST_CASE("serialize MsgPack array") { + JsonDocument doc; + JsonArray array = doc.to(); + + SECTION("empty") { + check(array, "\x90"); + } + + SECTION("fixarray") { + array.add("hello"); + array.add("world"); + + check(array, "\x92\xA5hello\xA5world"); + } + + SECTION("array 16") { + for (int i = 0; i < 16; i++) + array.add(i); + + check(array, + "\xDC\x00\x10\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D" + "\x0E\x0F"); + } + + SECTION("array 32") { + const char* nil = 0; + for (int i = 0; i < 65536; i++) + array.add(nil); + REQUIRE(array.size() == 65536); + + check(array, "\xDD\x00\x01\x00\x00"_s + std::string(65536, '\xc0')); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeObject.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeObject.cpp new file mode 100644 index 00000000..7dc1526c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeObject.cpp @@ -0,0 +1,85 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Literals.hpp" + +static void check(const JsonObject object, const char* expected_data, + size_t expected_len) { + std::string expected(expected_data, expected_data + expected_len); + std::string actual; + size_t len = serializeMsgPack(object, actual); + CAPTURE(object); + REQUIRE(len == expected_len); + REQUIRE(actual == expected); +} + +template +static void check(const JsonObject object, const char (&expected_data)[N]) { + const size_t expected_len = N - 1; + check(object, expected_data, expected_len); +} + +// TODO: used by the commented test +// static void check(const JsonObject object, const std::string& expected) { +// check(object, expected.data(), expected.length()); +//} + +TEST_CASE("serialize MsgPack object") { + JsonDocument doc; + JsonObject object = doc.to(); + + SECTION("empty") { + check(object, "\x80"); + } + + SECTION("fixmap") { + object["hello"] = "world"; + + check(object, "\x81\xA5hello\xA5world"); + } + + SECTION("map 16") { + for (int i = 0; i < 16; ++i) { + char key[16]; + snprintf(key, sizeof(key), "i%X", i); + object[key] = i; + } + + check(object, + "\xDE\x00\x10\xA2i0\x00\xA2i1\x01\xA2i2\x02\xA2i3\x03\xA2i4\x04\xA2i5" + "\x05\xA2i6\x06\xA2i7\x07\xA2i8\x08\xA2i9\x09\xA2iA\x0A\xA2iB\x0B\xA2" + "iC\x0C\xA2iD\x0D\xA2iE\x0E\xA2iF\x0F"); + } + + // TODO: improve performance and uncomment + // SECTION("map 32") { + // std::string expected("\xDF\x00\x01\x00\x00", 5); + // + // for (int i = 0; i < 65536; ++i) { + // char kv[16]; + // snprintf(kv, sizeof(kv), "%04x", i); + // object[kv] = kv; + // expected += '\xA4'; + // expected += kv; + // expected += '\xA4'; + // expected += kv; + // } + // + // check(object, expected); + // } + + SECTION("serialized(const char*)") { + object["hello"] = serialized("\xDB\x00\x01\x00\x00", 5); + check(object, "\x81\xA5hello\xDB\x00\x01\x00\x00"); + } + + SECTION("serialized(std::string)") { + object["hello"] = serialized("\xDB\x00\x01\x00\x00"_s); + check(object, "\x81\xA5hello\xDB\x00\x01\x00\x00"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeVariant.cpp b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeVariant.cpp new file mode 100644 index 00000000..56faccd4 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/MsgPackSerializer/serializeVariant.cpp @@ -0,0 +1,214 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Literals.hpp" + +template +static void checkVariant(T value, const char* expected_data, + size_t expected_len) { + JsonDocument doc; + JsonVariant variant = doc.to(); + variant.set(value); + std::string expected(expected_data, expected_data + expected_len); + std::string actual; + size_t len = serializeMsgPack(variant, actual); + CAPTURE(variant); + REQUIRE(len == expected_len); + REQUIRE(actual == expected); +} + +template +static void checkVariant(T value, const char (&expected_data)[N]) { + const size_t expected_len = N - 1; + checkVariant(value, expected_data, expected_len); +} + +template +static void checkVariant(T value, const std::string& expected) { + checkVariant(value, expected.data(), expected.length()); +} + +TEST_CASE("serialize MsgPack value") { + SECTION("unbound") { + checkVariant(JsonVariant(), "\xC0"); // we represent undefined as nil + } + + SECTION("nil") { + const char* nil = 0; // ArduinoJson uses a string for null + checkVariant(nil, "\xC0"); + } + + SECTION("bool") { + checkVariant(false, "\xC2"); + checkVariant(true, "\xC3"); + } + + SECTION("positive fixint") { + SECTION("signed") { + checkVariant(0, "\x00"); + checkVariant(127, "\x7F"); + } + SECTION("unsigned") { + checkVariant(0U, "\x00"); + checkVariant(127U, "\x7F"); + } + } + + SECTION("uint 8") { + checkVariant(128, "\xCC\x80"); + checkVariant(255, "\xCC\xFF"); + } + + SECTION("uint 16") { + checkVariant(256, "\xCD\x01\x00"); + checkVariant(0xFFFF, "\xCD\xFF\xFF"); + } + + SECTION("uint 32") { + checkVariant(0x00010000U, "\xCE\x00\x01\x00\x00"); + checkVariant(0x12345678U, "\xCE\x12\x34\x56\x78"); + checkVariant(0xFFFFFFFFU, "\xCE\xFF\xFF\xFF\xFF"); + } + +#if ARDUINOJSON_USE_LONG_LONG + SECTION("uint 64") { + checkVariant(0x0001000000000000U, "\xCF\x00\x01\x00\x00\x00\x00\x00\x00"); + checkVariant(0x123456789ABCDEF0U, "\xCF\x12\x34\x56\x78\x9A\xBC\xDE\xF0"); + checkVariant(0xFFFFFFFFFFFFFFFFU, "\xCF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"); + } +#endif + + SECTION("negative fixint") { + checkVariant(-1, "\xFF"); + checkVariant(-32, "\xE0"); + } + + SECTION("int 8") { + checkVariant(-33, "\xD0\xDF"); + checkVariant(-128, "\xD0\x80"); + } + + SECTION("int 16") { + checkVariant(-129, "\xD1\xFF\x7F"); + checkVariant(-32768, "\xD1\x80\x00"); + } + + SECTION("int 32") { + checkVariant(-32769, "\xD2\xFF\xFF\x7F\xFF"); + checkVariant(-2147483647 - 1, "\xD2\x80\x00\x00\x00"); + } + +#if ARDUINOJSON_USE_LONG_LONG + SECTION("int 64") { + checkVariant(int64_t(0xFEDCBA9876543210), + "\xD3\xFE\xDC\xBA\x98\x76\x54\x32\x10"); + } +#endif + + SECTION("float 32") { + checkVariant(1.25, "\xCA\x3F\xA0\x00\x00"); + checkVariant(9.22337204e+18f, "\xca\x5f\x00\x00\x00"); + } + + SECTION("float 64") { + checkVariant(3.1415, "\xCB\x40\x09\x21\xCA\xC0\x83\x12\x6F"); + } + + SECTION("fixstr") { + checkVariant("", "\xA0"); + checkVariant("hello world hello world hello !", + "\xBFhello world hello world hello !"); + } + + SECTION("str 8") { + checkVariant("hello world hello world hello !!", + "\xD9\x20hello world hello world hello !!"); + } + + SECTION("str 16") { + std::string shortest(256, '?'); + checkVariant(shortest.c_str(), "\xDA\x01\x00"_s + shortest); + + std::string longest(65535, '?'); + checkVariant(longest.c_str(), "\xDA\xFF\xFF"_s + longest); + } + + SECTION("str 32") { + std::string shortest(65536, '?'); + checkVariant(JsonString(shortest.c_str(), true), // force store by pointer + "\xDB\x00\x01\x00\x00"_s + shortest); + } + + SECTION("serialized(const char*)") { + checkVariant(serialized("\xDA\xFF\xFF"), "\xDA\xFF\xFF"); + checkVariant(serialized("\xDB\x00\x01\x00\x00", 5), "\xDB\x00\x01\x00\x00"); + } + + SECTION("bin 8") { + checkVariant(MsgPackBinary("?", 1), "\xC4\x01?"); + } + + SECTION("bin 16") { + auto str = std::string(256, '?'); + checkVariant(MsgPackBinary(str.data(), str.size()), "\xC5\x01\x00"_s + str); + } + + // bin 32 is tested in string_length_size_4.cpp + + SECTION("fixext 1") { + checkVariant(MsgPackExtension(1, "\x02", 1), "\xD4\x01\x02"); + } + + SECTION("fixext 2") { + checkVariant(MsgPackExtension(1, "\x03\x04", 2), "\xD5\x01\x03\x04"); + } + + SECTION("fixext 4") { + checkVariant(MsgPackExtension(1, "\x05\x06\x07\x08", 4), + "\xD6\x01\x05\x06\x07\x08"); + } + + SECTION("fixext 8") { + checkVariant(MsgPackExtension(1, "????????", 8), "\xD7\x01????????"); + } + + SECTION("fixext 16") { + checkVariant(MsgPackExtension(1, "????????????????", 16), + "\xD8\x01????????????????"); + } + + SECTION("ext 8") { + checkVariant(MsgPackExtension(2, "???", 3), "\xC7\x03\x02???"); + checkVariant(MsgPackExtension(2, "?????", 5), "\xC7\x05\x02?????"); + checkVariant(MsgPackExtension(2, "???????", 7), "\xC7\x07\x02???????"); + checkVariant(MsgPackExtension(2, "?????????", 9), "\xC7\x09\x02?????????"); + checkVariant(MsgPackExtension(2, "???????????????", 15), + "\xC7\x0F\x02???????????????"); + checkVariant(MsgPackExtension(2, "?????????????????", 17), + "\xC7\x11\x02?????????????????"); + } + + SECTION("ext 16") { + auto str = std::string(256, '?'); + checkVariant(MsgPackExtension(2, str.data(), str.size()), + "\xC8\x01\x00\x02"_s + str); + } + + SECTION("serialize round double as integer") { // Issue #1718 + checkVariant(-32768.0, "\xD1\x80\x00"); + checkVariant(-129.0, "\xD1\xFF\x7F"); + checkVariant(-128.0, "\xD0\x80"); + checkVariant(-33.0, "\xD0\xDF"); + checkVariant(-32.0, "\xE0"); + checkVariant(-1.0, "\xFF"); + checkVariant(0.0, "\x00"); + checkVariant(127.0, "\x7F"); + checkVariant(128.0, "\xCC\x80"); + checkVariant(255.0, "\xCC\xFF"); + checkVariant(256.0, "\xCD\x01\x00"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Numbers/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/Numbers/CMakeLists.txt new file mode 100644 index 00000000..6505ce75 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Numbers/CMakeLists.txt @@ -0,0 +1,19 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(NumbersTests + convertNumber.cpp + decomposeFloat.cpp + parseDouble.cpp + parseFloat.cpp + parseInteger.cpp + parseNumber.cpp +) + +add_test(Numbers NumbersTests) + +set_tests_properties(Numbers + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/Numbers/convertNumber.cpp b/mb-script/lib/ArduinoJson/extras/tests/Numbers/convertNumber.cpp new file mode 100644 index 00000000..98cd6763 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Numbers/convertNumber.cpp @@ -0,0 +1,131 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +using namespace ArduinoJson::detail; + +TEST_CASE("canConvertNumber()") { + SECTION("int8_t -> int8_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(127) == true); + CHECK(canConvertNumber(-128) == true); + } + + SECTION("int8_t -> int16_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(127) == true); + CHECK(canConvertNumber(-128) == true); + } + + SECTION("int8_t -> uint8_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(127) == true); + CHECK(canConvertNumber(-128) == false); + } + + SECTION("int8_t -> uint16_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(127) == true); + CHECK(canConvertNumber(-128) == false); + } + + SECTION("int16_t -> int8_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(127) == true); + CHECK(canConvertNumber(128) == false); + CHECK(canConvertNumber(-128) == true); + CHECK(canConvertNumber(-129) == false); + } + + SECTION("int16_t -> uint8_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(255) == true); + CHECK(canConvertNumber(256) == false); + CHECK(canConvertNumber(-1) == false); + } + + SECTION("uint8_t -> int8_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(127) == true); + CHECK(canConvertNumber(128) == false); + CHECK(canConvertNumber(255) == false); + } + + SECTION("uint8_t -> int16_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(127) == true); + CHECK(canConvertNumber(128) == true); + CHECK(canConvertNumber(255) == true); + } + + SECTION("uint8_t -> uint8_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(127) == true); + CHECK(canConvertNumber(128) == true); + CHECK(canConvertNumber(255) == true); + } + + SECTION("uint8_t -> uint16_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(127) == true); + CHECK(canConvertNumber(128) == true); + CHECK(canConvertNumber(255) == true); + } + + SECTION("float -> int32_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(-2.147483904e9f) == false); + CHECK(canConvertNumber(-2.147483648e+9f) == true); + CHECK(canConvertNumber(2.14748352e+9f) == true); + CHECK(canConvertNumber(2.14748365e+9f) == false); + } + + SECTION("double -> int32_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(-2.147483649e+9) == false); + CHECK(canConvertNumber(-2.147483648e+9) == true); + CHECK(canConvertNumber(2.147483647e+9) == true); + CHECK(canConvertNumber(2.147483648e+9) == false); + } + + SECTION("float -> uint32_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(-1.401298e-45f) == false); + CHECK(canConvertNumber(4.29496704e+9f) == true); + CHECK(canConvertNumber(4.294967296e+9f) == false); + } + + SECTION("float -> int64_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(-9.22337204e+18f) == true); + CHECK(canConvertNumber(9.22337149e+18f) == true); + CHECK(canConvertNumber(9.22337204e+18f) == false); + } + + SECTION("double -> int64_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(-9.2233720368547758e+18) == true); + CHECK(canConvertNumber(9.2233720368547748e+18) == true); + CHECK(canConvertNumber(9.2233720368547758e+18) == false); + } + + SECTION("float -> uint64_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(-1.401298e-45f) == false); + CHECK(canConvertNumber(1.84467429741979238e+19f) == true); + CHECK(canConvertNumber(1.844674407370955161e+19f) == + false); + } + + SECTION("double -> uint64_t") { + CHECK(canConvertNumber(0) == true); + CHECK(canConvertNumber(-4.9406564584124e-324) == false); + CHECK(canConvertNumber(1.844674407370954958e+19) == true); + CHECK(canConvertNumber(1.844674407370955166e+19) == + false); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Numbers/decomposeFloat.cpp b/mb-script/lib/ArduinoJson/extras/tests/Numbers/decomposeFloat.cpp new file mode 100644 index 00000000..e0578f6c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Numbers/decomposeFloat.cpp @@ -0,0 +1,42 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +using namespace ArduinoJson::detail; + +TEST_CASE("decomposeFloat()") { + SECTION("1.7976931348623157E+308") { + auto parts = decomposeFloat(1.7976931348623157E+308, 9); + REQUIRE(parts.integral == 1); + REQUIRE(parts.decimal == 797693135); + REQUIRE(parts.decimalPlaces == 9); + REQUIRE(parts.exponent == 308); + } + + SECTION("4.94065645841247e-324") { + auto parts = decomposeFloat(4.94065645841247e-324, 9); + REQUIRE(parts.integral == 4); + REQUIRE(parts.decimal == 940656458); + REQUIRE(parts.decimalPlaces == 9); + REQUIRE(parts.exponent == -324); + } + + SECTION("3.4E+38") { + auto parts = decomposeFloat(3.4E+38f, 6); + REQUIRE(parts.integral == 3); + REQUIRE(parts.decimal == 4); + REQUIRE(parts.decimalPlaces == 1); + REQUIRE(parts.exponent == 38); + } + + SECTION("1.17549435e−38") { + auto parts = decomposeFloat(1.17549435e-38f, 6); + REQUIRE(parts.integral == 1); + REQUIRE(parts.decimal == 175494); + REQUIRE(parts.decimalPlaces == 6); + REQUIRE(parts.exponent == -38); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseDouble.cpp b/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseDouble.cpp new file mode 100644 index 00000000..a4592790 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseDouble.cpp @@ -0,0 +1,96 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_USE_DOUBLE 1 +#define ARDUINOJSON_ENABLE_NAN 1 +#define ARDUINOJSON_ENABLE_INFINITY 1 + +#include +#include + +using namespace ArduinoJson::detail; + +void checkDouble(const char* input, double expected) { + CAPTURE(input); + REQUIRE(parseNumber(input) == Approx(expected)); +} + +void checkDoubleNaN(const char* input) { + CAPTURE(input); + double result = parseNumber(input); + REQUIRE(result != result); +} + +void checkDoubleInf(const char* input, bool negative) { + CAPTURE(input); + double x = parseNumber(input); + if (negative) + REQUIRE(x < 0); + else + REQUIRE(x > 0); + REQUIRE(x == x); // not a NaN + REQUIRE(x * 2 == x); // a property of infinity +} + +TEST_CASE("parseNumber()") { + SECTION("Short_NoExponent") { + checkDouble("3.14", 3.14); + checkDouble("-3.14", -3.14); + checkDouble("+3.14", +3.14); + } + + SECTION("Short_NoDot") { + checkDouble("1E+308", 1E+308); + checkDouble("-1E+308", -1E+308); + checkDouble("+1E-308", +1E-308); + checkDouble("+1e+308", +1e+308); + checkDouble("-1e-308", -1e-308); + } + + SECTION("Max") { + checkDouble(".017976931348623147e+310", 1.7976931348623147e+308); + checkDouble(".17976931348623147e+309", 1.7976931348623147e+308); + checkDouble("1.7976931348623147e+308", 1.7976931348623147e+308); + checkDouble("17.976931348623147e+307", 1.7976931348623147e+308); + checkDouble("179.76931348623147e+306", 1.7976931348623147e+308); + } + + SECTION("Min") { + checkDouble(".022250738585072014e-306", 2.2250738585072014e-308); + checkDouble(".22250738585072014e-307", 2.2250738585072014e-308); + checkDouble("2.2250738585072014e-308", 2.2250738585072014e-308); + checkDouble("22.250738585072014e-309", 2.2250738585072014e-308); + checkDouble("222.50738585072014e-310", 2.2250738585072014e-308); + } + + SECTION("VeryLong") { + checkDouble("0.00000000000000000000000000000001", 1e-32); + checkDouble("100000000000000000000000000000000.0", 1e+32); + checkDouble( + "100000000000000000000000000000000.00000000000000000000000000000", + 1e+32); + } + + SECTION("MantissaTooLongToFit") { + checkDouble("0.179769313486231571111111111111", 0.17976931348623157); + checkDouble("17976931348623157.11111111111111", 17976931348623157.0); + checkDouble("1797693.134862315711111111111111", 1797693.1348623157); + + checkDouble("-0.179769313486231571111111111111", -0.17976931348623157); + checkDouble("-17976931348623157.11111111111111", -17976931348623157.0); + checkDouble("-1797693.134862315711111111111111", -1797693.1348623157); + } + + SECTION("ExponentTooBig") { + checkDoubleInf("1e309", false); + checkDoubleInf("-1e309", true); + checkDoubleInf("1e65535", false); + checkDouble("1e-65535", 0.0); + } + + SECTION("NaN") { + checkDoubleNaN("NaN"); + checkDoubleNaN("nan"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseFloat.cpp b/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseFloat.cpp new file mode 100644 index 00000000..62c0917c --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseFloat.cpp @@ -0,0 +1,87 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#define ARDUINOJSON_ENABLE_NAN 1 +#define ARDUINOJSON_ENABLE_INFINITY 1 + +#include +#include + +using namespace ArduinoJson::detail; + +void checkFloat(const char* input, float expected) { + CAPTURE(input); + auto result = parseNumber(input); + REQUIRE(result.type() == NumberType::Float); + REQUIRE(result.asFloat() == Approx(expected)); +} + +void checkFloatNaN(const char* input) { + CAPTURE(input); + float result = parseNumber(input); + REQUIRE(result != result); +} + +void checkFloatInf(const char* input, bool negative) { + CAPTURE(input); + float x = parseNumber(input); + if (negative) + REQUIRE(x < 0); + else + REQUIRE(x > 0); + REQUIRE(x == x); // not a NaN + REQUIRE(x * 2 == x); // a property of infinity +} + +TEST_CASE("parseNumber()") { + SECTION("Float_Short_NoExponent") { + checkFloat("3.14", 3.14f); + checkFloat("-3.14", -3.14f); + checkFloat("+3.14", +3.14f); + } + + SECTION("Short_NoDot") { + checkFloat("1E+38", 1E+38f); + checkFloat("-1E+38", -1E+38f); + checkFloat("+1E-38", +1E-38f); + checkFloat("+1e+38", +1e+38f); + checkFloat("-1e-38", -1e-38f); + } + + SECTION("Max") { + checkFloat("340.2823e+36", 3.402823e+38f); + checkFloat("34.02823e+37", 3.402823e+38f); + checkFloat("3.402823e+38", 3.402823e+38f); + checkFloat("0.3402823e+39", 3.402823e+38f); + checkFloat("0.03402823e+40", 3.402823e+38f); + checkFloat("0.003402823e+41", 3.402823e+38f); + } + + SECTION("VeryLong") { + checkFloat("0.00000000000000000000000000000001", 1e-32f); + + // The following don't work because they have many digits so parseNumber() + // treats them as double. But it's not an issue because JsonVariant will use + // a float to store them. + // + // checkFloat("100000000000000000000000000000000.0", 1e+32f); + // checkFloat( + // "100000000000000000000000000000000.00000000000000000000000000000", + // 1e+32f); + } + + SECTION("NaN") { + checkFloatNaN("NaN"); + checkFloatNaN("nan"); + } + + SECTION("Infinity") { + checkFloatInf("Infinity", false); + checkFloatInf("+Infinity", false); + checkFloatInf("-Infinity", true); + checkFloatInf("inf", false); + checkFloatInf("+inf", false); + checkFloatInf("-inf", true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseInteger.cpp b/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseInteger.cpp new file mode 100644 index 00000000..aff23585 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseInteger.cpp @@ -0,0 +1,68 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +using namespace ArduinoJson::detail; + +template +void checkInteger(const char* input, T expected) { + CAPTURE(input); + T actual = parseNumber(input); + REQUIRE(expected == actual); +} + +TEST_CASE("parseNumber()") { + checkInteger("-128", -128); + checkInteger("127", 127); + checkInteger("+127", 127); + checkInteger("3.14", 3); + checkInteger("x42", 0); + checkInteger("128", 0); // overflow + checkInteger("-129", 0); // overflow +} + +TEST_CASE("parseNumber()") { + checkInteger("-32768", -32768); + checkInteger("32767", 32767); + checkInteger("+32767", 32767); + checkInteger("3.14", 3); + checkInteger("x42", 0); + checkInteger("-32769", 0); // overflow + checkInteger("32768", 0); // overflow +} + +TEST_CASE("parseNumber()") { + checkInteger("-2147483648", (-2147483647 - 1)); + checkInteger("2147483647", 2147483647); + checkInteger("+2147483647", 2147483647); + checkInteger("3.14", 3); + checkInteger("x42", 0); + checkInteger("-2147483649", 0); // overflow + checkInteger("2147483648", 0); // overflow +} + +TEST_CASE("parseNumber()") { + checkInteger("0", 0); + checkInteger("-0", 0); + checkInteger("255", 255); + checkInteger("+255", 255); + checkInteger("3.14", 3); + checkInteger("x42", 0); + checkInteger("-1", 0); + checkInteger("256", 0); +} + +TEST_CASE("parseNumber()") { + checkInteger("0", 0); + checkInteger("65535", 65535); + checkInteger("+65535", 65535); + checkInteger("3.14", 3); + // checkInteger(" 42", 0); + checkInteger("x42", 0); + checkInteger("-1", 0); + checkInteger("65536", 0); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseNumber.cpp b/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseNumber.cpp new file mode 100644 index 00000000..37b12bb7 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/Numbers/parseNumber.cpp @@ -0,0 +1,63 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +using namespace ArduinoJson; +using namespace ArduinoJson::detail; + +TEST_CASE("Test unsigned integer overflow") { + Number first, second; + + // Avoids MSVC warning C4127 (conditional expression is constant) + size_t integerSize = sizeof(JsonInteger); + + if (integerSize == 8) { + first = parseNumber("18446744073709551615"); + second = parseNumber("18446744073709551616"); + } else { + first = parseNumber("4294967295"); + second = parseNumber("4294967296"); + } + + REQUIRE(first.type() == NumberType::UnsignedInteger); + REQUIRE(second.type() == NumberType::Double); +} + +TEST_CASE("Test signed integer overflow") { + Number first, second; + + // Avoids MSVC warning C4127 (conditional expression is constant) + size_t integerSize = sizeof(JsonInteger); + + if (integerSize == 8) { + first = parseNumber("-9223372036854775808"); + second = parseNumber("-9223372036854775809"); + } else { + first = parseNumber("-2147483648"); + second = parseNumber("-2147483649"); + } + + REQUIRE(first.type() == NumberType::SignedInteger); + REQUIRE(second.type() == NumberType::Double); +} + +TEST_CASE("Invalid value") { + auto result = parseNumber("6a3"); + + REQUIRE(result.type() == NumberType::Invalid); +} + +TEST_CASE("float") { + auto result = parseNumber("3.402823e38"); + + REQUIRE(result.type() == NumberType::Float); +} + +TEST_CASE("double") { + auto result = parseNumber("1.7976931348623157e308"); + + REQUIRE(result.type() == NumberType::Double); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/CMakeLists.txt new file mode 100644 index 00000000..27ff0e90 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/CMakeLists.txt @@ -0,0 +1,25 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(ResourceManagerTests + allocVariant.cpp + clear.cpp + saveString.cpp + shrinkToFit.cpp + size.cpp + StringBuilder.cpp + swap.cpp +) + +add_compile_definitions(ResourceManagerTests + ARDUINOJSON_SLOT_ID_SIZE=1 # require less RAM for overflow tests + ARDUINOJSON_POOL_CAPACITY=16 +) + +add_test(ResourceManager ResourceManagerTests) + +set_tests_properties(ResourceManager + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/StringBuilder.cpp b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/StringBuilder.cpp new file mode 100644 index 00000000..0c1b1c16 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/StringBuilder.cpp @@ -0,0 +1,143 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" + +using namespace ArduinoJson::detail; + +TEST_CASE("StringBuilder") { + KillswitchAllocator killswitch; + SpyingAllocator spyingAllocator(&killswitch); + ResourceManager resources(&spyingAllocator); + + SECTION("Empty string") { + StringBuilder str(&resources); + + str.startString(); + str.save(); + + REQUIRE(resources.size() == sizeofString("")); + REQUIRE(resources.overflowed() == false); + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer()), + Reallocate(sizeofStringBuffer(), sizeofString("")), + }); + } + + SECTION("Short string fits in first allocation") { + StringBuilder str(&resources); + + str.startString(); + str.append("hello"); + + REQUIRE(str.isValid() == true); + REQUIRE(str.str() == "hello"); + REQUIRE(resources.overflowed() == false); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + Allocate(sizeofStringBuffer()), + }); + } + + SECTION("Long string needs reallocation") { + StringBuilder str(&resources); + const char* lorem = + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " + "eiusmod tempor incididunt ut labore et dolore magna aliqua."; + + str.startString(); + str.append(lorem); + + REQUIRE(str.isValid() == true); + REQUIRE(str.str() == lorem); + REQUIRE(resources.overflowed() == false); + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer(1)), + Reallocate(sizeofStringBuffer(1), sizeofStringBuffer(2)), + Reallocate(sizeofStringBuffer(2), sizeofStringBuffer(3)), + }); + } + + SECTION("Realloc fails") { + StringBuilder str(&resources); + + str.startString(); + killswitch.on(); + str.append( + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do " + "eiusmod tempor incididunt ut labore et dolore magna aliqua."); + + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofStringBuffer()), + ReallocateFail(sizeofStringBuffer(), sizeofStringBuffer(2)), + Deallocate(sizeofStringBuffer()), + }); + REQUIRE(str.isValid() == false); + REQUIRE(resources.overflowed() == true); + } + + SECTION("Initial allocation fails") { + StringBuilder str(&resources); + + killswitch.on(); + str.startString(); + + REQUIRE(str.isValid() == false); + REQUIRE(resources.overflowed() == true); + REQUIRE(spyingAllocator.log() == AllocatorLog{ + AllocateFail(sizeofStringBuffer()), + }); + } +} + +static StringNode* addStringToPool(ResourceManager& resources, const char* s) { + StringBuilder str(&resources); + str.startString(); + str.append(s); + return str.save(); +} + +TEST_CASE("StringBuilder::save() deduplicates strings") { + ResourceManager resources; + + SECTION("Basic") { + auto s1 = addStringToPool(resources, "hello"); + auto s2 = addStringToPool(resources, "world"); + auto s3 = addStringToPool(resources, "hello"); + + REQUIRE(s1 == s3); + REQUIRE(s2 != s3); + REQUIRE(s1->references == 2); + REQUIRE(s2->references == 1); + REQUIRE(s3->references == 2); + REQUIRE(resources.size() == sizeofString("hello") + sizeofString("world")); + } + + SECTION("Requires terminator") { + auto s1 = addStringToPool(resources, "hello world"); + auto s2 = addStringToPool(resources, "hello"); + + REQUIRE(s2 != s1); + REQUIRE(s1->references == 1); + REQUIRE(s2->references == 1); + REQUIRE(resources.size() == + sizeofString("hello world") + sizeofString("hello")); + } + + SECTION("Don't overrun") { + auto s1 = addStringToPool(resources, "hello world"); + auto s2 = addStringToPool(resources, "wor"); + + REQUIRE(s2 != s1); + REQUIRE(s1->references == 1); + REQUIRE(s2->references == 1); + REQUIRE(resources.size() == + sizeofString("hello world") + sizeofString("wor")); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/allocVariant.cpp b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/allocVariant.cpp new file mode 100644 index 00000000..05687917 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/allocVariant.cpp @@ -0,0 +1,92 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include + +#include "Allocators.hpp" + +using namespace ArduinoJson::detail; + +TEST_CASE("ResourceManager::allocVariant()") { + SECTION("Returns different pointer") { + ResourceManager resources; + + auto s1 = resources.allocVariant(); + REQUIRE(s1.ptr() != nullptr); + auto s2 = resources.allocVariant(); + REQUIRE(s2.ptr() != nullptr); + + REQUIRE(s1.ptr() != s2.ptr()); + } + + SECTION("Returns the same slot after calling freeVariant()") { + ResourceManager resources; + + auto s1 = resources.allocVariant(); + auto s2 = resources.allocVariant(); + resources.freeVariant(s1); + resources.freeVariant(s2); + auto s3 = resources.allocVariant(); + auto s4 = resources.allocVariant(); + auto s5 = resources.allocVariant(); + + REQUIRE(s2.id() != s1.id()); + REQUIRE(s3.id() == s2.id()); + REQUIRE(s4.id() == s1.id()); + REQUIRE(s5.id() != s1.id()); + REQUIRE(s5.id() != s2.id()); + } + + SECTION("Returns aligned pointers") { + ResourceManager resources; + + REQUIRE(isAligned(resources.allocVariant().ptr())); + REQUIRE(isAligned(resources.allocVariant().ptr())); + } + + SECTION("Returns null if pool list allocation fails") { + ResourceManager resources(FailingAllocator::instance()); + + auto variant = resources.allocVariant(); + REQUIRE(variant.id() == NULL_SLOT); + REQUIRE(variant.ptr() == nullptr); + } + + SECTION("Returns null if pool allocation fails") { + ResourceManager resources(FailingAllocator::instance()); + + resources.allocVariant(); + + auto variant = resources.allocVariant(); + REQUIRE(variant.id() == NULL_SLOT); + REQUIRE(variant.ptr() == nullptr); + } + + SECTION("Try overflow pool counter") { + ResourceManager resources; + + // this test assumes SlotId is 8-bit; otherwise it consumes a lot of memory + // tyhe GitHub Workflow gets killed + REQUIRE(NULL_SLOT == 255); + + // fill all the pools + for (SlotId i = 0; i < NULL_SLOT; i++) { + auto slot = resources.allocVariant(); + REQUIRE(slot.id() == i); // or != NULL_SLOT + REQUIRE(slot.ptr() != nullptr); + } + + REQUIRE(resources.overflowed() == false); + + // now all allocations should fail + for (int i = 0; i < 10; i++) { + auto slot = resources.allocVariant(); + REQUIRE(slot.id() == NULL_SLOT); + REQUIRE(slot.ptr() == nullptr); + } + + REQUIRE(resources.overflowed() == true); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/clear.cpp b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/clear.cpp new file mode 100644 index 00000000..e7707763 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/clear.cpp @@ -0,0 +1,30 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include +#include + +using namespace ArduinoJson::detail; + +TEST_CASE("ResourceManager::clear()") { + ResourceManager resources; + + SECTION("Discards allocated variants") { + resources.allocVariant(); + + resources.clear(); + REQUIRE(resources.size() == 0); + } + + SECTION("Discards allocated strings") { + resources.saveString(adaptString("123456789")); + REQUIRE(resources.size() == sizeofString(9)); + + resources.clear(); + + REQUIRE(resources.size() == 0); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/saveString.cpp b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/saveString.cpp new file mode 100644 index 00000000..3c7a228b --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/saveString.cpp @@ -0,0 +1,70 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Allocators.hpp" + +using namespace ArduinoJson::detail; + +static StringNode* saveString(ResourceManager& resources, const char* s) { + return resources.saveString(adaptString(s)); +} + +static StringNode* saveString(ResourceManager& resources, const char* s, + size_t n) { + return resources.saveString(adaptString(s, n)); +} + +TEST_CASE("ResourceManager::saveString()") { + ResourceManager resources; + + SECTION("Duplicates different strings") { + auto a = saveString(resources, "hello"); + auto b = saveString(resources, "world"); + REQUIRE(+a->data != +b->data); + REQUIRE(a->length == 5); + REQUIRE(b->length == 5); + REQUIRE(a->references == 1); + REQUIRE(b->references == 1); + REQUIRE(resources.size() == sizeofString("hello") + sizeofString("world")); + } + + SECTION("Deduplicates identical strings") { + auto a = saveString(resources, "hello"); + auto b = saveString(resources, "hello"); + REQUIRE(a == b); + REQUIRE(a->length == 5); + REQUIRE(a->references == 2); + REQUIRE(resources.size() == sizeofString("hello")); + } + + SECTION("Deduplicates identical strings that contain NUL") { + auto a = saveString(resources, "hello\0world", 11); + auto b = saveString(resources, "hello\0world", 11); + REQUIRE(a == b); + REQUIRE(a->length == 11); + REQUIRE(a->references == 2); + REQUIRE(resources.size() == sizeofString("hello world")); + } + + SECTION("Don't stop on first NUL") { + auto a = saveString(resources, "hello"); + auto b = saveString(resources, "hello\0world", 11); + REQUIRE(a != b); + REQUIRE(a->length == 5); + REQUIRE(b->length == 11); + REQUIRE(a->references == 1); + REQUIRE(b->references == 1); + REQUIRE(resources.size() == + sizeofString("hello") + sizeofString("hello world")); + } + + SECTION("Returns NULL when allocation fails") { + ResourceManager pool2(FailingAllocator::instance()); + REQUIRE(saveString(pool2, "a") == nullptr); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/shrinkToFit.cpp b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/shrinkToFit.cpp new file mode 100644 index 00000000..4f1eb5de --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/shrinkToFit.cpp @@ -0,0 +1,57 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Allocators.hpp" + +using namespace ArduinoJson::detail; + +TEST_CASE("ResourceManager::shrinkToFit()") { + SpyingAllocator spyingAllocator; + ResourceManager resources(&spyingAllocator); + + SECTION("empty") { + resources.shrinkToFit(); + + REQUIRE(spyingAllocator.log() == AllocatorLog{}); + } + + SECTION("only one pool") { + resources.allocVariant(); + + resources.shrinkToFit(); + + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofPool()), + Reallocate(sizeofPool(), sizeofPool(1)), + }); + } + + SECTION("more pools than initial count") { + for (size_t i = 0; + i < ARDUINOJSON_POOL_CAPACITY * ARDUINOJSON_INITIAL_POOL_COUNT + 1; + i++) + resources.allocVariant(); + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Allocate(sizeofPool()) * ARDUINOJSON_INITIAL_POOL_COUNT, + Allocate(sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT * 2)), + Allocate(sizeofPool()), + }); + + spyingAllocator.clearLog(); + resources.shrinkToFit(); + + REQUIRE(spyingAllocator.log() == + AllocatorLog{ + Reallocate(sizeofPool(), sizeofPool(1)), + Reallocate(sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT * 2), + sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT + 1)), + }); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/size.cpp b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/size.cpp new file mode 100644 index 00000000..17f3f42e --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/size.cpp @@ -0,0 +1,31 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include "Allocators.hpp" + +using namespace ArduinoJson::detail; + +TEST_CASE("ResourceManager::size()") { + TimebombAllocator timebomb(0); + ResourceManager resources(&timebomb); + + SECTION("Initial size is 0") { + REQUIRE(0 == resources.size()); + } + + SECTION("Doesn't grow when allocation of second pool fails") { + timebomb.setCountdown(1); + for (size_t i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++) + resources.allocVariant(); + size_t size = resources.size(); + + resources.allocVariant(); + + REQUIRE(size == resources.size()); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/swap.cpp b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/swap.cpp new file mode 100644 index 00000000..f5d8feec --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/ResourceManager/swap.cpp @@ -0,0 +1,96 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include +#include + +#include "Allocators.hpp" + +using namespace ArduinoJson::detail; + +static void fullPreallocatedPools(ResourceManager& resources) { + for (int i = 0; + i < ARDUINOJSON_INITIAL_POOL_COUNT * ARDUINOJSON_POOL_CAPACITY; i++) + resources.allocVariant(); +} + +TEST_CASE("ResourceManager::swap()") { + SECTION("Both using preallocated pool list") { + SpyingAllocator spy; + ResourceManager a(&spy); + ResourceManager b(&spy); + + auto a1 = a.allocVariant(); + auto b1 = b.allocVariant(); + + swap(a, b); + + REQUIRE(a1.ptr() == b.getVariant(a1.id())); + REQUIRE(b1.ptr() == a.getVariant(b1.id())); + + REQUIRE(spy.log() == AllocatorLog{ + Allocate(sizeofPool()) * 2, + }); + } + + SECTION("Only left using preallocated pool list") { + SpyingAllocator spy; + ResourceManager a(&spy); + ResourceManager b(&spy); + fullPreallocatedPools(b); + + auto a1 = a.allocVariant(); + auto b1 = b.allocVariant(); + swap(a, b); + + REQUIRE(a1.ptr() == b.getVariant(a1.id())); + REQUIRE(b1.ptr() == a.getVariant(b1.id())); + + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofPool()) * (ARDUINOJSON_INITIAL_POOL_COUNT + 1), + Allocate(sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT * 2)), + Allocate(sizeofPool()), + }); + } + + SECTION("Only right using preallocated pool list") { + SpyingAllocator spy; + ResourceManager a(&spy); + fullPreallocatedPools(a); + ResourceManager b(&spy); + + auto a1 = a.allocVariant(); + auto b1 = b.allocVariant(); + swap(a, b); + + REQUIRE(a1.ptr() == b.getVariant(a1.id())); + REQUIRE(b1.ptr() == a.getVariant(b1.id())); + + REQUIRE(spy.log() == + AllocatorLog{ + Allocate(sizeofPool()) * ARDUINOJSON_INITIAL_POOL_COUNT, + Allocate(sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT * 2)), + Allocate(sizeofPool()) * 2, + }); + } + + SECTION("None is using preallocated pool list") { + SpyingAllocator spy; + ResourceManager a(&spy); + fullPreallocatedPools(a); + ResourceManager b(&spy); + fullPreallocatedPools(b); + + auto a1 = a.allocVariant(); + auto b1 = b.allocVariant(); + + swap(a, b); + + REQUIRE(a1.ptr() == b.getVariant(a1.id())); + REQUIRE(b1.ptr() == a.getVariant(b1.id())); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/CMakeLists.txt new file mode 100644 index 00000000..79618c78 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/CMakeLists.txt @@ -0,0 +1,18 @@ +# ArduinoJson - https://arduinojson.org +# Copyright © 2014-2025, Benoit BLANCHON +# MIT License + +add_executable(TextFormatterTests + writeFloat.cpp + writeInteger.cpp + writeString.cpp +) + +set_target_properties(TextFormatterTests PROPERTIES UNITY_BUILD OFF) + +add_test(TextFormatter TextFormatterTests) + +set_tests_properties(TextFormatter + PROPERTIES + LABELS "Catch" +) diff --git a/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/writeFloat.cpp b/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/writeFloat.cpp new file mode 100644 index 00000000..1afcaec5 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/writeFloat.cpp @@ -0,0 +1,119 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#define ARDUINOJSON_ENABLE_NAN 1 +#define ARDUINOJSON_ENABLE_INFINITY 1 +#include +#include + +using namespace ArduinoJson::detail; + +template +void check(TFloat input, const std::string& expected) { + std::string output; + Writer sb(output); + TextFormatter> writer(sb); + writer.writeFloat(input); + REQUIRE(writer.bytesWritten() == output.size()); + CHECK(expected == output); +} + +TEST_CASE("TextFormatter::writeFloat(double)") { + SECTION("Pi") { + check(3.14159265359, "3.141592654"); + } + + SECTION("Signaling NaN") { + double nan = std::numeric_limits::signaling_NaN(); + check(nan, "NaN"); + } + + SECTION("Quiet NaN") { + double nan = std::numeric_limits::quiet_NaN(); + check(nan, "NaN"); + } + + SECTION("Infinity") { + double inf = std::numeric_limits::infinity(); + check(inf, "Infinity"); + check(-inf, "-Infinity"); + } + + SECTION("Zero") { + check(0.0, "0"); + check(-0.0, "0"); + } + + SECTION("Espilon") { + check(2.2250738585072014E-308, "2.225073859e-308"); + check(-2.2250738585072014E-308, "-2.225073859e-308"); + } + + SECTION("Max double") { + check(1.7976931348623157E+308, "1.797693135e308"); + check(-1.7976931348623157E+308, "-1.797693135e308"); + } + + SECTION("Big exponent") { + // this test increases coverage of normalize() + check(1e255, "1e255"); + check(1e-255, "1e-255"); + } + + SECTION("Exponentation when <= 1e-5") { + check(1e-4, "0.0001"); + check(1e-5, "1e-5"); + + check(-1e-4, "-0.0001"); + check(-1e-5, "-1e-5"); + } + + SECTION("Exponentation when >= 1e7") { + check(9999999.999, "9999999.999"); + check(10000000.0, "1e7"); + + check(-9999999.999, "-9999999.999"); + check(-10000000.0, "-1e7"); + } + + SECTION("Rounding when too many decimals") { + check(0.000099999999999, "0.0001"); + check(0.0000099999999999, "1e-5"); + check(0.9999999996, "1"); + } + + SECTION("9 decimal places") { + check(0.100000001, "0.100000001"); + check(0.999999999, "0.999999999"); + + check(9.000000001, "9.000000001"); + check(9.999999999, "9.999999999"); + } + + SECTION("10 decimal places") { + check(0.1000000001, "0.1"); + check(0.9999999999, "1"); + + check(9.0000000001, "9"); + check(9.9999999999, "10"); + } +} + +TEST_CASE("TextFormatter::writeFloat(float)") { + SECTION("Pi") { + check(3.14159265359f, "3.141593"); + } + + SECTION("999.9") { // issue #543 + check(999.9f, "999.9"); + } + + SECTION("24.3") { // # issue #588 + check(24.3f, "24.3"); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/writeInteger.cpp b/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/writeInteger.cpp new file mode 100644 index 00000000..47a864c3 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/writeInteger.cpp @@ -0,0 +1,55 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include +#include +#include + +#include +#include + +using namespace ArduinoJson::detail; + +template +void checkWriteInteger(T value, std::string expected) { + char output[64] = {0}; + StaticStringWriter sb(output, sizeof(output)); + TextFormatter writer(sb); + writer.writeInteger(value); + REQUIRE(expected == output); + REQUIRE(writer.bytesWritten() == expected.size()); +} + +TEST_CASE("int8_t") { + checkWriteInteger(0, "0"); + checkWriteInteger(-128, "-128"); + checkWriteInteger(127, "127"); +} + +TEST_CASE("uint8_t") { + checkWriteInteger(0, "0"); + checkWriteInteger(255, "255"); +} + +TEST_CASE("int16_t") { + checkWriteInteger(0, "0"); + checkWriteInteger(-32768, "-32768"); + checkWriteInteger(32767, "32767"); +} + +TEST_CASE("uint16_t") { + checkWriteInteger(0, "0"); + checkWriteInteger(65535, "65535"); +} + +TEST_CASE("int32_t") { + checkWriteInteger(0, "0"); + checkWriteInteger(-2147483647 - 1, "-2147483648"); + checkWriteInteger(2147483647, "2147483647"); +} + +TEST_CASE("uint32_t") { + checkWriteInteger(0, "0"); + checkWriteInteger(4294967295U, "4294967295"); +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/writeString.cpp b/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/writeString.cpp new file mode 100644 index 00000000..35ae2977 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/TextFormatter/writeString.cpp @@ -0,0 +1,57 @@ +// ArduinoJson - https://arduinojson.org +// Copyright © 2014-2025, Benoit BLANCHON +// MIT License + +#include + +#include +#include + +using namespace ArduinoJson::detail; + +void check(const char* input, std::string expected) { + char output[64] = {0}; + StaticStringWriter sb(output, sizeof(output)); + TextFormatter writer(sb); + writer.writeString(input); + REQUIRE(expected == output); + REQUIRE(writer.bytesWritten() == expected.size()); +} + +TEST_CASE("TextFormatter::writeString()") { + SECTION("EmptyString") { + check("", "\"\""); + } + + SECTION("QuotationMark") { + check("\"", "\"\\\"\""); + } + + SECTION("ReverseSolidus") { + check("\\", "\"\\\\\""); + } + + SECTION("Solidus") { + check("/", "\"/\""); // but the JSON format allows \/ + } + + SECTION("Backspace") { + check("\b", "\"\\b\""); + } + + SECTION("Formfeed") { + check("\f", "\"\\f\""); + } + + SECTION("Newline") { + check("\n", "\"\\n\""); + } + + SECTION("CarriageReturn") { + check("\r", "\"\\r\""); + } + + SECTION("HorizontalTab") { + check("\t", "\"\\t\""); + } +} diff --git a/mb-script/lib/ArduinoJson/extras/tests/catch/CMakeLists.txt b/mb-script/lib/ArduinoJson/extras/tests/catch/CMakeLists.txt new file mode 100644 index 00000000..c5fb5fb8 --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/catch/CMakeLists.txt @@ -0,0 +1,21 @@ +# ArduinoJson - https://arduinojson.org +# Copyright Benoit Blanchon 2014-2021 +# MIT License + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED OFF) + +add_library(catch + catch.hpp + catch.cpp +) + +target_include_directories(catch + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + +if(MINGW) + # prevent "too many sections (32837)" with MinGW + target_compile_options(catch PRIVATE -Wa,-mbig-obj) +endif() diff --git a/mb-script/lib/ArduinoJson/extras/tests/catch/catch.cpp b/mb-script/lib/ArduinoJson/extras/tests/catch/catch.cpp new file mode 100644 index 00000000..e6c8548a --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/catch/catch.cpp @@ -0,0 +1,6 @@ +// ArduinoJson - https://arduinojson.org +// Copyright Benoit Blanchon 2014-2021 +// MIT License + +#define CATCH_CONFIG_MAIN +#include "catch.hpp" diff --git a/mb-script/lib/ArduinoJson/extras/tests/catch/catch.hpp b/mb-script/lib/ArduinoJson/extras/tests/catch/catch.hpp new file mode 100644 index 00000000..9b309bdd --- /dev/null +++ b/mb-script/lib/ArduinoJson/extras/tests/catch/catch.hpp @@ -0,0 +1,17976 @@ +/* + * Catch v2.13.10 + * Generated: 2022-10-16 11:01:23.452308 + * ---------------------------------------------------------- + * This file has been merged from multiple headers. Please don't edit it directly + * Copyright (c) 2022 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED +#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED +// start catch.hpp + + +#define CATCH_VERSION_MAJOR 2 +#define CATCH_VERSION_MINOR 13 +#define CATCH_VERSION_PATCH 10 + +#ifdef __clang__ +# pragma clang system_header +#elif defined __GNUC__ +# pragma GCC system_header +#endif + +// start catch_suppress_warnings.h + +#ifdef __clang__ +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(push) +# pragma warning(disable: 161 1682) +# else // __ICC +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic ignored "-Wswitch-enum" +# pragma clang diagnostic ignored "-Wcovered-switch-default" +# endif +#elif defined __GNUC__ + // Because REQUIREs trigger GCC's -Wparentheses, and because still + // supported version of g++ have only buggy support for _Pragmas, + // Wparentheses have to be suppressed globally. +# pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details + +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wpadded" +#endif +// end catch_suppress_warnings.h +#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) +# define CATCH_IMPL +# define CATCH_CONFIG_ALL_PARTS +#endif + +// In the impl file, we want to have access to all parts of the headers +// Can also be used to sanely support PCHs +#if defined(CATCH_CONFIG_ALL_PARTS) +# define CATCH_CONFIG_EXTERNAL_INTERFACES +# if defined(CATCH_CONFIG_DISABLE_MATCHERS) +# undef CATCH_CONFIG_DISABLE_MATCHERS +# endif +# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +# endif +#endif + +#if !defined(CATCH_CONFIG_IMPL_ONLY) +// start catch_platform.h + +// See e.g.: +// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html +#ifdef __APPLE__ +# include +# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ + (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) +# define CATCH_PLATFORM_MAC +# elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) +# define CATCH_PLATFORM_IPHONE +# endif + +#elif defined(linux) || defined(__linux) || defined(__linux__) +# define CATCH_PLATFORM_LINUX + +#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) +# define CATCH_PLATFORM_WINDOWS +#endif + +// end catch_platform.h + +#ifdef CATCH_IMPL +# ifndef CLARA_CONFIG_MAIN +# define CLARA_CONFIG_MAIN_NOT_DEFINED +# define CLARA_CONFIG_MAIN +# endif +#endif + +// start catch_user_interfaces.h + +namespace Catch { + unsigned int rngSeed(); +} + +// end catch_user_interfaces.h +// start catch_tag_alias_autoregistrar.h + +// start catch_common.h + +// start catch_compiler_capabilities.h + +// Detect a number of compiler features - by compiler +// The following features are defined: +// +// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? +// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? +// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? +// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled? +// **************** +// Note to maintainers: if new toggles are added please document them +// in configuration.md, too +// **************** + +// In general each macro has a _NO_ form +// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature. +// Many features, at point of detection, define an _INTERNAL_ macro, so they +// can be combined, en-mass, with the _NO_ forms later. + +#ifdef __cplusplus + +# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) +# define CATCH_CPP14_OR_GREATER +# endif + +# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) +# define CATCH_CPP17_OR_GREATER +# endif + +#endif + +// Only GCC compiler should be used in this block, so other compilers trying to +// mask themselves as GCC should be ignored. +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) + +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) + +#endif + +#if defined(__clang__) + +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) + +// As of this writing, IBM XL's implementation of __builtin_constant_p has a bug +// which results in calls to destructors being emitted for each temporary, +// without a matching initialization. In practice, this can result in something +// like `std::string::~string` being called on an uninitialized value. +// +// For example, this code will likely segfault under IBM XL: +// ``` +// REQUIRE(std::string("12") + "34" == "1234") +// ``` +// +// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented. +# if !defined(__ibmxl__) && !defined(__CUDACC__) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ +# endif + +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ + _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") + +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) + +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) + +#endif // __clang__ + +//////////////////////////////////////////////////////////////////////////////// +// Assume that non-Windows platforms support posix signals by default +#if !defined(CATCH_PLATFORM_WINDOWS) + #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS +#endif + +//////////////////////////////////////////////////////////////////////////////// +// We know some environments not to support full POSIX signals +#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) + #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#endif + +#ifdef __OS400__ +# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +# define CATCH_CONFIG_COLOUR_NONE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Android somehow still does not support std::to_string +#if defined(__ANDROID__) +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +# define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Not all Windows environments support SEH properly +#if defined(__MINGW32__) +# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH +#endif + +//////////////////////////////////////////////////////////////////////////////// +// PS4 +#if defined(__ORBIS__) +# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Cygwin +#ifdef __CYGWIN__ + +// Required for some versions of Cygwin to declare gettimeofday +// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin +# define _BSD_SOURCE +// some versions of cygwin (most) do not support std::to_string. Use the libstd check. +// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 +# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ + && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) + +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING + +# endif +#endif // __CYGWIN__ + +//////////////////////////////////////////////////////////////////////////////// +// Visual C++ +#if defined(_MSC_VER) + +// Universal Windows platform does not support SEH +// Or console colours (or console at all...) +# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +# define CATCH_CONFIG_COLOUR_NONE +# else +# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH +# endif + +# if !defined(__clang__) // Handle Clang masquerading for msvc + +// MSVC traditional preprocessor needs some workaround for __VA_ARGS__ +// _MSVC_TRADITIONAL == 0 means new conformant preprocessor +// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor +# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +# endif // MSVC_TRADITIONAL + +// Only do this if we're not using clang on Windows, which uses `diagnostic push` & `diagnostic pop` +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) +# endif // __clang__ + +#endif // _MSC_VER + +#if defined(_REENTRANT) || defined(_MSC_VER) +// Enable async processing, as -pthread is specified or no additional linking is required +# define CATCH_INTERNAL_CONFIG_USE_ASYNC +#endif // _MSC_VER + +//////////////////////////////////////////////////////////////////////////////// +// Check if we are compiled with -fno-exceptions or equivalent +#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) +# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED +#endif + +//////////////////////////////////////////////////////////////////////////////// +// DJGPP +#ifdef __DJGPP__ +# define CATCH_INTERNAL_CONFIG_NO_WCHAR +#endif // __DJGPP__ + +//////////////////////////////////////////////////////////////////////////////// +// Embarcadero C++Build +#if defined(__BORLANDC__) + #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN +#endif + +//////////////////////////////////////////////////////////////////////////////// + +// Use of __COUNTER__ is suppressed during code analysis in +// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly +// handled by it. +// Otherwise all supported compilers support COUNTER macro, +// but user still might want to turn it off +#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) + #define CATCH_INTERNAL_CONFIG_COUNTER +#endif + +//////////////////////////////////////////////////////////////////////////////// + +// RTX is a special version of Windows that is real time. +// This means that it is detected as Windows, but does not provide +// the same set of capabilities as real Windows does. +#if defined(UNDER_RTSS) || defined(RTX64_BUILD) + #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH + #define CATCH_INTERNAL_CONFIG_NO_ASYNC + #define CATCH_CONFIG_COLOUR_NONE +#endif + +#if !defined(_GLIBCXX_USE_C99_MATH_TR1) +#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER +#endif + +// Various stdlib support checks that require __has_include +#if defined(__has_include) + // Check if string_view is available and usable + #if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW + #endif + + // Check if optional is available and usable + # if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL + # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) + + // Check if byte is available and usable + # if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # include + # if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0) + # define CATCH_INTERNAL_CONFIG_CPP17_BYTE + # endif + # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) + + // Check if variant is available and usable + # if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # if defined(__clang__) && (__clang_major__ < 8) + // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 + // fix should be in clang 8, workaround in libstdc++ 8.2 + # include + # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) + # define CATCH_CONFIG_NO_CPP17_VARIANT + # else + # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT + # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) + # else + # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT + # endif // defined(__clang__) && (__clang_major__ < 8) + # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) +#endif // defined(__has_include) + +#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) +# define CATCH_CONFIG_COUNTER +#endif +#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) +# define CATCH_CONFIG_WINDOWS_SEH +#endif +// This is set by default, because we assume that unix compilers are posix-signal-compatible by default. +#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) +# define CATCH_CONFIG_POSIX_SIGNALS +#endif +// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. +#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) +# define CATCH_CONFIG_WCHAR +#endif + +#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) +# define CATCH_CONFIG_CPP11_TO_STRING +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) +# define CATCH_CONFIG_CPP17_OPTIONAL +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) +# define CATCH_CONFIG_CPP17_STRING_VIEW +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) +# define CATCH_CONFIG_CPP17_VARIANT +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) +# define CATCH_CONFIG_CPP17_BYTE +#endif + +#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) +# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE +#endif + +#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) +# define CATCH_CONFIG_NEW_CAPTURE +#endif + +#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +# define CATCH_CONFIG_DISABLE_EXCEPTIONS +#endif + +#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) +# define CATCH_CONFIG_POLYFILL_ISNAN +#endif + +#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) +# define CATCH_CONFIG_USE_ASYNC +#endif + +#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE) +# define CATCH_CONFIG_ANDROID_LOGWRITE +#endif + +#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) +# define CATCH_CONFIG_GLOBAL_NEXTAFTER +#endif + +// Even if we do not think the compiler has that warning, we still have +// to provide a macro that can be used by the code. +#if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION +#endif +#if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS +#endif + +// The goal of this macro is to avoid evaluation of the arguments, but +// still have the compiler warn on problems inside... +#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) +#endif + +#if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) +# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#elif defined(__clang__) && (__clang_major__ < 5) +# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#endif + +#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#endif + +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +#define CATCH_TRY if ((true)) +#define CATCH_CATCH_ALL if ((false)) +#define CATCH_CATCH_ANON(type) if ((false)) +#else +#define CATCH_TRY try +#define CATCH_CATCH_ALL catch (...) +#define CATCH_CATCH_ANON(type) catch (type) +#endif + +#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) +#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#endif + +// end catch_compiler_capabilities.h +#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line +#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) +#ifdef CATCH_CONFIG_COUNTER +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) +#else +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) +#endif + +#include +#include +#include + +// We need a dummy global operator<< so we can bring it into Catch namespace later +struct Catch_global_namespace_dummy {}; +std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); + +namespace Catch { + + struct CaseSensitive { enum Choice { + Yes, + No + }; }; + + class NonCopyable { + NonCopyable( NonCopyable const& ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable& operator = ( NonCopyable const& ) = delete; + NonCopyable& operator = ( NonCopyable && ) = delete; + + protected: + NonCopyable(); + virtual ~NonCopyable(); + }; + + struct SourceLineInfo { + + SourceLineInfo() = delete; + SourceLineInfo( char const* _file, std::size_t _line ) noexcept + : file( _file ), + line( _line ) + {} + + SourceLineInfo( SourceLineInfo const& other ) = default; + SourceLineInfo& operator = ( SourceLineInfo const& ) = default; + SourceLineInfo( SourceLineInfo&& ) noexcept = default; + SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; + + bool empty() const noexcept { return file[0] == '\0'; } + bool operator == ( SourceLineInfo const& other ) const noexcept; + bool operator < ( SourceLineInfo const& other ) const noexcept; + + char const* file; + std::size_t line; + }; + + std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); + + // Bring in operator<< from global namespace into Catch namespace + // This is necessary because the overload of operator<< above makes + // lookup stop at namespace Catch + using ::operator<<; + + // Use this in variadic streaming macros to allow + // >> +StreamEndStop + // as well as + // >> stuff +StreamEndStop + struct StreamEndStop { + std::string operator+() const; + }; + template + T const& operator + ( T const& value, StreamEndStop ) { + return value; + } +} + +#define CATCH_INTERNAL_LINEINFO \ + ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) + +// end catch_common.h +namespace Catch { + + struct RegistrarForTagAliases { + RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); + }; + +} // end namespace Catch + +#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +// end catch_tag_alias_autoregistrar.h +// start catch_test_registry.h + +// start catch_interfaces_testcase.h + +#include + +namespace Catch { + + class TestSpec; + + struct ITestInvoker { + virtual void invoke () const = 0; + virtual ~ITestInvoker(); + }; + + class TestCase; + struct IConfig; + + struct ITestCaseRegistry { + virtual ~ITestCaseRegistry(); + virtual std::vector const& getAllTests() const = 0; + virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; + }; + + bool isThrowSafe( TestCase const& testCase, IConfig const& config ); + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector const& getAllTestCasesSorted( IConfig const& config ); + +} + +// end catch_interfaces_testcase.h +// start catch_stringref.h + +#include +#include +#include +#include + +namespace Catch { + + /// A non-owning string class (similar to the forthcoming std::string_view) + /// Note that, because a StringRef may be a substring of another string, + /// it may not be null terminated. + class StringRef { + public: + using size_type = std::size_t; + using const_iterator = const char*; + + private: + static constexpr char const* const s_empty = ""; + + char const* m_start = s_empty; + size_type m_size = 0; + + public: // construction + constexpr StringRef() noexcept = default; + + StringRef( char const* rawChars ) noexcept; + + constexpr StringRef( char const* rawChars, size_type size ) noexcept + : m_start( rawChars ), + m_size( size ) + {} + + StringRef( std::string const& stdString ) noexcept + : m_start( stdString.c_str() ), + m_size( stdString.size() ) + {} + + explicit operator std::string() const { + return std::string(m_start, m_size); + } + + public: // operators + auto operator == ( StringRef const& other ) const noexcept -> bool; + auto operator != (StringRef const& other) const noexcept -> bool { + return !(*this == other); + } + + auto operator[] ( size_type index ) const noexcept -> char { + assert(index < m_size); + return m_start[index]; + } + + public: // named queries + constexpr auto empty() const noexcept -> bool { + return m_size == 0; + } + constexpr auto size() const noexcept -> size_type { + return m_size; + } + + // Returns the current start pointer. If the StringRef is not + // null-terminated, throws std::domain_exception + auto c_str() const -> char const*; + + public: // substrings and searches + // Returns a substring of [start, start + length). + // If start + length > size(), then the substring is [start, size()). + // If start > size(), then the substring is empty. + auto substr( size_type start, size_type length ) const noexcept -> StringRef; + + // Returns the current start pointer. May not be null-terminated. + auto data() const noexcept -> char const*; + + constexpr auto isNullTerminated() const noexcept -> bool { + return m_start[m_size] == '\0'; + } + + public: // iterators + constexpr const_iterator begin() const { return m_start; } + constexpr const_iterator end() const { return m_start + m_size; } + }; + + auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; + auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; + + constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { + return StringRef( rawChars, size ); + } +} // namespace Catch + +constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { + return Catch::StringRef( rawChars, size ); +} + +// end catch_stringref.h +// start catch_preprocessor.hpp + + +#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ +#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) + +#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ +// MSVC needs more evaluations +#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) +#else +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) +#endif + +#define CATCH_REC_END(...) +#define CATCH_REC_OUT + +#define CATCH_EMPTY() +#define CATCH_DEFER(id) id CATCH_EMPTY() + +#define CATCH_REC_GET_END2() 0, CATCH_REC_END +#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 +#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 +#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT +#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) +#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) + +#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) + +#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) + +// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, +// and passes userdata as the first parameter to each invocation, +// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) +#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) +#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ +#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ +#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF +#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) +#else +// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF +#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) +#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) +#endif + +#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__ +#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name) + +#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper()) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) +#else +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper())) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) +#endif + +#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ + CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) + +#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) +#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) +#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) +#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) +#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) +#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) +#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) +#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) +#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) +#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) +#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) + +#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N + +#define INTERNAL_CATCH_TYPE_GEN\ + template struct TypeList {};\ + template\ + constexpr auto get_wrapper() noexcept -> TypeList { return {}; }\ + template class...> struct TemplateTypeList{};\ + template class...Cs>\ + constexpr auto get_wrapper() noexcept -> TemplateTypeList { return {}; }\ + template\ + struct append;\ + template\ + struct rewrap;\ + template class, typename...>\ + struct create;\ + template class, typename>\ + struct convert;\ + \ + template \ + struct append { using type = T; };\ + template< template class L1, typename...E1, template class L2, typename...E2, typename...Rest>\ + struct append, L2, Rest...> { using type = typename append, Rest...>::type; };\ + template< template class L1, typename...E1, typename...Rest>\ + struct append, TypeList, Rest...> { using type = L1; };\ + \ + template< template class Container, template class List, typename...elems>\ + struct rewrap, List> { using type = TypeList>; };\ + template< template class Container, template class List, class...Elems, typename...Elements>\ + struct rewrap, List, Elements...> { using type = typename append>, typename rewrap, Elements...>::type>::type; };\ + \ + template