c++ - GP635T GPS-sensor output of data -
i have rather weird problem gp635t gps-sensor connected intel edison. use c++ , eclipse program it.
if try receive data this
message = serialgps.readstr(100); startposition = message.find('$'); endposition = message.find("\n"); std::cout << "complete message: " << message << std::endl;
i long output consisting of types of supported messages $gpgga
$gptxt
(see datasheet --> http://www.cypax.dk/pdf/gp-635t-121130.pdf). want work $gpgll
-messages. adjusted code find index of beginning of message , end of it:
message = serialgps.readstr(100); startposition = message.find("$gpgll"); endposition = message.find('$', startposition+1); std::cout << "complete message: " << message << std::endl;
but code, variable 'message' consists of 1 single message of random type. don't know why happens, because not touch variable 'message' anywhere in code.
additionally, same effect happens, if delete / comment lines message.find()
out. still 1 message of random type. first code block shows long message.
i managed solve problem not receiving whole string, getting single character. code, works me.
while(serialgps.dataavailable(10)) { message += serialgps.readstr(1); }
Comments
Post a Comment