CortexClient class
Last updated
Last updated
Use CortexClient to send and receive JSON messages to the Cortex library. You must the Cortex library before creating an instance of CortexClient.
Set a handler to receive the JSON messages from the Cortex library.
The handler is defined like this:
The argument responseMessage of the method processResponse is a JSON message sent by the Cortex library.
This function is to help you log in into Cortex, using for authentication.
When you call this function, your application displays a web form from the EMOTIV web site. This form requires the user to enter their EmotivID and password.
The first argument is the activity that will display the web form. It must be an object of the type . The second argument is the client id of your Cortex application. You can find it on the . The argument requestCode can take any value.
One way to get the result of the activity is to override its function onActivityResult like this:
Call this method to send a JSON message to the Cortex library. Cortex will respond asynchronously, using the handler you provided in the method registerResponseHandler.
This method closes the connection to the Cortex library and frees all the resources allocated for this object. Calling this method is optional. After you called it, you must not call any other method on this object.
Your application must get the result from the activity and then call the function getAuthenticationCode. This function returns an authentication code that you can then use to call the JSON API method .
This function returns an authentication code that you can use to call the JSON API method . You must call this function after you called the function authenticate and get the result of the activity.