Initial commit
This commit is contained in:
11 files changed
+543
No files matched your search
@@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "roll.proto";
|
||||
|
||||
package raas.cmd;
|
||||
|
||||
message Command {
|
||||
uint32 id = 1;
|
||||
uint64 timestamp = 2;
|
||||
oneof cmd {
|
||||
raas.bot.roll.RollCmd roll_cmd = 3;
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
pub mod raas {
|
||||
pub mod register {
|
||||
include!(concat!(env!("OUT_DIR"), "/raas.register.rs"));
|
||||
}
|
||||
|
||||
pub mod bot {
|
||||
pub mod roll {
|
||||
include!(concat!(env!("OUT_DIR"), "/raas.bot.roll.rs"));
|
||||
}
|
||||
}
|
||||
|
||||
pub mod ping {
|
||||
include!(concat!(env!("OUT_DIR"), "/raas.ping.rs"));
|
||||
}
|
||||
|
||||
pub mod cmd {
|
||||
include!(concat!(env!("OUT_DIR"), "/raas.cmd.rs"));
|
||||
}
|
||||
|
||||
pub mod resp {
|
||||
include!(concat!(env!("OUT_DIR"), "/raas.resp.rs"));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::raas;
|
||||
|
||||
#[test]
|
||||
fn create_cmd() {
|
||||
let cmd = raas::cmd::Command {
|
||||
id: 0,
|
||||
timestamp: 0,
|
||||
cmd: Some(raas::cmd::command::Cmd::RollCmd(raas::bot::roll::RollCmd {
|
||||
cmd: Some(raas::bot::roll::roll_cmd::Cmd::Roll(
|
||||
raas::bot::roll::Roll { rotations: 1 },
|
||||
)),
|
||||
})),
|
||||
};
|
||||
|
||||
assert_eq!(cmd.id, 0);
|
||||
assert_eq!(cmd.timestamp, 0);
|
||||
assert!(cmd.cmd.is_some());
|
||||
|
||||
let sub_cmd = cmd.cmd.unwrap();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package raas.ping;
|
||||
|
||||
message Ping {
|
||||
string data =2;
|
||||
}
|
||||
|
||||
message Pong {
|
||||
Ping ping = 1;
|
||||
bool is_ok = 2;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package raas.register;
|
||||
|
||||
enum BotTypes {
|
||||
ROLL = 0;
|
||||
}
|
||||
|
||||
message Register {
|
||||
string name = 1;
|
||||
BotTypes bot_type = 2;
|
||||
}
|
||||
|
||||
message RegisterResponse {
|
||||
string name = 1;
|
||||
BotTypes type = 2;
|
||||
uint32 id = 3;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "roll.proto";
|
||||
|
||||
package raas.resp;
|
||||
|
||||
message Response {
|
||||
uint32 id = 1;
|
||||
uint64 timestamp = 2;
|
||||
oneof resp {
|
||||
raas.bot.roll.RollResponse roll_resp = 3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "ping.proto";
|
||||
|
||||
package raas.bot.roll;
|
||||
|
||||
message RollCmd {
|
||||
oneof cmd {
|
||||
raas.ping.Ping ping = 1;
|
||||
Roll roll = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message Roll {
|
||||
uint32 rotations = 1;
|
||||
}
|
||||
|
||||
message RollResponse {
|
||||
oneof response {
|
||||
raas.ping.Pong pong = 1;
|
||||
RollImage roll_image = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message RollImage {
|
||||
bytes img = 3;
|
||||
}
|
||||
Reference in new issue
Block a user