private void SendCmd(FingerSensorPacket.SB_OEM_PKT pkt, int pktSize) { byte[] _pkt = FingerSensorPacket.StructureToByte(pkt); Console.WriteLine("SEND: " + FingerSensorPacket.ByteToHexString(_pkt)); isRecv = true; sPort.Write(_pkt, 0, pktSize); //SerialDataReceived(); }
private int SendCmdOrAck(ushort cmd, int param) { FingerSensorPacket.SB_OEM_PKT pkt = new FingerSensorPacket.SB_OEM_PKT(); pkt.head1 = (byte)STX1; pkt.head2 = (byte)STX2; pkt.devId = devID; pkt.cmd = cmd; pkt.param = param; pkt.chkSum = FingerSensorPacket.CalcChkSumOfCmdAckPkt(pkt); SendCmd(pkt, SB_OEM_PKT_SIZE); return(0); }