예제 #1
0
        public DeviceManager(ITraceContext traceContext, DebugLogger logger)
        {
            _traceContext = traceContext;

            _spokes = Spokes.Instance;
            _spokes.SetLogger(logger);

            _spokes.Attached += OnDeviceAttached;
            _spokes.Detached += OnDeviceDetached;

            _spokes.Connected +=OnHeadsetConnected;
            _spokes.Disconnected += OnHeadsetDisconnected;

            _spokes.MuteChanged += OnMuteChanged;
            _spokes.ButtonPress += OnButtonPress;

            _spokes.CallAnswered += OnCallAnswered;
            _spokes.CallEnded += OnCallEnded;

            _spokes.OnCall += OnDeviceCall;

            _spokes.Connect("Interaction Client AddIn");
               // _spokes.
        }
예제 #2
0
파일: PLTLayer.cs 프로젝트: aliotta/Samples
        /// <summary>
        /// Call setup to instruct PLTLayer object to connect to Plantronics Hub runtime engine 
        /// and register itself so that it can begin to communicate with the attached Plantronics device.
        /// </summary>
        /// <param name="AppName">Optional name of your appplication's session within Spokes runtime engine. If omitted it will default to "PLTLayer App".</param>
        public void setup(string AppName = "PLTLayer App")
        {
            try
            {
                // Obtain Spokes Wrapper singtleton object instance
                m_spokes = Spokes.Instance;
                // request log info
                m_spokes.SetLogger(this);

                // Sign up for Plantronics events of interest...

                // Wearing sensor:
                m_spokes.PutOn += new Spokes.PutOnEventHandler(m_spokes_PutOn);
                m_spokes.TakenOff += new Spokes.TakenOffEventHandler(m_spokes_TakenOff);

                // Proximity:
                m_spokes.Near += new Spokes.NearEventHandler(m_spokes_Near);
                m_spokes.Far += new Spokes.FarEventHandler(m_spokes_Far);
                m_spokes.InRange += new Spokes.InRangeEventHandler(m_spokes_InRange);
                m_spokes.OutOfRange += new Spokes.OutOfRangeEventHandler(m_spokes_OutOfRange);
                m_spokes.Docked += new Spokes.DockedEventHandler(m_spokes_Docked);
                m_spokes.UnDocked += new Spokes.DockedEventHandler(m_spokes_UnDocked);

                // Mobile caller id:
                m_spokes.MobileCallerId += new Spokes.MobileCallerIdEventHandler(m_spokes_MobileCallerId);
                m_spokes.OnMobileCall += new Spokes.OnMobileCallEventHandler(m_spokes_OnMobileCall);
                m_spokes.NotOnMobileCall += new Spokes.NotOnMobileCallEventHandler(m_spokes_NotOnMobileCall);

                // Serial Number:
                m_spokes.SerialNumber += new Spokes.SerialNumberEventHandler(m_spokes_SerialNumber);

                // Call control:
                m_spokes.CallAnswered += new Spokes.CallAnsweredEventHandler(m_spokes_CallAnswered);
                m_spokes.CallEnded += new Spokes.CallEndedEventHandler(m_spokes_CallEnded);
                m_spokes.CallSwitched += new Spokes.CallSwitchedEventHandler(m_spokes_CallSwitched);
                m_spokes.OnCall += new Spokes.OnCallEventHandler(m_spokes_OnCall);
                m_spokes.NotOnCall += new Spokes.NotOnCallEventHandler(m_spokes_NotOnCall);
                m_spokes.MuteChanged += new Spokes.MuteChangedEventHandler(m_spokes_MuteChanged);
                m_spokes.CallRequested += new Spokes.CallRequestedEventHandler(m_spokes_CallRequested);

                // Device attach/detach:
                m_spokes.Attached += new Spokes.AttachedEventHandler(m_spokes_Attached);
                m_spokes.Detached += new Spokes.DetachedEventHandler(m_spokes_Detached);
                m_spokes.CapabilitiesChanged += new Spokes.CapabilitiesChangedEventHandler(m_spokes_CapabilitiesChanged);

                // Headset connect/disconnect (QD):
                m_spokes.Connected += new Spokes.ConnectedEventHandler(m_spokes_Connected);
                m_spokes.Disconnected += new Spokes.DisconnectedEventHandler(m_spokes_Disconnected);

                // Multiline:
                m_spokes.MultiLineStateChanged += new Spokes.MultiLineStateChangedEventHandler(m_spokes_MultiLineStateChanged);

                // Button presses
                m_spokes.ButtonPress += new Spokes.ButtonPressEventHandler(m_spokes_ButtonPress);
                m_spokes.BaseButtonPress += new Spokes.BaseButtonPressEventHandler(m_spokes_BaseButtonPress);

                // Raw Data Received (custom message responses)
                m_spokes.RawDataReceived += new Spokes.RawDataReceivedEventHandler(m_spokes_RawDataReceived);

                // Connect to Plantronics SDK
                m_IsConnected = m_spokes.Connect(AppName);
            }
            catch (Exception e)
            {
                throw new Exception("Failed to connect to Plantronics SDK. See inner exception.", e);
            }
        }
예제 #3
0
파일: Form1.cs 프로젝트: aliotta/Samples
        private void Form1_Load(object sender, EventArgs e)
        {
            LogMessage(MethodInfo.GetCurrentMethod().Name, "Spokes Easy Demo Loading main form.");

            // Get the Spokes object singleton
            m_spokes = Spokes.Instance;

            m_spokes.SetLogger(this); // tell spokes to log debug output to me using DebugLogger interface

            if (!m_spokes.IsSpokesInstalled(3))
            {
                MessageBox.Show("Sorry, this application demo requires Spokes 3.0 or newer to be installed. Please exit, install Spokes, then run again.", "Spokes EZ Demo for Spokes 3.0");
            }
            else
            {
                // Sign up for Plantronics events of interest...

                // Wearing sensor:
                m_spokes.PutOn += spokes_DevicePutOn;
                m_spokes.TakenOff += spokes_DeviceTakenOff;

                // Proximity:
                m_spokes.Near += spokes_Near;
                m_spokes.Far += spokes_Far;
                m_spokes.InRange += spokes_InRange;
                m_spokes.OutOfRange += spokes_OutOfRange;
                m_spokes.Docked += spokes_Docked;
                m_spokes.UnDocked += spokes_UnDocked;

                // Mobile caller id:
                m_spokes.MobileCallerId += spokes_MobileCallerId;
                m_spokes.OnMobileCall += m_spokes_OnMobileCall;
                m_spokes.NotOnMobileCall += m_spokes_NotOnMobileCall;

                // Serial Number:
                m_spokes.SerialNumber += spokes_SerialNumber;

                // Call control:
                m_spokes.CallAnswered += spokes_CallAnswered;
                m_spokes.CallEnded += spokes_CallEnded;
                m_spokes.CallSwitched += spokes_CallSwitched;
                m_spokes.OnCall += spokes_OnCall;
                m_spokes.NotOnCall += spokes_NotOnCall;
                m_spokes.MuteChanged += spokes_DeviceMuteChanged;
                m_spokes.CallRequested += m_spokes_CallRequested;

                // Device attach/detach:
                m_spokes.Attached += spokes_DeviceAttached;
                m_spokes.Detached += spokes_DeviceDetached;
                m_spokes.CapabilitiesChanged += spokes_DeviceCapabilitiesChanged;

                // Multiline:
                m_spokes.MultiLineStateChanged += m_spokes_MultiLineStateChanged;

                // Button presses
                m_spokes.ButtonPress += m_spokes_ButtonPress;
                m_spokes.BaseButtonPress += m_spokes_BaseButtonPress;

                // QD connector
                m_spokes.Connected += new Spokes.ConnectedEventHandler(m_spokes_Connected);
                m_spokes.Disconnected += new Spokes.DisconnectedEventHandler(m_spokes_Disconnected);

                Show();
                Update();

                // Now connect to attached device, if any
                m_spokes.Connect(APP_NAME);
            }
        }
예제 #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // get Spokes singleton
            m_spokes = Spokes.Instance;

            // set us as the Spokes debug logger
            m_spokes.SetLogger(this);

            // register event handlers...

            // detect when Plantronics device is added or removed from PC:
            m_spokes.Attached += new Spokes.AttachedEventHandler(m_spokes_Attached);
            m_spokes.Detached += new Spokes.DetachedEventHandler(m_spokes_Detached);

            // detect when we are on a VoIP call:
            m_spokes.OnCall += new Spokes.OnCallEventHandler(m_spokes_OnCall);
            m_spokes.NotOnCall += new Spokes.NotOnCallEventHandler(m_spokes_NotOnCall);

            // detect when user answers/ends a call using headset buttons:
            m_spokes.CallAnswered += new Spokes.CallAnsweredEventHandler(m_spokes_CallAnswered);
            m_spokes.CallEnded += new Spokes.CallEndedEventHandler(m_spokes_CallEnded);

            // detect when we are on a Mobile call:
            m_spokes.OnMobileCall += new Spokes.OnMobileCallEventHandler(m_spokes_OnMobileCall);
            m_spokes.NotOnMobileCall += new Spokes.NotOnMobileCallEventHandler(m_spokes_NotOnMobileCall);
            m_spokes.MobileCallerId += new Spokes.MobileCallerIdEventHandler(m_spokes_MobileCallerId);

            // detect if we are wearing the headset:
            m_spokes.PutOn += new Spokes.PutOnEventHandler(m_spokes_PutOn);
            m_spokes.TakenOff += new Spokes.TakenOffEventHandler(m_spokes_TakenOff);

            // detect if headset is docked:
            m_spokes.Docked += new Spokes.DockedEventHandler(m_spokes_Docked);
            m_spokes.UnDocked += new Spokes.DockedEventHandler(m_spokes_UnDocked);

            // now connect to Spokes
            m_spokes.Connect("Hello Spokes 2.x World");
        }