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
5#include "Capsule/CDefinesPrivate.h"
6#include "Capsule/CError.h"
7#include "Capsule/CString.h"
8
9#ifdef __cplusplus
10 extern "C" {
11#endif
12
16 typedef enum clCDisconnectReason {
17 clC_DR_UserRequested,
18 clC_DR_Destruction,
19 clC_DR_FatalError
20} clCDisconnectReason;
21
25 typedef enum clCConnectionState {
26 clC_CS_Disconnected,
27 clC_CS_Connecting,
28 clC_CS_Connected,
29 clC_CS_Disconnecting
30} clCConnectionState;
31
37 CLC_CLASS_WN(ClientPrivate, clCClient);
38
43 CLC_STRUCT(clCClientDelegate);
44 typedef void (*clCClientHandler)(clCClient);
45 CL_DLL void clCClientDelegate_Set(clCClientDelegate delegate,
46 clCClientHandler callback) NOEXCEPT;
50 CLC_STRUCT(clCClientDelegateDisconnectReason);
51 typedef void (*clCClientHandlerDisconnectReason)(clCClient,
52 clCDisconnectReason);
53 CL_DLL void clCClientDelegateDisconnectReason_Set(
54 clCClientDelegateDisconnectReason delegate,
55 clCClientHandlerDisconnectReason callback) NOEXCEPT;
59 CLC_STRUCT(clCClientDelegateError);
60 typedef void (*clCClientHandlerError)(clCClient, clCError);
61 CL_DLL void clCClientDelegateError_Set(clCClientDelegateError delegate,
62 clCClientHandlerError callback) NOEXCEPT;
63
69 CL_DLL clCString clCClient_GetVersionString() NOEXCEPT;
70
76 CL_DLL void clCClient_SetAppVersion(clCClient client, const char* version);
77
83 CL_DLL clCClient clCClient_Create() NOEXCEPT;
90 CL_DLL clCClient clCClient_CreateWithName(const char* clientName) NOEXCEPT;
97 CL_DLL clCClient clCClient_CreateWithDataDirectory(const char* dataDir) NOEXCEPT;
105 CL_DLL clCClient clCClient_CreateWithDataDirectoryAndName(const char* dataDir,
106 const char* clientName) NOEXCEPT;
112 CL_DLL void clCClient_Destroy(clCClient client) NOEXCEPT;
123 CL_DLL void clCClient_Connect(clCClient client, const char* address) NOEXCEPT;
135 CL_DLL void clCClient_ConnectWithAccessToken(clCClient client,
136 const char* address,
137 const char* accessToken) NOEXCEPT;
150 CL_DLL void clCClient_ConnectWithAccessTokenAndPlatformAddress(clCClient client,
151 const char* address,
152 const char* accessToken,
153 const char* platformAddress) NOEXCEPT;
154
161 CL_DLL clCClientDelegate
162 clCClient_GetOnRefreshAccessTokenRequestedEvent(clCClient client) NOEXCEPT;
168 CL_DLL void clCClient_RefreshToken(clCClient client, const char* accessToken) NOEXCEPT;
173 CL_DLL uint64_t clCClient_GetTime() NOEXCEPT;
178 CL_DLL uint64_t clCClient_GetTimeMicro() NOEXCEPT;
184 CL_DLL void clCClient_Disconnect(clCClient client) NOEXCEPT;
190 CL_DLL bool clCClient_IsConnected(clCClient client) NOEXCEPT;
196 CL_DLL bool clCClient_IsConnecting(clCClient client) NOEXCEPT;
197
205 CL_DLL clCString clCClient_GetCapsuleVersion(clCClient client) NOEXCEPT;
213 CL_DLL clCString clCClient_GetClientName(clCClient client) NOEXCEPT;
221 CL_DLL clCString clCClient_GetDataDirectory(clCClient client) NOEXCEPT;
229 CL_DLL void clCClient_Update(clCClient client) NOEXCEPT;
230
237 CL_DLL clCClientDelegate clCClient_GetOnConnectedEvent(clCClient client) NOEXCEPT;
244 CL_DLL clCClientDelegateDisconnectReason
245 clCClient_GetOnDisconnectedEvent(clCClient client) NOEXCEPT;
252 CL_DLL clCClientDelegateError clCClient_GetOnErrorEvent(clCClient client) NOEXCEPT;
253
254#ifdef __cplusplus
255}
256#endif
clCClient_Connect
CL_DLL void clCClient_Connect(clCClient client, const char *address) NOEXCEPT
clCClient_GetClientName
CL_DLL clCString clCClient_GetClientName(clCClient client) NOEXCEPT
clCClient_GetTime
CL_DLL uint64_t clCClient_GetTime() NOEXCEPT
clCClient_IsConnected
CL_DLL bool clCClient_IsConnected(clCClient client) NOEXCEPT
clCClient_GetTimeMicro
CL_DLL uint64_t clCClient_GetTimeMicro() NOEXCEPT
clCClient_GetVersionString
CL_DLL clCString clCClient_GetVersionString() NOEXCEPT
clCClientDelegate_Set
CL_DLL void clCClientDelegate_Set(clCClientDelegate delegate, clCClientHandler callback) NOEXCEPT
clCClient_RefreshToken
CL_DLL void clCClient_RefreshToken(clCClient client, const char *accessToken) NOEXCEPT
clCClient_GetCapsuleVersion
CL_DLL clCString clCClient_GetCapsuleVersion(clCClient client) NOEXCEPT
clCDisconnectReason
clCDisconnectReason
Reason for client's disconnect.
Definition CClient.h:16
clC_DR_FatalError
@ clC_DR_FatalError
Definition CClient.h:19
clC_DR_UserRequested
@ clC_DR_UserRequested
Definition CClient.h:17
clC_DR_Destruction
@ clC_DR_Destruction
Definition CClient.h:18
clCClient_GetOnErrorEvent
CL_DLL clCClientDelegateError clCClient_GetOnErrorEvent(clCClient client) NOEXCEPT
clCClient_IsConnecting
CL_DLL bool clCClient_IsConnecting(clCClient client) NOEXCEPT
clCClient_GetOnConnectedEvent
CL_DLL clCClientDelegate clCClient_GetOnConnectedEvent(clCClient client) NOEXCEPT
clCClient_Update
CL_DLL void clCClient_Update(clCClient client) NOEXCEPT
clCClient_Destroy
CL_DLL void clCClient_Destroy(clCClient client) NOEXCEPT
clCClient_CreateWithName
CL_DLL clCClient clCClient_CreateWithName(const char *clientName) NOEXCEPT
clCClientDelegateDisconnectReason_Set
CL_DLL void clCClientDelegateDisconnectReason_Set(clCClientDelegateDisconnectReason delegate, clCClientHandlerDisconnectReason callback) NOEXCEPT
clCClient_Disconnect
CL_DLL void clCClient_Disconnect(clCClient client) NOEXCEPT
clCClientHandler
void(* clCClientHandler)(clCClient)
Definition CClient.h:44
clCClient_ConnectWithAccessToken
CL_DLL void clCClient_ConnectWithAccessToken(clCClient client, const char *address, const char *accessToken) NOEXCEPT
clCClient_Create
CL_DLL clCClient clCClient_Create() NOEXCEPT
clCClient_SetAppVersion
CL_DLL void clCClient_SetAppVersion(clCClient client, const char *version)
Client application version setter. Must be set before client connection.
clCClientHandlerError
void(* clCClientHandlerError)(clCClient, clCError)
Definition CClient.h:60
clCClientDelegateError_Set
CL_DLL void clCClientDelegateError_Set(clCClientDelegateError delegate, clCClientHandlerError callback) NOEXCEPT
clCClient_GetOnRefreshAccessTokenRequestedEvent
CL_DLL clCClientDelegate clCClient_GetOnRefreshAccessTokenRequestedEvent(clCClient client) NOEXCEPT
clCClient_GetOnDisconnectedEvent
CL_DLL clCClientDelegateDisconnectReason clCClient_GetOnDisconnectedEvent(clCClient client) NOEXCEPT
clCClient_CreateWithDataDirectoryAndName
CL_DLL clCClient clCClient_CreateWithDataDirectoryAndName(const char *dataDir, const char *clientName) NOEXCEPT
clCClientHandlerDisconnectReason
void(* clCClientHandlerDisconnectReason)(clCClient, clCDisconnectReason)
Definition CClient.h:51
clCClient_CreateWithDataDirectory
CL_DLL clCClient clCClient_CreateWithDataDirectory(const char *dataDir) NOEXCEPT
clCClient_ConnectWithAccessTokenAndPlatformAddress
CL_DLL void clCClient_ConnectWithAccessTokenAndPlatformAddress(clCClient client, const char *address, const char *accessToken, const char *platformAddress) NOEXCEPT
clCClient_GetDataDirectory
CL_DLL clCString clCClient_GetDataDirectory(clCClient client) NOEXCEPT
clCConnectionState
clCConnectionState
Connection state to Capsule.
Definition CClient.h:25
clC_CS_Connected
@ clC_CS_Connected
Definition CClient.h:28
clC_CS_Connecting
@ clC_CS_Connecting
Definition CClient.h:27
clC_CS_Disconnecting
@ clC_CS_Disconnecting
Definition CClient.h:29
clC_CS_Disconnected
@ clC_CS_Disconnected
Definition CClient.h:26
CDefinesPrivate.h
CLC_STRUCT
#define CLC_STRUCT(Name)
Definition CDefinesPrivate.h:24
NOEXCEPT
#define NOEXCEPT
Definition CDefinesPrivate.h:52
CL_DLL
#define CL_DLL
Definition CDefinesPrivate.h:21
CLC_CLASS_WN
#define CLC_CLASS_WN(Wrapped, Name)
Definition CDefinesPrivate.h:54
CError.h
clCError
clCError
Capsule error.
Definition CError.h:8
CString.h