Class StubBase

Definition

Namespace:
Tizen.Applications.RPCPort
Assembly:
Tizen.Applications.Common.dll

Base class for creating stubs in RPC.

C#
Copy
public abstract class StubBase : IDisposable
Inheritance
object
StubBase
Implements
System.IDisposable
Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

Constructors

View Source

StubBase(string)

Constructs a new instance of the StubBase class.

Declaration
C#
Copy
public StubBase(string portName)
Parameters
Type Name Description
string portName

The name of the port that wants to listen.

Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

Examples

Here's an example showing how to construct a new instance of the StubBase class:

Copy
// Create a new instance of the StubBase class var stubBase = new StubBase("MyPort");
Exceptions
Type Condition
InvalidIOException

Thrown when an internal IO error occurs.

Properties

View Source

PortName

Gets port name.

Declaration
C#
Copy
public string PortName { get; }
Property Value
Type Description
string
Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

Methods

View Source

AddPrivilege(string)

Adds a privilege to the stub.

Declaration
C#
Copy
protected void AddPrivilege(string privilege)
Parameters
Type Name Description
string privilege

The privilege to access this stub.

Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the privilege is null.

View Source

Dispose()

Release all the resources used by the class StubBase.

Declaration
C#
Copy
public void Dispose()
Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

View Source

Dispose(bool)

Releases any unmanaged resources used by this object and disposes any other disposable objects.

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

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

Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

View Source

~StubBase()

Finalizer of the class StubBase.

Declaration
C#
Copy
protected ~StubBase()
Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

View Source

GetPort(Type, string)

Retrieves a port based on its type and the connected instance.

Declaration
C#
Copy
protected Port GetPort(Port.Type t, string instance)
Parameters
Type Name Description
Port.Type t

The type of port to retrieve.

string instance

The ID of the instance that the port is connected to.

Returns
Type Description
Port

The requested port.

Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

Exceptions
Type Condition
InvalidIDException

Thrown if an invalid instance ID is passed.

InvalidIOException

Thrown in case of an internal I/O error.

View Source

Listen()

Starts listening to incoming connection requests on the specified port.

Declaration
C#
Copy
protected void Listen()
Remarks

This method enables your application to listen for incoming connection requests from other applications. It is typically called after setting up the necessary network infrastructure such as creating a server socket and specifying a listening port.

Exceptions
Type Condition
InvalidIOException

Thrown when an internal IO error occurs during the listening process.

View Source

OnConnectedEvent(string, string)

Abstract method for receiving connected event.

Declaration
C#
Copy
protected abstract void OnConnectedEvent(string sender, string instance)
Parameters
Type Name Description
string sender

The target proxy applicstion ID.

string instance

The information about the request.

Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

View Source

OnDisconnectedEvent(string, string)

Abstract method for receiving disconnected event.

Declaration
C#
Copy
protected abstract void OnDisconnectedEvent(string sender, string instance)
Parameters
Type Name Description
string sender

The target proxy applicstion ID.

string instance

The information about the request.

Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

View Source

OnReceivedEvent(string, string, Port)

Abstract method called when the stub receives data from proxy.

Declaration
C#
Copy
protected abstract bool OnReceivedEvent(string sender, string instance, Port port)
Parameters
Type Name Description
string sender

The target proxy applicstion ID.

string instance

The information about the request.

Port port

Port object for reading and writing.

Returns
Type Description
bool

true to continue receiving data, otherwise false to disconnect from the port.

Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

View Source

OnTerminatedEvent()

Abstract method called immediately before disposing an object.

Declaration
C#
Copy
protected abstract void OnTerminatedEvent()
Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

View Source

SetTrusted(bool)

Sets whether the stub allows only trusted proxies or not.

Declaration
C#
Copy
protected void SetTrusted(bool trusted)
Parameters
Type Name Description
bool trusted

Indicates if the stub allows only trusted proxies or not.

Remarks

This class provides a base implementation for creating stubs that are used in Remote Procedure Call (RPC). By extending this class, you can easily implement your own stubs for specific interfaces. The StubBase class handles common functionality such as managing the connection state and handling incoming requests from clients. It also provides methods for sending responses back to the client after processing the request. To create a stub for a specific interface, you need to extend the StubBase class and override its virtual methods according to the requirements of the interface.

Implements

System.IDisposable