public override HEADSET_LIMITATIONS Initalize(IDeviceHost host) { this.host = host; device.SetButtonEventHandler(OnButtonEvent); device.SetStateEventHandler(OnStateEvent); host.StatusChanged += HostStatusChanged; return HEADSET_LIMITATIONS.ONLY_ACTIVE_DURING_CALLS; }
public override HEADSET_LIMITATIONS Initalize(IDeviceHost host) { this.host = host; device.DeviceEvents.MuteStateChanged += DeviceEvents_MuteStateChanged; device.DeviceEvents.FlashPressed += DeviceEvents_FlashPressed; device.DeviceEvents.TalkPressed += DeviceEvents_TalkPressed; device.DeviceEvents.AudioStateChanged += DeviceEvents_AudioStateChanged; device.DeviceEvents.ButtonPressed += DeviceEvents_ButtonPressed; host.StatusChanged += HostStatusChanged; return HEADSET_LIMITATIONS.NO_UNMUTE; }
public abstract HEADSET_LIMITATIONS Initalize(IDeviceHost host);
private void HostStatusChanged(object sender, IDeviceHost.StatusEventArgs e) { switch (e.type) { case IDeviceHost.PHONE_EVENT_TYPE.InCallRing: case IDeviceHost.PHONE_EVENT_TYPE.Ring: device.SetRinger(e.enable, last_caller_id); break; case IDeviceHost.PHONE_EVENT_TYPE.LineActive: if (e.enable == false && muted) device.SetMicrophoneMute(false); device.SetHookState(e.enable); hook_enabled = e.enable; break; case IDeviceHost.PHONE_EVENT_TYPE.Mute: device.SetMicrophoneMute(e.enable); muted = e.enable; break; } }
private void HostStatusChanged(object sender, IDeviceHost.StatusEventArgs e) { switch (e.type) { case IDeviceHost.PHONE_EVENT_TYPE.InCallRing: case IDeviceHost.PHONE_EVENT_TYPE.Ring: device.HostCommand.Ring(e.enable); break; case IDeviceHost.PHONE_EVENT_TYPE.LineActive: ignore_next_radio_on = e.enable; device.HostCommand.AudioState = e.enable ? PL.AudioType.MonoOn : PL.AudioType.MonoOff; break; } }
private void CreateEvent(IDeviceHost.PHONE_EVENT_TYPE type, bool enable, bool is_during_call) { List<PluginError> errors = null; lock (devices_lock) { foreach (DeviceData data in devices) { if (!data.active) continue; try { if (type != IDeviceHost.PHONE_EVENT_TYPE.LineActive) data.host.CreateEvent(type, enable); else { if (data.HasLimit(IHeadsetDevice.HEADSET_LIMITATIONS.ONLY_ACTIVE_DURING_CALLS)) { if (is_during_call) data.host.CreateEvent(type, enable); } else if (!is_during_call) data.host.CreateEvent(type, enable); } } catch (Exception e) { if (errors == null) errors = new List<PluginError>(); errors.Add(new PluginError { device = data, exception = e }); } } } if (errors != null) foreach (PluginError err in errors) HandleError(err); }
private void CreateEvent(IDeviceHost.PHONE_EVENT_TYPE type, bool enable) { CreateEvent(type, enable, false); }