void DeviceEvents_AudioStateChanged(object sender, PL.DeviceEventArgs e)
 {
     if (e.AudioState == PL.AudioType.MonoOff)
         StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.RadioClosed));
     else if (e.AudioState == PL.AudioType.MonoOn || e.AudioState == PL.AudioType.MonoOnWait) {
         StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.RadioOpen));
         if (ignore_next_radio_on)
             ignore_next_radio_on = false;
         else {
             StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.ToggleTalk));
         }
     }
 }
        void device_manager_DeviceStateChanged(object sender, PL.DeviceStateEventArgs e)
        {
            PlantronicsHeadset headset = (from d in devices where d.device_path == e.DevicePath select d).SingleOrDefault();
            if (e.State == PL.DeviceState.Removed && headset != null)
                DeviceRemoved(this, new DeviceEventArgs(headset));
            else if (e.State == PL.DeviceState.Added) {

                AddNewDevice(device_manager.FindDeviceForPath(e.DevicePath));
            }
        }
 public PlantronicsHeadset(PL.IDevice device)
 {
     this.device = device;
 }
 private void AddNewDevice(PL.IDevice pl_device)
 {
     PlantronicsHeadset device = new PlantronicsHeadset(pl_device);
     devices.Add(device);
     DeviceAdded(this, new DeviceEventArgs(device));
 }
 void DeviceEvents_TalkPressed(object sender, PL.DeviceEventArgs e)
 {
     StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.ToggleTalk));
 }
 void DeviceEvents_MuteStateChanged(object sender, PL.DeviceEventArgs e)
 {
     if (e.Mute)
         StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.Mute));
     else
         StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.UnMute));
 }
 void DeviceEvents_FlashPressed(object sender, PL.DeviceEventArgs e)
 {
     StatusChanged(this, new StatusEventArgs(HEADSET_EVENT_TYPE.Flash));
 }
 void DeviceEvents_ButtonPressed(object sender, PL.DeviceEventArgs e)
 {
     Debug.WriteLine("Got a raw event of: " + e.ButtonPressed);
 }