Пример #1
0
        public MainWindowViewModel()
        {
            _spokes = Spokes.Instance;
            _spokes.Connected += OnHeadsetConnected;
            _spokes.Connect("Interaction Client Launcher");

            string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            FilePath = Path.Combine(assemblyFolder, "AutoStartSettings.xml");

            _xmlSettings = new XmlDocument();

            if (File.Exists(FilePath))
            {
                _xmlSettings.Load(FilePath);
            }
            else
            {
                _xmlSettings.LoadXml("<settings/>");
            }

            StartClientWhenHeadsetIsConnected = GetBoolSetting("StartClientWhenHeadsetIsConnected", false);
            NtAuth = GetBoolSetting("NtAuth", true);
            CicServer = GetStringSetting("CicServer", String.Empty);
            Station = GetStringSetting("Station", String.Empty);
        }
Пример #2
0
        static void Main(string[] args)
        {
            spokes = Spokes.Instance;
            spokes.PutOn += spokes_PutOn;
            spokes.TakenOff += spokes_TakenOff;
            spokes.Connect("Spokes Quick Start");

            Console.WriteLine("Press enter to quit...");
            Console.ReadLine();

            spokes.PutOn -= spokes_PutOn;
            spokes.TakenOff -= spokes_TakenOff;
            spokes.Disconnect();
        }
Пример #3
0
        static void Main(string[] args)
        {
            spokes = Spokes.Instance;
            spokes.PutOn += new Spokes.PutOnEventHandler(spokes_PutOn);
            spokes.TakenOff += new Spokes.TakenOffEventHandler(spokes_TakenOff);
            spokes.Near += new Spokes.NearEventHandler(spokes_Near);
            spokes.Far += new Spokes.FarEventHandler(spokes_Far);
            spokes.InRange += new Spokes.InRangeEventHandler(spokes_InRange);
            spokes.OutOfRange += new Spokes.OutOfRangeEventHandler(spokes_OutOfRange);
            spokes.Docked += new Spokes.DockedEventHandler(spokes_Docked);
            spokes.UnDocked += new Spokes.DockedEventHandler(spokes_UnDocked);
            spokes.MobileCallerId += new Spokes.MobileCallerIdEventHandler(spokes_MobileCallerId);
            spokes.OnMobileCall += new Spokes.OnMobileCallEventHandler(spokes_OnMobileCall);
            spokes.NotOnMobileCall += new Spokes.NotOnMobileCallEventHandler(spokes_NotOnMobileCall);
            spokes.SerialNumber += new Spokes.SerialNumberEventHandler(spokes_SerialNumber);
            spokes.CallAnswered += new Spokes.CallAnsweredEventHandler(spokes_CallAnswered);
            spokes.CallEnded += new Spokes.CallEndedEventHandler(spokes_CallEnded);
            spokes.CallSwitched += new Spokes.CallSwitchedEventHandler(spokes_CallSwitched);
            spokes.OnCall += new Spokes.OnCallEventHandler(spokes_OnCall);
            spokes.NotOnCall += new Spokes.NotOnCallEventHandler(spokes_NotOnCall);
            spokes.MuteChanged += new Spokes.MuteChangedEventHandler(spokes_MuteChanged);
            spokes.LineActiveChanged += new Spokes.LineActiveChangedEventHandler(spokes_LineActiveChanged);
            spokes.Attached += new Spokes.AttachedEventHandler(spokes_Attached);
            spokes.Detached += new Spokes.DetachedEventHandler(spokes_Detached);
            spokes.CapabilitiesChanged += new Spokes.CapabilitiesChangedEventHandler(spokes_CapabilitiesChanged);
            spokes.MultiLineStateChanged += new Spokes.MultiLineStateChangedEventHandler(spokes_MultiLineStateChanged);

            // NOTE: we will not call Connect on spokes until client app has connected
            // otherwise client will miss initial state events!

            socket = new SpokesSocketInterface(spokes);
            socket.StartSocket();

            // TODO make socket threaded so you are not stuck in a loop in above call...
            Console.WriteLine("Enter to quit");
            Console.ReadLine();

            socket.StopSocket();
        }
Пример #4
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.
        }
Пример #5
0
 public SpokesSocketInterface(Spokes aSpokes)
 {
     spokes = aSpokes;
 }
Пример #6
0
        /// <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);
            }
        }
Пример #7
0
        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);
            }
        }
Пример #8
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Obtain Plantronics API singleton
            m_spokes = Spokes.Instance;

            // Register for Plantronics API events of interest

            // Have I got a Plantronics device?
            m_spokes.Attached += new Spokes.AttachedEventHandler(m_spokes_Attached);
            m_spokes.Detached += new Spokes.DetachedEventHandler(m_spokes_Detached);

            // Am I wearing Plantronics device?
            m_spokes.PutOn += new Spokes.PutOnEventHandler(m_spokes_PutOn);
            m_spokes.TakenOff += new Spokes.TakenOffEventHandler(m_spokes_TakenOff);

            // Is Plantronics device docked?
            m_spokes.Docked += new Spokes.DockedEventHandler(m_spokes_Docked);
            m_spokes.UnDocked += new Spokes.DockedEventHandler(m_spokes_UnDocked);

            // Is Plantronics device near or far
            m_spokes.Near += new Spokes.NearEventHandler(m_spokes_Near);
            m_spokes.Far += new Spokes.FarEventHandler(m_spokes_Far);

            // Is Plantronics device connected (InRange) or disconnected (OutOfRange)
            m_spokes.InRange += new Spokes.InRangeEventHandler(m_spokes_InRange);
            m_spokes.OutOfRange += new Spokes.OutOfRangeEventHandler(m_spokes_OutOfRange);

            // Did Plantronics device disconnect from paired mobile device (receive ProximityDisabled event when that occurs)
            m_spokes.ProximityDisabled += new Spokes.ProximityDisabledEventHandler(m_spokes_ProximityDisabled);
            m_spokes.ProximityEnabled += new Spokes.ProximityEnabledEventHandler(m_spokes_ProximityEnabled);

            // Finally connect to Plantronics API
            m_spokes.Connect("ScreenLockSample");
        }
Пример #9
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");
        }
Пример #10
0
 public void Dispose()
 {
     _spokes.Disconnect();
     _spokes = null;
 }