From 97d670d1cd79d5b81570a770a9b52dc353e1f794 Mon Sep 17 00:00:00 2001 From: Daniel Peter Chokola Date: Sun, 8 Nov 2026 23:37:27 -0500 Subject: [PATCH] mcpserver: chirpmodem listen mode listen with mode "chirpmodem" adds the ChirpModem demodulator with SF9 at 62.5 kHz, placed 56 kHz clear of the device's DC spike in a baseband of at least 256 kS/s. It is not a scan mode (no channel raster). Frames go to get_packets. listen sent the mode's bandwidth as rfBandwidth to every demodulator. A mode whose settings give it under the demodulator's own key ("bandwidth" for ChirpModem) now keeps it, so no unknown key is reported. The get_packets, server instructions, readme and receiving guide texts list chirpmodem. Verified over the air: listen on 223.60 MHz through an RTL-SDR, the ChirpModem modulator transmitting from a Pluto through 40 dB: 5/5 frames in get_packets, +13.2 dB, -12.0 ppm. Co-Authored-By: Claude Opus 5.5 --- plugins/feature/mcpserver/bandguide.md | 3 ++- plugins/feature/mcpserver/mcpprotocol.cpp | 2 +- plugins/feature/mcpserver/mcptools.cpp | 16 +++++++++++----- plugins/feature/mcpserver/readme.md | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/plugins/feature/mcpserver/bandguide.md b/plugins/feature/mcpserver/bandguide.md index fc76a6ddd..6873c58d9 100644 --- a/plugins/feature/mcpserver/bandguide.md +++ b/plugins/feature/mcpserver/bandguide.md @@ -60,6 +60,7 @@ Minimum device sample rates: |------|---------|-----------|-------| | APRS and AX.25 packet | `PacketDemod` | 144.800 MHz in Europe, 144.390 MHz in North America | `listen` with mode `aprs` adds the APRS feature, which decodes and maps the stations; mode `packet` is the demodulator alone | | M17 digital voice | `M17Demod` | 144 and 430 MHz bands | Also carries data packets | +| chirpmodem | `ChirpModemDemod` | 223.58 MHz (1.25 m band), or as arranged | Chirp spread spectrum, SF and bandwidth not signalled: `listen` with mode `chirpmodem` sets SF9 at 62.5 kHz; change `spreadFactor` and `bandwidth` with `set_channel_settings` to match the transmitter. Frames go to `get_packets` with source, destination and body | | FT8 and other digital HF | `FT8Demod` | HF band segments | Needs an HF capable receiver | | SSB and CW | `SSBDemod`, `WDSPRx` | HF | `WDSPRx` has the more capable receiver chain | | RTTY | `RTTYDemod` | HF | | @@ -227,7 +228,7 @@ looks like an empty band. | DVB-T and DVB-T2 (and DVB-S and S2) | Channel report | `DVBDemodReport`: `state` (Locked when the transport stream is being decoded), `standard`, `mode`, `constellation`, `codeRate`, `mer`, and `postViterbiBER` for DVB-T and DVB-S (below 2e-4 is error free) or `ldpcIterations` and `bchFailures` for DVB-T2 and DVB-S2; for DVB-S2 also `modcod`, `esN0` (dB, compare with the MODCOD's threshold), `plFrames` and `plHeaderMisses`, and `measuredSymbolRate` for both satellite standards. What's on: `epgNowTitle`, `epgNowStart` (UTC), `epgNowDuration` (s), `epgNowDescription` and `epgNextTitle`, `epgNextStart` of `epgServiceId` (the `serviceId` setting, or the first TV service); the guide takes a minute or so to arrive, and is cached. Recording to .ts files in `recordDirectory`: channel_action `{"record": 1}` (or 0 to stop) records the service selected, or with `recordMode` 0 the whole multiplex; `{"recordEvent": 1, "serviceId": id, "eventId": id}` records a programme from the guide (0 cancels), starting `recordStartPadding` s early and ending `recordEndPadding` s late; the report has `recording`, `recordingFile`, `recordingSize` and `scheduledRecordings`. channel_action `{"play": 1, "serviceId": id}` plays a service from the guide, retuning the device to its multiplex if it's on another. Audio and subtitles: `audioLanguage` and `subtitleLanguage` (ISO 639-2, e.g. eng), `audioDescription` 1 to mix in audio description and `subtitles` 1 to show subtitles, where the service has them. Video, the service list and the full guide are in the GUI; with `udpEnabled` the transport stream goes to `udpAddress`:`udpPort` for VLC | | DRM | Channel report | `DRMDemodReport`: `syncState`, `mscMERDB`, `services`, `audioActive`, `textMessage`, `error`; select a service with `set_channel_settings` (see Checking DRM reception) | | ADS-B | Map items | `get_map_items` lists the aircraft with position, altitude, heading and callsign; the channel report only has counts and the tracked target | -| AIS, APRS and AX.25, LoRa, M17, Meshtastic, MeshCore, Inmarsat, radiosondes | Packet buffer | `get_packets`, which decodes AIS position reports, APRS positions and RS41 frames. Ships, stations and sondes also appear in `get_map_items` when the Map feature is present | +| AIS, APRS and AX.25, LoRa, M17, Meshtastic, MeshCore, Inmarsat, radiosondes, chirpmodem | Packet buffer | `get_packets`, which decodes AIS position reports, APRS positions, RS41 frames and chirpmodem MAC frames. Ships, stations and sondes also appear in `get_map_items` when the Map feature is present | | DroneID | Packet buffer and map items | `get_packets` decodes serial number, model, drone position, altitude and speed, and pilot and home positions. `get_map_items` lists the drone, pilot and home point when the Map feature is present | | VOR | Channel report | `VORDemodReport.radial` with `validRadial`, and the Morse ident | | Pagers, DSC, NAVTEX, RTTY, FT8 | GUI only | The decoded messages are shown in the plugin's window; the API carries the channel power only. Say so rather than reporting the band as empty | diff --git a/plugins/feature/mcpserver/mcpprotocol.cpp b/plugins/feature/mcpserver/mcpprotocol.cpp index 2fefad2cd..1bbbc22c6 100644 --- a/plugins/feature/mcpserver/mcpprotocol.cpp +++ b/plugins/feature/mcpserver/mcpprotocol.cpp @@ -344,7 +344,7 @@ QString MCPProtocol::instructions() "\n" "Recording: record_iq writes baseband IQ for a fixed time, start_iq_recording/stop_iq_recording for longer; capture_audio " "writes a demodulator's audio to WAV and says whether it was silent. Files go under the capture directory shown by " - "get_server_status. Live data: get_packets (AIS, APRS, LoRa, M17, Meshtastic, Inmarsat, radiosondes) and get_map_items " + "get_server_status. Live data: get_packets (AIS, APRS, LoRa, M17, Meshtastic, Inmarsat, radiosondes, chirpmodem) and get_map_items " "(aircraft, ships, sondes, satellites) return what running plugins have decoded.\n" "\n" "Frequencies are in Hz. Direction is \"rx\" or \"tx\". Creation tools wait for SDRangel to finish and return the new index; " diff --git a/plugins/feature/mcpserver/mcptools.cpp b/plugins/feature/mcpserver/mcptools.cpp index 4b7992bba..83a5d9fd7 100644 --- a/plugins/feature/mcpserver/mcptools.cpp +++ b/plugins/feature/mcpserver/mcptools.cpp @@ -2366,9 +2366,9 @@ void MCPTools::registerInstanceTools() add("get_packets", "Get recently decoded packets from packet-oriented demodulators (AIS, APRS/AX.25 packet, LoRa/ChirpChat, M17, Meshtastic, " - "MeshCore, Inmarsat, radiosonde, DJI DroneID). Each packet has the raw bytes (hex and printable text) and, where SDRangel can decode it, " + "MeshCore, Inmarsat, radiosonde, DJI DroneID, chirpmodem). Each packet has the raw bytes (hex and printable text) and, where SDRangel can decode it, " "a decoded object: AIS message type, MMSI, position, course and speed; AX.25 from/to/via and data with APRS position and " - "comment; RS41 radiosonde serial, position and height; DroneID drone serial, model, position, altitude and speed, and pilot " + "comment; chirpmodem source, destination and body; RS41 radiosonde serial, position and height; DroneID drone serial, model, position, altitude and speed, and pilot " "and home positions. Packets are kept in a buffer of the last 1000; use sinceSequence " "with the lastSequence of a previous call to read only new packets.", schema({ @@ -3956,11 +3956,14 @@ const ListenMode listenModes[] = { // with the APRS feature to plot the stations {"packet", "PacketDemod", 12500, 48000, "{}", 0, nullptr, 0}, {"aprs", "PacketDemod", 12500, 48000, "{}", 0, "APRS", 0}, + // chirpmodem (libchirpmodem format v1): SF9 at 62.5 kHz, as on 223.58 MHz. Its bandwidth key is + // "bandwidth", given here, so listen does not also send rfBandwidth. Frames go to get_packets + {"chirpmodem", "ChirpModemDemod", 62500, 256000, "{\"spreadFactor\":9,\"bandwidth\":62500}", 0, nullptr, 0}, // DJI DroneID is a 9 MHz wide OFDM burst, needing a 15.36 MS/s baseband {"droneid", "DroneIDDemod", 0, 15360000, "{}", 0, nullptr, 0}, }; -const char *const listenModeList = "bfm, wfm, nfm, am, ssb, usb, lsb, dab, drm, adsb, ais, dsc, dsd, dmr, dpmr, dstar, ysf, nxdn, pager, sonde, packet, aprs, droneid"; +const char *const listenModeList = "bfm, wfm, nfm, am, ssb, usb, lsb, dab, drm, adsb, ais, dsc, dsd, dmr, dpmr, dstar, ysf, nxdn, pager, sonde, packet, aprs, chirpmodem, droneid"; // The feature a demodulator of this type feeds, by the modes that add one; null for none const char *featureForChannelType(const QString& channelType) @@ -5292,7 +5295,8 @@ void MCPTools::registerIntentTools() {"frequency", numProp("Frequency to receive in Hz, e.g. 97300000 for 97.3 MHz")}, {"mode", strProp("bfm (broadcast FM with stereo and RDS), wfm, nfm, am or airband, ssb/usb, lsb, dab, drm (Digital Radio Mondiale), adsb, ais, dsc, dsd/dmr, " "dmr, dpmr, dstar, ysf, nxdn or nxdn24 (digital voice through the DSD demodulator with the deviation and baud rate of that standard), " - "pager (POCSAG), sonde (RS41 radiosondes), packet (AX.25), aprs (APRS with its feature), or any channel type id from list_channel_types. Default nfm")}, + "pager (POCSAG), sonde (RS41 radiosondes), packet (AX.25), aprs (APRS with its feature), chirpmodem (chirpmodem frames, SF9 62.5 kHz), " + "or any channel type id from list_channel_types. Default nfm")}, {"device", strProp(deviceHint)}, {"replace", prop("boolean", "Retune the demodulator a previous listen added to this device set when it is of the same type, and remove every other channel earlier listen and scan calls added there, so that exploring a band does not leave a trail of demodulators all playing audio and mis-tuned for the current centre frequency. Channels added any other way are kept on their frequency where the baseband still holds them; audio demodulators it cannot hold are removed, anything else is left and named. Default true")}, {"tuneGain", prop("boolean", "Measure and set the receiver gain, as tune_gain does, when the device set is new or the retune is to another band (more than a tenth of the frequency away). Adds several seconds in those cases and none otherwise. false leaves the gain as it is. Default true")} @@ -5435,7 +5439,9 @@ void MCPTools::registerIntentTools() initial["inputFrequencyOffset"] = offset; - if (rfBandwidth != 0) { + // A mode whose settings give the bandwidth under the demodulator's own key (the + // ChirpModem demodulator's is "bandwidth") keeps it: rfBandwidth would be an unknown key + if ((rfBandwidth != 0) && !initial.contains("bandwidth")) { initial["rfBandwidth"] = rfBandwidth; } diff --git a/plugins/feature/mcpserver/readme.md b/plugins/feature/mcpserver/readme.md index 5e6fe9d0c..dee67763b 100644 --- a/plugins/feature/mcpserver/readme.md +++ b/plugins/feature/mcpserver/readme.md @@ -127,7 +127,7 @@ Each tool carries MCP annotations: whether it only reads, whether it overwrites `describe_settings` returns the OpenAPI documentation of the settings, report and actions keys of a device, channel or feature type, so that an agent can learn the valid keys rather than guess them. The `set_*_settings` tools accept a partial settings object containing only the keys to change. -`get_packets` returns the packets received on the `packets`, `ais` and `radiosonde` message pipes of the packet, ChirpChat, M17, Meshtastic, MeshCore, Inmarsat, AIS and radiosonde demodulators, kept in a buffer of the last 1000. Each packet carries the raw bytes and, where possible, a decode: AIS message type, MMSI, position, course and speed; AX.25 addresses and data with the APRS position and comment; RS41 serial, position and height. `get_map_items` returns the objects that the same channels and features that feed the Map send on the `mapitems` pipe (aircraft, ships, APRS stations, radiosondes, satellites, Sun and Moon, beacons), with the image, text and, on request, the track. Items are removed when their source removes them or is deleted. Both work whether or not a Map or AIS/APRS feature is present. +`get_packets` returns the packets received on the `packets`, `ais` and `radiosonde` message pipes of the packet, ChirpChat, ChirpModem, M17, Meshtastic, MeshCore, Inmarsat, AIS and radiosonde demodulators, kept in a buffer of the last 1000. Each packet carries the raw bytes and, where possible, a decode: AIS message type, MMSI, position, course and speed; AX.25 addresses and data with the APRS position and comment; RS41 serial, position and height; chirpmodem source, destination and body. `get_map_items` returns the objects that the same channels and features that feed the Map send on the `mapitems` pipe (aircraft, ships, APRS stations, radiosondes, satellites, Sun and Moon, beacons), with the image, text and, on request, the track. Items are removed when their source removes them or is deleted. Both work whether or not a Map or AIS/APRS feature is present. `record_iq` records baseband IQ to an `.sdriq` file for a fixed number of seconds and returns the files written; `start_iq_recording` and `stop_iq_recording` do the same without a time limit for longer captures. Both work by adding a File Sink channel to the device set, so the recording has the offset and decimation the tools are given. `capture_audio` records the demodulated audio of a channel to a WAV file, and reports the sample rate, the peak level and whether the audio was silent, which tells an agent that a squelch is closed rather than that nothing is wrong. It works with demodulators that feed the Demod Analyzer, such as NFMDemod, AMDemod, SSBDemod, WFMDemod and BFMDemod. With `inline` true it also returns the audio as base64, as a mono 16 kHz copy, since MCP clients refuse a tool result over about a megabyte and ten seconds at 48 kHz would exceed that once encoded; the file keeps the full rate. Both blocking tools are capped at 30 seconds so they cannot hold an MCP client's connection open indefinitely.