|
@@ -258,8 +258,18 @@ namespace UHFHelper |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
public void OpenBeep(int addr) |
|
|
public void OpenBeep(int addr) |
|
|
{ |
|
|
{ |
|
|
byte[] sendData = new byte[] { 0x07, (byte)addr, 0x33, 0x08, 0x02, 0x03, 0x33, 0xB1 }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//byte[] sendData = new byte[] { 0x07, (byte)addr, 0x33, 0x08, 0x02, 0x03, 0x33, 0xB1 }; |
|
|
|
|
|
byte[] data1 = new byte[6] { 0x07, (byte)addr, 0x33, 0x08, 0x02, 0x03 }; |
|
|
|
|
|
//生成crc校验码 |
|
|
|
|
|
byte[] data2 = CRC16.ToCRC16(data1); |
|
|
|
|
|
byte[] data3 = new byte[data1.Length + data2.Length]; |
|
|
|
|
|
data1.CopyTo(data3, 0); |
|
|
|
|
|
data2.CopyTo(data3, data1.Length); |
|
|
|
|
|
if (_serialPort != null) |
|
|
|
|
|
{ |
|
|
|
|
|
_serialPort.DiscardInBuffer(); |
|
|
|
|
|
_serialPort.Write(data3, 0, data3.Length); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|