Emotiv / cortex-example

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

How do I subscribe to performance metrics data in Unity #182

Closed tearoue323 closed 2 years ago

tearoue323 commented 2 years ago

As title, How do I subscribe to performance indicator data in Unity, I just want to get the foc and eng data, is it in DataStreamManger.cs or PMDataBuffer.cs?

tungntEmotiv commented 2 years ago

Hi @tearoue323 ,

To get the performance metrics data you can use EmotivUnityItf.cs and follow the below steps: 1) call Init() to set application configuration ( clientId, client Secret...) and if you want to save data to buffer before obtaining the data , please set isDataBufferUsing = true 2) call Start() to start a websocket and authorizing 3) CreateSessionWithHeadset(string headsetId) to create a working session with your headset 4) call SubscribeData(List() {"met"}) to subscribe performance metrics 5) If you use Data buffer -> you need to call GetPMData(string label) to get the pm data. If you don't use the data buffer -> you will get the data at OnPerfDataReceived() You can reference to https://github.com/Emotiv/cortex-v2-example/blob/master/unity/Assets/SimpleExample.unity for more detail Thank you

tearoue323 commented 2 years ago

@tungntEmotiv I will give it a try ,thanks.