From 05f58605e172b284056120dfdb468805e798339d Mon Sep 17 00:00:00 2001 From: Harikrishnan Hariharan Date: Tue, 24 May 2016 16:58:49 +0530 Subject: [PATCH] Return the correct length of nmea sentence. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return the correct length of nmea sentence in the function loc_eng_nmea_put_checksum(). The correct length is length of NMEA string including ‘$’ character alongwith length of checksum. Change-Id: I45a086190008df79a93b9386bc69d9c50e47c93b CRs-Fixed: 1020044 --- loc_api/libloc_api_50001/loc_eng_nmea.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/loc_api/libloc_api_50001/loc_eng_nmea.cpp index 3672e196..3d2336f7 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.cpp +++ b/loc_api/libloc_api_50001/loc_eng_nmea.cpp @@ -88,8 +88,12 @@ int loc_eng_nmea_put_checksum(char *pNmea, int maxSize) length++; } + // length now contains nmea sentence string length not including $ sign. int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum); - return (length + checksumLength); + + // total length of nmea sentence is length of nmea sentence inc $ sign plus + // length of checksum (+1 is to cover the $ character in the length). + return (length + checksumLength + 1); } /*===========================================================================