public AbstractWheel(int size, bool isWide)
 {
     this._size   = size;
     this._isWide = isWide;
     _spoke       = new Spokes();
     _bearings    = new Bearings();
 }
        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");
        }
Exemple #3
0
 public AbstractWheel(int size, bool isWide)
 {
     this._size   = size;
     this._IsWide = isWide;
     _spokes      = new Spokes();   //added new 3-5-19 Visitor Design Pattern
     _bearings    = new Bearings(); //added new 3-5-19  Visitor Design Pattern
 }
Exemple #4
0
        public SpokesIntegration()
        {
            pltlabsapi = new PLTLabsAPI(this);

            spokes = Spokes.Instance;

            InitializeWebSockets();
        }
        /// <summary>
        /// Constructor for PLTLabsAPI object which is used to connect
        /// to the Plantronics motion sensor headset devices.
        /// ***NOTE: Only instantiate 1 of these objects - pending to do make a singleton***
        /// </summary>
        /// <param name="aCallBackHandler">Pass reference to your object class that implements
        /// the PLTLabsCallbackHandler interface to be able to receive motion tracking and other
        /// sensor data.</param>
        public PLTLabsAPI(PLTLabsCallbackHandler aCallBackHandler)
        {
            m_callbackhandler = aCallBackHandler;

            m_quatproc = new QuaternionProcessor(this);

            m_spokes = Spokes.Instance;

            // register for device attach/detach events
            m_spokes.Attached += new Spokes.AttachedEventHandler(m_spokes_Attached);
            m_spokes.Detached += new Spokes.DetachedEventHandler(m_spokes_Detached);

            // Register for some special device events that we need initial
            // status for as soon as we call connect
            m_spokes.PutOn    += new Spokes.PutOnEventHandler(m_spokes_PutOn);
            m_spokes.TakenOff += new Spokes.TakenOffEventHandler(m_spokes_TakenOff);

            // register for battery level events
            m_spokes.BatteryLevelChanged += new Spokes.BatteryLevelChangedEventHandler(m_spokes_BatteryLevelChanged);

            // register for device proximity events
            // NOTE: these are also used to infer whether the actual Concept 1 headset is connected
            // to the BT300 dongle - i.e. if we have any of Near/Far/InRange then we can announce
            // the device as attached to the application
            m_spokes.OutOfRange += new Spokes.OutOfRangeEventHandler(m_spokes_OutOfRange);
            m_spokes.InRange    += new Spokes.InRangeEventHandler(m_spokes_InRange);
            m_spokes.Near       += new Spokes.NearEventHandler(m_spokes_Near);
            m_spokes.Far        += new Spokes.FarEventHandler(m_spokes_Far);

            // call state events:
            m_spokes.MobileCallerId  += new Spokes.MobileCallerIdEventHandler(m_spokes_MobileCallerId);
            m_spokes.OnCall          += new Spokes.OnCallEventHandler(m_spokes_OnCall);
            m_spokes.OnMobileCall    += new Spokes.OnMobileCallEventHandler(m_spokes_OnMobileCall);
            m_spokes.NotOnCall       += new Spokes.NotOnCallEventHandler(m_spokes_NotOnCall);
            m_spokes.NotOnMobileCall += new Spokes.NotOnMobileCallEventHandler(m_spokes_NotOnMobileCall);

            // Docked state
            m_spokes.Docked   += new Spokes.DockedEventHandler(m_spokes_Docked);
            m_spokes.UnDocked += new Spokes.DockedEventHandler(m_spokes_UnDocked);

            m_isConnectedToSpokes = m_spokes.Connect("PLTLabsAPI");

            // we are connected to Spokes at this point in time
            // however lets still let connecting app openConnection to a specific device
            // (even though Spokes PC only has 1 active call control device configured
            //  through spokes settings)

            // mark constructor as done so we can avoid sending
            // client app a DeviceChanged callback
            m_constructordone = true;
        }
Exemple #6
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();
        }
        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);

#if doubloon
            // NEW CC events
            m_spokes.Connected    += new Spokes.ConnectedEventHandler(m_spokes_Connected);
            m_spokes.Disconnected += new Spokes.DisconnectedEventHandler(m_spokes_Disconnected);
#endif
            // now connect to Spokes
            m_spokes.Connect("Hello Spokes 3.0 World");
        }
Exemple #8
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();
        }
Exemple #9
0
 internal PLTConnection(Spokes aSpokesConnection, PLTLabsAPI aPLTLabsAPI, PLTDevice aDevice)
 {
     m_spokes     = aSpokesConnection;
     m_pltlabsapi = aPLTLabsAPI;
     m_device     = aDevice;
 }
Exemple #10
0
 public void Visit(Spokes spokes)
 {
     _spokesCount++;
 }
Exemple #11
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);
            }
        }
Exemple #12
0
        private bool connected = false; // connected to Spokes yet?

        public SpokesSocketInterface(Spokes aSpokes)
        {
            spokes = aSpokes;
        }