cmvr-es/protos/cmvr/api/common.proto

80 lines
2.0 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
package cmvr.api;
import "google/protobuf/timestamp.proto";
message DeviceLifecycle {
enum Lifecycle {
STATE_INIT = 0;
STATE_READY = 1;
STATE_RUNNING = 2;
STATE_ERROR = 3;
STATE_ESTOP = 4;
STATE_STOP = 5;
}
Lifecycle state = 1;
}
message CommandHeader {
message Request {
string device_id = 1; // 目标设备名称
google.protobuf.Timestamp timestamp = 2; // 请求时间
}
message Feedback {
bool success = 1; // 是否成功
string error_message = 2; // 错误信息(成功时为空)
google.protobuf.Timestamp timestamp = 3; // 回复时间
}
}
message AudioData {
enum AudioFormat {
PCM = 0;
MP3 = 1;
AAC = 2;
WAV = 3;
OPUS = 4;
}
bytes data = 1;
int32 sample_rate = 2;
int32 channels = 3;
AudioFormat format = 4;
string codec = 5;
int64 pts = 6;
int32 nb_samples = 7;
}
message ConfigParam {
string param_name = 1;
oneof param_value {
int32 int_value = 2; // 整数类型
double double_value = 3; // 浮点数类型
string string_value = 4; // 字符串类型
bool bool_value = 5; // 布尔类型
bytes bytes_value = 6; // 二进制数据类型
}
}
// 设备厂商扩展 JSON 命令;JSON 内容及字段单位由具体设备命令定义。
message JsonDeviceCommand {
// JSON 命令请求。
message Request {
// 通用请求头,包含目标设备 ID 和请求时间戳。
CommandHeader.Request header = 1;
// JSON 格式的设备命令字符串,无单位。
string request_json = 2;
}
// JSON 命令响应。
message Feedback {
// 通用响应头,包含成功标志、错误信息和响应时间戳。
CommandHeader.Feedback header = 1;
// JSON 格式的设备响应字符串,无单位。
string response_json = 2;
}
}