コード例 #1
0
    /*
       * INTERNAL HELPER METHODS
       */
    private void AddHeadsetData()
    {
        ThinkGearData headsetData = new ThinkGearData();

        headsetData.elapsedTime = elapsedTime;
        headsetData.attention = (int)client.headsetData.attention;
        headsetData.meditation = (int)client.headsetData.meditation;
        headsetData.delta = client.headsetData.delta;
        headsetData.theta = client.headsetData.theta;
        headsetData.lowAlpha = client.headsetData.lowAlpha;
        headsetData.highAlpha = client.headsetData.highAlpha;
        headsetData.lowBeta = client.headsetData.lowBeta;
        headsetData.highBeta = client.headsetData.highBeta;
        headsetData.lowGamma = client.headsetData.lowGamma;
        headsetData.highGamma = client.headsetData.highGamma;

        data.Add(headsetData);
    }
コード例 #2
0
    private void UpdateDataValuesThread()
    {
        while(updateThread.IsAlive && updateDataThreadActive){
          // Update/refresh the data values
          int readResult = enableDemoMode ? 0 : ThinkGear.ReadPackets(-1);

          if(readResult < 0){
        // if we haven't seen a valid packet in a while, then the headset was probably
        // disconnected. do a cleanup.
        if(DateTime.Now.Ticks - lastPacketReadTime > TIMEOUT_INTERVAL_TICKS){
          Debug.Log("Headset data receipt timed out.");
          GameHelper.SendMessageToAll("OnRequestHeadsetDisconnect", null, SendMessageOptions.DontRequireReceiver);
        }
          }
          else {
        lock(this){
          headsetData = dataPlayer.DataAt(elapsedTime);

          if(headsetData.blink != blinkStrength){
            blinkStrength = (int)headsetData.blink;
            hasBlinked = true;
          }
        }

        lastPacketReadTime = DateTime.Now.Ticks;
          }

          Thread.Sleep(20);
        }
    }
コード例 #3
0
 /**
    * Adds a new ThinkGearData to the list of ThinkGearDatas.
    */
 public void Add(ThinkGearData data)
 {
     brainwaveData.Add(data);
 }