/// <summary> /// Output information content via audio if input was received /// for a device currently in this haptic rectangle /// </summary> /// <param name="haptiQ"></param> /// <param name="gestureType"></param> public override void handlePress(HaptiQ haptiQ, PRESSURE_GESTURE_TYPE gestureType) { Tuple<STATE, IBehaviour> HaptiQState = _HaptiQBehaviours.ContainsKey(haptiQ.getID()) ? _HaptiQBehaviours[haptiQ.getID()] : null; if (pointIsInside(haptiQ.position) && HaptiQState != null && HaptiQState.Item1 == STATE.down) { if (_action != null) { _action.run(haptiQ.getID(), gestureType, haptiQ.getCurrentPressureData()); } else { SpeechOutput.Instance.speak(information); } } }
/// <summary> /// Create a wrapper for the pressure gesture arguments /// </summary> /// <param name="id"></param> /// <param name="position"></param> /// <param name="gestureType"></param> public PressureGestureArgs(uint id, Point position, PRESSURE_GESTURE_TYPE gestureType) { ID = id; Position = position; GestureType = gestureType; }
/// <summary> /// Execute this action: outputs the textual information to the speakers /// </summary> /// <param name="id"></param> /// <param name="pressureData"></param> /// <param name="gestureType"></param> public void run(uint id, PRESSURE_GESTURE_TYPE gestureType, Dictionary<int, double> pressureData) { Console.WriteLine("Getting input from device with id " + id); SpeechOutput.Instance.speak(_information); }
/// <summary> /// Handle an actuator press. /// Note: Multiple presses are not supported, yet. /// </summary> /// <param name="haptiQ"></param> /// <param name="gestureType"></param> public virtual void handlePress(HaptiQ haptiQ, PRESSURE_GESTURE_TYPE gestureType) { Tuple<STATE, IBehaviour> HaptiQState = _HaptiQBehaviours.ContainsKey(haptiQ.getID()) ? _HaptiQBehaviours[haptiQ.getID()] : null; if (pointIsInside(haptiQ.position) && HaptiQState != null && HaptiQState.Item1 == STATE.down) { if (_action != null) { _action.run(haptiQ.getID(), gestureType, haptiQ.getCurrentPressureData()); } } }
/* -------------- */ /* EVENT METHODS */ /* ---------------*/ /// <summary> /// This method raises a PressureGestureEventHandler event. /// </summary> /// <param name="gestureType"></param> private void OnPressureGesture(PRESSURE_GESTURE_TYPE gestureType) { if (PressureGesture != null) { PressureGestureArgs args = new PressureGestureArgs(_id, _position, gestureType); PressureGesture(this, args); } }