public MatchReturn MatchTemplates(ImageTemplateBuffers StoreBufferToSaveToMatch, ushort StartAtPageIndex, ushort PageCount)
 {
     byte[] PageStartIndex  = BitConverterHelpers.GetBytes16(StartAtPageIndex);
     byte[] PageCountNumber = BitConverterHelpers.GetBytes16(PageCount);
     SendCommand(CommandCodes.TryMatchAnyImageTemplate, new byte[] { (byte)StoreBufferToSaveToMatch, PageStartIndex[0], PageStartIndex[1], PageCountNumber[0], PageCountNumber[1] });
     return(GetReturn());
 }
 public BasicCommandReturn DeleteImageTemplateFromSlaveFlash(ImageTemplateBuffers StoreBufferToSaveToFlash, ushort PageIndex, ushort NumberOfPagesToDelete)
 {
     byte[] Index  = BitConverterHelpers.GetBytes16(PageIndex);
     byte[] Number = BitConverterHelpers.GetBytes16(NumberOfPagesToDelete);
     SendCommand(CommandCodes.DeleteImageTemplate, new byte[] { (byte)StoreBufferToSaveToFlash, Index[0], Index[1], Number[0], Number[1] });
     return(GetReturn());
 }
 /// <summary>
 /// Sets the address in the device then sets it in the class to match
 /// </summary>
 /// <param name="Address">the new address to use</param>
 /// <returns></returns>
 public BasicCommandReturn SetAddress(uint Address)
 {
     byte[] NewAddress = BitConverterHelpers.GetBytes32(Address);
     SendCommand(CommandCodes.SetAddress, NewAddress);
     this.AddressBytes = NewAddress;
     return(GetReturn());
 }
        /// <summary>
        /// Creates a serial connection and sets up the class to begin a connection
        /// </summary>
        /// <param name="ComPort"></param>
        /// <param name="Address"></param>
        /// <param name="BaudRate"></param>
        /// <param name="DataPackageChunkSize"></param>
        public FingerPrintScaner(string ComPort, uint?Address = null, BaudRates BaudRate = BaudRates.BaudRateOf57600, PackageLength DataPackageChunkSize = PackageLength.LengthOf128, bool OpenNow = true)
        {
            if (!Enum.IsDefined(typeof(BaudRates), BaudRate))
            {
                throw new Exception("BaudRate is not a valid baudrate!");
            }
            if (!Enum.IsDefined(typeof(PackageLength), DataPackageChunkSize))
            {
                throw new Exception("The chunk size is not a valid max chunk size for the device!");
            }
            int BaudRateValue = DefaultBaudRate;

            switch (BaudRate)
            {
            case BaudRates.BaudRateOf9600:
                BaudRateValue = 9600;
                BaudRate      = BaudRates.BaudRateOf9600;
                break;

            case BaudRates.BaudRateOf19200:
                BaudRateValue = 19200;
                BaudRate      = BaudRates.BaudRateOf19200;
                break;

            case BaudRates.BaudRateOf28800:
                BaudRateValue = 28800;
                BaudRate      = BaudRates.BaudRateOf28800;
                break;

            case BaudRates.BaudRateOf38400:
                BaudRateValue = 38400;
                BaudRate      = BaudRates.BaudRateOf38400;
                break;

            case BaudRates.BaudRateOf48000:
                BaudRateValue = 48000;
                BaudRate      = BaudRates.BaudRateOf48000;
                break;

            case BaudRates.BaudRateOf57600:
                BaudRateValue = 57600;
                BaudRate      = BaudRates.BaudRateOf57600;
                break;

            case BaudRates.BaudRateOf67200:
                BaudRateValue = 67200;
                BaudRate      = BaudRates.BaudRateOf67200;
                break;

            case BaudRates.BaudRateOf76800:
                BaudRateValue = 76800;
                BaudRate      = BaudRates.BaudRateOf76800;
                break;

            case BaudRates.BaudRateOf86400:
                BaudRateValue = 86400;
                BaudRate      = BaudRates.BaudRateOf86400;
                break;

            case BaudRates.BaudRateOf96000:
                BaudRateValue = 96000;
                BaudRate      = BaudRates.BaudRateOf96000;
                break;

            case BaudRates.BaudRateOf105600:
                BaudRateValue = 105600;
                BaudRate      = BaudRates.BaudRateOf105600;
                break;

            case BaudRates.BaudRateOf115200:
                BaudRateValue = 115200;
                BaudRate      = BaudRates.BaudRateOf115200;
                break;
            }

            if (Address != null)
            {
                this.AddressBytes = BitConverterHelpers.GetBytes32(Address.Value);
            }

            this.DataPackageChunkSize = DataPackageChunkSize;
            SerialPort = new SerialPort(ComPort, BaudRateValue, Parity.None, 8, StopBits.One);

            if (OpenNow)
            {
                SerialPort.Open();
            }
        }
 public BasicCommandReturn LoadImageTemplateFromSlaveFlash(ImageTemplateBuffers StoreBufferToSaveToFlash, ushort PageIndex)
 {
     byte[] Index = BitConverterHelpers.GetBytes16(PageIndex);
     SendCommand(CommandCodes.LoadImageTemplate, new byte[] { (byte)StoreBufferToSaveToFlash, Index[0], Index[1] });
     return(GetReturn());
 }