客户交付包含 RAW、STREAM、SAM,开机默认进入 STREAM,采集初始为停止状态。
| 任务 | 应用与操作 | 设备 API |
|---|---|---|
| 保留原始无头数据报 | RAW | RAW API |
| 选择 IQ 档位和通道组,记录数据 | STREAM | STREAM API |
| 查看频谱与快照,按应用控制输出 | SAM | SAM API |
ULMUS · Device SDK · DAQ Server
| 你要做什么 | 接口 | 程序负责什么 |
|---|---|---|
| 查状态、改 NCO 或启停采集 | 管理网 POST http://DEVICE_IP:8081/rpc |
认证、校验响应、确认实际状态 |
| 发现当前应用的方法和参数 | 管理网 GET http://DEVICE_IP:8080/api/v1/manifest |
按当前应用及版本选择功能 |
| 接收采集数据 | R508 通过 100G 数据网发 UDP | 在接收主机绑定地址和端口,按应用格式解析并保存 |
| 目标 | 可选方式 | 仍需自行负责 |
|---|---|---|
| 查询状态、配置或启停设备 | 标准 HTTP/JSON-RPC 客户端直连 R508 管理口 | 认证、应用/版本匹配、参数单位、错误与唯一控制权;API可达不代表IQ已保存 |
| 用现成服务管理任务和文件 | 业务程序调用已部署的 DAQ Web/API | 客户端机器无需SDK;接收服务器上的DAQ仍依赖配套SDK,不能说整个系统不需要SDK |
| 自行接收和处理 IQ | 按公开应用协议实现 UDP 接收、解包和保存 | 收包资源、流重排、通道/IQ率/包头、停止排空、有效长度、连续性及存储预算 |
下面的直接 RPC 和第一包练习保留为入门:标准 socket 的少量收包不等于持续满速接收。不同应用的结构化包头或无头 IQ 合同不能混用,无头包没有可供补造的源序号。需要多台设备时先规划管理/数据地址与独立 DAQ 实例,不要靠复制同一配置或改一个端口推定 DPDK 并行隔离。
r508_direct.py,运行 python3 r508_direct.py R508_MANAGEMENT_IP。将 R508_MANAGEMENT_IP 替换为设备的实际管理地址,按提示粘贴 Token。示例通过受信管理网访问设备的原生 HTTP。system.status 返回的应用身份和 state。查询成功后可在代码中复用 call(),把方法及命名参数替换为 manifest 所列的值。比如通用 ADC 读频率方法声明存在时,调用 adc.frequency.get,传入 {"channels":[0]} 查询逻辑 CH0。如果上位机是网页,由自己的后端保存设备 Token、发起 RPC 和接收 UDP,网页通过自己的后端获取状态和结果。
管理或接收主机 · 按本段的设备合同准备网络,替换管理地址、凭据文件及接收端参数。
"""Copyright (C) LogicRF Technologies (Chengdu) Co., Ltd. All Rights Reserved.
@file r508_direct.py
@brief Query R508 identity over JSON-RPC.
@details This standard-library example is the shared source for both languages
of the public developer guide. It runs on the customer's host.
@author LogicRF Technologies
@architect LogicRF
@email info@logicrf.com
@website https://www.logicrf.com
@version 1.0.0
@date 2026-11-18
"""
import argparse
import getpass
import http.client
import json
import uuid
def call(device_ip, token, method, params=None):
"""Send one request and return its matched result, without automatic retries."""
request_id = uuid.uuid4().hex
request = {"jsonrpc": "2.0", "id": request_id, "method": method,
"params": {} if params is None else params}
connection = http.client.HTTPConnection(device_ip, 8081, timeout=15)
try:
connection.request("POST", "/rpc", json.dumps(request), {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}",
})
response = connection.getresponse()
if response.status != 200:
raise RuntimeError(f"{method}: HTTP {response.status}")
reply = json.loads(response.read(1024 * 1024))
finally:
connection.close()
if reply.get("jsonrpc") != "2.0" or reply.get("id") != request_id:
raise RuntimeError(f"{method}: unexpected JSON-RPC response")
if "error" in reply:
raise RuntimeError(f"{method}: JSON-RPC error {reply['error']['code']}")
return reply["result"]
def main():
"""Query the current device identity from the management host."""
parser = argparse.ArgumentParser()
parser.add_argument("device_ip")
args = parser.parse_args()
token = getpass.getpass("Device token: ")
status = call(args.device_ip, token, "system.status", {})
print(json.dumps(status, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()
先保存上文的 r508_direct.py,再把下面的代码保存为同目录的 stream_first_packet.py。在 ULMUS 核对活动应用为 eagle_r508_stream250,确认设备独占、没有 DAQ/Workbench 采集任务,已停用受共享时钟影响的 DAC。核对数据网口上配置的接收地址和目的端口。
在接收机执行 python3 stream_first_packet.py DEVICE_IP LOCAL_DATA_IP UDP_PORT,将三项替换为实际管理 IP、本机数据口 IP 和已配置的目的端口。按提示输入具备采集权限的设备令牌。成功时显示序列号及 ADC1–8 各一对 I、Q,然后停止发送。超时或设备失联时先读回状态,再决定是否重试。参数和数据报格式
管理或接收主机 · 按本段的设备合同准备网络,替换管理地址、凭据文件及接收端参数。
"""Copyright (C) LogicRF Technologies (Chengdu) Co., Ltd. All Rights Reserved.
@file stream_first_packet.py
@brief Receive one STREAM V1 IQ datagram on an exclusively owned R508.
@details Uses call() from r508_direct.py in the developer guide.
@author LogicRF Technologies
@version 1.0
"""
import argparse
import getpass
import socket
import struct
from r508_direct import call
def decode(packet):
"""Validate the eight-channel example profile and return sequence and first IQ pairs."""
if len(packet) != 8192:
raise ValueError("Expected one complete 8192-byte UDP payload")
magic, version, words, station, kind, mask, flags, sequence = struct.unpack_from("<IBBBBHHQ", packet)
if (magic, version, words, kind, mask) != (0x53594E43, 1, 1, 1, 255):
raise ValueError("Expected eight-channel V1 ADC IQ")
if struct.unpack_from("<QH", packet, 36) != (500_000_000, 1):
raise ValueError("Unexpected NCO or sample-rate ID")
if struct.unpack_from("<4H", packet, 48) != (127, 8128, 1, 127):
raise ValueError("Unexpected IQ payload layout")
return sequence, list(struct.iter_unpack("<hh", packet[64:96]))
def capture(rpc, local_ip, udp_port):
"""Bind first, configure the idle sender, verify its response and stop our acquisition."""
status = rpc("system.status")
if (status.get("device_id"), status.get("state"), status.get("udp_running")) != (
"eagle-r508-stream250", "ready", False
) or rpc("clock.status").get("locked") is not True:
raise RuntimeError("Check app identity, readiness, idle sender and clock lock")
profile = {"profile": "BW8M_10MSPS", "channel_mask": 255, "flow_count": 1,
"header_enabled": True, "center_frequency_hz": 500_000_000}
choices = rpc("stream.profile.list")["profiles"]
if not any(p["profile"] == profile["profile"] and 255 in p["channel_masks"] for p in choices):
raise RuntimeError("This profile and channel group are unavailable")
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as receiver:
receiver.bind((local_ip, udp_port))
receiver.settimeout(8)
rpc("stream.profile.set", profile)
current = rpc("stream.profile.get")
target = current["target"]
if current.get("ready_to_start") is not True or any(
target.get("name" if key == "profile" else key) != value for key, value in profile.items()
):
raise RuntimeError("Readback does not match the requested profile")
rpc("udp.configure")
try:
rpc("udp.start")
packet, peer = receiver.recvfrom(65535)
sequence, samples = decode(packet)
print("Peer:", peer, "sequence:", sequence, "ADC1–8 (I,Q):", samples)
finally:
# We established exclusive control and an idle sender before starting.
if rpc("system.status")["udp_running"]:
rpc("udp.stop")
if rpc("system.status")["udp_running"]:
raise RuntimeError("Sender still active; check the device")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument("device", help="R508 management address")
parser.add_argument("local_ip", help="provisioned receiver NIC address")
parser.add_argument("udp_port", type=int, help="provisioned destination UDP port")
args = parser.parse_args()
token = getpass.getpass("Named device token: ")
capture(lambda method, params=None: call(args.device, token, method, params), args.local_ip, args.udp_port)
DAQ:只操作自己的任务、排空与读取有效长度 · SDK 缓冲区与释放 · IQ 校准记录
按参考通道、频点和数据格式选择校准系数。 ADC1–7