aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDante Russo <drusso@codeaurora.org>2016-07-06 14:03:12 -0700
committerfirebird11 <hbgassel@gmail.com>2019-01-12 14:02:08 +0100
commitf81f8f47bce44784ba7b4a28ef408a9b726726e7 (patch)
tree84da2178ba0458ecfe279feaf02843caebb97dca
parentedd2c4774dea5cf0cdb8af9f8e4eace789fe4c1a (diff)
g3-common: gps: Return the correct length of nmea sentence
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. CRs-Fixed: 1020044 Change-Id: I50d80b9c4492de4664bb3ccb7295b0eb4fee15a9
-rw-r--r--gps/libloc_api_50001/loc_eng_nmea.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/gps/libloc_api_50001/loc_eng_nmea.cpp b/gps/libloc_api_50001/loc_eng_nmea.cpp
index 2485c59..2d40338 100644
--- a/gps/libloc_api_50001/loc_eng_nmea.cpp
+++ b/gps/libloc_api_50001/loc_eng_nmea.cpp
@@ -92,8 +92,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);
}
/*===========================================================================