iot_cloud/proto/message.proto
2026-04-18 23:43:34 +08:00

72 lines
1.0 KiB
Protocol Buffer

syntax = "proto3";
message AuthRequest {
bytes uuid = 1;
bytes username = 2;
bytes salt = 3;
bytes token = 4;
int32 timestamp = 5;
}
message AuthReply {
int32 code = 1;
bytes payload = 2;
}
message Pub {
bytes topic = 1;
int32 qos = 2;
bytes content = 3;
}
message Command {
int32 command_type = 1;
bytes command = 2;
}
message JsonRpcRequest {
bytes method = 1;
bytes params = 2;
}
message JsonRpcReply {
bytes result = 1;
bytes error = 2;
}
message RequestFrame {
uint32 packet_id = 1;
oneof body {
AuthRequest auth_request = 2;
JsonRpcRequest jsonrpc_request = 3;
}
}
message ResponseFrame {
uint32 packet_id = 1;
oneof body {
AuthReply auth_reply = 2;
JsonRpcReply jsonrpc_reply = 3;
}
}
message CastFrame {
oneof body {
Pub pub = 1;
Command command = 2;
Data data = 3;
TaskEventStream event_stream = 4;
}
}
message Data {
bytes route_key = 1;
bytes metric = 2;
}
message TaskEventStream {
int32 task_id = 1;
bytes type = 2;
bytes stream = 3;
}