コード例 #1
0
ファイル: HubSDKConnector.cs プロジェクト: W0LFB1TE/pdc
 private void OnHeadsetStateChanged(COMDeviceListenerEventArgs e)
 {
     if (HeadsetStateChanged != null)
     {
         HeadsetStateChanged(e);
     }
 }
コード例 #2
0
 private void _deviceListenerEvents_onATDStateChanged(COMDeviceListenerEventArgs args)
 {
     // informs us of a variety of Plantronics device state changes
     OnHeadsetStateChanged(args);
     OnHeadsetStateChangedPy(
         (int)args.DeviceEventType, args.DeviceEventType.ToString(),
         (int)args.HeadsetStateChange, args.HeadsetStateChange.ToString());
 }
コード例 #3
0
 private static void _deviceListenerEvents_onHeadsetStateChanged(COMDeviceListenerEventArgs args)
 {
     // informs us of a variety of Plantronics device state changes
     Console.Write(args.DeviceEventType + " - ");
     if (args.DeviceEventType == COMDeviceEventType.DeviceEventType_HeadsetStateChanged)
     {
         Console.Write(args.HeadsetStateChange);
     }
     Console.WriteLine();
 }
コード例 #4
0
        private void _deviceListenerEvents_onHeadsetStateChanged(COMDeviceListenerEventArgs args)
        {
            // informs us of a variety of Plantronics device state changes
            OnHeadsetStateChanged(args);
            OnHeadsetStateChangedPy(
                (int)args.DeviceEventType, args.DeviceEventType.ToString(),
                (int)args.HeadsetStateChange, args.HeadsetStateChange.ToString());

            // uncomment for additional information message
            //OnSDKInfo(new SDKInfoArgs(SDKInfoType.sdk_notification, "ICOMDeviceListenerEvents_Event.onHeadsetStateChanged: " + args.HeadsetStateChange));
        }
コード例 #5
0
ファイル: SpokesWrapper3.0.cs プロジェクト: pltdev/Samples
        void m_deviceListenerEvents_HandlerMethods(COMDeviceListenerEventArgs e)
        {
            DebugPrint(MethodInfo.GetCurrentMethod().Name, "Spokes: Received Spokes Event: " + e.DeviceEventType.ToString());

            switch (e.DeviceEventType)
            {
                case COMDeviceEventType.DeviceEventType_HeadsetStateChanged:
                    switch (e.HeadsetStateChange)
                    {
                        case DeviceHeadsetStateChange.HeadsetStateChange_Don:
                            OnPutOn(new WearingStateArgs(true, false));
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_Doff:
                            OnTakenOff(new WearingStateArgs(false, false));
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_Near:
                            OnNear(EventArgs.Empty);
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_Far:
                            OnFar(EventArgs.Empty);
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_ProximityDisabled:
                            // Note: intepret this event as that the mobile phone has gone out of Bluetooth
                            // range and is no longer paired to the headset.
                            // Lock the PC, but immediately re-enable proximity
                            OnProximityDisabled(EventArgs.Empty);
                            // Immediately re-enable proximity
                            RegisterForProximity(true);
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_ProximityEnabled:
                            OnProximityEnabled(EventArgs.Empty);
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_ProximityUnknown:
                            OnProximityUnknown(EventArgs.Empty);
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_InRange:
                            OnInRange(EventArgs.Empty);
                            //// Immediately re-enable proximity
                            //RegisterForProximity(true);
                            //// Request headset serial number (maybe user paired with another?)
                            //RequestSingleSerialNumber(SerialNumberTypes.Headset);
                            // New, get all the device state info on inrange trigger:
                            // now poll for current state (proximity, mobile call status, donned status, mute status)
                            GetInitialDeviceState();

                            // tell app to look again at battery level (headset in range)
                            OnBatteryLevelChanged(EventArgs.Empty);
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_OutofRange:
                            OnOutOfRange(EventArgs.Empty);
                            OnSerialNumber(new SerialNumberArgs("", SerialNumberTypes.Headset));

                            // tell app to look again at battery level (headset out of range / disconnected)
                            OnBatteryLevelChanged(EventArgs.Empty);
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_BatteryLevel:
                            // note; on legend we always get a battery level when docking...
                            // what is in this event, anything we can use to infer docked?
                            DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("HeadsetStateChanged: BatteryLevel"));

                            // TODO - rework this code for Spokes 3.0 - it gets stuck in an endless loop!
                            //if (!m_ignorenextbattlevevent && (!m_lastdocked && m_battlevEventCount < 10)) // TEST, allow 10 of these thru so it gets docking more quickly on legend!
                            //{
                            //    // Only if we were undocked and there were no battery level events
                            //    // since we last undocked should we detect batt charge status (docking status).
                            //    // This is so this only happens once, otherwise we get stuck in a loop
                            //    // Because looking at the battery info triggers another batterylevel changed
                            //    // event!
                            //    m_ignorenextundockedevent = true;
                            //    m_ignorenextbattlevevent = true;
                            //    m_lastdocked = DetectLegendDockedState(false); // NOTE: will ALWAYS trigger another batterylevel change event
                            //    // AND another UnDocked event if we are undocked!
                            //    m_battlevEventCount++;
                            //}
                            //else
                            //{
                            //    if (m_ignorenextbattlevevent) m_ignorenextbattlevevent = false;
                            //    if (m_lastdocked) m_ignorenextundockedevent = false;
                            //}

                            // tell app to look at battery level (it has changed)
                            OnBatteryLevelChanged(EventArgs.Empty);
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_Docked:
                        case DeviceHeadsetStateChange.HeadsetStateChange_DockedCharging:  // new, for legend, but is v SLOW, sometimes never comes
                            // only send to app the docked value if it is different to m_lastdocked (i.e. if it has changed)
                            if (!m_lastdocked) OnDocked(new DockedStateArgs(true, false));
                            m_lastdocked = true;
                            //m_battlevEventCount = 0;
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_UnDocked:
                            if (!m_ignorenextundockedevent)
                            {
                                // only send to app the docked value if it is different to m_lastdocked (i.e. if it has changed)
                                if (m_lastdocked) OnUnDocked(new DockedStateArgs(false, false));
                                // if (m_lastdocked) m_battlevEventCount = 0; // if we were docked before, set battlev event count to zero
                                // // i.e. we would like to check the next battery level event
                                m_lastdocked = false;
                            }
                            m_ignorenextundockedevent = false;
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_MuteON:
                            OnMuteChanged(new MuteChangedArgs(true));
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_MuteOFF:
                            OnMuteChanged(new MuteChangedArgs(false));
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_MonoON:
                            OnLineActiveChanged(new LineActiveChangedArgs(true));
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_MonoOFF:
                            OnLineActiveChanged(new LineActiveChangedArgs(false));
                            break;

                        // NEW CC events
                        case DeviceHeadsetStateChange.HeadsetStateChange_Connected:
                            OnConnected(new ConnectedStateArgs(true, false));
                            break;
                        case DeviceHeadsetStateChange.HeadsetStateChange_Disconnected:
                            OnDisconnected(new ConnectedStateArgs(false, false));
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }
        }
コード例 #6
0
ファイル: SpokesWrapper3.0.cs プロジェクト: pltdev/Samples
        // print device listner events
        void m_deviceListenerEvents_Handler(COMDeviceListenerEventArgs e)
        {
            try
            {
                switch (e.DeviceEventType)
                {
                    case COMDeviceEventType.DeviceEventType_ATDButtonPressed:
                        break;
                    case COMDeviceEventType.DeviceEventType_ATDStateChanged:
                        DeviceListener_ATDStateChanged(e);
                        break;
                    case COMDeviceEventType.DeviceEventType_BaseButtonPressed:

                        DeviceListener_BaseButtonPressed(e);
                        break;
                    case COMDeviceEventType.DeviceEventType_BaseStateChanged:
                        DeviceListener_BaseStateChanged(e);
                        break;
                    case COMDeviceEventType.DeviceEventType_HeadsetButtonPressed:
                        DebugPrint(MethodInfo.GetCurrentMethod().Name, "DeviceEventType_HeadsetButtonPressed " + e.HeadsetButton.ToString());
                        OnButtonPress(new ButtonPressArgs(e.HeadsetButton, m_activeDevice.HostCommand.AudioState,
                            m_activeDevice.HostCommand.mute));
                        break;
                    case COMDeviceEventType.DeviceEventType_HeadsetStateChanged:
                    default:
                        break;
                }
            }
            catch (Exception exc)
            {
                DebugPrint(MethodInfo.GetCurrentMethod().Name, "INFO: Exception caught: " + exc.ToString());
            }
        }
コード例 #7
0
ファイル: SpokesWrapper3.0.cs プロジェクト: pltdev/Samples
 // Respond to various base state changes by updating our knowledge of multiline active/held states...
 void DeviceListener_BaseStateChanged(COMDeviceListenerEventArgs e)
 {
     // write your own code to react to the state change
     switch (e.BaseStateChange)
     {
         case DeviceBaseStateChange.BaseStateChange_Unknown:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: Unknown"));
             break;
         case DeviceBaseStateChange.BaseStateChange_PstnLinkEstablished:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: PstnLinkEstablished"));
             GetActiveStates();
             OnMultiLineStateChanged(new MultiLineStateArgs(m_activeHeldFlags));
             break;
         case DeviceBaseStateChange.BaseStateChange_PstnLinkDown:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: PstnLinkDown"));
             GetActiveStates();
             OnMultiLineStateChanged(new MultiLineStateArgs(m_activeHeldFlags));
             break;
         case DeviceBaseStateChange.BaseStateChange_VoipLinkEstablished:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: VoipLinkEstablished"));
             GetActiveStates();
             OnMultiLineStateChanged(new MultiLineStateArgs(m_activeHeldFlags));
             break;
         case DeviceBaseStateChange.BaseStateChange_VoipLinkDown:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: VoipLinkDown"));
             GetActiveStates();
             OnMultiLineStateChanged(new MultiLineStateArgs(m_activeHeldFlags));
             break;
         case DeviceBaseStateChange.BaseStateChange_AudioMixer:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: AudioMixer"));
             break;
         case DeviceBaseStateChange.BaseStateChange_RFLinkWideBand:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: RFLinkWideBand"));
             break;
         case DeviceBaseStateChange.BaseStateChange_RFLinkNarrowBand:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: RFLinkNarrowBand"));
             break;
         case DeviceBaseStateChange.BaseStateChange_MobileLinkEstablished:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: MobileLinkEstablished"));
             GetActiveStates();
             OnMultiLineStateChanged(new MultiLineStateArgs(m_activeHeldFlags));
             break;
         case DeviceBaseStateChange.BaseStateChange_MobileLinkDown:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: MobileLinkDown"));
             GetActiveStates();
             OnMultiLineStateChanged(new MultiLineStateArgs(m_activeHeldFlags));
             break;
         case DeviceBaseStateChange.BaseStateChange_InterfaceStateChanged:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: InterfaceStateChanged"));
             GetHoldStates();
             OnMultiLineStateChanged(new MultiLineStateArgs(m_activeHeldFlags));
             break;
         case DeviceBaseStateChange.BaseStateChange_AudioLocationChanged:
             DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseStateChanged: AudioLocationChanged"));
             break;
     }
 }
コード例 #8
0
ファイル: SpokesWrapper3.0.cs プロジェクト: pltdev/Samples
 // Respond to various base button presses by passing button pressed event to app event handler
 private void DeviceListener_BaseButtonPressed(COMDeviceListenerEventArgs e)
 {
     DebugPrint(MethodInfo.GetCurrentMethod().Name, String.Format("BaseButtonPressed: {0}", e.BaseButton.ToString()));
     OnBaseButtonPress(new BaseButtonPressArgs(e.BaseButton, e.DialedKey));
 }
コード例 #9
0
ファイル: SpokesWrapper3.0.cs プロジェクト: pltdev/Samples
 //        #region DeviceListener events
 void DeviceListener_ATDStateChanged(COMDeviceListenerEventArgs e)
 {
     //HANDLE ATD State changes
     switch (e.ATDStateChange)
     {
         case DeviceATDStateChange.ATDStateChange_MobileInComing:
             m_mobIncoming = true; // set on call flag
             OnOnMobileCall(new OnMobileCallArgs(m_mobIncoming, MobileCallState.Ringing));
             break;
         case DeviceATDStateChange.ATDStateChange_MobileOnCall:
             OnOnMobileCall(new OnMobileCallArgs(m_mobIncoming, MobileCallState.OnCall));
             break;
         case DeviceATDStateChange.ATDStateChange_MobileCallEnded:
             m_mobIncoming = false; // clear mobile call direction flag
             OnNotOnMobileCall(EventArgs.Empty);
             break;
         case DeviceATDStateChange.ATDStateChange_MobileCallerID:
             OnMobileCallerId(new MobileCallerIdArgs(GetMobileCallerID()));
             break;
         case DeviceATDStateChange.ATDStateChange_MobileOutGoing:
             break;
         case DeviceATDStateChange.ATDStateChange_PstnInComingCallRingOn:
             break;
         case DeviceATDStateChange.ATDStateChange_PstnInComingCallRingOff:
             break;
     }
 }
コード例 #10
0
        // print device listner events
        void m_deviceListenerEvents_Handler(COMDeviceListenerEventArgs e)
        {
            switch (e.DeviceEventType)
            {
                case COMDeviceEventType.DeviceEventType_ATDButtonPressed:
                    break;
                case COMDeviceEventType.DeviceEventType_ATDStateChanged:
                    DeviceListener_ATDStateChanged(e);
                    break;
                case COMDeviceEventType.DeviceEventType_BaseButtonPressed:

                    DeviceListener_BaseButtonPressed(e);
                    break;
                case COMDeviceEventType.DeviceEventType_BaseStateChanged:
                    DeviceListener_BaseStateChanged(e);
                    break;
                case COMDeviceEventType.DeviceEventType_HeadsetButtonPressed:
                    DebugPrint(MethodInfo.GetCurrentMethod().Name, "DeviceEventType_HeadsetButtonPressed " + e.HeadsetButton.ToString());
                    break;
                case COMDeviceEventType.DeviceEventType_HeadsetStateChanged:
                default:
                    break;
            }
        }
コード例 #11
0
ファイル: HubSDKConnector.cs プロジェクト: W0LFB1TE/pdc
 private void _deviceListenerEvents_onHeadsetStateChanged(COMDeviceListenerEventArgs args)
 {
     // informs us of a variety of Plantronics device state changes
     OnHeadsetStateChanged(args);
 }