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
-
objectComponentPort
- Implements
-
System.IDisposable
Constructors
View SourceComponentPort(string)
Constructor for this class.
Declaration
public ComponentPort(string portName)
Parameters
Type | Name | Description |
---|---|---|
string | portName | The name of the port. |
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 SourcePortName
Gets the port name.
Declaration
public string PortName { get; }
Property Value
Type | Description |
---|---|
string |
Methods
View SourceAddPrivilege(string)
Adds a privilege to the port object.
Declaration
public void AddPrivilege(string privilege)
Parameters
Type | Name | Description |
---|---|---|
string | privilege | privilege data |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the argument is invalid. |
Cancel()
Cancels waiting for events.
Declaration
public void Cancel()
Dispose()
Releases all the resources used by the class ComponentPort.
Declaration
public void Dispose()
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. |
~ComponentPort()
Finalizer of the class ComponentPort.
Declaration
protected ~ComponentPort()
Send(string, int, object)
Sends the request data.
Declaration
public void Send(string endpoint, int timeout, object request)
Parameters
Type | Name | Description |
---|---|---|
string | endpoint | The name of the endpoint |
int | timeout | The timeout in milliseconds, -1 to use the default timeout |
object | request | The serializable data to send |
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. |
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 |
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. |
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 |
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. |
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 run until Cancel() is called. To avoid blocking the main thread, it's recommended to use the ComponentTask class.
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 SourceRequestReceived
Occurs whenever the request is received.
Declaration
public event EventHandler<RequestEventArgs> RequestReceived
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><RequestEventArgs> |
Remarks
If the reply is requested, RequestEventArgs.Request should be set.