??? 11/17/06 17:28 Read: times |
#128204 - No one size fits all Responding to: ???'s previous message |
Since the topic was protocols
switch(SerialNumberControl) { case 1: // Serial Number case 2: case 3: case 4: case 5: case 7: // Control Number if(inChar >= '0' && inChar <= '9') { (*index)++; } else { nak = COMMAND_NACK; SerialNumberControl = 0; // cancel config write } break; case 6: // Part Number Suffix case 8: // Control Number Revision if(inChar >= 'A' && inChar <= 'W') //X, Y, and Z are packet delimiters { (*index)++; } else { nak = COMMAND_NACK; SerialNumberControl = 0; // cancel config write } break; case 9: // close S/N if(inChar == 'o') { (*index)++; } else { nak = COMMAND_NACK; SerialNumberControl = 0; // cancel config write } break; default: // Normal Diag commands if(strchr("VuNWwCcOG",inChar) != NULL)(*index)++; else nak = COMMAND_NACK; } It depends on the states and what you do with them |