Example #1
0
 public JabraHeadset(JA.IDevice device)
 {
     this.device = device;
     device_path = device.DeviceHandle.ToString();
     device_name = device.Name;
 }
Example #2
0
 private void OnDeviceDetached(JA.IDevice device)
 {
     JabraHeadset headset = (from d in devices where d.device == device select d).SingleOrDefault();
     if (headset != null)
         DeviceRemoved(this, new DeviceEventArgs(headset));
 }
Example #3
0
 private void OnDeviceAttached(JA.IDevice device)
 {
     AddNewDevice(device);
 }
Example #4
0
 private void AddNewDevice(JA.IDevice ja_device)
 {
     try{
     JabraHeadset device = new JabraHeadset(ja_device);
     devices.Add(device);
     DeviceAdded(this, new DeviceEventArgs(device));
     }
     catch (System.IO.FileNotFoundException) {
         Utils.PluginLog("Jabra Provider", "Unable to add new device");
     }
 }
Example #5
0
        private void OnStateEvent(JA.IDevice device, JA.State state, bool value)
        {
            switch (state) {
                case JA.State.OnLine:
                    if (value) {
                        StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.RadioOpen));
                        if (muted) {
                            DelayedFunction.DelayedCall("jabra_mute", () => {
                                ignore_next_mute = true;
                                device.SetMicrophoneMute(muted);

                            }, 2500);
                        }
                    }
                    else
                        StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.RadioClosed));
                    break;
            }
        }
Example #6
0
        private void OnButtonEvent(JA.IDevice device, JA.ButtonEvent button, bool value)
        {
            try {
                switch (button) {
                    case JA.ButtonEvent.HookSwitch:
                        if (value) {
                            if (!hook_enabled)
                                StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.Talk));
                            hook_enabled = true;
                        }
                        else {
                            if (hook_enabled) {
                                StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.Hangup));
                                device.SetHookState(false);
                            }
                            hook_enabled = false;
                        }
                        break;
                    case JA.ButtonEvent.MicMute:
                        if (!ignore_next_mute)
                            StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.ToggleMute));
                        ignore_next_mute = false;
                        break;
                    case JA.ButtonEvent.Flash:
                        StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.Flash));
                        break;
                    case JA.ButtonEvent.RejectCall:
                        StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.Hangup));
                        break;
                    case JA.ButtonEvent.FireAlarm:
                        throw new Exception("WTF");
                    case JA.ButtonEvent.Redial:
                        StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.Redial));
                        break;

                }
            }
            catch (Exception){}
        }