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(); } }
private void DisconnectHeadsetReceived(object sender, string headsetID) { Console.WriteLine("Disconnect headset " + headsetID); // Clear session //if (SessionCtr.IsCreateSession) // CloseSession(); SessionCtr.ClearSessionControllerData(); }
// Stop Record public void StopRecord() { if (SessionCtr.IsRecording) { SessionCtr.NextStatus = "stopRecord"; SessionCtr.UpdateSession(GetAccessToken(), SessionCtr.RecordingName, SessionCtr.RecordingNote, SessionCtr.RecordingSubject); } }
// 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); } }
// 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); } }
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(); }
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); } }
// 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); } }
// Update Notes public void UpdateNote(string note) { SessionCtr.UpdateNote(GetAccessToken(), SessionCtr.RecordID, note); }
// Unsubcribe data public void UnSubcribeData(string stream) { SessionCtr.RequestData(GetAccessToken(), stream, false, false); }
// Subcribe data public void SubcribeData(string stream) { SessionCtr.RequestData(GetAccessToken(), stream, false, true); //SessionCtr.RequestAllData(GetAccessToken(), GetCurrentSessionID(), false, true); }
// Close Session public void CloseSession() { SessionCtr.CloseSession(GetAccessToken()); }
// Query Session public void QuerySession() { SessionCtr.QuerrySession(GetAccessToken()); }
// Inject marker public bool InjectMarker(string label, int value, Int64 timeStamp) { return(SessionCtr.InjectMarker(GetAccessToken(), "USB", label, value, timeStamp)); }