docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IServiceClient

    Sends typed requests to a ROS service and receives responses, either via callback or Task<TResult>.

    Namespace: Unity.SimulationPro.Foundation
    Assembly: Unity.SimulationPro.Foundation.dll
    Syntax
    public interface IServiceClient
    Remarks

    Obtain an IServiceClient by calling RegisterServiceClient<TRequest, TResponse>(string) on an active connector.

    Properties

    RequestTypeId

    Gets the message type identifier for the request message.

    Declaration
    MessageTypeId RequestTypeId { get; }
    Property Value
    Type Description
    MessageTypeId

    ResponseTypeId

    Gets the message type identifier for the response message.

    Declaration
    MessageTypeId ResponseTypeId { get; }
    Property Value
    Type Description
    MessageTypeId

    ServiceName

    Gets the ROS service name this client sends requests to.

    Declaration
    string ServiceName { get; }
    Property Value
    Type Description
    string

    Methods

    SendRequest(IMessage)

    Send the request to the service and return the Task to handle the response

    Declaration
    Task<IMessage> SendRequest(IMessage request)
    Parameters
    Type Name Description
    IMessage request

    The IMessage message to send

    Returns
    Type Description
    Task<IMessage>

    A Task<TResult> that will complete when the response is received.

    SendRequest(IMessage, Action<IMessage>)

    Send the request to the service and handle the response

    Declaration
    void SendRequest(IMessage request, Action<IMessage> callback)
    Parameters
    Type Name Description
    IMessage request

    The IMessage message to send

    Action<IMessage> callback

    The callback Action to handle the TResponse response. The callback will be scheduled on the current SynchronizationContext; i.e. the main thread

    SendRequest<TRequest, TResponse>(TRequest)

    Send the request to the service and return the Task to handle the response

    Declaration
    Task<TResponse> SendRequest<TRequest, TResponse>(TRequest request) where TRequest : IMessage where TResponse : IMessage
    Parameters
    Type Name Description
    TRequest request

    The TRequest message to send

    Returns
    Type Description
    Task<TResponse>

    A Task<TResult> that will complete when the response is received.

    Type Parameters
    Name Description
    TRequest

    The type of the IMessage request

    TResponse

    The type of the IMessage response

    SendRequest<TRequest, TResponse>(TRequest, Action<TResponse>)

    Send the request to the service and handle the response

    Declaration
    void SendRequest<TRequest, TResponse>(TRequest request, Action<TResponse> callback) where TRequest : IMessage where TResponse : IMessage
    Parameters
    Type Name Description
    TRequest request

    The TRequest message to send

    Action<TResponse> callback

    The callback Action to handle the TResponse response. The callback will be scheduled on the current SynchronizationContext; i.e. the main thread

    Type Parameters
    Name Description
    TRequest

    The type of the IMessage request

    TResponse

    The type of the IMessage response

    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)