Browse Source

增加蜂鸣时间

Lishi
747575620@qq.com 2 years ago
parent
commit
0740ca9410
4 changed files with 47 additions and 2 deletions
  1. +1
    -1
      UHFHelper/UHFCardHelper.cs
  2. +10
    -1
      UHFHelper/UHF_RS485_Helper.cs
  3. +26
    -0
      test/Form1.Designer.cs
  4. +10
    -0
      test/Form1.cs

+ 1
- 1
UHFHelper/UHFCardHelper.cs View File

@@ -139,7 +139,7 @@ namespace UHFHelper
//输出模式
int Reader_bit1 = 0;
//蜂鸣开关
int Reader_bit2 = 0;
int Reader_bit2 = 1;
//起始地址
int Reader_bit3 = 0;
//是否SYRIS485输出


+ 10
- 1
UHFHelper/UHF_RS485_Helper.cs View File

@@ -171,7 +171,7 @@ namespace UHFHelper
/// <param name="timeout">超时时间</param>
/// <param name="count">串口回复字节数</param>
/// <returns></returns>
public async Task<byte[]> SendMessageAsync(byte[] msg, TimeSpan timeout, int count)
public async Task<byte[]?> 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;
}

/// <summary>
/// 发出蜂鸣声音3次,代表扣款成功!
/// </summary>
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


+ 26
- 0
test/Form1.Designer.cs View File

@@ -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;
}
}

+ 10
- 0
test/Form1.cs View File

@@ -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();
}
}
}

Loading…
Cancel
Save