Skip to content

Add JSON serial event subscriptions#333

Closed
samuelcoustet wants to merge 2 commits into
esp32-si4732:mainfrom
samuelcoustet:feature/json-serial-events
Closed

Add JSON serial event subscriptions#333
samuelcoustet wants to merge 2 commits into
esp32-si4732:mainfrom
samuelcoustet:feature/json-serial-events

Conversation

@samuelcoustet

Copy link
Copy Markdown

This PR extends the optional JSON serial API by adding asynchronous event subscriptions over USB serial.

Goals:

  • reduce polling from external clients
  • improve responsiveness for Flask/web/mobile integrations
  • provide real-time radio state updates
  • keep backward compatibility with existing serial protocol

New commands:

  • subscribe_events
  • unsubscribe_events
  • subscribe_signal
  • unsubscribe_signal

New event types:

  • frequency_changed
  • mode_changed
  • bfo_changed
  • volume_changed
  • signal
  • seek_up_started
  • seek_down_started

Implementation details:

  • adds jsonTick() periodic processing
  • minimal Remote.cpp modification
  • protocol version bumped to 1.2
  • optional async signal reporting every 500 ms

Examples:

{"cmd":"subscribe_events"}
{"cmd":"subscribe_signal"}

Example output:

{"status":"event","event":"frequency_changed",...}
{"status":"event","event":"signal","rssi":42,"snr":18}

Compatibility:

  • existing serial protocol unchanged
  • fully compatible with previous JSON API PR
  • no UI redesign
  • no DSP changes

Notes:

  • events are opt-in only
  • designed for external dashboards and automation
  • future websocket bridge possible

@max-arnold

Copy link
Copy Markdown
Contributor

Hey!

Thank you for the PR, it is very helpful for me because the code explains the intent better than any feature request. It is not going to be merged though, because I'm working on a different design:

  • multiple transports (serial, bluetooth, tcp, websocket)
  • multiple protocols, including CAT (probably Kenwood-compatible)

Let's keep this PR open as a reminder for me, and please close your first PR #332 if this one supersedes it

Related: #128, #196, #295 (hamlib protocol)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants