// Turns on or off the LED backlight // Parameter: true turns on the backlight, false turns it off // Returns: True if successful, false if not bool FPS_GT511C3::SetLED(bool on) { Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::CmosLed; if (on) { if (UseSerialDebug) Serial.println("FPS - LED on"); cp->Parameter[0] = 0x01; } else { if (UseSerialDebug) Serial.println("FPS - LED off"); cp->Parameter[0] = 0x00; } cp->Parameter[1] = 0x00; cp->Parameter[2] = 0x00; cp->Parameter[3] = 0x00; byte* packetbytes = cp->GetPacketBytes(); SendCommand(packetbytes, 12); Response_Packet* rp = GetResponse(); bool retval = true; if (rp->ACK == false) retval = false; delete rp; delete packetbytes; delete cp; return retval; };
// Deletes all IDs (enrollments) from the database // Returns: true if successful, false if db is empty bool FPS_GT511C3::DeleteAll() { if (UseSerialDebug) Serial.println("FPS - DeleteAll"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::DeleteAll; byte* packetbytes = cp->GetPacketBytes(); SendCommand(packetbytes, 12); Response_Packet* rp = GetResponse(); bool retval = rp->ACK; delete rp; delete packetbytes; delete cp; return retval; }
// Checks the currently pressed finger against all enrolled fingerprints // Returns: // 0-199: Verified against the specified ID (found, and here is the ID number) // 200: Failed to find the fingerprint in the database int FPS_GT511C3::Identify1_N() { if (UseSerialDebug) Serial.println("FPS - Identify1_N"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::Identify1_N; byte* packetbytes = cp->GetPacketBytes(); SendCommand(packetbytes, 12); Response_Packet* rp = GetResponse(); int retval = rp->IntFromParameter(); if (retval > 200) retval = 200; delete rp; delete packetbytes; delete cp; return retval; }
// According to the DataSheet, this does nothing... // Implemented it for completeness. void FPS_GT511C3::Close() { if (UseSerialDebug) Serial.println("FPS - Close"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::Close; cp->Parameter[0] = 0x00; cp->Parameter[1] = 0x00; cp->Parameter[2] = 0x00; cp->Parameter[3] = 0x00; byte* packetbytes = cp->GetPacketBytes(); SendCommand(packetbytes, 12); Response_Packet* rp = GetResponse(); delete rp; delete packetbytes; };
// Deletes the specified ID (enrollment) from the database // Parameter: 0-199 (id number to be deleted) // Returns: true if successful, false if position invalid bool FPS_GT511C3::DeleteID(int id) { if (UseSerialDebug) Serial.println("FPS - DeleteID"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::DeleteID; cp->ParameterFromInt(id); char* packetchars = cp->GetPacketBytes(); SendCommand(packetchars, 12); Response_Packet* rp = GetResponse(); bool retval = rp->ACK; delete rp; delete packetchars; delete cp; return retval; }
// checks to see if the ID number is in use or not // Parameter: 0-199 // Return: True if the ID number is enrolled, false if not bool FPS_GT511C3::CheckEnrolled(int id) { if (UseSerialDebug) Serial.println("FPS - CheckEnrolled"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::CheckEnrolled; cp->ParameterFromInt(id); byte* packetbytes = cp->GetPacketBytes(); delete cp; SendCommand(packetbytes, 12); delete packetbytes; Response_Packet* rp = GetResponse(); bool retval = false; retval = rp->ACK; delete rp; return retval; }
// Gets the number of enrolled fingerprints // Return: The total number of enrolled fingerprints int FPS_GT511C3::GetEnrollCount() { if (UseSerialDebug) Serial.println("FPS - GetEnrolledCount"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::GetEnrollCount; cp->Parameter[0] = 0x00; cp->Parameter[1] = 0x00; cp->Parameter[2] = 0x00; cp->Parameter[3] = 0x00; byte* packetbytes = cp->GetPacketBytes(); SendCommand(packetbytes, 12); Response_Packet* rp = GetResponse(); int retval = rp->IntFromParameter(); delete rp; delete packetbytes; return retval; }
// Checks to see if a finger is pressed on the FPS // Return: true if finger pressed, false if not bool FPS_GT511C3::IsPressFinger() { if (UseSerialDebug) Serial.println("FPS - IsPressFinger"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::IsPressFinger; byte* packetbytes = cp->GetPacketBytes(); SendCommand(packetbytes, 12); Response_Packet* rp = GetResponse(); bool retval = false; int pval = rp->ParameterBytes[0]; pval += rp->ParameterBytes[1]; pval += rp->ParameterBytes[2]; pval += rp->ParameterBytes[3]; if (pval == 0) retval = true; delete rp; delete packetbytes; delete cp; return retval; }
// Gets the Third scan of an enrollment // Finishes Enrollment // Return: // 0 - ACK // 1 - Enroll Failed // 2 - Bad finger // 3 - ID in use int FPS_GT511C3::Enroll3() { if (UseSerialDebug) Serial.println("FPS - Enroll3"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::Enroll3; byte* packetbytes = cp->GetPacketBytes(); delete cp; SendCommand(packetbytes, 12); delete packetbytes; Response_Packet* rp = GetResponse(); int retval = rp->IntFromParameter(); if (retval < 200) retval = 3; else retval = 0; if (rp->ACK == false) { if (rp->Error == Response_Packet::ErrorCodes::NACK_ENROLL_FAILED) retval = 1; if (rp->Error == Response_Packet::ErrorCodes::NACK_BAD_FINGER) retval = 2; } delete rp; if (rp->ACK) return 0; else return retval; }
// Starts the Enrollment Process // Parameter: 0-199 // Return: // 0 - ACK // 1 - Database is full // 2 - Invalid Position // 3 - Position(ID) is already used int FPS_GT511C3::EnrollStart(int id) { if (UseSerialDebug) Serial.println("FPS - EnrollStart"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::EnrollStart; cp->ParameterFromInt(id); byte* packetbytes = cp->GetPacketBytes(); delete cp; SendCommand(packetbytes, 12); delete packetbytes; Response_Packet* rp = GetResponse(); int retval = 0; if (rp->ACK == false) { if (rp->Error == Response_Packet::ErrorCodes::NACK_DB_IS_FULL) retval = 1; if (rp->Error == Response_Packet::ErrorCodes::NACK_INVALID_POS) retval = 2; if (rp->Error == Response_Packet::ErrorCodes::NACK_IS_ALREADY_USED) retval = 3; } delete rp; return retval; }
// Checks the currently pressed finger against a specific ID // Parameter: 0-199 (id number to be checked) // Returns: // 0 - Verified OK (the correct finger) // 1 - Invalid Position // 2 - ID is not in use // 3 - Verified FALSE (not the correct finger) int FPS_GT511C3::Verify1_1(int id) { if (UseSerialDebug) Serial.println("FPS - Verify1_1"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::Verify1_1; cp->ParameterFromInt(id); char* packetchars = cp->GetPacketBytes(); SendCommand(packetchars, 12); Response_Packet* rp = GetResponse(); int retval = 0; if (rp->ACK == false) { if (rp->Error == Response_Packet::ErrorCodes::NACK_INVALID_POS) retval = 1; if (rp->Error == Response_Packet::ErrorCodes::NACK_IS_NOT_USED) retval = 2; if (rp->Error == Response_Packet::ErrorCodes::NACK_VERIFY_FAILED) retval = 3; } delete rp; delete packetchars; delete cp; return retval; }
// Checks the currently pressed finger against a specific ID // Parameter: 0-199 (id number to be checked) // Returns: // 0 - Verified OK (the correct finger) // 1 - Invalid Position // 2 - ID is not in use // 3 - Verified FALSE (not the correct finger) int FPS_GT511C3::Verify1_1(int id) { if (UseSerialDebug) Serial.println("FPS - Verify1_1"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::Verify1_1; cp->ParameterFromInt(id); byte* packetbytes = cp->GetPacketBytes(); SendCommand(packetbytes, 12); Response_Packet* rp = GetResponse(); int retval = 0; if (rp->ACK == false) { retval = 3; // grw 01/03/15 - set default value of not verified before assignment if (rp->Error == Response_Packet::ErrorCodes::NACK_INVALID_POS) retval = 1; if (rp->Error == Response_Packet::ErrorCodes::NACK_IS_NOT_USED) retval = 2; if (rp->Error == Response_Packet::ErrorCodes::NACK_VERIFY_FAILED) retval = 3; } delete rp; delete packetbytes; delete cp; return retval; }
// Captures the currently pressed finger into onboard ram use this prior to other commands // Parameter: true for high quality image(slower), false for low quality image (faster) // Generally, use high quality for enrollment, and low quality for verification/identification // Returns: True if ok, false if no finger pressed bool FPS_GT511C3::CaptureFinger(bool highquality) { if (UseSerialDebug) Serial.println("FPS - CaptureFinger"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::CaptureFinger; if (highquality) { cp->ParameterFromInt(1); } else { cp->ParameterFromInt(0); } byte* packetbytes = cp->GetPacketBytes(); SendCommand(packetbytes, 12); Response_Packet* rp = GetResponse(); bool retval = rp->ACK; delete rp; delete packetbytes; delete cp; return retval; }
// Changes the baud rate of the connection // Parameter: 9600, 19200, 38400, 57600, 115200 // Returns: True if success, false if invalid baud // NOTE: Untested (don't have a logic level changer and a voltage divider is too slow) bool FPS_GT511C3::ChangeBaudRate(int baud) { if ((baud == 9600) || (baud == 19200) || (baud == 38400) || (baud == 57600) || (baud == 115200)) { if (UseSerialDebug) Serial.println("FPS - ChangeBaudRate"); Command_Packet* cp = new Command_Packet(); cp->Command = Command_Packet::Commands::Open; cp->ParameterFromInt(baud); byte* packetbytes = cp->GetPacketBytes(); SendCommand(packetbytes, 12); Response_Packet* rp = GetResponse(); bool retval = rp->ACK; if (retval) { _serial.end(); _serial.begin(baud); } delete rp; delete packetbytes; return retval; } return false; }