Ejemplo n.º 1
0
void EBBParser::parseStream()
{
    if (!mStream.available())
        return;

    const char inChar = mStream.read();
    if (inChar != '\r') {
        if (mReadBuffer.length() < 64 && isprint(inChar))
            mReadBuffer += inChar;
        return;
    }

    char* str = mReadBuffer.begin();
    const char* cmd = strsep(&str, ",");
    const char* arg1 = strsep(&str, ",");
    const char* arg2 = strsep(&str, ",");
    const char* arg3 = strsep(&str, ",");

    if (strcmp(cmd, "EM") == 0) {
        parseEM(arg1, arg2);
    } else if (strcmp(cmd, "ND") == 0) {
        parseND();
    } else if (strcmp(cmd, "NI") == 0) {
        parseNI();
    } else if (strcmp(cmd, "PD") == 0) {
        sendAck();
    } else if (strcmp(cmd, "PO") == 0) {
        parsePO(arg1, arg2, arg3);
    } else if (strcmp(cmd, "QB") == 0) {
        parseQB();
    } else if (strcmp(cmd, "QL") == 0) {
        parseQL();
    } else if (strcmp(cmd, "QN") == 0) {
        parseQN();
    } else if (strcmp(cmd, "QP") == 0) {
        parseQP();
    } else if (strcmp(cmd, "SC") == 0) {
        parseSC(arg1, arg2);
    } else if (strcmp(cmd, "SE") == 0) {
        parseSE(arg1, arg2, arg3);
    } else if (strcmp(cmd, "SL") == 0) {
        parseSL(arg1);
    } else if (strcmp(cmd, "SM") == 0) {
        parseSM(arg1, arg2, arg3);
    } else if (strcmp(cmd, "SN") == 0) {
        parseSN(arg1);
    } else if (strcmp(cmd, "SP") == 0) {
        parseSP(arg1, arg2, arg3);
    } else if (strcmp(cmd, "TP") == 0) {
        parseTP(arg1);
    } else if (strcmp(cmd, "v") == 0) {
        parseV();
    } else
        sendError();

    mReadBuffer = "";
}
Ejemplo n.º 2
0
Steps::Steps( const char* vlist, const char* clist, const char* elist, int nIn )
    : vstepsLen( 1 ), cstepsLen( 1 ), estepsLen( 1 ), seatSteps( NULL ),
      v( 0 ), c( 0 ), e( -1 ), n( nIn )
{
    if ( vlist ) {
	parseV( vlist );
    } else {
	vsteps = (int*)malloc( sizeof(int) );
	vstepsLen = 0;
    }
    if ( clist ) {
	parseC( clist );
    } else {
	csteps = (int*)malloc( sizeof(int) );
	cstepsLen = 0;
    }
    if ( elist ) {
	parseE( elist );
    } else {
	esteps = (float*)malloc( sizeof(float) );
	estepsLen = 0;
    }
}
Ejemplo n.º 3
0
void L3OneByteProtocolElement::parseV(const L3Frame&src, size_t&rp, size_t expectedLength)
{
	if (expectedLength != 1) { LOG(ERR) << "Unexpected length="<<expectedLength <<" in one byte protocol element"; }	// Not much of a message.
	if (expectedLength) { parseV(src,rp); }
}