示例#1
0
        public void Connect()
        {
            PMUSBInterface.Initialize();
            var    deviceNo = PMUSBInterface.DiscoverPMs(PMUSBInterface.PMtype.PM5_PRODUCT_NAME);
            string serialNo = PMUSBInterface.getSerialNumber(0);

            PMUSBInterface.InitializeProtocol(1000);
        }
示例#2
0
        public uint getNewDistance()
        {
            CSAFECommand command = new CSAFECommand(0);

            command.CommandsBytes.Add((uint)CSAFECommands.CSAFE_GETHORIZONTAL_CMD);
            var data = command.Execute();

            return(PMUSBInterface.getMSB(data, 2));
            //return tDistance;
        }
示例#3
0
        private void btn_start_Click(object sender, RoutedEventArgs e)
        {
            PMUSBInterface.Initialize();
            var    deviceNo = PMUSBInterface.DiscoverPMs(PMUSBInterface.PMtype.PM5_PRODUCT_NAME);
            string message  = "";

            if (deviceNo > 0)
            {
                Rowing rowWindow = new Rowing(ref logic);
                rowWindow.ShowDialog();
            }
            else
            {
                message += "Nincs csatlakoztatva eszköz!";
                MessageBox.Show(message);
            }
        }
示例#4
0
        public PerformanceMonitor InitErg(ushort ergAddress)
        {
            //init the C2 interface
            //TODO: What if there are multiple Ergs connected, is it a good idea to init the interface multiple times?
            PMUSBInterface.Initialize();
            PMUSBInterface.InitializeProtocol(999);

            ushort numErgs = PMUSBInterface.DiscoverPMs(PMUSBInterface.PMtype.PM3TESTER_PRODUCT_NAME);

            numErgs += PMUSBInterface.DiscoverPMs(PMUSBInterface.PMtype.PM3_PRODUCT_NAME);
            numErgs += PMUSBInterface.DiscoverPMs(PMUSBInterface.PMtype.PM3_PRODUCT_NAME2);
            numErgs += PMUSBInterface.DiscoverPMs(PMUSBInterface.PMtype.PM4_PRODUCT_NAME);
            numErgs += PMUSBInterface.DiscoverPMs(PMUSBInterface.PMtype.PM5_PRODUCT_NAME);
            if (numErgs == 0)
            {
                //do not init the PM before there's an actual PM connected
                throw new PMUSBInterface.PMUSBException("No erg found", -1);
            }
            return(new PerformanceMonitor(ergAddress));
        }
示例#5
0
 private void btn_testconnection_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         PMUSBInterface.Initialize();
         var    deviceNo = PMUSBInterface.DiscoverPMs(PMUSBInterface.PMtype.PM5_PRODUCT_NAME);
         string message  = "";
         if (deviceNo > 0)
         {
             string serialNo = PMUSBInterface.getSerialNumber(0);
             message  = "Eszközök csatlakoztatva: " + deviceNo.ToString() + "\n";
             message += "Szériaszám: " + serialNo.ToString();
         }
         else
         {
             message += "Nincs csatlakoztatva eszköz!";
         }
         MessageBox.Show(message);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Hiba történt. Hibaüzenet: " + ex.Message);
     }
 }