diff --git a/UHFHelper/UHFCardHelper.cs b/UHFHelper/UHFCardHelper.cs index c1e117d..e062949 100644 --- a/UHFHelper/UHFCardHelper.cs +++ b/UHFHelper/UHFCardHelper.cs @@ -139,7 +139,7 @@ namespace UHFHelper //输出模式 int Reader_bit1 = 0; //蜂鸣开关 - int Reader_bit2 = 0; + int Reader_bit2 = 1; //起始地址 int Reader_bit3 = 0; //是否SYRIS485输出 diff --git a/UHFHelper/UHF_RS485_Helper.cs b/UHFHelper/UHF_RS485_Helper.cs index 2d2bec3..b00b459 100644 --- a/UHFHelper/UHF_RS485_Helper.cs +++ b/UHFHelper/UHF_RS485_Helper.cs @@ -171,7 +171,7 @@ namespace UHFHelper /// 超时时间 /// 串口回复字节数 /// - public async Task SendMessageAsync(byte[] msg, TimeSpan timeout, int count) + public async Task SendMessageAsync(byte[] msg, TimeSpan timeout, int count) { var sendTask = Task.Run(() => SendMessage(msg, timeout, count)); try @@ -184,6 +184,15 @@ namespace UHFHelper } return await sendTask; } + + /// + /// 发出蜂鸣声音3次,代表扣款成功! + /// + public async void OpenBeep() + { + byte[] sendData = new byte[]{ 0x07, 0x01, 0x33, 0x08, 0x02, 0x03, 0x33,0xB1 }; + await SendMessageAsync(sendData, TimeSpan.FromSeconds(1), 6); + } } public class SerialParam diff --git a/test/Form1.Designer.cs b/test/Form1.Designer.cs index c69e3fd..d8361cf 100644 --- a/test/Form1.Designer.cs +++ b/test/Form1.Designer.cs @@ -39,6 +39,8 @@ this.button6 = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.textBox4 = new System.Windows.Forms.TextBox(); + this.button7 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 @@ -141,11 +143,33 @@ this.textBox4.Size = new System.Drawing.Size(100, 23); this.textBox4.TabIndex = 9; // + // button7 + // + this.button7.Location = new System.Drawing.Point(155, 255); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(75, 23); + this.button7.TabIndex = 10; + this.button7.Text = "button7"; + this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.button7_Click); + // + // button8 + // + this.button8.Location = new System.Drawing.Point(288, 394); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(75, 23); + this.button8.TabIndex = 11; + this.button8.Text = "button8"; + this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.button8); + this.Controls.Add(this.button7); this.Controls.Add(this.textBox4); this.Controls.Add(this.label2); this.Controls.Add(this.button6); @@ -178,5 +202,7 @@ private Button button6; private Label label2; private TextBox textBox4; + private Button button7; + private Button button8; } } \ No newline at end of file diff --git a/test/Form1.cs b/test/Form1.cs index d95eff4..3421a5e 100644 --- a/test/Form1.cs +++ b/test/Form1.cs @@ -84,5 +84,15 @@ namespace test label2.Text = sss; } } + + private void button7_Click(object sender, EventArgs e) + { + UHFCardHelper.GetInstance().WorkMode(); + } + + private void button8_Click(object sender, EventArgs e) + { + UHF_RS485_Helper.GetInstance().OpenBeep(); + } } } \ No newline at end of file