Esempio n. 1
0
 private void Connected(object sender, bool isConnected)
 {
     if (isConnected)
     {
         Console.WriteLine("Websocket Client Connected");
         // Query user login
         if (!AccessCtr.IsLogin)
         {
             AccessCtr.QueryUserLogin();
         }
         // Query Headset
         if (!HeadsetCtr.IsConnected)
         {
             HeadsetCtr.QueryHeadsets();
         }
     }
     else
     {
         Console.WriteLine("Websocket Client disconnect");
         if (SessionCtr.IsCreateSession)
         {
             CloseSession();
         }
         // Clear session
         SessionCtr.ClearSessionControllerData();
     }
 }
Esempio n. 2
0
 private void DisconnectHeadsetReceived(object sender, string headsetID)
 {
     Console.WriteLine("Disconnect headset " + headsetID);
     // Clear session
     //if (SessionCtr.IsCreateSession)
     //    CloseSession();
     SessionCtr.ClearSessionControllerData();
 }
Esempio n. 3
0
 // Stop Record
 public void StopRecord()
 {
     if (SessionCtr.IsRecording)
     {
         SessionCtr.NextStatus = "stopRecord";
         SessionCtr.UpdateSession(GetAccessToken(), SessionCtr.RecordingName, SessionCtr.RecordingNote, SessionCtr.RecordingSubject);
     }
 }
Esempio n. 4
0
 // Inject marker
 public bool InjectMarker(string label, int value, string port, Int64 timeStamp)
 {
     if (SessionCtr.IsCreateSession)
     {
         return(SessionCtr.InjectMarker(GetAccessToken(), port, label, value, timeStamp));
     }
     else
     {
         return(false);
     }
 }
Esempio n. 5
0
 // Start Record
 public void StartRecord(string recordName, string recordSubject, string recordNote)
 {
     if (SessionCtr.IsCreateSession)
     {
         SessionCtr.NextStatus       = "startRecord";
         SessionCtr.RecordingName    = recordName;
         SessionCtr.RecordingSubject = recordSubject;
         SessionCtr.RecordingNote    = recordNote;
         SessionCtr.UpdateSession(GetAccessToken(), recordName, recordNote, recordSubject);
     }
 }
Esempio n. 6
0
 private void DisconnectHeadsetReceived(object sender, string headsetID)
 {
     //Console.WriteLine("Disconnect headset " + headsetID);
     output.text = "Disconnect headset " + headsetID;
     if (SessionCtr.IsCreateSession)
     {
         CloseSession();
     }
     // Clear session
     SessionCtr.ClearSessionControllerData();
 }
Esempio n. 7
0
        private void QuerryHeadsetReceived(object sender, List <Headset> headsets)
        {
            Console.WriteLine("QuerryHeadsetReceived");

            // Create a Session when have new update of headset connection
            if (string.IsNullOrEmpty(GetAccessToken()))
            {
                return;
            }
            if (!SessionCtr.IsCreateSession)
            {
                SessionCtr.CreateSession(GetSelectedHeadsetId(), GetAccessToken(), ExperimentID);
            }
        }
Esempio n. 8
0
        // Set status for session
        //public void SetNextStatus(string status)
        //{
        //    SessionCtr.NextStatus = status;
        //}

        // Create Session
        public void CreateSession()
        {
            if (string.IsNullOrEmpty(LicenseId))
            {
                SessionCtr.NextStatus = "open";
            }
            else
            {
                SessionCtr.NextStatus = "active";
            }
            if (IsHeadsetConnected() && !string.IsNullOrEmpty(GetAccessToken()))
            {
                SessionCtr.CreateSession(GetSelectedHeadsetId(), GetAccessToken(), ExperimentID);
            }
        }
Esempio n. 9
0
 // Update Notes
 public void UpdateNote(string note)
 {
     SessionCtr.UpdateNote(GetAccessToken(), SessionCtr.RecordID, note);
 }
Esempio n. 10
0
 // Unsubcribe data
 public void UnSubcribeData(string stream)
 {
     SessionCtr.RequestData(GetAccessToken(), stream, false, false);
 }
Esempio n. 11
0
 // Subcribe data
 public void SubcribeData(string stream)
 {
     SessionCtr.RequestData(GetAccessToken(), stream, false, true);
     //SessionCtr.RequestAllData(GetAccessToken(), GetCurrentSessionID(), false, true);
 }
Esempio n. 12
0
 // Close Session
 public void CloseSession()
 {
     SessionCtr.CloseSession(GetAccessToken());
 }
Esempio n. 13
0
 // Query Session
 public void QuerySession()
 {
     SessionCtr.QuerrySession(GetAccessToken());
 }
Esempio n. 14
0
 // Inject marker
 public bool InjectMarker(string label, int value, Int64 timeStamp)
 {
     return(SessionCtr.InjectMarker(GetAccessToken(), "USB", label, value, timeStamp));
 }