예제 #1
0
        public void parseSingleChanTest()
        {
            UInt16 testVal = 1000;
            byte[] buf = new byte[Packet.MaxLength];
            for (int i = 0; i < 14; i++)
            {
                buf[2*i] = (byte)(testVal & 0xFF);
                buf[2*i+1 ] = (byte)(testVal >> 8);
            }

            Packet testPacket = new Packet(buf);
            PacketHandler pkthandleTest = new PacketHandler();

            List<int> results = pkthandleTest.parseSingleChan(testPacket);

            //    Assert.AreEqual(2048-testVal, results[3]);
        }
예제 #2
0
        private void cmdOpen_Click(object sender, EventArgs e)
        {
            if (cmdOpen.Text == "Open")
            {
                if (cboDevices.SelectedIndex >= 0)
                {
                    if (openDevice(cboDevices.SelectedIndex))
                    {
                        pktHandler = new PacketHandler();
                        pktHandler.processingDone += new PacketHandler.processingDoneHandler(ProcessUSBpacket_Done);
                        if (!dataLogger.LoggingActivated)
                        {
                            MessageBox.Show("Data will not be saved for this session because no file was selected.");
                        }
                        cmdOpen.Enabled = false;
                        sw.Restart();

                        btnFile.Enabled = false;

                        mEpReader.DataReceivedEnabled = true;
                        cmdOpen.Text = "Close";
                        tmr_cnt = 0;
                    }
                }
            }
            else
            {
                sw.Stop();

                closeDevice();
                cmdOpen.Text = "Open";
                dataLogger.Stop();
                btnFile.Enabled = true;
                tRecv.Text = Convert.ToString(sw.ElapsedMilliseconds) + "/" + Convert.ToString(tmr_cnt) ;
            }
            cmdOpen.Enabled = true;
        }