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

Go to the source code of this file.

Classes

struct  clCNFBUserState
 User state, determined by NFB classifier. More...
 

Typedefs

typedef enum clCNFBCallResult clCNFBCallResult
 NFB call result.
 
typedef enum ccCNFBState ccCNFBState
 NFB state.
 
typedef struct clCNFBUserState clCNFBUserState
 User state, determined by NFB classifier.
 
typedef void(* clCNFBHandlerNFBUserState) (clCNFB, const clCNFBUserState *)
 
typedef void(* clCNFBHandler) (clCNFB)
 
typedef void(* clCNFBHandlerBool) (clCNFB, bool)
 
typedef void(* clCNFBHandlerString) (clCNFB, const char *)
 

Enumerations

enum  clCNFBCallResult {
  clC_NFB_Success , clC_NFB_NotInitialized , clC_NFB_ModelIsNotTrained , clC_NFB_ModelIsTrained ,
  clC_NFB_FailedToSendData
}
 NFB call result. More...
 
enum  ccCNFBState { cc_NFB_Undefined , cc_NFB_Relaxation , cc_NFB_Concentration }
 NFB state. More...
 

Functions

 CLC_CLASS_WN (ClassificationNFBPrivate, clCNFB)
 Interface to NFB classification process.
 
 CLC_STRUCT (clCNFBDelegateNFBUserState)
 
CL_DLL void clCNFBDelegateNFBUserState_Set (clCNFBDelegateNFBUserState delegate, clCNFBHandlerNFBUserState callback) NOEXCEPT
 
CL_DLL clCNFB clCNFB_Create (clCSession session) NOEXCEPT
 
CL_DLL void clCNFB_Destroy (clCNFB nfb) NOEXCEPT
 
 CLC_STRUCT (clCNFBDelegate)
 
CL_DLL void clCNFBDelegate_Set (clCNFBDelegate delegate, clCNFBHandler callback) NOEXCEPT
 
 CLC_STRUCT (clCNFBDelegateBool)
 
CL_DLL void clCNFBDelegateBool_Set (clCNFBDelegateBool delegate, clCNFBHandlerBool callback) NOEXCEPT
 
 CLC_STRUCT (clCNFBDelegateString)
 
CL_DLL void clCNFBDelegateString_Set (clCNFBDelegateString delegate, clCNFBHandlerString callback) NOEXCEPT
 
CL_DLL clCNFBDelegate clCNFB_GetOnInitializedEvent (clCNFB nfb) NOEXCEPT
 
CL_DLL clCNFBDelegate clCNFB_GetOnModelTrainedEvent (clCNFB nfb) NOEXCEPT
 
CL_DLL clCNFBDelegateBool clCNFB_GetOnResetEvent (clCNFB nfb) NOEXCEPT
 
CL_DLL clCNFBDelegateNFBUserState clCNFB_GetOnUserStateChangedEvent (clCNFB nfb) NOEXCEPT
 
CL_DLL clCNFBDelegateString clCNFB_GetOnErrorEvent (clCNFB nfb) NOEXCEPT
 
CL_DLL clCNFBCallResult clCNFB_Initialize (clCNFB nfb) NOEXCEPT
 Request initialization.
 
CL_DLL clCNFBCallResult clCNFB_InitializeWithPeriod (clCNFB nfb, float userStatePeriod) NOEXCEPT
 Request initialization.
 
CL_DLL clCNFBCallResult clCNFB_AddFeedbackFunction (clCNFB nfb, const char *feedbackFunction) NOEXCEPT
 Add calculation of neuro feedback with configured output.
 
CL_DLL clCNFBCallResult clCNFB_Train (clCNFB nfb) NOEXCEPT
 Request training, event is called when training is finished.
 
CL_DLL clCNFBCallResult clCNFB_Reset (clCNFB nfb) NOEXCEPT
 Request reset, event is called when reset finished.
 
CL_DLL bool clCNFB_IsInitialized (clCNFB nfb) NOEXCEPT
 Check whether interface was initialized.
 
CL_DLL bool clCNFB_IsModelTrained (clCNFB nfb) NOEXCEPT
 Check whether model was trained.
 
CL_DLL clCNFB clCNFB_CreateCalibrated (clCNFBCalibrator calibrator, clCError *error) NOEXCEPT
 
CL_DLL clCNFBCallResult clCNFB_MarkState (clCNFB nfb, ccCNFBState userState) NOEXCEPT
 Mark a change in user state.
 

Typedef Documentation

◆ ccCNFBState

typedef enum ccCNFBState ccCNFBState

NFB state.

◆ clCNFBCallResult

NFB call result.

◆ clCNFBHandler

typedef void(* clCNFBHandler) (clCNFB)

◆ clCNFBHandlerBool

typedef void(* clCNFBHandlerBool) (clCNFB, bool)

◆ clCNFBHandlerNFBUserState

typedef void(* clCNFBHandlerNFBUserState) (clCNFB, const clCNFBUserState *)

◆ clCNFBHandlerString

typedef void(* clCNFBHandlerString) (clCNFB, const char *)

◆ clCNFBUserState

User state, determined by NFB classifier.

Enumeration Type Documentation

◆ ccCNFBState

NFB state.

Enumerator
cc_NFB_Undefined 
cc_NFB_Relaxation 
cc_NFB_Concentration 

◆ clCNFBCallResult

NFB call result.

Enumerator
clC_NFB_Success 

Call has finished successfully.

clC_NFB_NotInitialized 

NFB interface has not been initialized.

clC_NFB_ModelIsNotTrained 

Model was not trained, must be trained first.

clC_NFB_ModelIsTrained 

Model is already trained, does not need any training.

clC_NFB_FailedToSendData 

Failed to send data, session might not be active.

Function Documentation

◆ CLC_CLASS_WN()

CLC_CLASS_WN ( ClassificationNFBPrivate  ,
clCNFB   
)

Interface to NFB classification process.

Before calling any of the functions make sure that:

  • A valid clCSession created with clCClient_CreateSession is passed to the constructor.
  • clCSession is active.

Model might need to be trained before it is able to calculate user state. clCNFB_IsModelTrained will return false if it needs to be trained.

In order to train model you should:

  • Mark each state at least once, with duration no less than a time window

◆ CLC_STRUCT() [1/4]

CLC_STRUCT ( clCNFBDelegate  )

◆ CLC_STRUCT() [2/4]

CLC_STRUCT ( clCNFBDelegateBool  )

◆ CLC_STRUCT() [3/4]

CLC_STRUCT ( clCNFBDelegateNFBUserState  )

◆ CLC_STRUCT() [4/4]

CLC_STRUCT ( clCNFBDelegateString  )

◆ clCNFB_AddFeedbackFunction()

CL_DLL clCNFBCallResult clCNFB_AddFeedbackFunction ( clCNFB  nfb,
const char *  feedbackFunction 
)

Add calculation of neuro feedback with configured output.

Parameters
nfbNFB handle
feedbackFunctionfunction of bands, e.g. "(alpha + beta) / theta"
Returns
call result.

◆ clCNFB_Create()

CL_DLL clCNFB clCNFB_Create ( clCSession  session)

Create a NFB classifier.

Parameters
sessionsession handle. Valid session must be passed (does not need to be active)
Returns
NFB handle.

◆ clCNFB_CreateCalibrated()

CL_DLL clCNFB clCNFB_CreateCalibrated ( clCNFBCalibrator  calibrator,
clCError error 
)

Create a NFB classifier after individual NFB has calibrated.

Parameters
calibratorNFB calibrator handle. A calibrated calibrator must be passed.
Returns
NFB handle.

◆ clCNFB_Destroy()

CL_DLL void clCNFB_Destroy ( clCNFB  nfb)

Destroy NFB classifier. Release the handle.

Parameters
nfbNFB handle

◆ clCNFB_GetOnErrorEvent()

CL_DLL clCNFBDelegateString clCNFB_GetOnErrorEvent ( clCNFB  nfb)

◆ clCNFB_GetOnInitializedEvent()

CL_DLL clCNFBDelegate clCNFB_GetOnInitializedEvent ( clCNFB  nfb)

◆ clCNFB_GetOnModelTrainedEvent()

CL_DLL clCNFBDelegate clCNFB_GetOnModelTrainedEvent ( clCNFB  nfb)

◆ clCNFB_GetOnResetEvent()

CL_DLL clCNFBDelegateBool clCNFB_GetOnResetEvent ( clCNFB  nfb)

◆ clCNFB_GetOnUserStateChangedEvent()

CL_DLL clCNFBDelegateNFBUserState clCNFB_GetOnUserStateChangedEvent ( clCNFB  nfb)

◆ clCNFB_Initialize()

CL_DLL clCNFBCallResult clCNFB_Initialize ( clCNFB  nfb)

Request initialization.

OnInitialized event is called on completion.

Parameters
nfbNFB handle
Returns
call result.

◆ clCNFB_InitializeWithPeriod()

CL_DLL clCNFBCallResult clCNFB_InitializeWithPeriod ( clCNFB  nfb,
float  userStatePeriod 
)

Request initialization.

OnInitialized event is called on completion.

Parameters
nfbNFB handle
userStateCheckPeriodperiod of user state updates
Returns
call result.

◆ clCNFB_IsInitialized()

CL_DLL bool clCNFB_IsInitialized ( clCNFB  nfb)

Check whether interface was initialized.

Parameters
nfbNFB handle
Returns
whether interface is initialized.

◆ clCNFB_IsModelTrained()

CL_DLL bool clCNFB_IsModelTrained ( clCNFB  nfb)

Check whether model was trained.

Parameters
nfbNFB handle
Returns
whether model is trained.

◆ clCNFB_MarkState()

CL_DLL clCNFBCallResult clCNFB_MarkState ( clCNFB  nfb,
ccCNFBState  userState 
)

Mark a change in user state.

Used in BCI system to train classifier to discriminate states. Should always end with Undefined state before Train() to mark an ending.

Parameters
nfbNFB handle
userStatestate to be marked
Returns
call result.

◆ clCNFB_Reset()

CL_DLL clCNFBCallResult clCNFB_Reset ( clCNFB  nfb)

Request reset, event is called when reset finished.

OnReset event is called on completion

Parameters
nfbNFB handle
Returns
call result.

◆ clCNFB_Train()

CL_DLL clCNFBCallResult clCNFB_Train ( clCNFB  nfb)

Request training, event is called when training is finished.

OnModelTrained event is called on completion

Parameters
nfbNFB handle
Returns
call result.

◆ clCNFBDelegate_Set()

CL_DLL void clCNFBDelegate_Set ( clCNFBDelegate  delegate,
clCNFBHandler  callback 
)

◆ clCNFBDelegateBool_Set()

CL_DLL void clCNFBDelegateBool_Set ( clCNFBDelegateBool  delegate,
clCNFBHandlerBool  callback 
)

◆ clCNFBDelegateNFBUserState_Set()

CL_DLL void clCNFBDelegateNFBUserState_Set ( clCNFBDelegateNFBUserState  delegate,
clCNFBHandlerNFBUserState  callback 
)

◆ clCNFBDelegateString_Set()

CL_DLL void clCNFBDelegateString_Set ( clCNFBDelegateString  delegate,
clCNFBHandlerString  callback 
)