Beispiel #1
0
        public void ConnectionOpen(PLTConnection pltConnection)
        {
            m_pltConnection = pltConnection;

            if (m_pltConnection != null)
            {
                pltlabsapi.subscribe(PLTService.MOTION_TRACKING_SVC, PLTMode.On_Change);
                pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Offset_Calibrated);
                pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Format_Orientation);
                pltlabsapi.subscribe(PLTService.SENSOR_CAL_STATE_SVC, PLTMode.On_Change);
            }
        }
        public void ConnectionOpen(PLTConnection pltConnection)
        {
            m_pltConnection = pltConnection;

            if (pltConnection != null)
            {
                DebugPrint(MethodInfo.GetCurrentMethod().Name, "Success! Connection was opened!: " + pltConnection.m_device.m_ProductName);

                // lets register for headtracking service
                DebugPrint(MethodInfo.GetCurrentMethod().Name, "About to register for head tracking data.");
                m_pltlabsapi.subscribe(PLTService.MOTION_TRACKING_SVC, PLTMode.On_Change);

                //m_pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Offset_Raw);
                m_pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Offset_Calibrated);
                //m_pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Offset_Calibrated,
                //    new PLTQuaternion
                //    {
                //        m_quaternion = new double[4] { 1.0d, 0.0d, 0.0d, 0.0d }
                //    });
                //m_pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Format_Quaternion);
                m_pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Format_Orientation);

                m_pltlabsapi.subscribe(PLTService.SENSOR_CAL_STATE_SVC, PLTMode.On_Change);

                // check we subcribed ok...
                DebugPrintSubscribedServices();

                ConnStatusLbl.Dispatcher.Invoke(new Action(delegate()
                {
                    if (pltConnection != null)
                    {
                        ConnStatusLbl.Content = "Yes";
                        DeviceLbl.Content     = m_pltConnection.DeviceName;
                    }
                    else
                    {
                        ConnStatusLbl.Content = "No";
                        DeviceLbl.Content     = "-";
                    }
                }));
            }
        }
Beispiel #3
0
        public void ConnectionOpen(PLTConnection pltConnection)
        {
            m_pltConnection = pltConnection;

            if (pltConnection != null)
            {
                DebugPrint(MethodInfo.GetCurrentMethod().Name, "Success! Connection was opened!: " + pltConnection.m_device.m_ProductName);

                UpdateVersionInfoGUI();

                DebugPrint(MethodInfo.GetCurrentMethod().Name, "About to register for headset services.");

                // 1. MOTION_TRACKING_SVC Lets register for headtracking service:
                m_pltlabsapi.subscribe(PLTService.MOTION_TRACKING_SVC, PLTMode.On_Change);
                //m_pltlabsapi.subscribe(PLTService.MOTION_TRACKING_SVC, PLTMode.Periodic, 500);

                // Example: configure motion tracking to utilise uncalibrated (raw) quaternions:
                //m_pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Offset_Raw);

                // Example: configure motion tracking to utilise calibrated quaternions (based on current quaternion):
                m_pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Offset_Calibrated);

                // Example: configure motion tracking to utilise calibrated quaternions (based on user-specified quaternion):
                //m_pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Offset_Calibrated,
                //    new PLTQuaternion
                //    {
                //        m_quaternion = new double[4] { 1.0d, 0.0d, 0.0d, 0.0d }
                //    });

                // Example: configure motion tracking to provide angles in quaternion format:
                //m_pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Format_Quaternion);

                // Example: configure motion tracking to provide angles in orientation format (heading,pitch,roll):
                m_pltlabsapi.configureService(PLTService.MOTION_TRACKING_SVC, PLTConfiguration.MotionSvc_Format_Orientation);

                // 2. MOTION_STATE_SVC Lets register for motion state service
                // (NOTE: not currently implemented, so commenting out)
                //m_pltlabsapi.subscribe(PLTService.MOTION_STATE_SVC, PLTMode.Periodic, 500);

                // 3. SENSOR_CAL_STATE_SVC
                m_pltlabsapi.subscribe(PLTService.SENSOR_CAL_STATE_SVC, PLTMode.On_Change);

                // 4. PEDOMETER_SVC
                m_pltlabsapi.subscribe(PLTService.PEDOMETER_SVC, PLTMode.On_Change);

                // 5. TAP_SVC
                m_pltlabsapi.subscribe(PLTService.TAP_SVC, PLTMode.On_Change);

                // 6. WEARING_STATE_SVC Lets register for wearing state service
                //m_pltlabsapi.subscribe(PLTService.WEARING_STATE_SVC, PLTMode.Periodic, 1000);
                m_pltlabsapi.subscribe(PLTService.WEARING_STATE_SVC, PLTMode.On_Change);

                // 7. FREE_FALL_SVC
                m_pltlabsapi.subscribe(PLTService.FREE_FALL_SVC, PLTMode.On_Change);

                // 8. PROXIMITY_SVC
                m_pltlabsapi.subscribe(PLTService.PROXIMITY_SVC, PLTMode.On_Change);

                // 9. CALLERID_SVC
                m_pltlabsapi.subscribe(PLTService.CALLERID_SVC, PLTMode.On_Change);

                // 10. CALLSTATE_SVC
                m_pltlabsapi.subscribe(PLTService.CALLSTATE_SVC, PLTMode.On_Change);

                // 11. DOCKSTATE_SVC
                m_pltlabsapi.subscribe(PLTService.DOCKSTATE_SVC, PLTMode.On_Change);

                // 12. CHARGESTATE_SVC Lets register for battery level service
                m_pltlabsapi.subscribe(PLTService.CHARGESTATE_SVC, PLTMode.Periodic, 2000);

                // check we subcribed ok...
                DebugPrintSubscribedServices();

                DebugPrint(MethodInfo.GetCurrentMethod().Name, "Connected ok? "
                           + (pltConnection != null ? "Yes" : "No"));
            }
        }