Skip to content

v1.13.18 - Unified EventQueue 3-Layer Architecture (2025-12-11)

What Changed?

This release completes the architectural unification of EventQueue and CommandQueue by implementing a consistent 3-layer pipeline for all device output. The circular dependency issue in event_response.h has been resolved, and event serialization now follows the same layer pattern as command responses. This improves maintainability, reduces code duplication, and paves the way for future event validation enhancements.


What's New

Main Feature: Unified 3-Layer Event Processing Pipeline

What it does:

EventQueue now uses the same 3-layer architecture as CommandQueue:

  • Layer 1 (Domain): event_response_t with validation and metadata
  • Layer 2 (Transport): DeviceResponse::from_event() converts to unified format
  • Layer 3 (Serialization): DeviceResponse::send() produces JSON output

How to use it: No changes required for users. Event output format remains unchanged. Developers using EventQueue::enqueue() will automatically benefit from the unified serialization pipeline.

Code example:

// Layer 1: Create event response (in detection_process)
event_t event = { .hit1 = 100, .hit2 = 85, ... };
event_response_t event_response = event_response_ok(&event);
event_response.sent_at = device_get_timestamp();

// Queue entry combines both
event_queue_entry_t entry = {
  .response = event_response,
  .event = event
};
EventQueue::enqueue(&entry);

// Layer 2 & 3: Automatic conversion and serialization in EventQueue::flush()
// Output: {"type":"event","status":"ok","sent_at":12345,"hit1":100,...}

Installation

Quick Start

# Get the release
git checkout v1.13.18

# Build
task build

# Upload
task upload

# Check it works
task monitor

What's Different from the Last Version?

βœ… Added

  • event_response_t Layer 1 structure unified with command_response_t
  • DeviceResponse::from_event() method for Layer 2 conversion
  • Progress documentation: EventQueue↔CommandQueue symmetry analysis
  • 3-layer serialization pipeline in EventQueue::flush()

πŸ”§ Changed

  • EventQueue now uses unified device response protocol throughout
  • All 23 command handlers updated to use unified helper function names:
  • command_response_ok() for success responses
  • command_response_error() for error responses
  • event_queue.h includes only device_response_types.h (resolves circular dependency)
  • EventQueue serialization moved from send_event_response_full() to DeviceResponse::send()

πŸ› Fixed

  • βœ… Circular dependency between event_response.h and device_response.h
  • βœ… Build failure due to undefined event_response_t in DeviceResponse class
  • βœ… Inconsistent error handling between command and event paths

❌ Removed

  • include/event_response.h (consolidated into event_queue.h)
  • src/event_response.cpp (consolidated into event_queue.cpp)

Is It Safe to Upgrade?

Backward Compatible: Yes

  • Event output format remains unchanged (same JSON structure)
  • EventQueue API unchanged (init(), enqueue(), flush() signatures identical)
  • ENABLE_DEVICE_RESPONSE=0 continues to work with legacy protocol
  • All existing command handlers remain compatible (function name changes internal only)

Tests Passed

  • βœ… Builds without errors (all 3 profiles: release, debug, next)
  • βœ… RAM usage: 36.2% (118,720 / 327,680 bytes)
  • βœ… Flash usage: 27.3% (357,765 / 1,310,720 bytes)
  • βœ… Pre-commit hooks: All passed (trailing whitespace, file endings, merge conflicts)
  • βœ… Build time: 5.34 seconds

Release Details

  • Date: 2025-12-11
  • Version: v1.13.18
  • Commits: 7 (from v1.13.17)
  • Files Changed: 29
  • Lines Added: 1,232
  • Lines Deleted: 530

Next Steps

Planned for v1.14.0

  • CommandParser class for unified argument parsing
  • Event validation layer (Layer 1.5) for sensor error handling
  • Stream format options consolidation (STREAM_FORMAT unification)

Future Roadmap (v1.15.0+)

  • Complete Doxygen documentation for event_response_t
  • EventQueue and CommandQueue test suites
  • Performance benchmarking and optimization
  • Multi-threaded event handling exploration