Class ComponentPort

    Definition

    Namespace:
    Tizen.Applications.ComponentBased
    Assembly:
    Tizen.Applications.ComponentBased.Port.dll

    The component port API provides functions to send and receive requests between components of component-based-application.

    public class ComponentPort : IDisposable
    Inheritance
    object
    ComponentPort
    Implements
    System.IDisposable

    Constructors

    View Source

    ComponentPort(string)

    Constructs a new instance of this class.

    Declaration
    public ComponentPort(string portName)
    Parameters
    Type Name Description
    string portName

    The name of the port to connect to.

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown when the argument is invalid.

    System.OutOfMemoryException

    Thrown when the memory is insufficient.

    System.IO.IOException

    Thrown when because of I/O error.

    Properties

    View Source

    PortName

    Gets the port name.

    Declaration
    public string PortName { get; }
    Property Value
    Type Description
    string

    Methods

    View Source

    AddPrivilege(string)

    Adds a privilege to the port object.

    Declaration
    public void AddPrivilege(string privilege)
    Parameters
    Type Name Description
    string privilege

    Privilege data specifying the access rights to be granted.

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown when the argument is invalid.

    View Source

    Cancel()

    Cancels waiting for events.

    Declaration
    public void Cancel()
    View Source

    Dispose()

    Releases all the resources used by the class ComponentPort.

    Declaration
    public void Dispose()
    View Source

    Dispose(bool)

    Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    If true, disposes any disposable objects, or false not to dispose disposable objects.

    View Source

    ~ComponentPort()

    Finalizes an instance of the class ComponentPort.

    Declaration
    protected ~ComponentPort()
    View Source

    Send(string, int, object)

    Sends the request data to the specified endpoint.

    Declaration
    public void Send(string endpoint, int timeout, object request)
    Parameters
    Type Name Description
    string endpoint

    The name of the endpoint to which the request is sent.

    int timeout

    The timeout in milliseconds, -1 to use the default timeout.

    object request

    The serializable data to send.

    Remarks

    This method sends the serialized request data to the specified endpoint. If the timeout value is not set (-1), the default timeout will be used.

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown when the argument is invalid.

    System.OutOfMemoryException

    Thrown when the memory is insufficient.

    System.UnauthorizedAccessException

    Thrown when permission is denied.

    System.IO.IOException

    Thrown when because of I/O error.

    View Source

    SendAndReceive(string, int, object)

    Sends the request data and receives the reply data.

    Declaration
    public object SendAndReceive(string endpoint, int timeout, object request)
    Parameters
    Type Name Description
    string endpoint

    The name of the endpoint to which the request is sent.

    int timeout

    The timeout in milliseconds, -1 to use the default timeout.

    object request

    The serializable data to send.

    Returns
    Type Description
    object

    The received serializable data.

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown when the argument is invalid.

    System.OutOfMemoryException

    Thrown when the memory is insufficient.

    System.UnauthorizedAccessException

    Thrown when permission is denied.

    System.IO.IOException

    Thrown when because of I/O error.

    View Source

    SendAndReceiveAsync(string, int, object)

    Sends the request data and receives the reply data asynchronously.

    Declaration
    public Task<object> SendAndReceiveAsync(string endpoint, int timeout, object request)
    Parameters
    Type Name Description
    string endpoint

    The name of the endpoint to which the request is sent.

    int timeout

    The timeout in milliseconds, -1 to use the default timeout.

    object request

    The serializable data to send.

    Returns
    Type Description
    System.Threading.Tasks.Task<TResult><object>

    The received serializable data.

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown when the argument is invalid.

    System.OutOfMemoryException

    Thrown when the memory is insufficient.

    System.UnauthorizedAccessException

    Thrown when permission is denied.

    System.IO.IOException

    Thrown when because of I/O error.

    View Source

    WaitForEvent()

    Waits for events.

    Declaration
    public void WaitForEvent()
    Remarks

    This method runs a main loop until Cancel() is called. The code in the next line will not execute until Cancel() is called. To prevent blocking the main thread, consider using the ComponentTask class instead.

    Examples
    ComponentTask task = new ComponentTask(new ComponentPort("Comm"));
    task.Start();
    View Source

    WaitForPort(string)

    Waits until the port is ready.

    Declaration
    public static Task WaitForPort(string endpoint)
    Parameters
    Type Name Description
    string endpoint

    The name of the port

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task.

    Events

    View Source

    RequestReceived

    Occurs whenever the request is received.

    Declaration
    public event EventHandler<RequestEventArgs> RequestReceived
    Event Type
    Type Description
    System.EventHandler<TEventArgs><RequestEventArgs>
    Remarks

    The event handler receives a RequestEventArgs argument that contains information about the request. If the reply is requested, RequestEventArgs.Request should be set.

    Implements

    System.IDisposable
    • View Source
    Back to top Copyright © 2016-2024 Samsung
    Generated by DocFX