Example
Loading...
Searching...
No Matches
CClient.h
Go to the documentation of this file.
1// Copyright. 2019 - 2024 PSBD. All rights reserved.
2
3#pragma once
4
6#include "Capsule/CError.h"
7#include "Capsule/CString.h"
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
16typedef enum clCDisconnectReason {
21
25typedef enum clCConnectionState {
31
37CLC_CLASS_WN(ClientPrivate, clCClient);
38
43CLC_STRUCT(clCClientDelegate);
44typedef void (*clCClientHandler)(clCClient);
45CL_DLL void clCClientDelegate_Set(clCClientDelegate delegate,
46 clCClientHandler callback) NOEXCEPT;
50CLC_STRUCT(clCClientDelegateDisconnectReason);
51typedef void (*clCClientHandlerDisconnectReason)(clCClient,
54 clCClientDelegateDisconnectReason delegate,
59CLC_STRUCT(clCClientDelegateError);
60typedef void (*clCClientHandlerError)(clCClient, clCError);
61CL_DLL void clCClientDelegateError_Set(clCClientDelegateError delegate,
63
70
76CL_DLL void clCClient_SetAppVersion(clCClient client, const char* version);
77
90CL_DLL clCClient clCClient_CreateWithName(const char* clientName) NOEXCEPT;
97CL_DLL clCClient clCClient_CreateWithDataDirectory(const char* dataDir) NOEXCEPT;
106 const char* clientName) NOEXCEPT;
112CL_DLL void clCClient_Destroy(clCClient client) NOEXCEPT;
123CL_DLL void clCClient_Connect(clCClient client, const char* address) NOEXCEPT;
136 const char* address,
137 const char* accessToken) NOEXCEPT;
151 const char* address,
152 const char* accessToken,
153 const char* platformAddress) NOEXCEPT;
154
161CL_DLL clCClientDelegate
168CL_DLL void clCClient_RefreshToken(clCClient client, const char* accessToken) NOEXCEPT;
184CL_DLL void clCClient_Disconnect(clCClient client) NOEXCEPT;
190CL_DLL bool clCClient_IsConnected(clCClient client) NOEXCEPT;
197
205CL_DLL clCString clCClient_GetCapsuleVersion(clCClient client) NOEXCEPT;
213CL_DLL clCString clCClient_GetClientName(clCClient client) NOEXCEPT;
221CL_DLL clCString clCClient_GetDataDirectory(clCClient client) NOEXCEPT;
229CL_DLL void clCClient_Update(clCClient client) NOEXCEPT;
230
237CL_DLL clCClientDelegate clCClient_GetOnConnectedEvent(clCClient client) NOEXCEPT;
244CL_DLL clCClientDelegateDisconnectReason
252CL_DLL clCClientDelegateError clCClient_GetOnErrorEvent(clCClient client) NOEXCEPT;
253
254#ifdef __cplusplus
255}
256#endif
CL_DLL void clCClient_Connect(clCClient client, const char *address) NOEXCEPT
CL_DLL clCString clCClient_GetClientName(clCClient client) NOEXCEPT
CL_DLL uint64_t clCClient_GetTime() NOEXCEPT
CL_DLL bool clCClient_IsConnected(clCClient client) NOEXCEPT
CL_DLL uint64_t clCClient_GetTimeMicro() NOEXCEPT
CL_DLL clCString clCClient_GetVersionString() NOEXCEPT
CL_DLL void clCClientDelegate_Set(clCClientDelegate delegate, clCClientHandler callback) NOEXCEPT
CL_DLL void clCClient_RefreshToken(clCClient client, const char *accessToken) NOEXCEPT
CL_DLL clCString clCClient_GetCapsuleVersion(clCClient client) NOEXCEPT
clCDisconnectReason
Reason for client's disconnect.
Definition CClient.h:16
@ clC_DR_FatalError
Definition CClient.h:19
@ clC_DR_UserRequested
Definition CClient.h:17
@ clC_DR_Destruction
Definition CClient.h:18
CL_DLL clCClientDelegateError clCClient_GetOnErrorEvent(clCClient client) NOEXCEPT
CL_DLL bool clCClient_IsConnecting(clCClient client) NOEXCEPT
CL_DLL clCClientDelegate clCClient_GetOnConnectedEvent(clCClient client) NOEXCEPT
CL_DLL void clCClient_Update(clCClient client) NOEXCEPT
CL_DLL void clCClient_Destroy(clCClient client) NOEXCEPT
CL_DLL clCClient clCClient_CreateWithName(const char *clientName) NOEXCEPT
CL_DLL void clCClientDelegateDisconnectReason_Set(clCClientDelegateDisconnectReason delegate, clCClientHandlerDisconnectReason callback) NOEXCEPT
CL_DLL void clCClient_Disconnect(clCClient client) NOEXCEPT
void(* clCClientHandler)(clCClient)
Definition CClient.h:44
CL_DLL void clCClient_ConnectWithAccessToken(clCClient client, const char *address, const char *accessToken) NOEXCEPT
CL_DLL clCClient clCClient_Create() NOEXCEPT
CL_DLL void clCClient_SetAppVersion(clCClient client, const char *version)
Client application version setter. Must be set before client connection.
void(* clCClientHandlerError)(clCClient, clCError)
Definition CClient.h:60
CL_DLL void clCClientDelegateError_Set(clCClientDelegateError delegate, clCClientHandlerError callback) NOEXCEPT
CL_DLL clCClientDelegate clCClient_GetOnRefreshAccessTokenRequestedEvent(clCClient client) NOEXCEPT
CL_DLL clCClientDelegateDisconnectReason clCClient_GetOnDisconnectedEvent(clCClient client) NOEXCEPT
CL_DLL clCClient clCClient_CreateWithDataDirectoryAndName(const char *dataDir, const char *clientName) NOEXCEPT
void(* clCClientHandlerDisconnectReason)(clCClient, clCDisconnectReason)
Definition CClient.h:51
CL_DLL clCClient clCClient_CreateWithDataDirectory(const char *dataDir) NOEXCEPT
CL_DLL void clCClient_ConnectWithAccessTokenAndPlatformAddress(clCClient client, const char *address, const char *accessToken, const char *platformAddress) NOEXCEPT
CL_DLL clCString clCClient_GetDataDirectory(clCClient client) NOEXCEPT
clCConnectionState
Connection state to Capsule.
Definition CClient.h:25
@ clC_CS_Connected
Definition CClient.h:28
@ clC_CS_Connecting
Definition CClient.h:27
@ clC_CS_Disconnecting
Definition CClient.h:29
@ clC_CS_Disconnected
Definition CClient.h:26
#define CLC_STRUCT(Name)
Definition CDefinesPrivate.h:24
#define NOEXCEPT
Definition CDefinesPrivate.h:52
#define CL_DLL
Definition CDefinesPrivate.h:21
#define CLC_CLASS_WN(Wrapped, Name)
Definition CDefinesPrivate.h:54
clCError
Capsule error.
Definition CError.h:8