#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Angle {
#[prost(float, tag = "1")]
pub rad: f32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UnitVector3 {
#[prost(float, tag = "1")]
pub x: f32,
#[prost(float, tag = "2")]
pub y: f32,
#[prost(float, tag = "3")]
pub z: f32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Point3 {
#[prost(float, tag = "1")]
pub x: f32,
#[prost(float, tag = "2")]
pub y: f32,
#[prost(float, tag = "3")]
pub z: f32,
}
#[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,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Geometry {
#[prost(message, repeated, tag = "1")]
pub devices: ::prost::alloc::vec::Vec<geometry::Autd3>,
}
pub mod geometry {
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Autd3 {
#[prost(message, optional, tag = "1")]
pub pos: ::core::option::Option<super::Point3>,
#[prost(message, optional, tag = "2")]
pub rot: ::core::option::Option<super::Quaternion>,
#[prost(float, optional, tag = "3")]
pub sound_speed: ::core::option::Option<f32>,
}
}
#[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 n: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SendResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RxMessage {
#[prost(bytes = "vec", tag = "1")]
pub data: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ReadRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CloseRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CloseResponse {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GeometryResponse {}
pub mod simulator_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct SimulatorClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> SimulatorClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::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> + std::marker::Send + std::marker::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::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::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::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::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::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::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct EcatClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> EcatClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::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> + std::marker::Send + std::marker::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::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::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::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::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait Simulator: std::marker::Send + std::marker::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> {
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> 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 + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::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 {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> 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,
}
}
}
pub const SERVICE_NAME: &str = "autd3.Simulator";
impl<T> tonic::server::NamedService for SimulatorServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod ecat_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait Ecat: std::marker::Send + std::marker::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> {
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> 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 + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::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 {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> 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,
}
}
}
pub const SERVICE_NAME: &str = "autd3.ECAT";
impl<T> tonic::server::NamedService for EcatServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EmitIntensity {
#[prost(uint32, tag = "1")]
pub value: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Phase {
#[prost(uint32, tag = "1")]
pub value: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SamplingConfig {
#[prost(oneof = "sampling_config::Variant", tags = "1, 2, 3, 4, 5")]
pub variant: ::core::option::Option<sampling_config::Variant>,
}
pub mod sampling_config {
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Division {
#[prost(uint32, tag = "1")]
pub div: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Freq {
#[prost(float, tag = "1")]
pub freq: f32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FreqNearest {
#[prost(float, tag = "1")]
pub freq: f32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Period {
#[prost(uint64, tag = "1")]
pub ns: u64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PeriodNearest {
#[prost(uint64, tag = "1")]
pub ns: u64,
}
#[non_exhaustive]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Variant {
#[prost(message, tag = "1")]
Division(Division),
#[prost(message, tag = "2")]
Freq(Freq),
#[prost(message, tag = "3")]
FreqNearest(FreqNearest),
#[prost(message, tag = "4")]
Period(Period),
#[prost(message, tag = "5")]
PeriodNearest(PeriodNearest),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LoopBehavior {
#[prost(oneof = "loop_behavior::Variant", tags = "1, 2")]
pub variant: ::core::option::Option<loop_behavior::Variant>,
}
pub mod loop_behavior {
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Infinite {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Finite {
#[prost(uint32, tag = "1")]
pub rep: u32,
}
#[non_exhaustive]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Variant {
#[prost(message, tag = "1")]
Infinite(Infinite),
#[prost(message, tag = "2")]
Finite(Finite),
}
}
#[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 {
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SyncIdx {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SysTime {
#[prost(uint64, tag = "1")]
pub value: u64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Gpio {
#[prost(enumeration = "super::GpioIn", tag = "1")]
pub value: i32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Ext {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Immediate {}
#[non_exhaustive]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Mode {
#[prost(message, tag = "1")]
SyncIdx(SyncIdx),
#[prost(message, tag = "2")]
SysTime(SysTime),
#[prost(message, tag = "3")]
Gpio(Gpio),
#[prost(message, tag = "4")]
Ext(Ext),
#[prost(message, tag = "5")]
Immediate(Immediate),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ControlPoint {
#[prost(message, optional, tag = "1")]
pub pos: ::core::option::Option<Point3>,
#[prost(message, optional, tag = "2")]
pub offset: ::core::option::Option<Phase>,
}
#[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 {
Self::S0 => "S0",
Self::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 {
Self::I0 => "I0",
Self::I1 => "I1",
Self::I2 => "I2",
Self::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,
}
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct BesselOption {
#[prost(message, optional, tag = "1")]
pub intensity: ::core::option::Option<EmitIntensity>,
#[prost(message, optional, tag = "2")]
pub phase_offset: ::core::option::Option<Phase>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Bessel {
#[prost(message, optional, tag = "1")]
pub pos: ::core::option::Option<Point3>,
#[prost(message, optional, tag = "2")]
pub dir: ::core::option::Option<UnitVector3>,
#[prost(message, optional, tag = "3")]
pub theta: ::core::option::Option<Angle>,
#[prost(message, optional, tag = "4")]
pub option: ::core::option::Option<BesselOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FocusOption {
#[prost(message, optional, tag = "1")]
pub intensity: ::core::option::Option<EmitIntensity>,
#[prost(message, optional, tag = "2")]
pub phase_offset: ::core::option::Option<Phase>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Focus {
#[prost(message, optional, tag = "1")]
pub pos: ::core::option::Option<Point3>,
#[prost(message, optional, tag = "2")]
pub option: ::core::option::Option<FocusOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Null {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PlaneOption {
#[prost(message, optional, tag = "1")]
pub intensity: ::core::option::Option<EmitIntensity>,
#[prost(message, optional, tag = "2")]
pub phase_offset: ::core::option::Option<Phase>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Plane {
#[prost(message, optional, tag = "1")]
pub dir: ::core::option::Option<UnitVector3>,
#[prost(message, optional, tag = "2")]
pub option: ::core::option::Option<PlaneOption>,
}
#[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>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Amplitude {
#[prost(float, tag = "1")]
pub value: f32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Holo {
#[prost(message, optional, tag = "1")]
pub pos: ::core::option::Option<Point3>,
#[prost(message, optional, tag = "2")]
pub amp: ::core::option::Option<Amplitude>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EmissionConstraint {
#[prost(oneof = "emission_constraint::Variant", tags = "1, 2, 3, 4")]
pub variant: ::core::option::Option<emission_constraint::Variant>,
}
pub mod emission_constraint {
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Normalize {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Multiply {
#[prost(float, tag = "1")]
pub value: f32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Uniform {
#[prost(message, optional, tag = "1")]
pub value: ::core::option::Option<super::EmitIntensity>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Clamp {
#[prost(message, optional, tag = "1")]
pub min: ::core::option::Option<super::EmitIntensity>,
#[prost(message, optional, tag = "2")]
pub max: ::core::option::Option<super::EmitIntensity>,
}
#[non_exhaustive]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Variant {
#[prost(message, tag = "1")]
Normalize(Normalize),
#[prost(message, tag = "2")]
Uniform(Uniform),
#[prost(message, tag = "3")]
Clamp(Clamp),
#[prost(message, tag = "4")]
Multiply(Multiply),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NaiveOption {
#[prost(message, optional, tag = "1")]
pub constraint: ::core::option::Option<EmissionConstraint>,
}
#[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 option: ::core::option::Option<NaiveOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GsOption {
#[prost(message, optional, tag = "1")]
pub constraint: ::core::option::Option<EmissionConstraint>,
#[prost(uint64, optional, tag = "2")]
pub repeat: ::core::option::Option<u64>,
}
#[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 option: ::core::option::Option<GsOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GspatOption {
#[prost(message, optional, tag = "1")]
pub constraint: ::core::option::Option<EmissionConstraint>,
#[prost(uint64, optional, tag = "2")]
pub repeat: ::core::option::Option<u64>,
}
#[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 option: ::core::option::Option<GspatOption>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LmOption {
#[prost(message, optional, tag = "1")]
pub constraint: ::core::option::Option<EmissionConstraint>,
#[prost(float, optional, tag = "2")]
pub eps_1: ::core::option::Option<f32>,
#[prost(float, optional, tag = "3")]
pub eps_2: ::core::option::Option<f32>,
#[prost(float, optional, tag = "4")]
pub tau: ::core::option::Option<f32>,
#[prost(uint64, optional, tag = "5")]
pub k_max: ::core::option::Option<u64>,
#[prost(float, repeated, tag = "6")]
pub initial: ::prost::alloc::vec::Vec<f32>,
}
#[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 option: ::core::option::Option<LmOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GreedyOption {
#[prost(message, optional, tag = "1")]
pub constraint: ::core::option::Option<EmissionConstraint>,
#[prost(uint32, optional, tag = "2")]
pub phase_div: ::core::option::Option<u32>,
}
#[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 option: ::core::option::Option<GreedyOption>,
}
#[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]
#[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),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Static {
#[prost(uint32, optional, tag = "1")]
pub intensity: ::core::option::Option<u32>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SineOption {
#[prost(message, optional, tag = "1")]
pub config: ::core::option::Option<SamplingConfig>,
#[prost(uint32, optional, tag = "2")]
pub intensity: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "3")]
pub offset: ::core::option::Option<u32>,
#[prost(message, optional, tag = "4")]
pub phase: ::core::option::Option<Angle>,
#[prost(bool, optional, tag = "5")]
pub clamp: ::core::option::Option<bool>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SineExact {
#[prost(uint32, tag = "1")]
pub freq: u32,
#[prost(message, optional, tag = "2")]
pub option: ::core::option::Option<SineOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SineExactFloat {
#[prost(float, tag = "1")]
pub freq: f32,
#[prost(message, optional, tag = "2")]
pub option: ::core::option::Option<SineOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SineNearest {
#[prost(float, tag = "1")]
pub freq: f32,
#[prost(message, optional, tag = "2")]
pub option: ::core::option::Option<SineOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SquareOption {
#[prost(message, optional, tag = "1")]
pub config: ::core::option::Option<SamplingConfig>,
#[prost(uint32, optional, tag = "2")]
pub low: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "3")]
pub high: ::core::option::Option<u32>,
#[prost(float, optional, tag = "4")]
pub duty: ::core::option::Option<f32>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SquareExact {
#[prost(uint32, tag = "1")]
pub freq: u32,
#[prost(message, optional, tag = "2")]
pub option: ::core::option::Option<SquareOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SquareExactFloat {
#[prost(float, tag = "1")]
pub freq: f32,
#[prost(message, optional, tag = "2")]
pub option: ::core::option::Option<SquareOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SquareNearest {
#[prost(float, tag = "1")]
pub freq: f32,
#[prost(message, optional, tag = "2")]
pub option: ::core::option::Option<SquareOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Modulation {
#[prost(oneof = "modulation::Modulation", tags = "1, 10, 11, 12, 20, 21, 22")]
pub modulation: ::core::option::Option<modulation::Modulation>,
}
pub mod modulation {
#[non_exhaustive]
#[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),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Clear {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Silencer {
#[prost(oneof = "silencer::Config", tags = "1, 2, 3")]
pub config: ::core::option::Option<silencer::Config>,
}
pub mod silencer {
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FixedUpdateRate {
#[prost(uint32, tag = "1")]
pub value_intensity: u32,
#[prost(uint32, tag = "2")]
pub value_phase: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FixedCompletionSteps {
#[prost(uint32, optional, tag = "1")]
pub value_intensity: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "2")]
pub value_phase: ::core::option::Option<u32>,
#[prost(bool, optional, tag = "3")]
pub strict_mode: ::core::option::Option<bool>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FixedCompletionTime {
#[prost(uint32, optional, tag = "1")]
pub value_intensity: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "2")]
pub value_phase: ::core::option::Option<u32>,
#[prost(bool, optional, tag = "3")]
pub strict_mode: ::core::option::Option<bool>,
}
#[non_exhaustive]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Config {
#[prost(message, tag = "1")]
FixedUpdateRate(FixedUpdateRate),
#[prost(message, tag = "2")]
FixedCompletionTime(FixedCompletionTime),
#[prost(message, tag = "3")]
FixedCompletionSteps(FixedCompletionSteps),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Synchronize {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ForceFan {
#[prost(bool, repeated, tag = "1")]
pub value: ::prost::alloc::vec::Vec<bool>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadsFpgaState {
#[prost(bool, repeated, tag = "1")]
pub value: ::prost::alloc::vec::Vec<bool>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GainStmOption {
#[prost(enumeration = "GainStmMode", optional, tag = "1")]
pub mode: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GainStm {
#[prost(message, repeated, tag = "1")]
pub gains: ::prost::alloc::vec::Vec<Gain>,
#[prost(message, optional, tag = "2")]
pub sampling_config: ::core::option::Option<SamplingConfig>,
#[prost(message, optional, tag = "3")]
pub option: ::core::option::Option<GainStmOption>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FociStm {
#[prost(message, repeated, tag = "1")]
pub foci: ::prost::alloc::vec::Vec<ControlPoints>,
#[prost(message, optional, tag = "2")]
pub sampling_config: ::core::option::Option<SamplingConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WithSegment {
#[prost(enumeration = "Segment", tag = "5")]
pub segment: i32,
#[prost(message, optional, tag = "6")]
pub transition_mode: ::core::option::Option<TransitionMode>,
#[prost(oneof = "with_segment::Inner", tags = "1, 2, 3, 4")]
pub inner: ::core::option::Option<with_segment::Inner>,
}
pub mod with_segment {
#[non_exhaustive]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Inner {
#[prost(message, tag = "1")]
Gain(super::Gain),
#[prost(message, tag = "2")]
Modulation(super::Modulation),
#[prost(message, tag = "3")]
FociStm(super::FociStm),
#[prost(message, tag = "4")]
GainStm(super::GainStm),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WithLoopBehavior {
#[prost(message, optional, tag = "4")]
pub loop_behavior: ::core::option::Option<LoopBehavior>,
#[prost(enumeration = "Segment", tag = "5")]
pub segment: i32,
#[prost(message, optional, tag = "6")]
pub transition_mode: ::core::option::Option<TransitionMode>,
#[prost(oneof = "with_loop_behavior::Inner", tags = "1, 2, 3")]
pub inner: ::core::option::Option<with_loop_behavior::Inner>,
}
pub mod with_loop_behavior {
#[non_exhaustive]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Inner {
#[prost(message, tag = "1")]
Modulation(super::Modulation),
#[prost(message, tag = "2")]
FociStm(super::FociStm),
#[prost(message, tag = "3")]
GainStm(super::GainStm),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SwapSegment {
#[prost(oneof = "swap_segment::Variant", tags = "1, 2, 3, 4")]
pub variant: ::core::option::Option<swap_segment::Variant>,
}
pub mod swap_segment {
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Gain {
#[prost(enumeration = "super::Segment", tag = "1")]
pub segment: i32,
#[prost(message, optional, tag = "2")]
pub transition_mode: ::core::option::Option<super::TransitionMode>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Modulation {
#[prost(enumeration = "super::Segment", tag = "1")]
pub segment: i32,
#[prost(message, optional, tag = "2")]
pub transition_mode: ::core::option::Option<super::TransitionMode>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FociStm {
#[prost(enumeration = "super::Segment", tag = "1")]
pub segment: i32,
#[prost(message, optional, tag = "2")]
pub transition_mode: ::core::option::Option<super::TransitionMode>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GainStm {
#[prost(enumeration = "super::Segment", tag = "1")]
pub segment: i32,
#[prost(message, optional, tag = "2")]
pub transition_mode: ::core::option::Option<super::TransitionMode>,
}
#[non_exhaustive]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Variant {
#[prost(message, tag = "1")]
Gain(Gain),
#[prost(message, tag = "2")]
Modulation(Modulation),
#[prost(message, tag = "3")]
FociStm(FociStm),
#[prost(message, tag = "4")]
GainStm(GainStm),
}
}
#[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 {
Self::PhaseIntensityFull => "PhaseIntensityFull",
Self::PhaseFull => "PhaseFull",
Self::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,
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Datagram {
#[prost(
oneof = "datagram::Datagram",
tags = "1, 2, 3, 4, 5, 6, 10, 30, 40, 50, 60, 61"
)]
pub datagram: ::core::option::Option<datagram::Datagram>,
}
pub mod datagram {
#[non_exhaustive]
#[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 = "30")]
Gain(super::Gain),
#[prost(message, tag = "40")]
FociStm(super::FociStm),
#[prost(message, tag = "50")]
GainStm(super::GainStm),
#[prost(message, tag = "60")]
WithSegment(super::WithSegment),
#[prost(message, tag = "61")]
WithLoopBehavior(super::WithLoopBehavior),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DatagramTuple {
#[prost(message, optional, tag = "1")]
pub first: ::core::option::Option<Datagram>,
#[prost(message, optional, tag = "2")]
pub second: ::core::option::Option<Datagram>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StdSleeper {
#[prost(uint32, optional, tag = "1")]
pub timer_resolution: ::core::option::Option<u32>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SpinSleeper {
#[prost(uint32, tag = "1")]
pub native_accuracy_ns: u32,
#[prost(enumeration = "SpinStrategy", tag = "2")]
pub spin_strategy: i32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct WaitableSleeper {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AsyncSleeper {
#[prost(uint32, optional, tag = "1")]
pub timer_resolution: ::core::option::Option<u32>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SenderOption {
#[prost(uint64, tag = "1")]
pub send_interval_ns: u64,
#[prost(uint64, tag = "2")]
pub receive_interval_ns: u64,
#[prost(uint64, optional, tag = "3")]
pub timeout_ns: ::core::option::Option<u64>,
#[prost(enumeration = "ParallelMode", tag = "4")]
pub parallel: i32,
#[prost(oneof = "sender_option::Sleeper", tags = "5, 6, 7, 8")]
pub sleeper: ::core::option::Option<sender_option::Sleeper>,
}
pub mod sender_option {
#[non_exhaustive]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Sleeper {
#[prost(message, tag = "5")]
Std(super::StdSleeper),
#[prost(message, tag = "6")]
Spin(super::SpinSleeper),
#[prost(message, tag = "7")]
Waitable(super::WaitableSleeper),
#[prost(message, tag = "8")]
Async(super::AsyncSleeper),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SendRequestLightweight {
#[prost(message, optional, tag = "1")]
pub datagram: ::core::option::Option<DatagramTuple>,
#[prost(message, optional, tag = "2")]
pub sender_option: ::core::option::Option<SenderOption>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SendResponseLightweight {
#[prost(bool, tag = "1")]
pub err: bool,
#[prost(string, tag = "2")]
pub msg: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GroupSendRequestLightweight {
#[prost(int32, repeated, tag = "1")]
pub keys: ::prost::alloc::vec::Vec<i32>,
#[prost(message, repeated, tag = "2")]
pub datagrams: ::prost::alloc::vec::Vec<DatagramTuple>,
#[prost(message, optional, tag = "3")]
pub sender_option: ::core::option::Option<SenderOption>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FirmwareVersionRequestLightweight {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FirmwareVersionResponseLightweight {
#[prost(bool, tag = "1")]
pub err: 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 {
#[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,
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FpgaStateRequestLightweight {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FpgaStateResponseLightweight {
#[prost(bool, tag = "1")]
pub err: bool,
#[prost(string, tag = "2")]
pub msg: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub fpga_state_list: ::prost::alloc::vec::Vec<fpga_state_response_lightweight::FpgaState>,
}
pub mod fpga_state_response_lightweight {
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FpgaState {
#[prost(uint32, optional, tag = "1")]
pub state: ::core::option::Option<u32>,
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CloseRequestLightweight {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenRequestLightweight {
#[prost(message, optional, tag = "1")]
pub geometry: ::core::option::Option<Geometry>,
#[prost(message, optional, tag = "2")]
pub sender_option: ::core::option::Option<SenderOption>,
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ParallelMode {
Auto = 0,
On = 1,
Off = 2,
}
impl ParallelMode {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Auto => "Auto",
Self::On => "On",
Self::Off => "Off",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"Auto" => Some(Self::Auto),
"On" => Some(Self::On),
"Off" => Some(Self::Off),
_ => None,
}
}
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SpinStrategy {
YieldThread = 0,
SpinLoopHint = 1,
}
impl SpinStrategy {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::YieldThread => "YieldThread",
Self::SpinLoopHint => "SpinLoopHint",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"YieldThread" => Some(Self::YieldThread),
"SpinLoopHint" => Some(Self::SpinLoopHint),
_ => None,
}
}
}
pub mod ecat_light_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct EcatLightClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> EcatLightClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::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> + std::marker::Send + std::marker::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::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::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 fpga_state(
&mut self,
request: impl tonic::IntoRequest<super::FpgaStateRequestLightweight>,
) -> std::result::Result<tonic::Response<super::FpgaStateResponseLightweight>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.ECATLight/FpgaState");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("autd3.ECATLight", "FpgaState"));
self.inner.unary(req, path, codec).await
}
pub async fn send(
&mut self,
request: impl tonic::IntoRequest<super::SendRequestLightweight>,
) -> std::result::Result<tonic::Response<super::SendResponseLightweight>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::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 group_send(
&mut self,
request: impl tonic::IntoRequest<super::GroupSendRequestLightweight>,
) -> std::result::Result<tonic::Response<super::SendResponseLightweight>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/autd3.ECATLight/GroupSend");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("autd3.ECATLight", "GroupSend"));
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::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::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait EcatLight: std::marker::Send + std::marker::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 fpga_state(
&self,
request: tonic::Request<super::FpgaStateRequestLightweight>,
) -> std::result::Result<tonic::Response<super::FpgaStateResponseLightweight>, tonic::Status>;
async fn send(
&self,
request: tonic::Request<super::SendRequestLightweight>,
) -> std::result::Result<tonic::Response<super::SendResponseLightweight>, tonic::Status>;
async fn group_send(
&self,
request: tonic::Request<super::GroupSendRequestLightweight>,
) -> 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> {
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> 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 + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::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/FpgaState" => {
#[allow(non_camel_case_types)]
struct FpgaStateSvc<T: EcatLight>(pub Arc<T>);
impl<T: EcatLight>
tonic::server::UnaryService<super::FpgaStateRequestLightweight>
for FpgaStateSvc<T>
{
type Response = super::FpgaStateResponseLightweight;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::FpgaStateRequestLightweight>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as EcatLight>::fpga_state(&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 = FpgaStateSvc(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::SendRequestLightweight> for SendSvc<T> {
type Response = super::SendResponseLightweight;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::SendRequestLightweight>,
) -> 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/GroupSend" => {
#[allow(non_camel_case_types)]
struct GroupSendSvc<T: EcatLight>(pub Arc<T>);
impl<T: EcatLight>
tonic::server::UnaryService<super::GroupSendRequestLightweight>
for GroupSendSvc<T>
{
type Response = super::SendResponseLightweight;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GroupSendRequestLightweight>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as EcatLight>::group_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 = GroupSendSvc(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 {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> 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,
}
}
}
pub const SERVICE_NAME: &str = "autd3.ECATLight";
impl<T> tonic::server::NamedService for EcatLightServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}