Пример #1
0
        public void infoUpdated(PLTConnection pltConnection, PLTInfo pltInfo)
        {
            if (pltInfo != null && pltInfo.m_data != null)
            {
                switch (pltInfo.m_serviceType)
                {
                case PLTService.SENSOR_CAL_STATE_SVC:
                    PLTSensorCal caldata = (PLTSensorCal)pltInfo.m_data;
                    m_calibrated = caldata.m_isgyrocal;
                    break;

                case PLTService.MOTION_TRACKING_SVC:
                    PLTMotionTrackingData motiondata = (PLTMotionTrackingData)pltInfo.m_data;
                    HeadsetTrackingUpdate(motiondata);
                    break;

                case PLTService.WEARING_STATE_SVC:
                    PLTWearingState weardata = (PLTWearingState)pltInfo.m_data;
                    m_worn = weardata.m_worn;
                    if (weardata.m_worn && !weardata.m_isInitialStateEvent)
                    {
                        // headset was put on
                        // lets auto calibrate
                        m_autoputoncalibratetimer.Start();
                    }
                    break;
                }
            }
        }
Пример #2
0
        public void infoUpdated(PLTConnection pltConnection, PLTInfo pltInfo)
        {
            // make sure we have some data...
            if (pltInfo != null && pltInfo.m_data != null)
            {
                switch (pltInfo.m_serviceType)
                {
                case PLTService.MOTION_TRACKING_SVC:
                    PLTMotionTrackingData trackingdata = (PLTMotionTrackingData)pltInfo.m_data;
                    //DebugPrint(MethodInfo.GetCurrentMethod().Name, "Motion Tracking Update received:\r\n" +
                    //"raw q0: " + trackingdata.m_rawquaternion[0] + "\r\n" +
                    //"raw q1: " + trackingdata.m_rawquaternion[1] + "\r\n" +
                    //"raw q2: " + trackingdata.m_rawquaternion[2] + "\r\n" +
                    //"raw q3: " + trackingdata.m_rawquaternion[3]);
                    // great we got some angles - lets update the GUI!
                    HeadsetTrackingUpdateGUI(trackingdata);
                    break;

                case PLTService.MOTION_STATE_SVC:
                    // NOTE: this service is not yet available, no data will come here
                    break;

                case PLTService.SENSOR_CAL_STATE_SVC:
                    PLTSensorCal caldata = (PLTSensorCal)pltInfo.m_data;
                    UpdateCalibrationGUI(caldata);
                    break;

                case PLTService.PEDOMETER_SVC:
                    PLTPedometerCount peddata = (PLTPedometerCount)pltInfo.m_data;
                    m_lastpedometercount = peddata.m_pedometercount;
                    if (m_lastpedometerreset == -1)
                    {
                        m_lastpedometerreset = m_lastpedometercount;
                    }
                    UpdatePedometerGUI();
                    break;

                case PLTService.TAP_SVC:
                    UpdateTapInfoGUI((PLTTapInfo)pltInfo.m_data);
                    break;

                case PLTService.WEARING_STATE_SVC:
                    PLTWearingState wearingstate = (PLTWearingState)pltInfo.m_data;
                    DebugPrint(MethodInfo.GetCurrentMethod().Name, "Wearing State Update received:\r\n" +
                               "Is Worn?: " + wearingstate.m_worn + "\r\n" +
                               "Initial State?: " + wearingstate.m_isInitialStateEvent);
                    if (wearingstate.m_worn && !wearingstate.m_isInitialStateEvent)
                    {
                        // they have put headset on, start the auto calibrate timer
                        // to zero angles in 2 seconds time
                        m_autoputoncalibratetimer.Start();
                    }
                    break;

                case PLTService.FREE_FALL_SVC:
                    UpdateFreeFallGUI((PLTFreeFall)pltInfo.m_data);
                    break;

                case PLTService.PROXIMITY_SVC:
                    PLTProximity proximitystate = (PLTProximity)pltInfo.m_data;
                    DebugPrint(MethodInfo.GetCurrentMethod().Name, "Proximity State Update received:\r\n" +
                               "Proximity State: " + proximitystate.m_proximity);
                    break;

                case PLTService.CALLERID_SVC:
                    PLTCallerId callerid = (PLTCallerId)pltInfo.m_data;
                    DebugPrint(MethodInfo.GetCurrentMethod().Name, "Caller Id Update received:\r\n" +
                               "Caller Id: " + callerid.m_callerid + "\r\n" +
                               "Line type: " + callerid.m_calltype);
                    break;

                case PLTService.CALLSTATE_SVC:
                    PLTCallStateInfo callinfo = (PLTCallStateInfo)pltInfo.m_data;
                    DebugPrint(MethodInfo.GetCurrentMethod().Name, "Call State Update received:\r\n" +
                               "Call State Event Type: " + callinfo.m_callstatetype + "\r\n" +
                               "Call Status: " + callinfo.m_callstate + "\r\n" +
                               "Internal Call Id: " + callinfo.m_callid + "\r\n" +
                               "Call Source: " + callinfo.m_callsource + "\r\n" +
                               "Was Incoming?: " + callinfo.m_incoming);
                    break;

                case PLTService.DOCKSTATE_SVC:
                    PLTDock dockedstate = (PLTDock)pltInfo.m_data;
                    DebugPrint(MethodInfo.GetCurrentMethod().Name, "Docked State Update received:\r\n" +
                               "Docked State: " + dockedstate.m_isdocked + "\r\n" +
                               "Is Initial State?: " + dockedstate.m_isinitialstatus);
                    break;

                case PLTService.CHARGESTATE_SVC:
                    UpdateBatteryLevelGUI((PLTBatteryState)pltInfo.m_data);
                    break;
                }
            }
            else
            {
                // no data...
                DebugPrint(MethodInfo.GetCurrentMethod().Name, "WARNING: no data for service subscription:\r\n" +
                           "SERVICE: " + (pltInfo != null ? pltInfo.m_serviceType.ToString() : "null"));
            }
        }