void counter(IEmotivState e) { if (e.Command == EmotivCommandType.PUSH) { if (streakCounter == 0) { startTime = e.Time; endTime = startTime; streakCounter++; } else { endTime = e.Time; } } else { if (getCurrentTime() > 1) { intervals.Add(getCurrentTime()); } streakCounter = 0; startTime = 0; endTime = 0; } }
protected override IEmotivState ReadingState(IConnectomeDevice <IEmotivState> device, long time) { IEmotivState currentState = device.Read(time); if (ShouldReadNull == false) { while (currentState.Command == Enum.EmotivCommandType.NULL) { InsureMillisecondPassed(); currentState = device.Read(time); } } return(currentState); }
public void OnRead(IEmotivState s) { States.Add(new ControledEmotivState() { Command = s.Command, Power = s.Power, Time = s.Time, Location = LabeledHighligter.HighlightedName, RefreshRate = RefreshInterpreter.ReachRate, ClickRate = ClickInterpreter.ReachRate, CalcRate = ClickInterpreter.ActivitySlider.value, ClickStatus = DidClick ? "Clicked" : "", Duration = SelectionManager.WaitInterval } ); DidClick = false; }
/// <summary> /// Calculate and trigger events based on calculation. /// <see cref="GetRate(IEnumerable{IEmotivState})"/> /// </summary> public override void Interpret() { IEmotivState lastRecorded = Timeline.Latest(); if (lastRecorded == null) { return; } IEnumerable <IEmotivState> dataSet = Timeline[lastRecorded.Time - Interval, lastRecorded.Time].ToArray(); if (dataSet == null || dataSet.Count() == 0) { return; } float targetRate = GetRate(dataSet); //Update slider if (Slider != null) { Slider.value = targetRate; } //Refresh if (targetRate >= RefreshThreshhold) { if (OnRefresh != null) { OnRefresh.Invoke(); } } //Click if (targetRate >= ClickThreshhold) { Timeline = new Timeline <IEmotivState>(); if (OnClick != null) { OnClick.Invoke(); } } }
/// <summary> /// Auto generation for the win. /// </summary> /// <param name="state"></param> private void ReaderOnRead(IEmotivState state) { if (!IsRecording) { return; } if (initTime == -1) { initTime = state.Time; } States.Add(new TaggedEmotivState() { Tag = LabeledFlashingHighligter.HighlightedName, EmotivState = state }); //StatesCSV.Add(string.Format("{0},{1},{2},{3}", LabeledFlashingHighligter.HighlightedName, state.Command, state.Time - initTime, state.Power)); }
private void ListenToState(IEmotivState e) { try { if (IsBreak) { return; } //Debug.Log(e.State); States[SessionIndex].Add(e); } catch (Exception x) { Debug.Log(x); Crashlytics.RecordCustomException("Profile Exception", "thrown exception", x.StackTrace); } }
void powerChecker(IEmotivState e) { if (e.Power >= currentPower) { if (waitSecond) { startSecond = e.Time; waitSecond = false; } if ((e.Time - startSecond) > 1000) { passedTest = true; waitSecond = true; } } else { waitSecond = true; } lastPower = e.Power; }