32 lines
879 B
Rust
32 lines
879 B
Rust
|
|
// ─── server/src/handshake.rs ───────────────────────────────────────────────
|
||
|
|
use tonic::{Request, Response, Status};
|
||
|
|
|
||
|
|
use lesavka_common::lesavka::{
|
||
|
|
Empty, HandshakeSet,
|
||
|
|
handshake_server::{Handshake, HandshakeServer},
|
||
|
|
};
|
||
|
|
|
||
|
|
pub struct HandshakeSvc {
|
||
|
|
pub camera: bool,
|
||
|
|
pub microphone: bool,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[tonic::async_trait]
|
||
|
|
impl Handshake for HandshakeSvc {
|
||
|
|
async fn get_capabilities(
|
||
|
|
&self,
|
||
|
|
_req: Request<Empty>,
|
||
|
|
) -> Result<Response<HandshakeSet>, Status> {
|
||
|
|
Ok(Response::new(HandshakeSet {
|
||
|
|
camera: self.camera,
|
||
|
|
microphone: self.microphone,
|
||
|
|
}))
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl HandshakeSvc {
|
||
|
|
pub fn server() -> HandshakeServer<Self> {
|
||
|
|
HandshakeServer::new(Self { camera: true, microphone: true })
|
||
|
|
}
|
||
|
|
}
|