Emotiv / cortex-example

Example with Cortex V2/V3 API
https://emotiv.com
MIT License
202 stars 115 forks source link

Cannot create a session! #29

Closed GeorgeSbyrakis closed 5 years ago

GeorgeSbyrakis commented 5 years ago

Hi everybody, I need to use the Cortex V2.0 with the examples presented on C# but it didn't work and I always get this error "MessageErrorRecieved :code -32019 message Session limit on this device has been reached." I have a free license and it does this error on all examples. I only use an Epoc+ headset.

If you have any clue about this please tell me, Thanks in advance.

I am pasting the console output showing the JSON messages exchange:

BAND POWER LOGGER Please wear Headset with good signal!!! Send getUserLogin { "jsonrpc": "2.0", "id": 1, "method": "getUserLogin" } Press Esc to exit Received: {"id":1,"jsonrpc":"2.0","result":[{"currentOSUId":"1001","currentOSUsername":"sbyyu","loggedInOSUId":"1001","loggedInOSUsername":"sbyyu","username":"geosbyr96"}]} handleResponse: getUserLogin Send hasAccessRight { "jsonrpc": "2.0", "id": 2, "method": "hasAccessRight", "params": { "clientId": "KrhZPx9ky2Xa9NyffNUv1yIYtlfw32vVTmcDPh29", "clientSecret": "nBa4u3tkXGfzB6xsuzbJDxgxTEGPGBPRnxp07ZvOKvp3L1PfkJavkI4cVgXrOcP92dDhIickBBqFF6KAOSSXUWq0axIa9iG0g9WHEbH338fTL4lDrSKwrRXCIZUMOiSM" } } Received: {"id":2,"jsonrpc":"2.0","result":{"accessGranted":true,"message":"The access right to the application has already been granted."}} handleResponse: hasAccessRight Send authorize { "jsonrpc": "2.0", "id": 3, "method": "authorize", "params": { "clientId": "KrhZPx9ky2Xa9NyffNUv1yIYtlfw32vVTmcDPh29", "clientSecret": "nBa4u3tkXGfzB6xsuzbJDxgxTEGPGBPRnxp07ZvOKvp3L1PfkJavkI4cVgXrOcP92dDhIickBBqFF6KAOSSXUWq0axIa9iG0g9WHEbH338fTL4lDrSKwrRXCIZUMOiSM", "debit": 0 } } Received: {"id":3,"jsonrpc":"2.0","result":{"cortexToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6ImNvbS5nZW9zYnlyOTYuYnJhaW5jb21wdXRlcmludGVyYWN0aW9uIiwiYXBwVmVyc2lvbiI6IjEuMCIsImV4cCI6MTU2NTA4NTQ5MywibGljZW5zZUlkIjoiZGRhMjRhYTItNDZhMi00Y2QwLTk5MDctZDdmNGI3MzFlMGE0IiwibmJmIjoxNTY0ODI2MjkzLCJ1c2VySWQiOiI4NDYwZjVjOS02MDVjLTQwZGItOGY1Yi1mYjdhM2ExYWVlYzEiLCJ1c2VybmFtZSI6Imdlb3NieXI5NiIsInZlcnNpb24iOiIyLjAifQ==.JLmQXLLhXya38RcwavJG3n0fRkXLUgeCI4hH8rDwW/0="}} handleResponse: authorize Authorize successfully. FindHeadset Send queryHeadsets { "jsonrpc": "2.0", "id": 4, "method": "queryHeadsets" } Received: {"id":4,"jsonrpc":"2.0","result":[{"connectedBy":"dongle","customName":"","dongle":"6ff","firmware":"633","id":"EPOCPLUS-4A2C04F1","motionSensors":["Q0","Q1","Q2","Q3","ACCX","ACCY","ACCZ","MAGX","MAGY","MAGZ"],"sensors":["AF3","F7","F3","FC5","T7","P7","O1","O2","P8","T8","FC6","F4","F8","AF4"],"settings":{"eegRate":128,"eegRes":16,"memsRate":32,"memsRes":16,"mode":"EPOCPLUS"},"status":"connected"}]} handleResponse: queryHeadsets Send createSession { "jsonrpc": "2.0", "id": 5, "method": "createSession", "params": { "headset": "EPOCPLUS-4A2C04F1", "cortexToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6ImNvbS5nZW9zYnlyOTYuYnJhaW5jb21wdXRlcmludGVyYWN0aW9uIiwiYXBwVmVyc2lvbiI6IjEuMCIsImV4cCI6MTU2NTA4NTQ5MywibGljZW5zZUlkIjoiZGRhMjRhYTItNDZhMi00Y2QwLTk5MDctZDdmNGI3MzFlMGE0IiwibmJmIjoxNTY0ODI2MjkzLCJ1c2VySWQiOiI4NDYwZjVjOS02MDVjLTQwZGItOGY1Yi1mYjdhM2ExYWVlYzEiLCJ1c2VybmFtZSI6Imdlb3NieXI5NiIsInZlcnNpb24iOiIyLjAifQ==.JLmQXLLhXya38RcwavJG3n0fRkXLUgeCI4hH8rDwW/0=", "status": "active" } } Send querySessions { "jsonrpc": "2.0", "id": 6, "method": "querySessions", "params": { "cortexToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6ImNvbS5nZW9zYnlyOTYuYnJhaW5jb21wdXRlcmludGVyYWN0aW9uIiwiYXBwVmVyc2lvbiI6IjEuMCIsImV4cCI6MTU2NTA4NTQ5MywibGljZW5zZUlkIjoiZGRhMjRhYTItNDZhMi00Y2QwLTk5MDctZDdmNGI3MzFlMGE0IiwibmJmIjoxNTY0ODI2MjkzLCJ1c2VySWQiOiI4NDYwZjVjOS02MDVjLTQwZGItOGY1Yi1mYjdhM2ExYWVlYzEiLCJ1c2VybmFtZSI6Imdlb3NieXI5NiIsInZlcnNpb24iOiIyLjAifQ==.JLmQXLLhXya38RcwavJG3n0fRkXLUgeCI4hH8rDwW/0=" } } Received: {"error":{"code":-32019,"message":"Session limit on this device has been reached."},"id":5,"jsonrpc":"2.0"} Received: Session limit on this device has been reached. MessageErrorRecieved :code -32019 message Session limit on this device has been reached. Received: {"id":6,"jsonrpc":"2.0","result":[]} handleResponse: querySessions

nguoithichkhampha commented 5 years ago

you should run "authorize"again to debit session. you can change debit number param in this class https://github.com/Emotiv/cortex-v2-example/blob/master/csharp/CortexAccess/Config.cs may 100 - 200. you will not need run "authorize" many times (default value is 5)