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#Copypublic class ComponentPort : IDisposable
- Inheritance
-
System.ObjectComponentPort
- Implements
-
System.IDisposable
Constructors
Declaration
C#Copypublic 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
Declaration
C#Copypublic string PortName { get; }
Property Value
Type | Description |
---|---|
System.String |
API Level: 9
Methods
Declaration
C#Copypublic 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
Declaration
C#Copypublic void Cancel()
API Level: 9
Declaration
C#Copypublic void Dispose()
API Level: 9
Dispose(Boolean)
Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
Declaration
C#Copyprotected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | If true, disposes any disposable objects, or false not to dispose disposable objects. |
API Level: 9
Declaration
C#Copyprotected void Finalize()
API Level: 9
Declaration
C#Copypublic void Send(string endpoint, int timeout, object request)
Parameters
Type | Name | Description |
---|---|---|
System.String | endpoint | The name of the endpoint |
System.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
SendAndReceive(String, Int32, Object)
Sends the request data and receives the reply data.
Declaration
C#Copypublic object SendAndReceive(string endpoint, int timeout, object request)
Parameters
Type | Name | Description |
---|---|---|
System.String | endpoint | The name of the endpoint |
System.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
SendAndReceiveAsync(String, Int32, Object)
Sends the request data and receives the reply data asynchronously.
Declaration
C#Copypublic Task<object> SendAndReceiveAsync(string endpoint, int timeout, object request)
Parameters
Type | Name | Description |
---|---|---|
System.String | endpoint | The name of the endpoint |
System.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
Declaration
C#Copypublic 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
CopyComponentTask task = new ComponentTask(new ComponentPort("Comm")); task.Start();
API Level: 9
Declaration
C#Copypublic 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
Declaration
C#Copypublic event EventHandler<RequestEventArgs> RequestReceived
Event Type
Type | Description |
---|---|
System.EventHandler<RequestEventArgs> |
Remarks
If the reply is requested, RequestEventArgs.Request should be set.