本页适用于交付清单指定 STREAM 的 Eagle R508。设备活动 manifest 的应用 ID 为 eagle_r508_stream250,设备合同 ID 为 eagle-r508-stream250。先根据现场 manifest、应用身份和权限使用本页方法。STREAM 应用指南
| 任务 | 端点 | 凭据与数据 |
|---|---|---|
| 发现设备的应用和方法 | GET http://DEVICE_IP:8080/api/v1/manifest |
设备管理网,以运行 manifest 为准 |
| 读取或配置设备 | POST http://DEVICE_IP:8081/rpc |
ULMUS 具名客户端 Token,Authorization: Bearer … |
| 受管流盘和文件 | 交付所用 DAQ Web/RPC 地址 | 接收服务器自己的权限与客户端凭据 |
| 接收采集数据 | QSFP28 100G UDP | 自己管理接收时,由主机按已配置地址和端口接收 |
DEVICE_IP 为设备实际管理地址。请求用 JSON-RPC 2.0,params 为命名对象,无参数时传 {}。匹配响应 id,先检查 error 再读 result。为设备启停和主机写盘指定一个所有者。通用接口和认证说明
| 方法 | 参数 | 读取或调用后的检查 |
|---|---|---|
system.status |
{} |
核对 device_id、应用身份、state 和 udp_running。 |
clock.status |
{} |
采集准备时确认 locked: true。 |
stream.profile.list |
{} |
adc_rate_sps 是 ADC 采样率,profiles 给出可用档位、output_rate_sps、rfdc_decimation 和 channel_masks。 |
stream.profile.get |
{} |
读取 target、ready_to_start 和 packetizer 读回。失败时结合 failure_stage、cleanup_failed 查现场状态。 |
stream.profile.set |
下表五个字段 | 返回 target 及 state: "configured_stopped"。再调用 get 核对档位、掩码、NCO、包头、flow 和就绪状态。 |
udp.configure |
{} |
按设备已部署的网络配置准备 UDP 发送,核对接收端地址和端口。 |
udp.start |
{} |
启动已就绪配置。以 system.status.udp_running 和接收端实际数据确认。 |
udp.stop |
{} |
请求停止设备发送并保留设置。确认 udp_running: false,再完成接收端文件收尾。 |
| 字段(全部提供) | 类型及有效取值 |
|---|---|
profile |
字符串。选择 BW8M_10MSPS、BW16M_20MSPS、IQ125MSPS 或 IQ250MSPS。 |
channel_mask |
整数。15 为 ADC1–4,240 为 ADC5–8,255 为 ADC1–8。250 MSPS 仅接受 15 或 240。 |
header_enabled |
布尔值。 true 选择 V1,false 选择无应用头。 |
center_frequency_hz |
非负整数 Hz,设置共同 NCO。具体频率按设备允许范围。 |
flow_count |
整数。V1 可选 1、2、4、8,无头必须给 1。 |
下面选 8 MHz、10 MSPS、全 8 路和单流 V1。500 MHz 是示例 NCO。
管理或接收主机。使用上方的设备/DAQ 地址、自有令牌与本机采集参数。JSON 为请求参数示例。
{
"jsonrpc": "2.0",
"id": 1,
"method": "stream.profile.set",
"params": {
"profile": "BW8M_10MSPS",
"channel_mask": 255,
"header_enabled": true,
"center_frequency_hz": 500000000,
"flow_count": 1
}
}
自主管理采集时,按以下顺序操作。
system.status、clock.status 和 stream.profile.list。在采集所有者中结束前一任务。变更采集档位涉及共享时钟时,先关闭受影响的 DAC 输出。stream.profile.set 后,用 stream.profile.get 核对 target.name 和其他目标值,确认 ready_to_start: true。udp.configure,再调用 udp.start。确认实际开始收包。多 flow 的接收端按匹配 SDK/DAQ 的部署使用配置的基端口和连续的目标端口。udp.stop,确认设备停流,再完成主机写盘与校验。写操作超时时先查询实际状态,根据读回决定如何恢复。全组改频继续使用 stream.profile.set 并保留其他参数。运行 manifest 可另提供 adc.frequency.*、adc.attenuation.*、adc.nyquist.*、dac.frequency.set、dac.amplitude.set、mts.synchronize、sensor.sysmon、system.*、debug.xvc.* 及 stream.packetizer.* 等公共方法,按当前权限和参数定义调用。用完整档位配置保持通道、NCO、采样率与包头一致。
每个 UDP payload 为 8192 字节。V1 的 IQ 从偏移 64 起,无头从偏移 0 起。IQ 为小端有符号 I16、Q16,按采样时刻和配置的通道顺序交织。一个时刻先写通道组第一个 ADC 的 I、Q,再写同组其他 ADC。
| V1 偏移(字节) | 字段 | 检查 |
|---|---|---|
| 0–7 | 同步字、版本、头长度、站点和包类型 | 小端同步字 0x53594E43,版本 1,头长度字段为 1 个 64 字节头,ADC IQ 类型 packet_type=1。 |
| 8–19 | channel_mask、标志、frame_sequence |
对照通道组。先归并各 flow,再按全局包序号检查接收。 |
| 20–43 | utc_second、sample_index、center_frequency_hz |
小端 64 位字段,频率为设置的 NCO。UTC 用途按 sync_status 及已验证的授时条件。 |
| 44–47 | sample_rate_id、decimation_id |
采样率 ID 1、2、3、4 对应 10、20、125、250 MSPS。RFDC 抽取按当前档位为 40 或 20。 |
| 48–63 | IQ 块计数、长度、adc_iq_format、状态及保留字段 |
V1 IQ 载荷 8128 字节。当前格式块数与有效块数均为 127,adc_iq_format=1,CRC 字段保留为 0。 |
V1 的四路/八路分别为每包每通道 508/254 个复数样点,无头分别为 512/256。无头文件依靠采集配置识别档位、通道和采样率。有头包序号适用于接收完整性检查。源样点连续性与绝对 UTC 精度另按测量结果评估。通道组和数据速率
使用配套的 STREAM DAQ 服务。先检查 server.status 和 device.status,用新的 task_id 调用 acquisition.start。下方只包含 DAQ Web 参数框需要的对象。示例选 256 MiB 分片,以运行 manifest 中可用的大小为准。
管理或接收主机。使用上方的设备/DAQ 地址、自有令牌与本机采集参数。JSON 为请求参数示例。
{
"task_id": "stream_first",
"profile": "BW8M_10MSPS",
"adc_channels": [0, 1, 2, 3, 4, 5, 6, 7],
"center_frequency_hz": 500000000,
"packet_header_enabled": true,
"flow_count": 1,
"segment_size_mib": 256
}
DAQ 主机参数使用零起始的 adc_channels 和 packet_header_enabled。选择 250 MSPS 时,用 [0,1,2,3] 或 [4,5,6,7]。只配置停止态时使用 stream.configure,按其 manifest 提交采集字段。实际开始和结束使用 acquisition.start、acquisition.stop,由 DAQ 完成设备和接收端编排。关闭后检查任务终态、累计有效字节与 task.json。
将下方保存为 stream250_query.py。从设备 Web 的客户端 Token 管理取得自己的有权 Token,保存在仅调用用户可读的文件中。用实际管理地址和 Token 文件路径运行 python3 stream250_query.py DEVICE_IP TOKEN_FILE。示例调用 system.status、stream.profile.list 和 stream.profile.get。
管理或接收主机。使用上方的设备/DAQ 地址、自有令牌与本机采集参数。JSON 为请求参数示例。
"""Query a delivery-matched R508 STREAM over device JSON-RPC."""
import http.client
import json
from pathlib import Path
import sys
import uuid
def call(host, token, method, params=None):
"""Return one matched result from the device management RPC endpoint."""
request_id = uuid.uuid4().hex
request = {"jsonrpc": "2.0", "id": request_id, "method": method,
"params": {} if params is None else params}
with_connection = http.client.HTTPConnection(host, 8081, timeout=10)
try:
with_connection.request("POST", "/rpc", json.dumps(request), {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}",
})
response = with_connection.getresponse()
if response.status != 200:
raise RuntimeError(f"{method}: HTTP {response.status}")
reply = json.loads(response.read(1_048_576))
finally:
with_connection.close()
if (reply.get("jsonrpc"), reply.get("id")) != ("2.0", request_id):
raise RuntimeError(f"{method}: unmatched JSON-RPC response")
if "error" in reply or not isinstance(reply.get("result"), dict):
raise RuntimeError(f"{method}: response has no usable result")
return reply["result"]
def main():
"""Read device identity, supported profiles and current profile."""
if len(sys.argv) != 3:
raise SystemExit("usage: python3 stream250_query.py DEVICE_IP TOKEN_FILE")
host, token_path = sys.argv[1:]
token = Path(token_path).read_text(encoding="utf-8").strip()
system = call(host, token, "system.status")
if system.get("device_id") != "eagle-r508-stream250":
raise SystemExit("The active device contract is not STREAM")
catalog = call(host, token, "stream.profile.list")
current = call(host, token, "stream.profile.get")
print(json.dumps({"profiles": catalog["profiles"], "target": current["target"],
"ready_to_start": current["ready_to_start"]}, indent=2))
if __name__ == "__main__":
main()
将下方保存为 stream250_query.cpp。使用 libcurl、JsonCpp 开发包和 pkg-config 编译,随后传入与 Python 示例相同的管理地址和 Token 文件路径。
管理或接收主机。使用上方的设备/DAQ 地址、自有令牌与本机采集参数。JSON 为请求参数示例。
g++ -std=c++17 -O2 stream250_query.cpp \
$(pkg-config --cflags --libs libcurl jsoncpp) -o stream250_query
./stream250_query DEVICE_IP TOKEN_FILE
管理或接收主机。使用上方的设备/DAQ 地址、自有令牌与本机采集参数。JSON 为请求参数示例。
/* Query the R508 STREAM device contract via libcurl and JsonCpp. */
#include <curl/curl.h>
#include <json/json.h>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <memory>
#include <sstream>
#include <stdexcept>
#include <string>
static size_t append_reply(char* data, size_t size, size_t count, void* state)
{
auto& body = *static_cast<std::string*>(state);
const size_t bytes = size * count;
if (bytes > 1048576 - body.size()) {
return 0;
}
body.append(data, bytes);
return bytes;
}
static Json::Value call(const std::string& host, const std::string& token,
const std::string& method, const Json::Value& params = Json::Value(Json::objectValue))
{
const std::string url = "http://" + host + ":8081/rpc";
Json::Value request(Json::objectValue);
request["jsonrpc"] = "2.0";
request["id"] = method; // One request at a time, with a matching response ID.
request["method"] = method;
request["params"] = params;
const std::string payload = Json::writeString(Json::StreamWriterBuilder{}, request);
const std::string authorization = "Authorization: Bearer " + token;
std::unique_ptr<CURL, decltype(&curl_easy_cleanup)> connection(curl_easy_init(), curl_easy_cleanup);
std::unique_ptr<curl_slist, decltype(&curl_slist_free_all)> headers(
curl_slist_append(nullptr, "Content-Type: application/json"), curl_slist_free_all);
if (!connection || !headers || !curl_slist_append(headers.get(), authorization.c_str())) {
throw std::runtime_error("Could not initialize HTTP request");
}
std::string body;
curl_easy_setopt(connection.get(), CURLOPT_URL, url.c_str());
curl_easy_setopt(connection.get(), CURLOPT_HTTPHEADER, headers.get());
curl_easy_setopt(connection.get(), CURLOPT_POSTFIELDS, payload.c_str());
curl_easy_setopt(connection.get(), CURLOPT_TIMEOUT, 10L);
curl_easy_setopt(connection.get(), CURLOPT_NOPROXY, "*");
curl_easy_setopt(connection.get(), CURLOPT_WRITEFUNCTION, append_reply);
curl_easy_setopt(connection.get(), CURLOPT_WRITEDATA, &body);
long http = 0;
if (curl_easy_perform(connection.get()) != CURLE_OK
|| curl_easy_getinfo(connection.get(), CURLINFO_RESPONSE_CODE, &http) != CURLE_OK
|| http != 200) {
throw std::runtime_error(method + ": HTTP request failed");
}
Json::Value reply;
std::istringstream stream(body);
Json::CharReaderBuilder reader;
reader["failIfExtra"] = true;
if (!Json::parseFromStream(reader, stream, &reply, nullptr) || !reply.isObject()
|| reply["jsonrpc"] != "2.0" || reply["id"] != request["id"]
|| reply.isMember("error") || !reply["result"].isObject()) {
throw std::runtime_error(method + ": response has no matched result");
}
return reply["result"];
}
int main(int argc, char** argv)
{
if (argc != 3) {
std::cerr << "usage: stream250_query DEVICE_IP TOKEN_FILE\n";
return 1;
}
try {
if (curl_global_init(CURL_GLOBAL_DEFAULT) != CURLE_OK) {
throw std::runtime_error("Could not initialize libcurl");
}
std::atexit(curl_global_cleanup);
std::ifstream token_file(argv[2]);
std::string token;
if (!(token_file >> token)) {
throw std::runtime_error("Cannot read the device token file");
}
if (call(argv[1], token, "system.status")["device_id"] != "eagle-r508-stream250") {
throw std::runtime_error("The active device contract is not STREAM");
}
const auto catalog = call(argv[1], token, "stream.profile.list");
const auto current = call(argv[1], token, "stream.profile.get");
Json::Value output(Json::objectValue);
output["profiles"] = catalog["profiles"];
output["target"] = current["target"];
output["ready_to_start"] = current["ready_to_start"];
std::cout << output << '\n';
} catch (const std::exception& error) {
std::cerr << error.what() << '\n';
return 1;
}
}