Class ComponentPort

Definition

Namespace:
Tizen.Applications.ComponentBased
Assembly:
Tizen.Applications.ComponentBased.Port.dll
API Level:
9

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

C#
Copy
public class ComponentPort : IDisposable
Inheritance
System.Object
ComponentPort
Implements
System.IDisposable

Constructors

View Source

ComponentPort(String)

Constructor for this class.

Declaration
C#
Copy
public ComponentPort(string portName)
Parameters
Type Name Description
System.String portName

The name of the port.

Exceptions
Type Condition
System.ArgumentException

Thrown when the argument is invalid.

OutOfMemoryException

Thrown when the memory is insufficient.

IOException

Thrown when because of I/O error.

API Level: 9

Properties

View Source

PortName

Gets the port name.

Declaration
C#
Copy
public string PortName { get; }
Property Value
Type Description
System.String
API Level: 9

Methods

View Source

AddPrivilege(String)

Adds a privilege to the port object.

Declaration
C#
Copy
public void AddPrivilege(string privilege)
Parameters
Type Name Description
System.String privilege

privilege data

Exceptions
Type Condition
System.ArgumentException

Thrown when the argument is invalid.

API Level: 9
View Source

Cancel()

Cancels waiting for events.

Declaration
C#
Copy
public void Cancel()
API Level: 9
View Source

Dispose()

Releases all the resources used by the class ComponentPort.

Declaration
C#
Copy
public void Dispose()
API Level: 9
View Source

Dispose(Boolean)

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

Declaration
C#
Copy
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing

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

API Level: 9
View Source

Finalize()

Finalizer of the class ComponentPort.

Declaration
C#
Copy
protected void Finalize()
API Level: 9
View Source

Send(String, Int32, Object)

Sends the request data.

Declaration
C#
Copy
public void Send(string endpoint, int timeout, object request)
Parameters
Type Name Description
System.String endpoint

The name of the endpoint

Int32 timeout

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

System.Object request

The serializable data to send

Exceptions
Type Condition
System.ArgumentException

Thrown when the argument is invalid.

OutOfMemoryException

Thrown when the memory is insufficient.

UnauthorizedAccessException

Thrown when permission is denied.

IOException

Thrown when because of I/O error.

API Level: 9
View Source

SendAndReceive(String, Int32, Object)

Sends the request data and receives the reply data.

Declaration
C#
Copy
public object SendAndReceive(string endpoint, int timeout, object request)
Parameters
Type Name Description
System.String endpoint

The name of the endpoint

Int32 timeout

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

System.Object request

The serializable data to send

Returns
Type Description
System.Object

The received serializable data

Exceptions
Type Condition
System.ArgumentException

Thrown when the argument is invalid.

OutOfMemoryException

Thrown when the memory is insufficient.

UnauthorizedAccessException

Thrown when permission is denied.

IOException

Thrown when because of I/O error.

API Level: 9
View Source

SendAndReceiveAsync(String, Int32, Object)

Sends the request data and receives the reply data asynchronously.

Declaration
C#
Copy
public Task<object> SendAndReceiveAsync(string endpoint, int timeout, object request)
Parameters
Type Name Description
System.String endpoint

The name of the endpoint

Int32 timeout

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

System.Object request

The serializable data to send

Returns
Type Description
System.Threading.Tasks.Task<System.Object>

The received serializable data

Exceptions
Type Condition
System.ArgumentException

Thrown when the argument is invalid.

OutOfMemoryException

Thrown when the memory is insufficient.

UnauthorizedAccessException

Thrown when permission is denied.

IOException

Thrown when because of I/O error.

API Level: 9
View Source

WaitForEvent()

Waits for events.

Declaration
C#
Copy
public void WaitForEvent()
Remarks

This method runs a main loop until Cancel() is called. The code in the next line will not run until Cancel() is called. To avoid blocking the main thread, it's recommended to use the ComponentTask class.

Examples
Copy
ComponentTask task = new ComponentTask(new ComponentPort("Comm")); task.Start();
API Level: 9
View Source

WaitForPort(String)

Waits until the port is ready.

Declaration
C#
Copy
public static Task WaitForPort(string endpoint)
Parameters
Type Name Description
System.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
C#
Copy
public event EventHandler<RequestEventArgs> RequestReceived
Event Type
Type Description
System.EventHandler<RequestEventArgs>
Remarks

If the reply is requested, RequestEventArgs.Request should be set.

API Level: 9

Implements

System.IDisposable