Example

Loading...
Searching...
No Matches
CNFB.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/CNFBCalibrator.h"
8#include "Capsule/CSession.h"
9
10#ifdef __cplusplus
11 extern "C" {
12#endif
13
17 typedef enum clCNFBCallResult {
18 clC_NFB_Success,
19 clC_NFB_NotInitialized,
20 clC_NFB_ModelIsNotTrained,
22 clC_NFB_ModelIsTrained,
24 clC_NFB_FailedToSendData
26} clCNFBCallResult;
27
31 typedef enum ccCNFBState {
32 cc_NFB_Undefined,
33 cc_NFB_Relaxation,
34 cc_NFB_Concentration
35} ccCNFBState;
36
40 typedef struct clCNFBUserState {
44 const float* feedbackData;
45 uint64_t feedbackSize;
46 int64_t timestamp;
47} clCNFBUserState;
48
63 CLC_CLASS_WN(ClassificationNFBPrivate, clCNFB);
64 CLC_STRUCT(clCNFBDelegateNFBUserState);
65 typedef void (*clCNFBHandlerNFBUserState)(clCNFB, const clCNFBUserState*);
66 CL_DLL void clCNFBDelegateNFBUserState_Set(clCNFBDelegateNFBUserState delegate,
67 clCNFBHandlerNFBUserState callback) NOEXCEPT;
74 CL_DLL clCNFB clCNFB_Create(clCSession session) NOEXCEPT;
80 CL_DLL void clCNFB_Destroy(clCNFB nfb) NOEXCEPT;
81
82 CLC_STRUCT(clCNFBDelegate);
83 typedef void (*clCNFBHandler)(clCNFB);
84 CL_DLL void clCNFBDelegate_Set(clCNFBDelegate delegate, clCNFBHandler callback) NOEXCEPT;
85
86 CLC_STRUCT(clCNFBDelegateBool);
87 typedef void (*clCNFBHandlerBool)(clCNFB, bool);
88 CL_DLL void clCNFBDelegateBool_Set(clCNFBDelegateBool delegate,
89 clCNFBHandlerBool callback) NOEXCEPT;
90
91 CLC_STRUCT(clCNFBDelegateString);
92 typedef void (*clCNFBHandlerString)(clCNFB, const char*);
93 CL_DLL void clCNFBDelegateString_Set(clCNFBDelegateString delegate,
94 clCNFBHandlerString callback) NOEXCEPT;
95
96 CL_DLL clCNFBDelegate clCNFB_GetOnInitializedEvent(clCNFB nfb) NOEXCEPT;
97 CL_DLL clCNFBDelegate clCNFB_GetOnModelTrainedEvent(clCNFB nfb) NOEXCEPT;
98 CL_DLL clCNFBDelegateBool clCNFB_GetOnResetEvent(clCNFB nfb) NOEXCEPT;
99 CL_DLL clCNFBDelegateNFBUserState clCNFB_GetOnUserStateChangedEvent(clCNFB nfb) NOEXCEPT;
100 CL_DLL clCNFBDelegateString clCNFB_GetOnErrorEvent(clCNFB nfb) NOEXCEPT;
101
111 CL_DLL clCNFBCallResult clCNFB_Initialize(clCNFB nfb) NOEXCEPT;
122 CL_DLL clCNFBCallResult clCNFB_InitializeWithPeriod(clCNFB nfb, float userStatePeriod) NOEXCEPT;
131 CL_DLL clCNFBCallResult clCNFB_AddFeedbackFunction(clCNFB nfb, const char* feedbackFunction) NOEXCEPT;
132
142 CL_DLL clCNFBCallResult clCNFB_Train(clCNFB nfb) NOEXCEPT;
152 CL_DLL clCNFBCallResult clCNFB_Reset(clCNFB nfb) NOEXCEPT;
153
161 CL_DLL bool clCNFB_IsInitialized(clCNFB nfb) NOEXCEPT;
169 CL_DLL bool clCNFB_IsModelTrained(clCNFB nfb) NOEXCEPT;
170
177 CL_DLL clCNFB clCNFB_CreateCalibrated(clCNFBCalibrator calibrator, clCError* error) NOEXCEPT;
178
190// DEPRECATED
191 CL_DLL clCNFBCallResult clCNFB_MarkState(clCNFB nfb, ccCNFBState userState) NOEXCEPT;
192
193#ifdef __cplusplus
194}
195#endif
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
clCNFB_Initialize
CL_DLL clCNFBCallResult clCNFB_Initialize(clCNFB nfb) NOEXCEPT
Request initialization.
clCNFB_CreateCalibrated
CL_DLL clCNFB clCNFB_CreateCalibrated(clCNFBCalibrator calibrator, clCError *error) NOEXCEPT
clCNFBCallResult
clCNFBCallResult
NFB call result.
Definition CNFB.h:17
clC_NFB_FailedToSendData
@ clC_NFB_FailedToSendData
Definition CNFB.h:24
clC_NFB_NotInitialized
@ clC_NFB_NotInitialized
Definition CNFB.h:19
clC_NFB_ModelIsTrained
@ clC_NFB_ModelIsTrained
Definition CNFB.h:22
clC_NFB_Success
@ clC_NFB_Success
Definition CNFB.h:18
clC_NFB_ModelIsNotTrained
@ clC_NFB_ModelIsNotTrained
Definition CNFB.h:20
clCNFB_AddFeedbackFunction
CL_DLL clCNFBCallResult clCNFB_AddFeedbackFunction(clCNFB nfb, const char *feedbackFunction) NOEXCEPT
Add calculation of neuro feedback with configured output.
clCNFBHandlerBool
void(* clCNFBHandlerBool)(clCNFB, bool)
Definition CNFB.h:87
clCNFB_IsModelTrained
CL_DLL bool clCNFB_IsModelTrained(clCNFB nfb) NOEXCEPT
Check whether model was trained.
ccCNFBState
ccCNFBState
NFB state.
Definition CNFB.h:31
cc_NFB_Undefined
@ cc_NFB_Undefined
Definition CNFB.h:32
cc_NFB_Relaxation
@ cc_NFB_Relaxation
Definition CNFB.h:33
cc_NFB_Concentration
@ cc_NFB_Concentration
Definition CNFB.h:34
clCNFB_Train
CL_DLL clCNFBCallResult clCNFB_Train(clCNFB nfb) NOEXCEPT
Request training, event is called when training is finished.
clCNFBDelegateBool_Set
CL_DLL void clCNFBDelegateBool_Set(clCNFBDelegateBool delegate, clCNFBHandlerBool callback) NOEXCEPT
clCNFBHandlerString
void(* clCNFBHandlerString)(clCNFB, const char *)
Definition CNFB.h:92
clCNFB_MarkState
CL_DLL clCNFBCallResult clCNFB_MarkState(clCNFB nfb, ccCNFBState userState) NOEXCEPT
Mark a change in user state.
clCNFBHandlerNFBUserState
void(* clCNFBHandlerNFBUserState)(clCNFB, const clCNFBUserState *)
Definition CNFB.h:65
clCNFB_Destroy
CL_DLL void clCNFB_Destroy(clCNFB nfb) NOEXCEPT
clCNFB_GetOnUserStateChangedEvent
CL_DLL clCNFBDelegateNFBUserState clCNFB_GetOnUserStateChangedEvent(clCNFB nfb) NOEXCEPT
clCNFB_GetOnInitializedEvent
CL_DLL clCNFBDelegate clCNFB_GetOnInitializedEvent(clCNFB nfb) NOEXCEPT
clCNFB_Reset
CL_DLL clCNFBCallResult clCNFB_Reset(clCNFB nfb) NOEXCEPT
Request reset, event is called when reset finished.
clCNFB_GetOnErrorEvent
CL_DLL clCNFBDelegateString clCNFB_GetOnErrorEvent(clCNFB nfb) NOEXCEPT
clCNFB_InitializeWithPeriod
CL_DLL clCNFBCallResult clCNFB_InitializeWithPeriod(clCNFB nfb, float userStatePeriod) NOEXCEPT
Request initialization.
clCNFBDelegateString_Set
CL_DLL void clCNFBDelegateString_Set(clCNFBDelegateString delegate, clCNFBHandlerString callback) NOEXCEPT
clCNFBDelegate_Set
CL_DLL void clCNFBDelegate_Set(clCNFBDelegate delegate, clCNFBHandler callback) NOEXCEPT
clCNFBHandler
void(* clCNFBHandler)(clCNFB)
Definition CNFB.h:83
clCNFBDelegateNFBUserState_Set
CL_DLL void clCNFBDelegateNFBUserState_Set(clCNFBDelegateNFBUserState delegate, clCNFBHandlerNFBUserState callback) NOEXCEPT
clCNFB_IsInitialized
CL_DLL bool clCNFB_IsInitialized(clCNFB nfb) NOEXCEPT
Check whether interface was initialized.
clCNFB_GetOnResetEvent
CL_DLL clCNFBDelegateBool clCNFB_GetOnResetEvent(clCNFB nfb) NOEXCEPT
clCNFB_Create
CL_DLL clCNFB clCNFB_Create(clCSession session) NOEXCEPT
clCNFB_GetOnModelTrainedEvent
CL_DLL clCNFBDelegate clCNFB_GetOnModelTrainedEvent(clCNFB nfb) NOEXCEPT
CNFBCalibrator.h
CSession.h
clCNFBUserState
User state, determined by NFB classifier.
Definition CNFB.h:40
clCNFBUserState::feedbackData
const float * feedbackData
User's neural feedback.
Definition CNFB.h:44
clCNFBUserState::feedbackSize
uint64_t feedbackSize
Definition CNFB.h:45
clCNFBUserState::timestamp
int64_t timestamp
Definition CNFB.h:46