Beispiel #1
0
        /// <summary>
        /// Converts byte to command and then executes command
        /// </summary>
        /// <param name="receivedCommand"></param>
        public void handleCommand(byte[] receivedCommand)
        {
            int command = (int)receivedCommand[2];

            switch (command)
            {
            // 0 is Start Cameras
            case 0:
            {
                MotionCapture.StartCameras();
                camerasStartedEvent();
                break;
            }

            // 1 is Stop Cameras
            case 1:
            {
                MotionCapture.StopCameras();
                break;
            }

            // 2 is Send Camera Coordinates
            case 2:
            {
                MotionCapture.UpdateCameraList();
                OptitrackCameraList.TransmitListOfCameras();
                break;
            }

            // 3 is Start Treadmill At Fixed Speed
            case 3:
            {
                TreadmillController.SetSpeed((float)BitConverter.ToDouble(receivedCommand, 4));
                break;
            }

            // 4 is Stop Treadmill
            case 4:
            {
                TreadmillController.SetSpeed(0.0f);
                break;
            }

            //8 is toggle feet on/off
            case 8:
            {
                break;
            }

            default:
            {
                System.Diagnostics.Debug.WriteLine("Invalid command received: " + command.ToString());
                break;
            }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Starts and stops the cameras server-side
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonCameraControl_Click(object sender, EventArgs e)
 {
     if (buttonCameraControl.Text == "Start Cameras")
     {
         statusBar1.Text = "Starting Cameras";
         MotionCapture.LoadProfile(textBoxCalibrationFilePath.Text);
         MotionCapture.StartCameras();
         statusBar1.Text = "Cameras Started";
         timerPollCameraInterface.Enabled = true;
         buttonCameraControl.Text         = "Stop Cameras";
     }
     else
     {
         timerPollCameraInterface.Enabled = false;
         MotionCapture.StopCameras();
         statusBar1.Text          = "Cameras Stopped";
         buttonCameraControl.Text = "Start Cameras";
     }
 }