52 const string AshtechData::preamble(
"$PASHR,");
55 const string AshtechData::trailer(
"\015\012");
61 int AshtechData::debugLevel = 0;
64 bool AshtechData::hexDump =
false;
68 void AshtechData::reallyGetRecord(
FFStream& ffs)
84 string& rawData = stream.
rawData;
89 if (rawData.length() < preamble.length()+4)
92 stream.read(buff,
sizeof(buff));
93 rawData.append(buff, stream.gcount());
97 i = rawData.find(preamble, preamble.length());
99 i = rawData.find(preamble);
104 i =
min (rawData.length(), i);
106 cout <<
"Tossing " << i
107 <<
" bytes at offset: 0x" << hex << stream.
getRawPos() << dec
115 id = rawData.substr(7,3);
125 string& rawData = stream.
rawData;
126 const static string term = trailer+preamble;
127 size_t term_pos = rawData.find(term);
131 term_pos = rawData.find(term);
132 if (term_pos > 0 && term_pos < rawData.length())
138 stream.read(cbuff,
sizeof(cbuff));
139 rawData.append(cbuff, stream.gcount());
145 term_pos += trailer.length();
149 decode(rawData.substr(0, term_pos));
151 if (!good() && debugLevel>1)
152 cout <<
"bad decode starting at at offset 0x"
156 rawData.erase(0, term_pos);
165 oss << getName() <<
" : id:" <<
id
166 <<
" checksum:" << hex << checksum
167 <<
" rdstate:" << rdstate() << dec;
177 out << oss.str() << endl;