# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from minknow.rpc import acquisition_pb2 as minknow_dot_rpc_dot_acquisition__pb2


class AcquisitionServiceStub(object):
  # missing associated documentation comment in .proto file
  pass

  def __init__(self, channel):
    """Constructor.

    Args:
      channel: A grpc.Channel.
    """
    self.start = channel.unary_unary(
        '/ont.rpc.acquisition.AcquisitionService/start',
        request_serializer=minknow_dot_rpc_dot_acquisition__pb2.StartRequest.SerializeToString,
        response_deserializer=minknow_dot_rpc_dot_acquisition__pb2.StartResponse.FromString,
        )
    self.stop = channel.unary_unary(
        '/ont.rpc.acquisition.AcquisitionService/stop',
        request_serializer=minknow_dot_rpc_dot_acquisition__pb2.StopRequest.SerializeToString,
        response_deserializer=minknow_dot_rpc_dot_acquisition__pb2.StopResponse.FromString,
        )
    self.watch_for_status_change = channel.stream_stream(
        '/ont.rpc.acquisition.AcquisitionService/watch_for_status_change',
        request_serializer=minknow_dot_rpc_dot_acquisition__pb2.WatchForStatusChangeRequest.SerializeToString,
        response_deserializer=minknow_dot_rpc_dot_acquisition__pb2.WatchForStatusChangeResponse.FromString,
        )
    self.watch_current_acquisition_run = channel.unary_stream(
        '/ont.rpc.acquisition.AcquisitionService/watch_current_acquisition_run',
        request_serializer=minknow_dot_rpc_dot_acquisition__pb2.WatchCurrentAcquisitionRunRequest.SerializeToString,
        response_deserializer=minknow_dot_rpc_dot_acquisition__pb2.AcquisitionRunInfo.FromString,
        )
    self.current_status = channel.unary_unary(
        '/ont.rpc.acquisition.AcquisitionService/current_status',
        request_serializer=minknow_dot_rpc_dot_acquisition__pb2.CurrentStatusRequest.SerializeToString,
        response_deserializer=minknow_dot_rpc_dot_acquisition__pb2.CurrentStatusResponse.FromString,
        )
    self.get_progress = channel.unary_unary(
        '/ont.rpc.acquisition.AcquisitionService/get_progress',
        request_serializer=minknow_dot_rpc_dot_acquisition__pb2.GetProgressRequest.SerializeToString,
        response_deserializer=minknow_dot_rpc_dot_acquisition__pb2.GetProgressResponse.FromString,
        )
    self.get_acquisition_info = channel.unary_unary(
        '/ont.rpc.acquisition.AcquisitionService/get_acquisition_info',
        request_serializer=minknow_dot_rpc_dot_acquisition__pb2.GetAcquisitionRunInfoRequest.SerializeToString,
        response_deserializer=minknow_dot_rpc_dot_acquisition__pb2.AcquisitionRunInfo.FromString,
        )
    self.list_acquisition_runs = channel.unary_unary(
        '/ont.rpc.acquisition.AcquisitionService/list_acquisition_runs',
        request_serializer=minknow_dot_rpc_dot_acquisition__pb2.ListAcquisitionRunsRequest.SerializeToString,
        response_deserializer=minknow_dot_rpc_dot_acquisition__pb2.ListAcquisitionRunsResponse.FromString,
        )
    self.get_current_acquisition_run = channel.unary_unary(
        '/ont.rpc.acquisition.AcquisitionService/get_current_acquisition_run',
        request_serializer=minknow_dot_rpc_dot_acquisition__pb2.GetCurrentAcquisitionRunRequest.SerializeToString,
        response_deserializer=minknow_dot_rpc_dot_acquisition__pb2.AcquisitionRunInfo.FromString,
        )
    self.set_signal_reader = channel.unary_unary(
        '/ont.rpc.acquisition.AcquisitionService/set_signal_reader',
        request_serializer=minknow_dot_rpc_dot_acquisition__pb2.SetSignalReaderRequest.SerializeToString,
        response_deserializer=minknow_dot_rpc_dot_acquisition__pb2.SetSignalReaderResponse.FromString,
        )


class AcquisitionServiceServicer(object):
  # missing associated documentation comment in .proto file
  pass

  def start(self, request, context):
    """Starts reading data from the device

    Some setup calls will need to be made before starting data acquisition: particularly setting the analysis configuration, 
    calibration, read writer and bulk writer config and some device calls such as setting the sampling frequency

    If acqusition is already running (even in the FINISHING state), this call will fail.

    On MinIONs and GridIONs, this will enable the ASIC power supply if it is not already enabled.
    See StopRequest.keep_power_on for more details about the implications of this.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def stop(self, request, context):
    """Stops data acquisition.

    Can specify a stop mode that handles what is done with the data when data acquisition is stopped. Refer to the enum
    description for documentation on what each mode does.

    Be aware that this command will return as soon as Minknow enters the FINISHING state and not the READY state.
    So if starting a new experiment then you will have to wait for the READY state seperately
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def watch_for_status_change(self, request_iterator, context):
    """Watches for status changes within MinKNOW. Status states are defined from MinknowStatus enum.
    This is a bi-directional stream where the incoming response stream will return everytime the status has changed
    and the request stream is used to stop the watcher. Refer to http://www.grpc.io/docs/tutorials/basic/python.html
    to see how bi-directoional streaming works in grpc, but essentially when calling this function the user will have 
    to pass in a generator that will eventually yield a WatchForStatusChangeRequest(stop=True) to the cpp side.
    A wrapper class for this is provided in the Python code.

    The function will first return with the current status that MinKNOW is in. Every response thereafter will be a 
    change from one status to another.

    The ERROR_STATUS state includes errors during transition between states. If that happens, MinKNOW will 
    try to revert to the READY state. It is up to the user to determine if they wish to try to wait for MinKNOW to
    correct itself or to try some other course of action
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def watch_current_acquisition_run(self, request, context):
    """Returns current acquisition run info and streams any changes to the current acquisition

    This call can be made even if acquisition is not running. In this case, the next streamed
    response will be the start of a new acquisition and you will receive updates for that acquisition
    until it finishes.

    If an acquisition finishes this stream will still continue to run and you will be notified when a new acquisition starts.

    Note if you begin this stream before any acquisition is started in minknow the state is `ACQUISITION_COMPLETED`.

    Since 1.13
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def current_status(self, request, context):
    """Check the current status of MinKNOW.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def get_progress(self, request, context):
    """Information on how much data has been acquired, processed and written.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def get_acquisition_info(self, request, context):
    """Gets information about an acquisition run, run within this instance on MinKNOW.

    If no run ID is provided, information about the most recently started acquisition run is
    provided.

    Since 1.11
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def list_acquisition_runs(self, request, context):
    """Gets information about all previous acquisitions.

    Since 1.11
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def get_current_acquisition_run(self, request, context):
    """Returns the name and run id of the currently running acquisition.

    Will fail with FAILED_PRECONDITION if there is no acquisition running

    Since 1.11
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def set_signal_reader(self, request, context):
    """Specify the signal reader to use

    Since 3.6
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_AcquisitionServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'start': grpc.unary_unary_rpc_method_handler(
          servicer.start,
          request_deserializer=minknow_dot_rpc_dot_acquisition__pb2.StartRequest.FromString,
          response_serializer=minknow_dot_rpc_dot_acquisition__pb2.StartResponse.SerializeToString,
      ),
      'stop': grpc.unary_unary_rpc_method_handler(
          servicer.stop,
          request_deserializer=minknow_dot_rpc_dot_acquisition__pb2.StopRequest.FromString,
          response_serializer=minknow_dot_rpc_dot_acquisition__pb2.StopResponse.SerializeToString,
      ),
      'watch_for_status_change': grpc.stream_stream_rpc_method_handler(
          servicer.watch_for_status_change,
          request_deserializer=minknow_dot_rpc_dot_acquisition__pb2.WatchForStatusChangeRequest.FromString,
          response_serializer=minknow_dot_rpc_dot_acquisition__pb2.WatchForStatusChangeResponse.SerializeToString,
      ),
      'watch_current_acquisition_run': grpc.unary_stream_rpc_method_handler(
          servicer.watch_current_acquisition_run,
          request_deserializer=minknow_dot_rpc_dot_acquisition__pb2.WatchCurrentAcquisitionRunRequest.FromString,
          response_serializer=minknow_dot_rpc_dot_acquisition__pb2.AcquisitionRunInfo.SerializeToString,
      ),
      'current_status': grpc.unary_unary_rpc_method_handler(
          servicer.current_status,
          request_deserializer=minknow_dot_rpc_dot_acquisition__pb2.CurrentStatusRequest.FromString,
          response_serializer=minknow_dot_rpc_dot_acquisition__pb2.CurrentStatusResponse.SerializeToString,
      ),
      'get_progress': grpc.unary_unary_rpc_method_handler(
          servicer.get_progress,
          request_deserializer=minknow_dot_rpc_dot_acquisition__pb2.GetProgressRequest.FromString,
          response_serializer=minknow_dot_rpc_dot_acquisition__pb2.GetProgressResponse.SerializeToString,
      ),
      'get_acquisition_info': grpc.unary_unary_rpc_method_handler(
          servicer.get_acquisition_info,
          request_deserializer=minknow_dot_rpc_dot_acquisition__pb2.GetAcquisitionRunInfoRequest.FromString,
          response_serializer=minknow_dot_rpc_dot_acquisition__pb2.AcquisitionRunInfo.SerializeToString,
      ),
      'list_acquisition_runs': grpc.unary_unary_rpc_method_handler(
          servicer.list_acquisition_runs,
          request_deserializer=minknow_dot_rpc_dot_acquisition__pb2.ListAcquisitionRunsRequest.FromString,
          response_serializer=minknow_dot_rpc_dot_acquisition__pb2.ListAcquisitionRunsResponse.SerializeToString,
      ),
      'get_current_acquisition_run': grpc.unary_unary_rpc_method_handler(
          servicer.get_current_acquisition_run,
          request_deserializer=minknow_dot_rpc_dot_acquisition__pb2.GetCurrentAcquisitionRunRequest.FromString,
          response_serializer=minknow_dot_rpc_dot_acquisition__pb2.AcquisitionRunInfo.SerializeToString,
      ),
      'set_signal_reader': grpc.unary_unary_rpc_method_handler(
          servicer.set_signal_reader,
          request_deserializer=minknow_dot_rpc_dot_acquisition__pb2.SetSignalReaderRequest.FromString,
          response_serializer=minknow_dot_rpc_dot_acquisition__pb2.SetSignalReaderResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'ont.rpc.acquisition.AcquisitionService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
