Exemplo n.º 1
0
 void autoputoncalibratetimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     // initiate auto calibration
     if (m_pltConnection != null)
     {
         m_pltlabsapi.calibrateService(PLTService.MOTION_TRACKING_SVC);
     }
 }
Exemplo n.º 2
0
        //Responsible for processing messages that have arrived via a websocket connection
        private static void HandleMessage(String message)
        {
            if (m_activeDevice == null)
            {
                Console.WriteLine("no active device, ignoring message");
                return;
            }

            PlantronicsMessage m = PlantronicsMessage.ParseMessageFromJSON(message);

            if (m.Type == PlantronicsMessage.MESSAGE_TYPE_SETTING)
            {
                if (m.Id == PlantronicsMessage.SETTING_HEADSET_INFO)
                {
                    PlantronicsMessage response = new PlantronicsMessage(PlantronicsMessage.MESSAGE_TYPE_SETTING, PlantronicsMessage.SETTING_HEADSET_INFO);
                    Device             device   = new Device();
                    //device.InternalName = m_activeDevice.InternalName;
                    //device.ManufacturerName = m_activeDevice.ManufacturerName;
                    //device.ProductName = m_activeDevice.ProductName;
                    //device.VendorId = String.Format("0x{0:X}", m_activeDevice.VendorID);
                    //device.ProductId = String.Format("0x{0:X}", m_activeDevice.ProductID);
                    //device.VersionNumber = m_activeDevice.VersionNumber;

                    //TODO fixup CAB - make this eventually come from Spokes or a dictionary lookup
                    device.NumberOfChannels = 1;
                    device.SampleRate       = 16000;

                    response.AddToPayload("device", device);
                    BroadcastMessage(response);
                }
            }
            else if (m.Type == PlantronicsMessage.MESSAGE_TYPE_COMMAND)
            {
                if (m.Id == PlantronicsMessage.COMMAND_RING_ON)
                {
                    Console.WriteLine("Ringing headset");
                    Object o = null;
                    if (!m.Payload.TryGetValue("offer", out o))
                    {
                        Console.WriteLine("Unable to get caller id from the message skipping headset ring operation");
                        return;
                    }
                    offer = o as Hashtable;
                    //ContactCOM contact = new ContactCOM() { Name = offer["from"] as String };
                    //callId = (int)(double)m.Payload["callId"];
                    //CallCOM call = new CallCOM() { Id = callId };
                    //m_comSession.CallCommand.IncomingCall(call, contact, RingTone.RingTone_Unknown, AudioRoute.AudioRoute_ToHeadset);
                }
                else if (m.Id == PlantronicsMessage.COMMAND_CALIBRATE)
                {
                    pltlabsapi.calibrateService(PLTService.MOTION_TRACKING_SVC);
                }
                //else if (m.Id == PlantronicsMessage.COMMAND_HANG_UP)
                //{
                //    CallCOM call = new CallCOM() { Id = callId };
                //    m_comSession.CallCommand.TerminateCall(call);

                //}
                //else if (m.Id == PlantronicsMessage.COMMAND_RING_OFF)
                //{
                //    Console.WriteLine("Turning ring off headset");
                //    m_activeDevice.HostCommand.Ring(false);

                //}
                //else if (m.Id == PlantronicsMessage.COMMAND_MUTE_ON)
                //{
                //    Console.WriteLine("Muting headset");
                //    m_activeDevice.DeviceListener.Mute = true;

                //}
                //else if (m.Id == PlantronicsMessage.COMMAND_MUTE_OFF)
                //{
                //    Console.WriteLine("Unmuting headset");
                //    m_activeDevice.DeviceListener.Mute = false;

                //}
            }
            else if (m.Type == PlantronicsMessage.MESSAGE_TYPE_EVENT)
            {
                Console.WriteLine("Event message received");
            }
        }
Exemplo n.º 3
0
 void autoputoncalibratetimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     m_pltlabsapi.calibrateService(PLTService.MOTION_TRACKING_SVC);
 }