31 #define _MDP_STANDALONE
32 #define _DATUM_DEFINED
42 char * getMRZPingInfo(
void * tgm)
56 char* pPI = (
char*)(&(dgm->partition.
dgmNum));
65 char *pSOD = (
char*)dgm;
78 char * getMRZSectorInfo(
void * tgm)
92 char* pPI = (
char*)(&(dgm->partition.
dgmNum));
110 char *pSOD = (
char*)dgm;
123 char *getMRZRxInfo(
void* tgm)
137 char* pPI = (
char*)(&(dgm->partition.
dgmNum));
154 pch += (nBytesTx * numTxSectors);
160 char *pSOD = (
char*)dgm;
173 char *getMRZSoundings(
void* tgm)
187 char* pPI = (
char*)(&(dgm->partition.
dgmNum));
204 pch += (nBytesTx * numTxSectors);
217 char *pSOD = (
char*)dgm;
230 static void help(
char* progname)
232 cout <<
"\n\nUsage: " << progname <<
"\n";
233 cout <<
" -h (gives this help)\n";
234 cout <<
" -f <filename>\n";
237 int main(
int argc,
char *argv[])
240 bool helpNeeded =
false;
245 if (argc == 1) helpNeeded =
true;
246 string h = string(
"-h");
247 string f = string(
"-f");
248 for (
int i = 1; i < argc; i++)
250 if (h.compare(
string(argv[i])) == 0)
255 if (f.compare(argv[i]) == 0)
263 filename.assign(argv[i]);
264 ifstream fexists(filename);
265 if (fexists.good() ==
false)
267 cout <<
"Filename " << filename <<
" does not exist.\n";
280 cout <<
"Filename: " << filename <<
"\n";
284 ifstream kmall(filename, ios::in | ios::binary);
290 memset(&mrz, 0,
sizeof(mrz));
291 memset(&header, 0,
sizeof(header));
293 kmall.read((
char*)&header,
sizeof(header));
294 if (kmall.gcount() !=
sizeof(header))
299 if (header.dgmType[0] ==
'#' && header.dgmType[1] ==
'M' && header.dgmType[2] ==
'R' && header.dgmType[3] ==
'Z')
304 memcpy(p, (
char*)&header,
sizeof(header));
308 kmall.read(p, header.numBytesDgm -
sizeof(header));
309 if (kmall.gcount() != header.numBytesDgm -
sizeof(header))
314 tmptime = header.time_sec;
316 tmptime += (header.time_nanosec / 1000000);
322 char* pData = (
char*)(&(depths->sectorInfo[depths->pingInfo.
numTxSectors]));
323 unsigned short numExtraDet = ((
pEMdgmMRZ_rxInfo)(pData))->numExtraDetectionClasses;
335 double dlat = (depthList + i)->deltaLatitude_deg;
336 double dlon = (depthList + i)->deltaLongitude_deg;
337 double depthRefPoint = (depthList + i)->z_reRefPoint_m;
338 double lat = blat + dlat;
339 double lon = blon + dlon;
341 cout << std::fixed << std::setprecision(8) << lat <<
" ";
342 cout << std::fixed << std::setprecision(8) << lon <<
" ";
343 cout << std::fixed << std::setprecision(2) << depthReWaterline <<
" ";
344 cout << tmptime <<
"\n";
350 kmall.seekg(header.numBytesDgm -
sizeof(header), ios::cur);