- 集成nanopb库用于protobuf序列化 - 创建cdc_wrapper_module.c实现帧解析功能 - 实现protocol_module.c处理协议编解码 - 定义device_comm.proto通信协议 - 修改CMakeLists.txt添加protobuf源文件 - 更新配置启用NANOPB支持 - 移除usb_cdc_module中基于行的处理逻辑
22 lines
365 B
Protocol Buffer
22 lines
365 B
Protocol Buffer
syntax = "proto3";
|
|
|
|
message HelloReq {
|
|
uint32 protocol_version = 1;
|
|
}
|
|
|
|
message HelloRsp {
|
|
uint32 protocol_version = 1;
|
|
uint32 vendor_id = 2;
|
|
uint32 product_id = 3;
|
|
uint32 firmware_major = 4;
|
|
uint32 firmware_minor = 5;
|
|
uint32 capability_flags = 6;
|
|
}
|
|
|
|
message CdcPacketBody {
|
|
oneof body {
|
|
HelloReq hello_req = 1;
|
|
HelloRsp hello_rsp = 2;
|
|
}
|
|
}
|