예제 #1
0
 public MainViewModel()
 {
     Current    = this;
     Arm        = new Arm();
     COMHandler = new COMHandler(Arm);
     loadCommands();
 }
예제 #2
0
        private void InitiateGSR()
        {
            bool connected = false;

            foreach (string port in COMHandler.Ports())
            {
                if (port != hrCollect.MyPort())
                {
                    Log.LogMessage("Trying to bind GSR to port: " + port);
                    gsrCollect = new GSRCollector(port, fusionData);
                    if (gsrCollect.TestPort())
                    {
                        connected    = true;
                        gsrPort.Text = "(" + port + ")";
                        Log.LogMessageSameLine("Trying to bind GSR to port: " + port + " - SUCCES");
                    }
                    else
                    {
                        Log.LogMessageSameLine("Trying to bind GSR to port: " + port + " - FAILED");
                    }
                }
            }

            if (!connected)
            {
                Log.LogMessage("GSR not found");
                gsrReady.BackColor = Color.Red;
            }
            else
            {
                gsrReady.BackColor = Color.Green;
                GSRDeviceReady     = true;
            }
        }
예제 #3
0
        private byte[] GetReading()
        {
            byte[] input = new byte[8];
            input[0] = COMHandler.ReadFromPort(comPort, 1, TIMEOUT_MS)[0];
            COMHandler.ReadFromPort(comPort, 7, TIMEOUT_MS).CopyTo(input, 1);

            return(input);
        }
예제 #4
0
        public bool TestPort()
        {
            COMHandler.OpenPort(this.comPort);
            bool result = VerifyByteStream(GetReading());

            COMHandler.ClosePort(this.comPort);

            return(result);
        }
예제 #5
0
 void CollectorTask()
 {
     COMHandler.OpenPort(comPort);
     while (!stopCollecting)
     {
         if (comPort.BytesToRead > 0)
         {
             fd.AddGSRData(ReadData());
         }
     }
     COMHandler.ClosePort(comPort);
     Log.LogMessage("Stopped GSR");
 }
예제 #6
0
 void CollectorTask()
 {
     COMHandler.OpenPort(arduino);
     while (!stopCollecting)
     {
         if (arduino.BytesToRead > 0)
         {
             fd.AddHRData(ReadData());
         }
     }
     COMHandler.ClosePort(arduino);
     Log.LogMessage("Stopped HR");
 }
예제 #7
0
        public bool Connect()
        {
            bool connected = false;

            foreach (var item in COMHandler.Ports())
            {
                Log.LogMessage("Trying to bind HR to port: " + item);
                if (COMHandler.IsArduino(item))
                {
                    arduino   = COMHandler.PortNamed(item, 115200, Parity.None, StopBits.One, 8);
                    connected = true;
                    Log.LogMessageSameLine("Trying to bind HR to port: " + item + " - SUCCES");
                    break;
                }
                else
                {
                    Log.LogMessageSameLine("Trying to bind HR to port: " + item + " - FAILED");
                }
            }

            return(connected);
        }
예제 #8
0
 public GSRCollector(string PortName, FusionData fd)
 {
     this.comPort = COMHandler.PortNamed(PortName, 19200, Parity.None, StopBits.One, 8);
     this.fd      = fd;
 }