diff --git a/src/FPS_GT511C3.cpp b/src/FPS_GT511C3.cpp index 4dc2aec..3e60348 100644 --- a/src/FPS_GT511C3.cpp +++ b/src/FPS_GT511C3.cpp @@ -90,7 +90,7 @@ Command_Packet::Command_Packet() #pragma region -= Response_Packet Definitions =- #endif //__GNUC__ // creates and parses a response packet from the finger print scanner -Response_Packet::Response_Packet(uint8_t* buffer) +Response_Packet::Response_Packet(uint8_t buffer[]) { CheckParsing(buffer[0], RESPONSE_START_CODE_1, RESPONSE_START_CODE_1, F("RESPONSE_START_CODE_1")); CheckParsing(buffer[1], RESPONSE_START_CODE_2, RESPONSE_START_CODE_2, F("RESPONSE_START_CODE_2")); @@ -189,7 +189,7 @@ bool Response_Packet::CheckParsing(uint8_t b, uint8_t propervalue, uint8_t alter } // calculates the checksum from the bytes in the packet -uint16_t Response_Packet::CalculateChecksum(uint8_t* buffer, uint16_t length) +uint16_t Response_Packet::CalculateChecksum(uint8_t buffer[], uint16_t length) { uint16_t checksum = 0; for (uint16_t i=0; ichecksum)); + Serial.print(tmp); + } + { + if (first) first=false; else Serial.print(" "); + char tmp[16]; + sprintf(tmp, "%.2X", GetHighByte(this->checksum)); + Serial.print(tmp); + } + Serial.print("\""); + Serial.println(); +#endif + + // Calculate checksum + this->checksum = CalculateChecksum(data_code, 4); + this->checksum = CalculateChecksum(buffer, length); + + // Send everything to the finger print scanner + _serial.write(data_code, 4); + _serial.write(buffer, length); + _serial.write(GetLowByte(this->checksum)); + _serial.write(GetHighByte(this->checksum)); + + // clean up + delete data_code; + +} +// creates and parses a data packet from the finger print scanner +Data_Packet::Data_Packet(uint8_t buffer[]) { #if FPS_DEBUG CheckParsing(buffer[0], DATA_START_CODE_1, DATA_START_CODE_1, F("DATA_START_CODE_1")); @@ -273,7 +334,7 @@ bool Data_Packet::CheckParsing(uint8_t b, uint8_t propervalue, uint8_t alternate } // calculates the checksum from the bytes in the packet -uint16_t Data_Packet::CalculateChecksum(uint8_t* buffer, uint16_t length) +uint16_t Data_Packet::CalculateChecksum(uint8_t buffer[], uint16_t length) { uint16_t checksum = this->checksum; for (uint16_t i=0; iACK) { @@ -954,7 +1015,7 @@ uint16_t FPS_GT511C3::SetTemplate(byte* tmplt, uint16_t id, bool duplicateCheck) #endif //__GNUC__ #ifndef __GNUC__ -#pragma region -= Not imlemented commands =- +#pragma region -= Not implemented commands =- #endif //__GNUC__ // Commands that are not implemented (and why) // VerifyTemplate1_1 - Couldn't find a good reason to implement this on an arduino @@ -1266,7 +1327,7 @@ bool FPS_GT511C3::ReturnData(uint16_t length, uint8_t data[]) // sends the byte array to the serial debugger in our hex format EX: "00 AF FF 10 00 13" void FPS_GT511C3::SendToSerial(uint8_t data[], uint16_t length) { - boolean first=true; + bool first=true; Serial.print("\""); for(uint16_t i=0; i