public Form1() { testthreads = new Thread[100]; volt = new int[5]; curr = new int[5]; recvcmdbuf = new byte[100][]; analyzer = new HWCommandAnalyzer(); analyzer.SingleQuiryResponse_Received += Analyzer_SingleQuiryResponse_Received; analyzer.RxModeResponse_Received += Analyzer_RxInitResponse_Received; analyzer.ConfigLoadResponse_Received += Analyzer_ConfigLoadResponse_Received; analyzer.ControlError_Received += Analyzer_ControlError_Received; analyzer.ReceivedPower8b_Received += Analyzer_ReceivedPower8b_Received; analyzer.SingleQuiryPowersupplyResponse_Received += Analyzer_SingleQuiryPowersupplyResponse_Received; analyzer.PowersupplyConfigResponse_Received += Analyzer_PowersupplyConfigResponse_Received; cmdwait = new EventWaitHandle[100]; for (int i = 0; i < 100; i++) { cmdwait[i] = new EventWaitHandle(false, EventResetMode.AutoReset); cmdwait[i].Reset(); } SerialPort sp = new SerialPort("COM12", 115200, Parity.None, 8, StopBits.One); sbp = new SerialBusProcessor.SerialBusProcessor(this, 256, sp); sbp.SerialCommandArrival += Sbp_SerialCommandArrial; sbp.SerialDataArrival += Sbp_SerialDataArrival; InitializeComponent(); sbp.OpenSerialBusProcessor(); }
private void Analyzer_SingleQuiryPowersupplyResponse_Received(HWCommandAnalyzer dca, int index) { int volt = dca.PowersupplyResp.volt_h * 256 + dca.PowersupplyResp.volt_l; int curr = dca.PowersupplyResp.curr_h * 256 + dca.PowersupplyResp.curr_l; Console.WriteLine(string.Format("power single quriy resp.Volt:{0},Curr:{1}", volt, curr)); flag = 0x0e; }
private void Analyzer_SingleQuiryResponse_Received(HWCommandAnalyzer dca, int index) { MessageBox.Show("Load" + dca.SingleQuiryResult.channel.ToString() + "-Current:" + (dca.SingleQuiryResult.curr_h * 256 + dca.SingleQuiryResult.curr_l).ToString() + "Load" + dca.SingleQuiryResult.channel.ToString() + "-Voltage:" + (dca.SingleQuiryResult.volt_h * 256 + dca.SingleQuiryResult.volt_l).ToString()); }
private void Analyzer_RxInitResponse_Received(HWCommandAnalyzer dca, int index) { Console.WriteLine(((RxMode)(dca.RxModeResp.mode)).ToString()); }
private void Analyzer_ControlError_Received(HWCommandAnalyzer dca, int index) { richTextBox1.AppendText("RX" + index.ToString() + ":" + "Control Error:" + ((sbyte)dca.CEPacket.QiCE).ToString() + "\n"); richTextBox1.AppendText("Current:" + (dca.CEPacket.Iout_h * 256 + dca.CEPacket.Iout_l).ToString() + "\n"); }
private void Analyzer_ReceivedPower8b_Received(HWCommandAnalyzer dca, int index) { richTextBox1.AppendText("RX" + index.ToString() + ":" + "Received Power:" + dca.RP8Packet.QiRP.ToString() + "\n"); }
private void Analyzer_ConfigLoadResponse_Received(HWCommandAnalyzer dca, int index) { //MessageBox.Show((dca.ConfigLoadResp.curr_h * 256 + dca.ConfigLoadResp.curr_l).ToString()); }
private void Analyzer_PowersupplyConfigResponse_Received(HWCommandAnalyzer dca, int index) { Console.WriteLine(string.Format("power config resp{0}", iii++)); resp = 1; }