1
- /*
1
+ /*
2
2
FPS_GT511C3.h v1.0 - Library for controlling the GT-511C3 Finger Print Scanner (FPS)
3
3
Created by Josh Hawley, July 23rd 2013
4
4
Licensed for non-commercial use, must include this license message
15
15
byte* Command_Packet::GetPacketBytes ()
16
16
{
17
17
byte* packetbytes= new byte[12 ];
18
-
18
+
19
19
// update command before calculating checksum (important!)
20
20
word cmd = Command;
21
21
command[0 ] = GetLowByte (cmd);
@@ -99,7 +99,7 @@ Response_Packet::Response_Packet(byte* buffer, bool UseSerialDebug)
99
99
byte checksum_high = GetHighByte (checksum);
100
100
CheckParsing (buffer[10 ], checksum_low, checksum_low, " Checksum_LOW" , UseSerialDebug);
101
101
CheckParsing (buffer[11 ], checksum_high, checksum_high, " Checksum_HIGH" , UseSerialDebug);
102
-
102
+
103
103
Error = ErrorCodes::ParseFromBytes (buffer[5 ], buffer[4 ]);
104
104
105
105
ParameterBytes[0 ] = buffer[4 ];
@@ -129,9 +129,9 @@ Response_Packet::ErrorCodes::Errors_Enum Response_Packet::ErrorCodes::ParseFromB
129
129
{
130
130
case 0x00 : e = NO_ERROR; break ;
131
131
case 0x01 : e = NACK_TIMEOUT; break ;
132
- case 0x02 : e = NACK_INVALID_BAUDRATE; break ;
133
- case 0x03 : e = NACK_INVALID_POS; break ;
134
- case 0x04 : e = NACK_IS_NOT_USED; break ;
132
+ case 0x02 : e = NACK_INVALID_BAUDRATE; break ;
133
+ case 0x03 : e = NACK_INVALID_POS; break ;
134
+ case 0x04 : e = NACK_IS_NOT_USED; break ;
135
135
case 0x05 : e = NACK_IS_ALREADY_USED; break ;
136
136
case 0x06 : e = NACK_COMM_ERR; break ;
137
137
case 0x07 : e = NACK_VERIFY_FAILED; break ;
@@ -200,11 +200,11 @@ bool Response_Packet::CheckParsing(byte b, byte propervalue, byte alternatevalue
200
200
Serial.print (" != " );
201
201
Serial.println (b, HEX);
202
202
}
203
-
203
+
204
204
}
205
205
#pragma endregion
206
206
207
- #pragma region -= Data_Packet =-
207
+ #pragma region -= Data_Packet =-
208
208
// void Data_Packet::StartNewPacket()
209
209
// {
210
210
// Data_Packet::NextPacketID = 0;
@@ -250,7 +250,7 @@ void FPS_GT511C3::Open()
250
250
delete packetbytes;
251
251
}
252
252
253
- // According to the DataSheet, this does nothing...
253
+ // According to the DataSheet, this does nothing...
254
254
// Implemented it for completeness.
255
255
void FPS_GT511C3::Close ()
256
256
{
@@ -316,7 +316,7 @@ bool FPS_GT511C3::ChangeBaudRate(int baud)
316
316
SendCommand (packetbytes, 12 );
317
317
Response_Packet* rp = GetResponse ();
318
318
bool retval = rp->ACK ;
319
- if (retval)
319
+ if (retval)
320
320
{
321
321
_serial.end ();
322
322
_serial.begin (baud);
@@ -399,7 +399,7 @@ int FPS_GT511C3::EnrollStart(int id)
399
399
}
400
400
401
401
// Gets the first scan of an enrollment
402
- // Return:
402
+ // Return:
403
403
// 0 - ACK
404
404
// 1 - Enroll Failed
405
405
// 2 - Bad finger
@@ -426,7 +426,7 @@ int FPS_GT511C3::Enroll1()
426
426
}
427
427
428
428
// Gets the Second scan of an enrollment
429
- // Return:
429
+ // Return:
430
430
// 0 - ACK
431
431
// 1 - Enroll Failed
432
432
// 2 - Bad finger
@@ -454,7 +454,7 @@ int FPS_GT511C3::Enroll2()
454
454
455
455
// Gets the Third scan of an enrollment
456
456
// Finishes Enrollment
457
- // Return:
457
+ // Return:
458
458
// 0 - ACK
459
459
// 1 - Enroll Failed
460
460
// 2 - Bad finger
@@ -645,7 +645,7 @@ bool FPS_GT511C3::CaptureFinger(bool highquality)
645
645
// Gets a template from the fps (498 bytes) in 4 Data_Packets
646
646
// Use StartDataDownload, and then GetNextDataPacket until done
647
647
// Parameter: 0-199 ID number
648
- // Returns:
648
+ // Returns:
649
649
// 0 - ACK Download starting
650
650
// 1 - Invalid position
651
651
// 2 - ID not used (no template to download
@@ -658,11 +658,11 @@ bool FPS_GT511C3::CaptureFinger(bool highquality)
658
658
// return false;
659
659
// }
660
660
661
- // Uploads a template to the fps
661
+ // Uploads a template to the fps
662
662
// Parameter: the template (498 bytes)
663
663
// Parameter: the ID number to upload
664
664
// Parameter: Check for duplicate fingerprints already on fps
665
- // Returns:
665
+ // Returns:
666
666
// 0-199 - ID duplicated
667
667
// 200 - Uploaded ok (no duplicate if enabled)
668
668
// 201 - Invalid position
@@ -686,7 +686,7 @@ bool FPS_GT511C3::CaptureFinger(bool highquality)
686
686
// may revisit this if I find a need for it
687
687
// }
688
688
689
- // Returns the next data packet
689
+ // Returns the next data packet
690
690
// Not implemented due to memory restrictions on the arduino
691
691
// may revisit this if I find a need for it
692
692
// Data_Packet GetNextDataPacket()
@@ -715,7 +715,7 @@ void FPS_GT511C3::SendCommand(byte cmd[], int length)
715
715
_serial.write (cmd, length);
716
716
if (UseSerialDebug)
717
717
{
718
- Serial.print (" FPS - SEND: " );
718
+ Serial.print (" FPS - SEND: " );
719
719
SendToSerial (cmd, length);
720
720
Serial.println ();
721
721
}
@@ -744,7 +744,7 @@ Response_Packet* FPS_GT511C3::GetResponse()
744
744
}
745
745
Response_Packet* rp = new Response_Packet (resp, UseSerialDebug);
746
746
delete resp;
747
- if (UseSerialDebug)
747
+ if (UseSerialDebug)
748
748
{
749
749
Serial.print (" FPS - RECV: " );
750
750
SendToSerial (rp->RawBytes , 12 );
@@ -771,8 +771,8 @@ void FPS_GT511C3::SendToSerial(byte data[], int length)
771
771
void FPS_GT511C3::serialPrintHex (byte data)
772
772
{
773
773
char tmp[16 ];
774
- sprintf (tmp, " %.2X" ,data);
775
- Serial.print (tmp);
774
+ sprintf (tmp, " %.2X" ,data);
775
+ Serial.print (tmp);
776
776
}
777
777
#pragma endregion
778
778
0 commit comments