Files
lain 7f331565c7 Add terminal service implementation and integration tests
- Introduced terminal.h header file defining the terminal service API.
- Implemented integration tests for terminal service registration and health checks.
- Added unit tests for FFI layer, health checks, and terminal service functionality.
- Created a mock center for testing terminal registration and deregistration.
- Ensured proper error handling and response validation in tests.
2026-09-20 10:55:38 +08:00

102 lines
3.6 KiB
Protocol Buffer

syntax = "proto3";
import "google/protobuf/any.proto";
package control;
/**
* @brief Parameter 代表一个可以封装任意类型值的消息, 包含字符串值, 整数值, 浮点数值和布尔值以及嵌套的子表和选择值
* @details
* Parameter 消息类型使用 oneof 字段来封装不同类型的值, 以支持多种参数类型的传递.
* 通过使用 Parameter 类型, 可以实现命令参数的灵活定义和扩展, 以适应不同命令的需求.
*/
message Parameter{
message Simple{
oneof value{
string string_value = 1;
int64 int_value = 2;
double double_value = 3;
bool bool_value = 4;
}
}
message SubTable{
map<string, Parameter> table = 1;
}
message Selected{
repeated string options = 1;
}
oneof value {
Simple simple_value = 1;
SubTable sub_table_value = 2;
Selected selected_value = 3;
}
}
/**
* @brief ParameterType 代表命令参数的类型
* @details
* ParameterType 消息类型使用枚举类型 Type 来定义参数的基本类型, 包括字符串, 整数, 浮点数和布尔值.
* 另外, ParameterType 还支持 Select 和 SubTable 类型, 以支持参数的选择和嵌套结构.
*/
message ParameterType{
enum Type {
STRING = 0;
INT = 1;
DOUBLE = 2;
BOOL = 3;
}
message Select{
repeated string options = 1;
}
message SubTable{
map<string, ParameterType> schema = 1;
}
oneof value{
Type type = 1;
Select select = 2;
SubTable sub_table = 3;
}
}
/*!
* @brief AsyncCommandResponse 代表控制终端异步命令的响应消息, 包含命令ID, 进度和消息
* @details
* cmd_id 字段用于唯一标识一个命令, 供控制系统进行命令的跟踪和管理
* progress 字段用于表示命令的执行进度, 范围为0.0到1.0
* message 字段用于提供命令执行的响应消息, 可以包含错误信息或者成功提示等内容
*/
message AsyncCommandResponse{
uint64 cmd_id = 1;
float progress = 2;
optional google.protobuf.Any data = 3;
}
/**
* @brief InvokeResponse 代表命令调用的响应结果, 包含调用是否成功和响应消息
* @details
* success 字段用于表示命令调用是否成功, true 表示成功, false 表示失败
* message 字段用于提供命令调用的响应消息, 可以包含错误信息或者成功提示等内容, 具体定义在extra路径下的proto文件中, 以便控制系统根据实际需求进行定制化设计.
*/
message InvokeResponse{
bool success = 1;
google.protobuf.Any message = 2;
}
/**
* @brief TerminalCommandInfo 代表控制终端支持的命令信息, 包含命令类型, 命令描述和命令参数类型列表
* @details
* id 字段用于标识命令的类型, 例如 "move", "stop"等等
* type 字段用于标识命令的可读类型, 例如 "移动", "停止"等等, 供控制系统展示使用
* description 字段用于描述命令的具体内容, 供控制系统展示使用
* icon_url 字段用于描述命令的图标URL, 供控制系统展示使用
* parameter 字段用于描述命令的参数类型列表, 以键值对的形式存储, 键为参数名, 值为参数类型.
* 参数类型使用 ParameterType 枚举类型进行定义
*/
message TerminalCommandInfo{
string id = 1;
string type = 2;
string description = 3;
string icon_url = 4;
map<string,ParameterType> parameter = 5;
}