Example

Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
CClient.h File Reference
`#include "Capsule/CDefinesPrivate.h"`
`#include "Capsule/CError.h"`
`#include "Capsule/CString.h"`
Include dependency graph for CClient.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Typedefs
typedef enum clCDisconnectReason | clCDisconnectReason
| Reason for client's disconnect.
typedef enum clCConnectionState | clCConnectionState
| Connection state to Capsule.
typedef void(* | clCClientHandler) (clCClient)
typedef void(* | clCClientHandlerDisconnectReason) (clCClient, clCDisconnectReason)
typedef void(* | clCClientHandlerError) (clCClient, clCError)

## Enumerations
enum | clCDisconnectReason { clC_DR_UserRequested , clC_DR_Destruction , clC_DR_FatalError }
| Reason for client's disconnect. More...
enum | clCConnectionState { clC_CS_Disconnected , clC_CS_Connecting , clC_CS_Connected , clC_CS_Disconnecting }
| Connection state to Capsule. More...

## Functions
| CLC_CLASS_WN (ClientPrivate, clCClient)
| Used to connect with Capsule.
| CLC_STRUCT (clCClientDelegate)
| Client callback without parameters. (Note: ALL callbacks receive their owner as first argument).
CL_DLL void | clCClientDelegate_Set (clCClientDelegate delegate, clCClientHandler callback) NOEXCEPT
| CLC_STRUCT (clCClientDelegateDisconnectReason)
| Client disconnect callback. Not supported in the current version.
CL_DLL void | clCClientDelegateDisconnectReason_Set (clCClientDelegateDisconnectReason delegate, clCClientHandlerDisconnectReason callback) NOEXCEPT
| CLC_STRUCT (clCClientDelegateError)
| Client error callback. Not supported in the current version.
CL_DLL void | clCClientDelegateError_Set (clCClientDelegateError delegate, clCClientHandlerError callback) NOEXCEPT
CL_DLL clCString | clCClient_GetVersionString () NOEXCEPT
CL_DLL void | clCClient_SetAppVersion (clCClient client, const char *version)
| Client application version setter. Must be set before client connection.
CL_DLL clCClient | clCClient_Create () NOEXCEPT
CL_DLL clCClient | clCClient_CreateWithName (const char *clientName) NOEXCEPT
CL_DLL clCClient | clCClient_CreateWithDataDirectory (const char *dataDir) NOEXCEPT
CL_DLL clCClient | clCClient_CreateWithDataDirectoryAndName (const char *dataDir, const char *clientName) NOEXCEPT
CL_DLL void | clCClient_Destroy (clCClient client) NOEXCEPT
CL_DLL void | clCClient_Connect (clCClient client, const char *address) NOEXCEPT
CL_DLL void | clCClient_ConnectWithAccessToken (clCClient client, const char *address, const char *accessToken) NOEXCEPT
CL_DLL void | clCClient_ConnectWithAccessTokenAndPlatformAddress (clCClient client, const char *address, const char *accessToken, const char *platformAddress) NOEXCEPT
CL_DLL clCClientDelegate | clCClient_GetOnRefreshAccessTokenRequestedEvent (clCClient client) NOEXCEPT
CL_DLL void | clCClient_RefreshToken (clCClient client, const char *accessToken) NOEXCEPT
CL_DLL uint64_t | clCClient_GetTime () NOEXCEPT
CL_DLL uint64_t | clCClient_GetTimeMicro () NOEXCEPT
CL_DLL void | clCClient_Disconnect (clCClient client) NOEXCEPT
CL_DLL bool | clCClient_IsConnected (clCClient client) NOEXCEPT
CL_DLL bool | clCClient_IsConnecting (clCClient client) NOEXCEPT
CL_DLL clCString | clCClient_GetCapsuleVersion (clCClient client) NOEXCEPT
CL_DLL clCString | clCClient_GetClientName (clCClient client) NOEXCEPT
CL_DLL clCString | clCClient_GetDataDirectory (clCClient client) NOEXCEPT
CL_DLL void | clCClient_Update (clCClient client) NOEXCEPT
CL_DLL clCClientDelegate | clCClient_GetOnConnectedEvent (clCClient client) NOEXCEPT
CL_DLL clCClientDelegateDisconnectReason | clCClient_GetOnDisconnectedEvent (clCClient client) NOEXCEPT
CL_DLL clCClientDelegateError | clCClient_GetOnErrorEvent (clCClient client) NOEXCEPT

## Typedef Documentation

## ◆ clCClientHandler

typedef void(* clCClientHandler) (clCClient)

## ◆ clCClientHandlerDisconnectReason

typedef void(* clCClientHandlerDisconnectReason) (clCClient, clCDisconnectReason)

## ◆ clCClientHandlerError

typedef void(* clCClientHandlerError) (clCClient, clCError)

## ◆ clCConnectionState

typedef enum clCConnectionState clCConnectionState

Connection state to Capsule.

## ◆ clCDisconnectReason

typedef enum clCDisconnectReason clCDisconnectReason

Reason for client's disconnect.

## Enumeration Type Documentation

## ◆ clCConnectionState

enum clCConnectionState

Connection state to Capsule.

Enumerator
clC_CS_Disconnected |
clC_CS_Connecting |
clC_CS_Connected |
clC_CS_Disconnecting |

## ◆ clCDisconnectReason

enum clCDisconnectReason

Reason for client's disconnect.

Enumerator
clC_DR_UserRequested |
clC_DR_Destruction |
clC_DR_FatalError |

## Function Documentation

## ◆ CLC_CLASS_WN()

CLC_CLASS_WN | ( | ClientPrivate | ,
|  | clCClient |
| ) |  |

Used to connect with Capsule.

Handle to client used to connect with Capsule, responsible for control.

## ◆ CLC_STRUCT() [1/3]

CLC_STRUCT | ( | clCClientDelegate |  | ) |

Client callback without parameters. (Note: ALL callbacks receive their owner as first argument).

## ◆ CLC_STRUCT() [2/3]

CLC_STRUCT | ( | clCClientDelegateDisconnectReason |  | ) |

Client disconnect callback. Not supported in the current version.

## ◆ CLC_STRUCT() [3/3]

CLC_STRUCT | ( | clCClientDelegateError |  | ) |

Client error callback. Not supported in the current version.

## ◆ clCClient_Connect()

CL_DLL void clCClient_Connect | ( | clCClient | client,
|  | const char * | address
| ) |  |

Connect to Capsule.

Parameters

  client | client handle
  address | Capsule address to connect to. If NULL, the default address "tcp:://127.0.0.1:5666" is in effect. For embedded Capsule use in-process protocol: "inproc://capsule", Otherwise use tcp protocol: "tcp:://127.0.0.1:5666". OnConnected event is called when connected.

## ◆ clCClient_ConnectWithAccessToken()

CL_DLL void clCClient_ConnectWithAccessToken | ( | clCClient | client,
|  | const char * | address,
|  | const char * | accessToken
| ) |  |

Connect to Capsule with access token.

Parameters

  client | client handle
  address | Capsule address to connect to. If NULL, the default address "tcp:://127.0.0.1:5666" is in effect. For embedded Capsule use in-process protocol: "inproc://capsule", Otherwise use tcp protocol: "tcp:://127.0.0.1:5666". OnConnected event is called when connected.
  accessToken | access token for communication with platform

## ◆ clCClient_ConnectWithAccessTokenAndPlatformAddress()

CL_DLL void clCClient_ConnectWithAccessTokenAndPlatformAddress | ( | clCClient | client,
|  | const char * | address,
|  | const char * | accessToken,
|  | const char * | platformAddress
| ) |  |

Connect to Capsule with access token and platform address.

Parameters

  client | client handle
  address | Capsule address to connect to. If NULL, the default address "tcp:://127.0.0.1:5666" is in effect. For embedded Capsule use in-process protocol: "inproc://capsule", Otherwise use tcp protocol: "tcp:://127.0.0.1:5666". OnConnected event is called when connected.
  accessToken | access token for communication with platform
  platformAddress | URL of a platform processing http requests

## ◆ clCClient_Create()

CL_DLL clCClient clCClient_Create | ( |  | ) |

Create a Capsule client.

Returns
  client handle

## ◆ clCClient_CreateWithDataDirectory()

CL_DLL clCClient clCClient_CreateWithDataDirectory | ( | const char * | dataDir | ) |

Create a Capsule client with data directory.

Parameters

  dataDir | path to data directory

Returns
  client handle

## ◆ clCClient_CreateWithDataDirectoryAndName()

CL_DLL clCClient clCClient_CreateWithDataDirectoryAndName | ( | const char * | dataDir,
|  | const char * | clientName
| ) |  |

Create a Capsule client with data directory and application name.

Parameters

  dataDir | path to data directory
  clientName | application name

Returns
  client handle

## ◆ clCClient_CreateWithName()

CL_DLL clCClient clCClient_CreateWithName | ( | const char * | clientName | ) |

Create a Capsule client with application name.

Parameters

  clientName | application name

Returns
  client handle

## ◆ clCClient_Destroy()

CL_DLL void clCClient_Destroy | ( | clCClient | client | ) |

Destroy Capsule client. Release the handle.

Parameters

  client | client handle

## ◆ clCClient_Disconnect()

CL_DLL void clCClient_Disconnect | ( | clCClient | client | ) |

Disconnects from Capsule, stopping any background threads.

Parameters

  client | client handle

## ◆ clCClient_GetCapsuleVersion()

CL_DLL clCString clCClient_GetCapsuleVersion | ( | clCClient | client | ) |

Get Capsule version string.

Parameters

  client | client handle

Returns
  capsule version as a string ("unknown" if not connected).

## ◆ clCClient_GetClientName()

CL_DLL clCString clCClient_GetClientName | ( | clCClient | client | ) |

Get Client application name.

Parameters

  client | client handle

Returns
  client name as a string ("unknown" if not connected).

## ◆ clCClient_GetDataDirectory()

CL_DLL clCString clCClient_GetDataDirectory | ( | clCClient | client | ) |

Get Capsule data directory.

Parameters

  client | client handle

Returns
  capsule data directory as a string ("" if not applicable).

## ◆ clCClient_GetOnConnectedEvent()

CL_DLL clCClientDelegate clCClient_GetOnConnectedEvent | ( | clCClient | client | ) |

Get delegate for client connected event.

Parameters

  client | client handle

Returns
  client delegate

## ◆ clCClient_GetOnDisconnectedEvent()

CL_DLL clCClientDelegateDisconnectReason clCClient_GetOnDisconnectedEvent | ( | clCClient | client | ) |

Get delegate for client disconnected event.

Parameters

  client | client handle

Returns
  client disconnect delegate

## ◆ clCClient_GetOnErrorEvent()

CL_DLL clCClientDelegateError clCClient_GetOnErrorEvent | ( | clCClient | client | ) |

Get delegate for client error event.

Parameters

  client | client handle

Returns
  client error delegate

## ◆ clCClient_GetOnRefreshAccessTokenRequestedEvent()

CL_DLL clCClientDelegate clCClient_GetOnRefreshAccessTokenRequestedEvent | ( | clCClient | client | ) |

Get delegate for client RefreshAccessTokenRequested event.

Parameters

  client | client handle

Returns
  client delegate

## ◆ clCClient_GetTime()

CL_DLL uint64_t clCClient_GetTime | ( |  | ) |

Get Capsule time for synchronization with EEG timestamps

Returns
  time

## ◆ clCClient_GetTimeMicro()

CL_DLL uint64_t clCClient_GetTimeMicro | ( |  | ) |

Get Capsule time in microseconds

Returns
  time in microseconds

## ◆ clCClient_GetVersionString()

CL_DLL clCString clCClient_GetVersionString | ( |  | ) |

Get Capsule client version

Returns
  client version string

## ◆ clCClient_IsConnected()

CL_DLL bool clCClient_IsConnected | ( | clCClient | client | ) |

Is client connected.

Parameters

  client | client handle

## ◆ clCClient_IsConnecting()

CL_DLL bool clCClient_IsConnecting | ( | clCClient | client | ) |

Is client connecting.

Parameters

  client | client handle

## ◆ clCClient_RefreshToken()

CL_DLL void clCClient_RefreshToken | ( | clCClient | client,
|  | const char * | accessToken
| ) |  |

Refresh access token for data upload

Parameters

  client | client handle
  accessToken | access token

## ◆ clCClient_SetAppVersion()

CL_DLL void clCClient_SetAppVersion | ( | clCClient | client,
|  | const char * | version
| ) |  |

Client application version setter. Must be set before client connection.

Parameters

  [in,out] | client | client handle
  [in] | version | string, representing client's version

## ◆ clCClient_Update()

CL_DLL void clCClient_Update | ( | clCClient | client | ) |

Client is single-threaded. Note: Update does all the work and must be called regularly to process events.

Parameters

  client | client handle

## ◆ clCClientDelegate_Set()

CL_DLL void clCClientDelegate_Set | ( | clCClientDelegate | delegate,
|  | clCClientHandler | callback
| ) |  |

## ◆ clCClientDelegateDisconnectReason_Set()

CL_DLL void clCClientDelegateDisconnectReason_Set | ( | clCClientDelegateDisconnectReason | delegate,
|  | clCClientHandlerDisconnectReason | callback
| ) |  |

## ◆ clCClientDelegateError_Set()

CL_DLL void clCClientDelegateError_Set | ( | clCClientDelegateError | delegate,
|  | clCClientHandlerError | callback
| ) |  |