#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LatLng {
#[prost(double, tag = "1")]
pub latitude: f64,
#[prost(double, tag = "2")]
pub longitude: f64,
#[prost(double, optional, tag = "3")]
pub altitude: ::core::option::Option<f64>,
#[prost(double, optional, tag = "4")]
pub accuracy: ::core::option::Option<f64>,
#[prost(double, optional, tag = "5")]
pub heading: ::core::option::Option<f64>,
#[prost(double, optional, tag = "6")]
pub speed: ::core::option::Option<f64>,
#[prost(int64, optional, tag = "7")]
pub timestamp_ms: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClientMsg {
#[prost(oneof = "client_msg::Body", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10")]
pub body: ::core::option::Option<client_msg::Body>,
}
pub mod client_msg {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Body {
#[prost(message, tag = "1")]
Resume(super::Resume),
#[prost(message, tag = "2")]
TrackStart(super::TrackStart),
#[prost(message, tag = "3")]
TrackStop(super::TrackStop),
#[prost(message, tag = "4")]
LocationAdd(super::LocationAdd),
#[prost(message, tag = "5")]
LocationBatch(super::LocationBatch),
#[prost(message, tag = "6")]
Subscribe(super::Subscribe),
#[prost(message, tag = "7")]
Unsubscribe(super::Unsubscribe),
#[prost(message, tag = "8")]
Ping(super::Ping),
#[prost(message, tag = "9")]
Event(super::Event),
#[prost(message, tag = "10")]
CommandAck(super::CommandAck),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Resume {
#[prost(string, tag = "1")]
pub track_uid: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub last_client_seq: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrackStart {
#[prost(message, optional, tag = "1")]
pub location: ::core::option::Option<LatLng>,
#[prost(message, repeated, tag = "2")]
pub route: ::prost::alloc::vec::Vec<LatLng>,
#[prost(bytes = "vec", tag = "3")]
pub metadata: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrackStop {
#[prost(string, tag = "1")]
pub track_uid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocationAdd {
#[prost(string, tag = "1")]
pub track_uid: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub client_seq: u64,
#[prost(message, optional, tag = "3")]
pub point: ::core::option::Option<LatLng>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocationBatch {
#[prost(string, tag = "1")]
pub track_uid: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub client_seq: u64,
#[prost(message, repeated, tag = "3")]
pub points: ::prost::alloc::vec::Vec<LatLng>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Subscribe {
#[prost(string, tag = "1")]
pub device_uid: ::prost::alloc::string::String,
#[prost(bool, optional, tag = "2")]
pub include_events: ::core::option::Option<bool>,
#[prost(uint32, tag = "3")]
pub min_location_interval_ms: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Unsubscribe {
#[prost(string, tag = "1")]
pub device_uid: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Ping {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Event {
#[prost(string, tag = "1")]
pub track_uid: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub payload: ::prost::alloc::vec::Vec<u8>,
#[prost(int64, optional, tag = "3")]
pub timestamp_ms: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommandAck {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(enumeration = "CommandAckStatus", tag = "2")]
pub status: i32,
#[prost(string, optional, tag = "3")]
pub message: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ServerMsg {
#[prost(
oneof = "server_msg::Body",
tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13"
)]
pub body: ::core::option::Option<server_msg::Body>,
}
pub mod server_msg {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Body {
#[prost(message, tag = "1")]
Hello(super::Hello),
#[prost(message, tag = "2")]
Relocate(super::Relocate),
#[prost(message, tag = "3")]
ResumeOk(super::ResumeOk),
#[prost(message, tag = "4")]
TrackStarted(super::TrackStarted),
#[prost(message, tag = "5")]
TrackStopped(super::TrackStopped),
#[prost(message, tag = "6")]
LocationAdded(super::LocationAdded),
#[prost(message, tag = "7")]
Subscribed(super::Subscribed),
#[prost(message, tag = "8")]
ListenerSubscribed(super::ListenerSubscribed),
#[prost(message, tag = "9")]
Error(super::Error),
#[prost(message, tag = "10")]
Pong(super::Pong),
#[prost(message, tag = "11")]
EventAdded(super::EventAdded),
#[prost(message, tag = "12")]
Command(super::Command),
#[prost(message, tag = "13")]
DevicePresence(super::DevicePresence),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Hello {
#[prost(string, tag = "1")]
pub node_id: ::prost::alloc::string::String,
#[prost(uint32, tag = "2")]
pub shard: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Relocate {
#[prost(string, tag = "1")]
pub endpoint: ::prost::alloc::string::String,
#[prost(uint32, tag = "2")]
pub retry_after_ms: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResumeOk {
#[prost(string, tag = "1")]
pub track_uid: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub last_acked_seq: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrackStarted {
#[prost(string, tag = "1")]
pub track_uid: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub metadata: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrackStopped {
#[prost(string, tag = "1")]
pub track_uid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocationAdded {
#[prost(string, tag = "1")]
pub device_uid: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub track_uid: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub point: ::core::option::Option<LatLng>,
#[prost(uint64, tag = "4")]
pub client_seq: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Subscribed {
#[prost(string, tag = "1")]
pub device_uid: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub track_uid: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub last_location: ::core::option::Option<LatLng>,
#[prost(message, repeated, tag = "4")]
pub route: ::prost::alloc::vec::Vec<LatLng>,
#[prost(double, tag = "6")]
pub estimated_distance: f64,
#[prost(double, tag = "7")]
pub estimated_duration: f64,
#[prost(string, tag = "8")]
pub start_location_name: ::prost::alloc::string::String,
#[prost(string, tag = "9")]
pub end_location_name: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "10")]
pub metadata: ::prost::alloc::vec::Vec<u8>,
#[prost(bool, tag = "11")]
pub online: bool,
#[prost(int64, optional, tag = "12")]
pub last_seen_ms: ::core::option::Option<i64>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ListenerSubscribed {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Error {
#[prost(enumeration = "ErrorCode", tag = "1")]
pub code: i32,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
#[prost(string, optional, tag = "3")]
pub track_uid: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag = "4")]
pub retry_after_ms: ::core::option::Option<u32>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Pong {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EventAdded {
#[prost(string, tag = "1")]
pub device_uid: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub track_uid: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "3")]
pub payload: ::prost::alloc::vec::Vec<u8>,
#[prost(int64, optional, tag = "4")]
pub timestamp_ms: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Command {
#[prost(string, tag = "1")]
pub command_id: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub payload: ::prost::alloc::vec::Vec<u8>,
#[prost(int64, optional, tag = "3")]
pub timestamp_ms: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DevicePresence {
#[prost(string, tag = "1")]
pub device_uid: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub online: bool,
#[prost(int64, optional, tag = "3")]
pub last_seen_ms: ::core::option::Option<i64>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CommandAckStatus {
Unspecified = 0,
Ok = 1,
Rejected = 2,
Failed = 3,
}
impl CommandAckStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "COMMAND_ACK_STATUS_UNSPECIFIED",
Self::Ok => "COMMAND_ACK_STATUS_OK",
Self::Rejected => "COMMAND_ACK_STATUS_REJECTED",
Self::Failed => "COMMAND_ACK_STATUS_FAILED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"COMMAND_ACK_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"COMMAND_ACK_STATUS_OK" => Some(Self::Ok),
"COMMAND_ACK_STATUS_REJECTED" => Some(Self::Rejected),
"COMMAND_ACK_STATUS_FAILED" => Some(Self::Failed),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ErrorCode {
Unspecified = 0,
Auth = 1,
TrackNotFound = 2,
Fenced = 3,
TryAgain = 4,
Invalid = 5,
Unauthorized = 6,
}
impl ErrorCode {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "ERROR_CODE_UNSPECIFIED",
Self::Auth => "ERROR_CODE_AUTH",
Self::TrackNotFound => "ERROR_CODE_TRACK_NOT_FOUND",
Self::Fenced => "ERROR_CODE_FENCED",
Self::TryAgain => "ERROR_CODE_TRY_AGAIN",
Self::Invalid => "ERROR_CODE_INVALID",
Self::Unauthorized => "ERROR_CODE_UNAUTHORIZED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ERROR_CODE_UNSPECIFIED" => Some(Self::Unspecified),
"ERROR_CODE_AUTH" => Some(Self::Auth),
"ERROR_CODE_TRACK_NOT_FOUND" => Some(Self::TrackNotFound),
"ERROR_CODE_FENCED" => Some(Self::Fenced),
"ERROR_CODE_TRY_AGAIN" => Some(Self::TryAgain),
"ERROR_CODE_INVALID" => Some(Self::Invalid),
"ERROR_CODE_UNAUTHORIZED" => Some(Self::Unauthorized),
_ => None,
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MeshEnvelope {
#[prost(string, tag = "1")]
pub device_uid: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub event: ::core::option::Option<ServerMsg>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MeshAck {
#[prost(bool, tag = "1")]
pub ok: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HandOffRequest {
#[prost(uint32, tag = "1")]
pub shard: u32,
#[prost(uint64, tag = "2")]
pub epoch: u64,
#[prost(string, tag = "3")]
pub from_node: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub to_node: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HandOffResponse {
#[prost(bool, tag = "1")]
pub ok: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
pub mod tracking_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TrackingClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TrackingClient<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> TrackingClient<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,
) -> TrackingClient<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,
{
TrackingClient::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 session(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::ClientMsg>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::ServerMsg>>,
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(
"/tracking.v2.Tracking/Session",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(GrpcMethod::new("tracking.v2.Tracking", "Session"));
self.inner.streaming(req, path, codec).await
}
}
}
pub mod mesh_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct MeshClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MeshClient<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> MeshClient<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,
) -> MeshClient<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,
{
MeshClient::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 forward(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::MeshEnvelope>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::MeshAck>>,
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("/tracking.v2.Mesh/Forward");
let mut req = request.into_streaming_request();
req.extensions_mut().insert(GrpcMethod::new("tracking.v2.Mesh", "Forward"));
self.inner.streaming(req, path, codec).await
}
pub async fn hand_off(
&mut self,
request: impl tonic::IntoRequest<super::HandOffRequest>,
) -> std::result::Result<
tonic::Response<super::HandOffResponse>,
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("/tracking.v2.Mesh/HandOff");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("tracking.v2.Mesh", "HandOff"));
self.inner.unary(req, path, codec).await
}
}
}