private void OnButtonInput(object sender, ButtonInputEventArgs e) { if (e.Value.HasValue) { log.Info($"OnButtonInput: {e.Button.ToString()}, {e.Value.Value}"); } else { log.Info($"OnButtonInput: {e.Button.ToString()}, (no value)"); } #region Mic mute if (e.Button == ButtonId.MicMute) { Action action = () => { lock (jabraLock) { if (activeCall != null) { if (!isCallMuted) { RequestMuteCallViaSIPEndpoint(activeCall); } else { RequestUnmuteCallViaSIPEndpoint(activeCall); } } } }; workQueue.Add(action); } #endregion #region Flash if (e.Button == ButtonId.Flash) { if (activeCall != null) { RequestHoldCall(activeCall); } else if (heldCalls.Any()) { RequestRetrieveCall(heldCalls.First()); } } #endregion #region Reject call if (e.Button == ButtonId.RejectCall) { Action action = () => { lock (jabraLock) { if (incomingCall != null) { if (e.Value.HasValue && e.Value == true) { RequestReleaseCall(incomingCall); } } } }; workQueue.Add(action); } #endregion #region Hook if (e.Button == ButtonId.HookSwitch) { Action action = () => { lock (jabraLock) { if (incomingCall != null) { if (e.Value.HasValue && e.Value == true) { RequestAnswerCall(incomingCall); } } else if (activeCall != null) { if (e.Value.HasValue && e.Value == false) { RequestReleaseCall(activeCall); } } } }; workQueue.Add(action); } #endregion }
private void onButtonPress(ButtonInputEventArgs obj) { Debug.Log($"The {_testKey.ToString()}-Button has been pressed for {obj.Duration} seconds."); }