Class ClientBase

Definition

Namespace:
Tizen.Applications.Cion
Assembly:
Tizen.Applications.Cion.dll
API Level:
9

An abstract class to represent cion client.

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

Constructors

View Source

ClientBase(String)

The constructor of ClientBase class.

Declaration
C#
Copy
public ClientBase(string serviceName)
Parameters
Type Name Description
System.String serviceName

The name of service.

Remarks

The maximum length of service name is 512.

Exceptions
Type Condition
System.ArgumentException

Thrown when the given service name is too long.

System.InvalidOperationException

Thrown when there is not enough memory to continue the execution of the method.

API Level: 9
View Source

ClientBase(String, SecurityInfo)

The constructor of ClientBase class.

Declaration
C#
Copy
public ClientBase(string serviceName, SecurityInfo security)
Parameters
Type Name Description
System.String serviceName

The name of service.

SecurityInfo security

The security configuration.

Remarks

The maximum length of service name is 512.

Exceptions
Type Condition
System.ArgumentException

Thrown when the given service name is too long.

System.InvalidOperationException

Thrown when there is not enough memory to continue the execution of the method.

API Level: 9

Properties

View Source

PeerInfo

Gets peer info of connected cion server.

Declaration
C#
Copy
public PeerInfo PeerInfo { get; }
Property Value
Type Description
PeerInfo
API Level: 9
View Source

ServiceName

Gets the service name of current cion client.

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

Methods

View Source

Connect(PeerInfo)

Connects with the cion server.

Declaration
C#
Copy
public void Connect(PeerInfo peer)
Parameters
Type Name Description
PeerInfo peer

The peer to connect.

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the client cannot connect to server.

UnauthorizedAccessException

Thrown when an application does not have the privilege to access this method.

API Level: 9
Privilege Level: public
Privilege: http://tizen.org/privilege/d2d.datasharinghttp://tizen.org/privilege/internet
View Source

Disconnect()

Disconnects from the cion server.

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

Dispose()

Releases all resources used by the ClientBase class.

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. If false, does not dispose disposable objects.

API Level: 9
View Source

OnConnectionResult(PeerInfo, ConnectionResult)

The result callback of connection request.

Declaration
C#
Copy
protected abstract void OnConnectionResult(PeerInfo peerInfo, ConnectionResult result)
Parameters
Type Name Description
PeerInfo peerInfo

The peer info of the cion server.

ConnectionResult result

The result of the connection.

API Level: 9
View Source

OnDisconnected(PeerInfo)

The callback invoked when disconnected with cion client.

Declaration
C#
Copy
protected abstract void OnDisconnected(PeerInfo peerInfo)
Parameters
Type Name Description
PeerInfo peerInfo

The peer info of the cion server.

API Level: 9
View Source

OnDiscovered(PeerInfo)

The callback invoked when the cion server discovered.

Declaration
C#
Copy
protected abstract void OnDiscovered(PeerInfo peerInfo)
Parameters
Type Name Description
PeerInfo peerInfo

The peer info of discovered cion server.

API Level: 9
View Source

OnPayloadReceived(Payload, PayloadTransferStatus)

The callback invoked when received payload.

Declaration
C#
Copy
protected abstract void OnPayloadReceived(Payload payload, PayloadTransferStatus status)
Parameters
Type Name Description
Payload payload

The received payload.

PayloadTransferStatus status

The status of sent payload.

API Level: 9
View Source

SendData(Byte[], Int32)

Sends data synchronously to the connected cion server.

Declaration
C#
Copy
public byte[] SendData(byte[] data, int timeout)
Parameters
Type Name Description
System.Byte[] data

The data to send.

Int32 timeout

The timeout of sending operation.

Returns
Type Description
System.Byte[]
Exceptions
Type Condition
System.ArgumentException

Thrown when the given data is invalid.

System.InvalidOperationException

Thrown when there is no connected cion server or failed to receive reply.

System.TimeoutException

Thrown when a timeout occurred.

API Level: 9
View Source

SendPayloadAsync(Payload)

Sends payload asynchronously to the connected cion server.

Declaration
C#
Copy
public Task<PayloadAsyncResult> SendPayloadAsync(Payload payload)
Parameters
Type Name Description
Payload payload

The payload to send.

Returns
Type Description
System.Threading.Tasks.Task<PayloadAsyncResult>
Exceptions
Type Condition
System.ArgumentException

Thrown when the payload is not valid.

System.InvalidOperationException

Thrown when there is no connected cion server or failed to send payload.

API Level: 9
View Source

StopDiscovery()

Stops discovering.

Declaration
C#
Copy
public void StopDiscovery()
Exceptions
Type Condition
System.InvalidOperationException

Thrown when the client is not discovering.

API Level: 9
View Source

TryDiscovery()

Starts discovering cion servers.

Declaration
C#
Copy
public void TryDiscovery()
Exceptions
Type Condition
System.InvalidOperationException

Thrown when the discovery operation is already in progress.

UnauthorizedAccessException

Thrown when an application does not have the privilege to access this method.

API Level: 9
Privilege Level: public
Privilege: http://tizen.org/privilege/d2d.datasharinghttp://tizen.org/privilege/internet

Implements

System.IDisposable