  */
 
 //-------------------------------------------------------------------------
-// static declrations
+// static declrations and enums
 
 static String kCmdList[] = {
   "hello",

  CMD_GET,
  CMD_POST,
  CMD_BYE,
} CMD_e;

//-------------------------------------------------------------------------

signed int getCommandIdx(String aCmd)
{
  aCmd.toLowerCase();
  for(int idx = 0; idx < SIZE_CMD; idx++) {
    if ( aCmd.equalsIgnoreCase(kCmdList[idx]) ) {
      return idx;
    }
  }
  return -1;
}

void Serial_replyToCommand(String cmdline)
{  
  String strcmd = extractCsvRow(cmdline, 0);
  if (strcmd.length() == 0) {
    return; // is not a command
  }

  int cmdidx = getCommandIdx(strcmd);
  if (cmdidx < 0) {
    Serial.println(cmdline);    
  }

  switch(cmdidx) {
  case CMD_HELLO:
    Serial.println("hello,7of9");
    break;
  case CMD_BYE:
    Serial.println("bye,7of9");
    break;
  default:
    // do nothing
    break;
  }
}

