#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Angle {
#[prost(float, tag = "1")]
pub rad: f32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Vector3 {
#[prost(float, tag = "1")]
pub x: f32,
#[prost(float, tag = "2")]
pub y: f32,
#[prost(float, tag = "3")]
pub z: f32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Quaternion {
#[prost(float, tag = "1")]
pub w: f32,
#[prost(float, tag = "2")]
pub x: f32,
#[prost(float, tag = "3")]
pub y: f32,
#[prost(float, tag = "4")]
pub z: f32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Geometry {
#[prost(message, repeated, tag = "1")]
pub devices: ::prost::alloc::vec::Vec<geometry::Autd3>,
}
pub mod geometry {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Autd3 {
#[prost(message, optional, tag = "1")]
pub pos: ::core::option::Option<super::Vector3>,
#[prost(message, optional, tag = "2")]
pub rot: ::core::option::Option<super::Quaternion>,
#[prost(float, tag = "3")]
pub sound_speed: f32,
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TxRawData {
#[prost(bytes = "vec", tag = "1")]
pub data: ::prost::alloc::vec::Vec<u8>,
#[prost(uint32, tag = "2")]
pub num_devices: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SendResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RxMessage {
#[prost(bytes = "vec", tag = "1")]
pub data: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ReadRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CloseRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CloseResponse {
#[prost(bool, tag = "1")]
pub success: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GeometryResponse {}
pub mod simulator_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct SimulatorClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SimulatorClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> SimulatorClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SimulatorClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
SimulatorClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn config_geomety(
&mut self,
request: impl tonic::IntoRequest<super::Geometry>,
) -> std::result::Result<
tonic::Response<super::GeometryResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/autd3.Simulator/ConfigGeomety",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("autd3.Simulator", "ConfigGeomety"));
self.inner.unary(req, path, codec).await
}
pub async fn update_geomety(
&mut self,
request: impl tonic::IntoRequest<super::Geometry>,
) -> std::result::Result<
tonic::Response<super::GeometryResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/autd3.Simulator/UpdateGeomety",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("autd3.Simulator", "UpdateGeomety"));
self.inner.unary(req, path, codec).await
}
pub async fn send_data(
&mut self,
request: impl tonic::IntoRequest<super::TxRawData>,
) -> std::result::Result<tonic::Response<super::SendResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.Simulator/SendData");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("autd3.Simulator", "SendData"));
self.inner.unary(req, path, codec).await
}
pub async fn read_data(
&mut self,
request: impl tonic::IntoRequest<super::ReadRequest>,
) -> std::result::Result<tonic::Response<super::RxMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.Simulator/ReadData");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("autd3.Simulator", "ReadData"));
self.inner.unary(req, path, codec).await
}
pub async fn close(
&mut self,
request: impl tonic::IntoRequest<super::CloseRequest>,
) -> std::result::Result<tonic::Response<super::CloseResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.Simulator/Close");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("autd3.Simulator", "Close"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod ecat_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct EcatClient<T> {
inner: tonic::client::Grpc<T>,
}
impl EcatClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> EcatClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> EcatClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
EcatClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn send_data(
&mut self,
request: impl tonic::IntoRequest<super::TxRawData>,
) -> std::result::Result<tonic::Response<super::SendResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.ECAT/SendData");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("autd3.ECAT", "SendData"));
self.inner.unary(req, path, codec).await
}
pub async fn read_data(
&mut self,
request: impl tonic::IntoRequest<super::ReadRequest>,
) -> std::result::Result<tonic::Response<super::RxMessage>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.ECAT/ReadData");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("autd3.ECAT", "ReadData"));
self.inner.unary(req, path, codec).await
}
pub async fn close(
&mut self,
request: impl tonic::IntoRequest<super::CloseRequest>,
) -> std::result::Result<tonic::Response<super::CloseResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.ECAT/Close");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("autd3.ECAT", "Close"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod simulator_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait Simulator: Send + Sync + 'static {
async fn config_geomety(
&self,
request: tonic::Request<super::Geometry>,
) -> std::result::Result<
tonic::Response<super::GeometryResponse>,
tonic::Status,
>;
async fn update_geomety(
&self,
request: tonic::Request<super::Geometry>,
) -> std::result::Result<
tonic::Response<super::GeometryResponse>,
tonic::Status,
>;
async fn send_data(
&self,
request: tonic::Request<super::TxRawData>,
) -> std::result::Result<tonic::Response<super::SendResponse>, tonic::Status>;
async fn read_data(
&self,
request: tonic::Request<super::ReadRequest>,
) -> std::result::Result<tonic::Response<super::RxMessage>, tonic::Status>;
async fn close(
&self,
request: tonic::Request<super::CloseRequest>,
) -> std::result::Result<tonic::Response<super::CloseResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct SimulatorServer<T: Simulator> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T: Simulator> SimulatorServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for SimulatorServer<T>
where
T: Simulator,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/autd3.Simulator/ConfigGeomety" => {
#[allow(non_camel_case_types)]
struct ConfigGeometySvc<T: Simulator>(pub Arc<T>);
impl<T: Simulator> tonic::server::UnaryService<super::Geometry>
for ConfigGeometySvc<T> {
type Response = super::GeometryResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Geometry>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Simulator>::config_geomety(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ConfigGeometySvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/autd3.Simulator/UpdateGeomety" => {
#[allow(non_camel_case_types)]
struct UpdateGeometySvc<T: Simulator>(pub Arc<T>);
impl<T: Simulator> tonic::server::UnaryService<super::Geometry>
for UpdateGeometySvc<T> {
type Response = super::GeometryResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Geometry>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Simulator>::update_geomety(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UpdateGeometySvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/autd3.Simulator/SendData" => {
#[allow(non_camel_case_types)]
struct SendDataSvc<T: Simulator>(pub Arc<T>);
impl<T: Simulator> tonic::server::UnaryService<super::TxRawData>
for SendDataSvc<T> {
type Response = super::SendResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TxRawData>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Simulator>::send_data(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SendDataSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/autd3.Simulator/ReadData" => {
#[allow(non_camel_case_types)]
struct ReadDataSvc<T: Simulator>(pub Arc<T>);
impl<T: Simulator> tonic::server::UnaryService<super::ReadRequest>
for ReadDataSvc<T> {
type Response = super::RxMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ReadRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Simulator>::read_data(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ReadDataSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/autd3.Simulator/Close" => {
#[allow(non_camel_case_types)]
struct CloseSvc<T: Simulator>(pub Arc<T>);
impl<T: Simulator> tonic::server::UnaryService<super::CloseRequest>
for CloseSvc<T> {
type Response = super::CloseResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CloseRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Simulator>::close(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CloseSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: Simulator> Clone for SimulatorServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
impl<T: Simulator> tonic::server::NamedService for SimulatorServer<T> {
const NAME: &'static str = "autd3.Simulator";
}
}
pub mod ecat_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait Ecat: Send + Sync + 'static {
async fn send_data(
&self,
request: tonic::Request<super::TxRawData>,
) -> std::result::Result<tonic::Response<super::SendResponse>, tonic::Status>;
async fn read_data(
&self,
request: tonic::Request<super::ReadRequest>,
) -> std::result::Result<tonic::Response<super::RxMessage>, tonic::Status>;
async fn close(
&self,
request: tonic::Request<super::CloseRequest>,
) -> std::result::Result<tonic::Response<super::CloseResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct EcatServer<T: Ecat> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T: Ecat> EcatServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for EcatServer<T>
where
T: Ecat,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/autd3.ECAT/SendData" => {
#[allow(non_camel_case_types)]
struct SendDataSvc<T: Ecat>(pub Arc<T>);
impl<T: Ecat> tonic::server::UnaryService<super::TxRawData>
for SendDataSvc<T> {
type Response = super::SendResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TxRawData>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Ecat>::send_data(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SendDataSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/autd3.ECAT/ReadData" => {
#[allow(non_camel_case_types)]
struct ReadDataSvc<T: Ecat>(pub Arc<T>);
impl<T: Ecat> tonic::server::UnaryService<super::ReadRequest>
for ReadDataSvc<T> {
type Response = super::RxMessage;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ReadRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Ecat>::read_data(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ReadDataSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/autd3.ECAT/Close" => {
#[allow(non_camel_case_types)]
struct CloseSvc<T: Ecat>(pub Arc<T>);
impl<T: Ecat> tonic::server::UnaryService<super::CloseRequest>
for CloseSvc<T> {
type Response = super::CloseResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CloseRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Ecat>::close(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CloseSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: Ecat> Clone for EcatServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
impl<T: Ecat> tonic::server::NamedService for EcatServer<T> {
const NAME: &'static str = "autd3.ECAT";
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EmitIntensity {
#[prost(uint32, tag = "1")]
pub value: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Phase {
#[prost(uint32, tag = "1")]
pub value: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SamplingConfig {
#[prost(uint32, tag = "1")]
pub div: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LoopBehavior {
#[prost(uint32, tag = "1")]
pub rep: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TransitionModeSyncIdx {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TransitionModeSysTime {
#[prost(uint64, tag = "1")]
pub value: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TransitionModeGpio {
#[prost(enumeration = "GpioIn", tag = "1")]
pub value: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TransitionModeExt {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TransitionModeImmediate {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TransitionMode {
#[prost(oneof = "transition_mode::Mode", tags = "1, 2, 3, 4, 5")]
pub mode: ::core::option::Option<transition_mode::Mode>,
}
pub mod transition_mode {
#[non_exhaustive]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Mode {
#[prost(message, tag = "1")]
SyncIdx(super::TransitionModeSyncIdx),
#[prost(message, tag = "2")]
SysTime(super::TransitionModeSysTime),
#[prost(message, tag = "3")]
Gpio(super::TransitionModeGpio),
#[prost(message, tag = "4")]
Ext(super::TransitionModeExt),
#[prost(message, tag = "5")]
Immediate(super::TransitionModeImmediate),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ControlPoint {
#[prost(message, optional, tag = "1")]
pub pos: ::core::option::Option<Vector3>,
#[prost(message, optional, tag = "2")]
pub offset: ::core::option::Option<Phase>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ControlPoints {
#[prost(message, repeated, tag = "1")]
pub points: ::prost::alloc::vec::Vec<ControlPoint>,
#[prost(message, optional, tag = "2")]
pub intensity: ::core::option::Option<EmitIntensity>,
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Segment {
S0 = 0,
S1 = 1,
}
impl Segment {
pub fn as_str_name(&self) -> &'static str {
match self {
Segment::S0 => "S0",
Segment::S1 => "S1",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"S0" => Some(Self::S0),
"S1" => Some(Self::S1),
_ => None,
}
}
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum GpioIn {
I0 = 0,
I1 = 1,
I2 = 2,
I3 = 3,
}
impl GpioIn {
pub fn as_str_name(&self) -> &'static str {
match self {
GpioIn::I0 => "I0",
GpioIn::I1 => "I1",
GpioIn::I2 => "I2",
GpioIn::I3 => "I3",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"I0" => Some(Self::I0),
"I1" => Some(Self::I1),
"I2" => Some(Self::I2),
"I3" => Some(Self::I3),
_ => None,
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Bessel {
#[prost(message, optional, tag = "1")]
pub pos: ::core::option::Option<Vector3>,
#[prost(message, optional, tag = "2")]
pub dir: ::core::option::Option<Vector3>,
#[prost(message, optional, tag = "3")]
pub theta: ::core::option::Option<Angle>,
#[prost(message, optional, tag = "4")]
pub intensity: ::core::option::Option<EmitIntensity>,
#[prost(message, optional, tag = "5")]
pub phase_offset: ::core::option::Option<Phase>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Focus {
#[prost(message, optional, tag = "1")]
pub pos: ::core::option::Option<Vector3>,
#[prost(message, optional, tag = "2")]
pub intensity: ::core::option::Option<EmitIntensity>,
#[prost(message, optional, tag = "3")]
pub phase_offset: ::core::option::Option<Phase>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Null {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Plane {
#[prost(message, optional, tag = "1")]
pub dir: ::core::option::Option<Vector3>,
#[prost(message, optional, tag = "2")]
pub intensity: ::core::option::Option<EmitIntensity>,
#[prost(message, optional, tag = "3")]
pub phase_offset: ::core::option::Option<Phase>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Uniform {
#[prost(message, optional, tag = "1")]
pub intensity: ::core::option::Option<EmitIntensity>,
#[prost(message, optional, tag = "2")]
pub phase: ::core::option::Option<Phase>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Amplitude {
#[prost(float, tag = "1")]
pub value: f32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Holo {
#[prost(message, optional, tag = "1")]
pub pos: ::core::option::Option<Vector3>,
#[prost(message, optional, tag = "2")]
pub amp: ::core::option::Option<Amplitude>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NormalizeConstraint {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MultiplyConstraint {
#[prost(float, tag = "1")]
pub value: f32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UniformConstraint {
#[prost(message, optional, tag = "1")]
pub value: ::core::option::Option<EmitIntensity>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ClampConstraint {
#[prost(message, optional, tag = "1")]
pub min: ::core::option::Option<EmitIntensity>,
#[prost(message, optional, tag = "2")]
pub max: ::core::option::Option<EmitIntensity>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EmissionConstraint {
#[prost(oneof = "emission_constraint::Constraint", tags = "1, 2, 3, 4")]
pub constraint: ::core::option::Option<emission_constraint::Constraint>,
}
pub mod emission_constraint {
#[non_exhaustive]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Constraint {
#[prost(message, tag = "1")]
Normalize(super::NormalizeConstraint),
#[prost(message, tag = "2")]
Uniform(super::UniformConstraint),
#[prost(message, tag = "3")]
Clamp(super::ClampConstraint),
#[prost(message, tag = "4")]
Multiply(super::MultiplyConstraint),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Naive {
#[prost(message, repeated, tag = "1")]
pub holo: ::prost::alloc::vec::Vec<Holo>,
#[prost(message, optional, tag = "2")]
pub constraint: ::core::option::Option<EmissionConstraint>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Gs {
#[prost(message, repeated, tag = "1")]
pub holo: ::prost::alloc::vec::Vec<Holo>,
#[prost(message, optional, tag = "2")]
pub constraint: ::core::option::Option<EmissionConstraint>,
#[prost(uint64, optional, tag = "3")]
pub repeat: ::core::option::Option<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Gspat {
#[prost(message, repeated, tag = "1")]
pub holo: ::prost::alloc::vec::Vec<Holo>,
#[prost(message, optional, tag = "2")]
pub constraint: ::core::option::Option<EmissionConstraint>,
#[prost(uint64, optional, tag = "3")]
pub repeat: ::core::option::Option<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Lm {
#[prost(message, repeated, tag = "1")]
pub holo: ::prost::alloc::vec::Vec<Holo>,
#[prost(message, optional, tag = "2")]
pub constraint: ::core::option::Option<EmissionConstraint>,
#[prost(float, optional, tag = "3")]
pub eps_1: ::core::option::Option<f32>,
#[prost(float, optional, tag = "4")]
pub eps_2: ::core::option::Option<f32>,
#[prost(float, optional, tag = "5")]
pub tau: ::core::option::Option<f32>,
#[prost(uint64, optional, tag = "6")]
pub k_max: ::core::option::Option<u64>,
#[prost(float, repeated, tag = "7")]
pub initial: ::prost::alloc::vec::Vec<f32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Greedy {
#[prost(message, repeated, tag = "1")]
pub holo: ::prost::alloc::vec::Vec<Holo>,
#[prost(message, optional, tag = "2")]
pub constraint: ::core::option::Option<EmissionConstraint>,
#[prost(uint32, optional, tag = "3")]
pub phase_div: ::core::option::Option<u32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Gain {
#[prost(oneof = "gain::Gain", tags = "1, 2, 3, 4, 5, 101, 102, 103, 104, 105")]
pub gain: ::core::option::Option<gain::Gain>,
}
pub mod gain {
#[non_exhaustive]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Gain {
#[prost(message, tag = "1")]
Bessel(super::Bessel),
#[prost(message, tag = "2")]
Focus(super::Focus),
#[prost(message, tag = "3")]
Null(super::Null),
#[prost(message, tag = "4")]
Plane(super::Plane),
#[prost(message, tag = "5")]
Uniform(super::Uniform),
#[prost(message, tag = "101")]
Naive(super::Naive),
#[prost(message, tag = "102")]
Gs(super::Gs),
#[prost(message, tag = "103")]
Gspat(super::Gspat),
#[prost(message, tag = "104")]
Lm(super::Lm),
#[prost(message, tag = "105")]
Greedy(super::Greedy),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GainWithSegment {
#[prost(message, optional, tag = "1")]
pub gain: ::core::option::Option<Gain>,
#[prost(enumeration = "Segment", tag = "2")]
pub segment: i32,
#[prost(bool, tag = "3")]
pub transition: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Static {
#[prost(uint32, optional, tag = "1")]
pub intensity: ::core::option::Option<u32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SineExact {
#[prost(uint32, tag = "1")]
pub freq: u32,
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<SamplingConfig>,
#[prost(uint32, optional, tag = "3")]
pub intensity: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "4")]
pub offset: ::core::option::Option<u32>,
#[prost(message, optional, tag = "5")]
pub phase: ::core::option::Option<Angle>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SineExactFloat {
#[prost(float, tag = "1")]
pub freq: f32,
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<SamplingConfig>,
#[prost(uint32, optional, tag = "3")]
pub intensity: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "4")]
pub offset: ::core::option::Option<u32>,
#[prost(message, optional, tag = "5")]
pub phase: ::core::option::Option<Angle>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SineNearest {
#[prost(float, tag = "1")]
pub freq: f32,
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<SamplingConfig>,
#[prost(uint32, optional, tag = "3")]
pub intensity: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "4")]
pub offset: ::core::option::Option<u32>,
#[prost(message, optional, tag = "5")]
pub phase: ::core::option::Option<Angle>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SquareExact {
#[prost(uint32, tag = "1")]
pub freq: u32,
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<SamplingConfig>,
#[prost(uint32, optional, tag = "3")]
pub low: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "4")]
pub high: ::core::option::Option<u32>,
#[prost(float, optional, tag = "5")]
pub duty: ::core::option::Option<f32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SquareExactFloat {
#[prost(float, tag = "1")]
pub freq: f32,
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<SamplingConfig>,
#[prost(uint32, optional, tag = "3")]
pub low: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "4")]
pub high: ::core::option::Option<u32>,
#[prost(float, optional, tag = "5")]
pub duty: ::core::option::Option<f32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SquareNearest {
#[prost(float, tag = "1")]
pub freq: f32,
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<SamplingConfig>,
#[prost(uint32, optional, tag = "3")]
pub low: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "4")]
pub high: ::core::option::Option<u32>,
#[prost(float, optional, tag = "5")]
pub duty: ::core::option::Option<f32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Modulation {
#[prost(message, optional, tag = "1000")]
pub loop_behavior: ::core::option::Option<LoopBehavior>,
#[prost(oneof = "modulation::Modulation", tags = "1, 10, 11, 12, 20, 21, 22")]
pub modulation: ::core::option::Option<modulation::Modulation>,
}
pub mod modulation {
#[non_exhaustive]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Modulation {
#[prost(message, tag = "1")]
Static(super::Static),
#[prost(message, tag = "10")]
SineExact(super::SineExact),
#[prost(message, tag = "11")]
SineExactFloat(super::SineExactFloat),
#[prost(message, tag = "12")]
SineNearest(super::SineNearest),
#[prost(message, tag = "20")]
SquareExact(super::SquareExact),
#[prost(message, tag = "21")]
SquareExactFloat(super::SquareExactFloat),
#[prost(message, tag = "22")]
SquareNearest(super::SquareNearest),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ModulationWithSegment {
#[prost(message, optional, tag = "1")]
pub modulation: ::core::option::Option<Modulation>,
#[prost(enumeration = "Segment", tag = "2")]
pub segment: i32,
#[prost(message, optional, tag = "3")]
pub transition_mode: ::core::option::Option<TransitionMode>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Clear {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SilencerFixedUpdateRate {
#[prost(uint32, tag = "1")]
pub value_intensity: u32,
#[prost(uint32, tag = "2")]
pub value_phase: u32,
#[prost(enumeration = "SilencerTarget", optional, tag = "3")]
pub target: ::core::option::Option<i32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SilencerFixedCompletionTime {
#[prost(uint32, tag = "1")]
pub value_intensity: u32,
#[prost(uint32, tag = "2")]
pub value_phase: u32,
#[prost(enumeration = "SilencerTarget", optional, tag = "4")]
pub target: ::core::option::Option<i32>,
#[prost(bool, optional, tag = "3")]
pub strict_mode: ::core::option::Option<bool>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Silencer {
#[prost(oneof = "silencer::Config", tags = "1, 2")]
pub config: ::core::option::Option<silencer::Config>,
}
pub mod silencer {
#[non_exhaustive]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Config {
#[prost(message, tag = "1")]
FixedUpdateRate(super::SilencerFixedUpdateRate),
#[prost(message, tag = "2")]
FixedCompletionTime(super::SilencerFixedCompletionTime),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Synchronize {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ForceFan {
#[prost(bool, repeated, tag = "1")]
pub value: ::prost::alloc::vec::Vec<bool>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadsFpgaState {
#[prost(bool, repeated, tag = "1")]
pub value: ::prost::alloc::vec::Vec<bool>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GainStm {
#[prost(message, optional, tag = "1")]
pub config: ::core::option::Option<SamplingConfig>,
#[prost(message, repeated, tag = "2")]
pub gains: ::prost::alloc::vec::Vec<Gain>,
#[prost(message, optional, tag = "3")]
pub loop_behavior: ::core::option::Option<LoopBehavior>,
#[prost(enumeration = "GainStmMode", optional, tag = "4")]
pub mode: ::core::option::Option<i32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GainStmWithSegment {
#[prost(message, optional, tag = "1")]
pub gain_stm: ::core::option::Option<GainStm>,
#[prost(enumeration = "Segment", tag = "2")]
pub segment: i32,
#[prost(message, optional, tag = "3")]
pub transition_mode: ::core::option::Option<TransitionMode>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FociStmProps {
#[prost(message, optional, tag = "1")]
pub config: ::core::option::Option<SamplingConfig>,
#[prost(message, optional, tag = "2")]
pub loop_behavior: ::core::option::Option<LoopBehavior>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStm1 {
#[prost(message, optional, tag = "1")]
pub props: ::core::option::Option<FociStmProps>,
#[prost(message, repeated, tag = "2")]
pub foci: ::prost::alloc::vec::Vec<ControlPoints>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStm2 {
#[prost(message, optional, tag = "1")]
pub props: ::core::option::Option<FociStmProps>,
#[prost(message, repeated, tag = "2")]
pub foci: ::prost::alloc::vec::Vec<ControlPoints>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStm3 {
#[prost(message, optional, tag = "1")]
pub props: ::core::option::Option<FociStmProps>,
#[prost(message, repeated, tag = "2")]
pub foci: ::prost::alloc::vec::Vec<ControlPoints>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStm4 {
#[prost(message, optional, tag = "1")]
pub props: ::core::option::Option<FociStmProps>,
#[prost(message, repeated, tag = "2")]
pub foci: ::prost::alloc::vec::Vec<ControlPoints>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStm5 {
#[prost(message, optional, tag = "1")]
pub props: ::core::option::Option<FociStmProps>,
#[prost(message, repeated, tag = "2")]
pub foci: ::prost::alloc::vec::Vec<ControlPoints>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStm6 {
#[prost(message, optional, tag = "1")]
pub props: ::core::option::Option<FociStmProps>,
#[prost(message, repeated, tag = "2")]
pub foci: ::prost::alloc::vec::Vec<ControlPoints>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStm7 {
#[prost(message, optional, tag = "1")]
pub props: ::core::option::Option<FociStmProps>,
#[prost(message, repeated, tag = "2")]
pub foci: ::prost::alloc::vec::Vec<ControlPoints>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStm8 {
#[prost(message, optional, tag = "1")]
pub props: ::core::option::Option<FociStmProps>,
#[prost(message, repeated, tag = "2")]
pub foci: ::prost::alloc::vec::Vec<ControlPoints>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStm {
#[prost(oneof = "foci_stm::Inner", tags = "1, 2, 3, 4, 5, 6, 7, 8")]
pub inner: ::core::option::Option<foci_stm::Inner>,
}
pub mod foci_stm {
#[non_exhaustive]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Inner {
#[prost(message, tag = "1")]
N1(super::FociStm1),
#[prost(message, tag = "2")]
N2(super::FociStm2),
#[prost(message, tag = "3")]
N3(super::FociStm3),
#[prost(message, tag = "4")]
N4(super::FociStm4),
#[prost(message, tag = "5")]
N5(super::FociStm5),
#[prost(message, tag = "6")]
N6(super::FociStm6),
#[prost(message, tag = "7")]
N7(super::FociStm7),
#[prost(message, tag = "8")]
N8(super::FociStm8),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStmWithSegment {
#[prost(message, optional, tag = "1")]
pub foci_stm: ::core::option::Option<FociStm>,
#[prost(enumeration = "Segment", tag = "2")]
pub segment: i32,
#[prost(message, optional, tag = "3")]
pub transition_mode: ::core::option::Option<TransitionMode>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SwapSegmentGain {
#[prost(enumeration = "Segment", tag = "1")]
pub segment: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SwapSegmentModulation {
#[prost(enumeration = "Segment", tag = "1")]
pub segment: i32,
#[prost(message, optional, tag = "2")]
pub transition_mode: ::core::option::Option<TransitionMode>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SwapSegmentFociStm {
#[prost(enumeration = "Segment", tag = "1")]
pub segment: i32,
#[prost(message, optional, tag = "2")]
pub transition_mode: ::core::option::Option<TransitionMode>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SwapSegmentGainStm {
#[prost(enumeration = "Segment", tag = "1")]
pub segment: i32,
#[prost(message, optional, tag = "2")]
pub transition_mode: ::core::option::Option<TransitionMode>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SwapSegment {
#[prost(oneof = "swap_segment::Inner", tags = "1, 2, 3, 4")]
pub inner: ::core::option::Option<swap_segment::Inner>,
}
pub mod swap_segment {
#[non_exhaustive]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Inner {
#[prost(message, tag = "1")]
Gain(super::SwapSegmentGain),
#[prost(message, tag = "2")]
Modulation(super::SwapSegmentModulation),
#[prost(message, tag = "3")]
FociStm(super::SwapSegmentFociStm),
#[prost(message, tag = "4")]
GainStm(super::SwapSegmentGainStm),
}
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SilencerTarget {
Intensity = 0,
PulseWidth = 1,
}
impl SilencerTarget {
pub fn as_str_name(&self) -> &'static str {
match self {
SilencerTarget::Intensity => "Intensity",
SilencerTarget::PulseWidth => "PulseWidth",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"Intensity" => Some(Self::Intensity),
"PulseWidth" => Some(Self::PulseWidth),
_ => None,
}
}
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum GainStmMode {
PhaseIntensityFull = 0,
PhaseFull = 1,
PhaseHalf = 2,
}
impl GainStmMode {
pub fn as_str_name(&self) -> &'static str {
match self {
GainStmMode::PhaseIntensityFull => "PhaseIntensityFull",
GainStmMode::PhaseFull => "PhaseFull",
GainStmMode::PhaseHalf => "PhaseHalf",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PhaseIntensityFull" => Some(Self::PhaseIntensityFull),
"PhaseFull" => Some(Self::PhaseFull),
"PhaseHalf" => Some(Self::PhaseHalf),
_ => None,
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Datagram {
#[prost(uint64, optional, tag = "1001")]
pub timeout: ::core::option::Option<u64>,
#[prost(uint64, optional, tag = "1002")]
pub parallel_threshold: ::core::option::Option<u64>,
#[prost(
oneof = "datagram::Datagram",
tags = "1, 2, 3, 4, 5, 6, 10, 11, 30, 31, 40, 41, 50, 51"
)]
pub datagram: ::core::option::Option<datagram::Datagram>,
}
pub mod datagram {
#[non_exhaustive]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Datagram {
#[prost(message, tag = "1")]
Clear(super::Clear),
#[prost(message, tag = "2")]
Synchronize(super::Synchronize),
#[prost(message, tag = "3")]
ForceFan(super::ForceFan),
#[prost(message, tag = "4")]
ReadsFpgaState(super::ReadsFpgaState),
#[prost(message, tag = "5")]
Silencer(super::Silencer),
#[prost(message, tag = "6")]
SwapSegment(super::SwapSegment),
#[prost(message, tag = "10")]
Modulation(super::Modulation),
#[prost(message, tag = "11")]
ModulationWithSegment(super::ModulationWithSegment),
#[prost(message, tag = "30")]
Gain(super::Gain),
#[prost(message, tag = "31")]
GainWithSegment(super::GainWithSegment),
#[prost(message, tag = "40")]
FociStm(super::FociStm),
#[prost(message, tag = "41")]
FociStmWithSegment(super::FociStmWithSegment),
#[prost(message, tag = "50")]
GainStm(super::GainStm),
#[prost(message, tag = "51")]
GainStmWithSegment(super::GainStmWithSegment),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SendResponseLightweight {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(bool, tag = "2")]
pub err: bool,
#[prost(string, tag = "3")]
pub msg: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FirmwareVersionRequestLightweight {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FirmwareVersionResponseLightweight {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub msg: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub firmware_version_list: ::prost::alloc::vec::Vec<
firmware_version_response_lightweight::FirmwareVersion,
>,
}
pub mod firmware_version_response_lightweight {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FirmwareVersion {
#[prost(uint32, tag = "1")]
pub fpga_major_version: u32,
#[prost(uint32, tag = "2")]
pub fpga_minor_version: u32,
#[prost(uint32, tag = "3")]
pub cpu_major_version: u32,
#[prost(uint32, tag = "4")]
pub cpu_minor_version: u32,
#[prost(uint32, tag = "5")]
pub fpga_function_bits: u32,
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CloseRequestLightweight {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenRequestLightweight {
#[prost(message, optional, tag = "1")]
pub geometry: ::core::option::Option<Geometry>,
#[prost(uint64, tag = "2")]
pub parallel_threshold: u64,
#[prost(uint64, tag = "3")]
pub send_interval: u64,
#[prost(uint32, tag = "4")]
pub timer_resolution: u32,
}
pub mod ecat_light_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct EcatLightClient<T> {
inner: tonic::client::Grpc<T>,
}
impl EcatLightClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> EcatLightClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> EcatLightClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
EcatLightClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn open(
&mut self,
request: impl tonic::IntoRequest<super::OpenRequestLightweight>,
) -> std::result::Result<
tonic::Response<super::SendResponseLightweight>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.ECATLight/Open");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("autd3.ECATLight", "Open"));
self.inner.unary(req, path, codec).await
}
pub async fn firmware_version(
&mut self,
request: impl tonic::IntoRequest<super::FirmwareVersionRequestLightweight>,
) -> std::result::Result<
tonic::Response<super::FirmwareVersionResponseLightweight>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/autd3.ECATLight/FirmwareVersion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("autd3.ECATLight", "FirmwareVersion"));
self.inner.unary(req, path, codec).await
}
pub async fn send(
&mut self,
request: impl tonic::IntoRequest<super::Datagram>,
) -> std::result::Result<
tonic::Response<super::SendResponseLightweight>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.ECATLight/Send");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("autd3.ECATLight", "Send"));
self.inner.unary(req, path, codec).await
}
pub async fn close(
&mut self,
request: impl tonic::IntoRequest<super::CloseRequestLightweight>,
) -> std::result::Result<
tonic::Response<super::SendResponseLightweight>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.ECATLight/Close");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("autd3.ECATLight", "Close"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod ecat_light_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait EcatLight: Send + Sync + 'static {
async fn open(
&self,
request: tonic::Request<super::OpenRequestLightweight>,
) -> std::result::Result<
tonic::Response<super::SendResponseLightweight>,
tonic::Status,
>;
async fn firmware_version(
&self,
request: tonic::Request<super::FirmwareVersionRequestLightweight>,
) -> std::result::Result<
tonic::Response<super::FirmwareVersionResponseLightweight>,
tonic::Status,
>;
async fn send(
&self,
request: tonic::Request<super::Datagram>,
) -> std::result::Result<
tonic::Response<super::SendResponseLightweight>,
tonic::Status,
>;
async fn close(
&self,
request: tonic::Request<super::CloseRequestLightweight>,
) -> std::result::Result<
tonic::Response<super::SendResponseLightweight>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct EcatLightServer<T: EcatLight> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T: EcatLight> EcatLightServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for EcatLightServer<T>
where
T: EcatLight,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/autd3.ECATLight/Open" => {
#[allow(non_camel_case_types)]
struct OpenSvc<T: EcatLight>(pub Arc<T>);
impl<
T: EcatLight,
> tonic::server::UnaryService<super::OpenRequestLightweight>
for OpenSvc<T> {
type Response = super::SendResponseLightweight;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::OpenRequestLightweight>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EcatLight>::open(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = OpenSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/autd3.ECATLight/FirmwareVersion" => {
#[allow(non_camel_case_types)]
struct FirmwareVersionSvc<T: EcatLight>(pub Arc<T>);
impl<
T: EcatLight,
> tonic::server::UnaryService<
super::FirmwareVersionRequestLightweight,
> for FirmwareVersionSvc<T> {
type Response = super::FirmwareVersionResponseLightweight;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::FirmwareVersionRequestLightweight,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EcatLight>::firmware_version(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = FirmwareVersionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/autd3.ECATLight/Send" => {
#[allow(non_camel_case_types)]
struct SendSvc<T: EcatLight>(pub Arc<T>);
impl<T: EcatLight> tonic::server::UnaryService<super::Datagram>
for SendSvc<T> {
type Response = super::SendResponseLightweight;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Datagram>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EcatLight>::send(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SendSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/autd3.ECATLight/Close" => {
#[allow(non_camel_case_types)]
struct CloseSvc<T: EcatLight>(pub Arc<T>);
impl<
T: EcatLight,
> tonic::server::UnaryService<super::CloseRequestLightweight>
for CloseSvc<T> {
type Response = super::SendResponseLightweight;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CloseRequestLightweight>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as EcatLight>::close(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CloseSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: EcatLight> Clone for EcatLightServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
impl<T: EcatLight> tonic::server::NamedService for EcatLightServer<T> {
const NAME: &'static str = "autd3.ECATLight";
}
}