73 lines
1.6 KiB
Protocol Buffer
73 lines
1.6 KiB
Protocol Buffer
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; // 二进制数据类型
|
|
}
|
|
}
|
|
|
|
message JsonDeviceCommand {
|
|
message Request {
|
|
CommandHeader.Request header = 1;
|
|
string request_json = 2;
|
|
}
|
|
|
|
message Feedback {
|
|
CommandHeader.Feedback header = 1;
|
|
string response_json = 2;
|
|
}
|
|
}
|