import abc
import typing
import grpclib.const
import grpclib.client
import grpclib.exceptions
if typing.TYPE_CHECKING:
import grpclib.server
from .... import common
import google.api.annotations_pb2
import google.protobuf.struct_pb2
from .... import component
[docs]class MotorServiceBase(abc.ABC):
[docs] @abc.abstractmethod
async def SetPower(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.SetPowerRequest, component.motor.v1.motor_pb2.SetPowerResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def GoFor(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.GoForRequest, component.motor.v1.motor_pb2.GoForResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def GoTo(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.GoToRequest, component.motor.v1.motor_pb2.GoToResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def SetRPM(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.SetRPMRequest, component.motor.v1.motor_pb2.SetRPMResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def ResetZeroPosition(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.ResetZeroPositionRequest, component.motor.v1.motor_pb2.ResetZeroPositionResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def GetPosition(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.GetPositionRequest, component.motor.v1.motor_pb2.GetPositionResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def GetProperties(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.GetPropertiesRequest, component.motor.v1.motor_pb2.GetPropertiesResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def Stop(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.StopRequest, component.motor.v1.motor_pb2.StopResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def IsPowered(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.IsPoweredRequest, component.motor.v1.motor_pb2.IsPoweredResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def IsMoving(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.IsMovingRequest, component.motor.v1.motor_pb2.IsMovingResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def DoCommand(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse]') -> None:
pass
[docs] @abc.abstractmethod
async def GetGeometries(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse]') -> None:
pass
[docs] def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
return {'/viam.component.motor.v1.MotorService/SetPower': grpclib.const.Handler(self.SetPower, grpclib.const.Cardinality.UNARY_UNARY, component.motor.v1.motor_pb2.SetPowerRequest, component.motor.v1.motor_pb2.SetPowerResponse), '/viam.component.motor.v1.MotorService/GoFor': grpclib.const.Handler(self.GoFor, grpclib.const.Cardinality.UNARY_UNARY, component.motor.v1.motor_pb2.GoForRequest, component.motor.v1.motor_pb2.GoForResponse), '/viam.component.motor.v1.MotorService/GoTo': grpclib.const.Handler(self.GoTo, grpclib.const.Cardinality.UNARY_UNARY, component.motor.v1.motor_pb2.GoToRequest, component.motor.v1.motor_pb2.GoToResponse), '/viam.component.motor.v1.MotorService/SetRPM': grpclib.const.Handler(self.SetRPM, grpclib.const.Cardinality.UNARY_UNARY, component.motor.v1.motor_pb2.SetRPMRequest, component.motor.v1.motor_pb2.SetRPMResponse), '/viam.component.motor.v1.MotorService/ResetZeroPosition': grpclib.const.Handler(self.ResetZeroPosition, grpclib.const.Cardinality.UNARY_UNARY, component.motor.v1.motor_pb2.ResetZeroPositionRequest, component.motor.v1.motor_pb2.ResetZeroPositionResponse), '/viam.component.motor.v1.MotorService/GetPosition': grpclib.const.Handler(self.GetPosition, grpclib.const.Cardinality.UNARY_UNARY, component.motor.v1.motor_pb2.GetPositionRequest, component.motor.v1.motor_pb2.GetPositionResponse), '/viam.component.motor.v1.MotorService/GetProperties': grpclib.const.Handler(self.GetProperties, grpclib.const.Cardinality.UNARY_UNARY, component.motor.v1.motor_pb2.GetPropertiesRequest, component.motor.v1.motor_pb2.GetPropertiesResponse), '/viam.component.motor.v1.MotorService/Stop': grpclib.const.Handler(self.Stop, grpclib.const.Cardinality.UNARY_UNARY, component.motor.v1.motor_pb2.StopRequest, component.motor.v1.motor_pb2.StopResponse), '/viam.component.motor.v1.MotorService/IsPowered': grpclib.const.Handler(self.IsPowered, grpclib.const.Cardinality.UNARY_UNARY, component.motor.v1.motor_pb2.IsPoweredRequest, component.motor.v1.motor_pb2.IsPoweredResponse), '/viam.component.motor.v1.MotorService/IsMoving': grpclib.const.Handler(self.IsMoving, grpclib.const.Cardinality.UNARY_UNARY, component.motor.v1.motor_pb2.IsMovingRequest, component.motor.v1.motor_pb2.IsMovingResponse), '/viam.component.motor.v1.MotorService/DoCommand': grpclib.const.Handler(self.DoCommand, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse), '/viam.component.motor.v1.MotorService/GetGeometries': grpclib.const.Handler(self.GetGeometries, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse)}
[docs]class UnimplementedMotorServiceBase(MotorServiceBase):
[docs] async def SetPower(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.SetPowerRequest, component.motor.v1.motor_pb2.SetPowerResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def GoFor(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.GoForRequest, component.motor.v1.motor_pb2.GoForResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def GoTo(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.GoToRequest, component.motor.v1.motor_pb2.GoToResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def SetRPM(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.SetRPMRequest, component.motor.v1.motor_pb2.SetRPMResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def ResetZeroPosition(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.ResetZeroPositionRequest, component.motor.v1.motor_pb2.ResetZeroPositionResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def GetPosition(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.GetPositionRequest, component.motor.v1.motor_pb2.GetPositionResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def GetProperties(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.GetPropertiesRequest, component.motor.v1.motor_pb2.GetPropertiesResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def Stop(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.StopRequest, component.motor.v1.motor_pb2.StopResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def IsPowered(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.IsPoweredRequest, component.motor.v1.motor_pb2.IsPoweredResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def IsMoving(self, stream: 'grpclib.server.Stream[component.motor.v1.motor_pb2.IsMovingRequest, component.motor.v1.motor_pb2.IsMovingResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def DoCommand(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def GetGeometries(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse]') -> None:
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs]class MotorServiceStub:
def __init__(self, channel: grpclib.client.Channel) -> None:
self.SetPower = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/SetPower', component.motor.v1.motor_pb2.SetPowerRequest, component.motor.v1.motor_pb2.SetPowerResponse)
self.GoFor = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/GoFor', component.motor.v1.motor_pb2.GoForRequest, component.motor.v1.motor_pb2.GoForResponse)
self.GoTo = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/GoTo', component.motor.v1.motor_pb2.GoToRequest, component.motor.v1.motor_pb2.GoToResponse)
self.SetRPM = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/SetRPM', component.motor.v1.motor_pb2.SetRPMRequest, component.motor.v1.motor_pb2.SetRPMResponse)
self.ResetZeroPosition = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/ResetZeroPosition', component.motor.v1.motor_pb2.ResetZeroPositionRequest, component.motor.v1.motor_pb2.ResetZeroPositionResponse)
self.GetPosition = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/GetPosition', component.motor.v1.motor_pb2.GetPositionRequest, component.motor.v1.motor_pb2.GetPositionResponse)
self.GetProperties = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/GetProperties', component.motor.v1.motor_pb2.GetPropertiesRequest, component.motor.v1.motor_pb2.GetPropertiesResponse)
self.Stop = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/Stop', component.motor.v1.motor_pb2.StopRequest, component.motor.v1.motor_pb2.StopResponse)
self.IsPowered = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/IsPowered', component.motor.v1.motor_pb2.IsPoweredRequest, component.motor.v1.motor_pb2.IsPoweredResponse)
self.IsMoving = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/IsMoving', component.motor.v1.motor_pb2.IsMovingRequest, component.motor.v1.motor_pb2.IsMovingResponse)
self.DoCommand = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/DoCommand', common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse)
self.GetGeometries = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.motor.v1.MotorService/GetGeometries', common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse)