-// generic.cxx -- generic protocal class
+// generic.cxx -- generic protocol class
//
// Written by Curtis Olson, started November 1999.
//
#include <simgear/misc/stdint.hxx>
#include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx>
+#include <simgear/math/SGMath.hxx>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Main/util.hxx>
#include "generic.hxx"
-FGGeneric::FGGeneric(vector<string> tokens) : exitOnError(false)
+FGGeneric::FGGeneric(vector<string> tokens) : exitOnError(false), initOk(false)
{
size_t configToken;
if (tokens[1] == "socket") {
configToken = 6;
}
- if (configToken >= tokens.size()) {
+ if ((configToken >= tokens.size())||(tokens[ configToken ] == "")) {
SG_LOG(SG_NETWORK, SG_ALERT,
- "Not enough tokens passed for generic protocol");
+ "Not enough tokens passed for generic '" << tokens[1] << "' protocol. ");
return;
}
if (direction != "in" && direction != "out" && direction != "bi") {
SG_LOG(SG_NETWORK, SG_ALERT, "Unsuported protocol direction: "
<< direction);
+ return;
}
reinit();
/* FIXME padding for alignment? Something like:
* length += (strlength % 4 > 0 ? sizeof(int32_t) - strlength % 4 : 0;
*/
+ break;
}
}
default: // SG_STRING
SG_LOG( SG_IO, SG_ALERT, "Generic protocol: "
"Ignoring unsupported binary input chunk type.");
+ break;
}
}
default: // SG_STRING
_in_message[i].prop->setStringValue(p1);
+ break;
}
p1 = p2;
}
}
}
+
+ initOk = true;
}