GPS Library  0.1
GPS driver and NMEA parser
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
I_NMEAMessage.cpp
Go to the documentation of this file.
1 #include "I_NMEAMessage.h"
2 #include <GPS/Data/GPSData.h>
3 #include <Exceptions/Exceptions.h>
4 
5 #include <string.h>
6 
8 
9 void I_NMEAMessage::GotMessage(const char * const * message, int params, I_GPSData & parent, I_GPSDriver * driver)
10 {
11  if (params < 1)
12  return;
13 
14  // Not a perfest solution, currently i have no better idea:
15  GPS::GPSData & real_parent(static_cast<GPS::GPSData&>(parent));
16 
17  for (MessageList::iterator i = AllNMEAMessages.begin(); i != AllNMEAMessages.end(); ++i) {
18  if (strcmp(message[0], i->identifier) == 0) {
19  try {
20  i->Interpret(message+1, params-1, real_parent, driver);
21  } catch (EX::Error & ex) {
22  // The message could not be interpreted.
23  std::cerr << ex.what() << std::endl; // temporary
24  }
25  return;
26  }
27  }
28 }
29 
30 /* * * * * * * * * * * * * End - of - File * * * * * * * * * * * * * * */