How to read from const String?

  arduino, arduino-esp8266, c++
const String roomname_short = "Test";
void setup() {
  Serial2.begin(9600, SERIAL_8N1, RXD, TXD);
  Serial.begin(115200);
  //Serial2.write("A");
  Serial2.println((READY_MESSAGE));
  Serial.println(READY_MESSAGE);
}

void loop() {
  char c;
  String readString;
  while (Serial2.available()) {
    c = Serial2.read();
    readString += c;
  }
  if (readString.length() >= 10) {
    if (readString.substring(1, 9) == "INTERNAL") {
      readString = "";
    }
  }
  if (readString.length() > 0) {
    Serial.println(readString);
    readString.trim();
    if (topicMatching(readString, COMMAND_VERSION)) {
      sendAnswer(COMMAND_VERSION + " " + VERSION);
    } else if (topicMatching(readString, COMMAND_TEMPERATURE)) {
      sendAnswer(COMMAND_TEMPERATURE + " " + ((temprature_sens_read() - 32) / 1.8) + " C");
    } else if (topicMatching(readString, COMMAND_ROOMCONFIG)) {
      roomconfig();
    } else if (topicMatching(readString, COMMAND_ROOMNAME)) {
      sendAnswer(COMMAND_ROOMNAME_SHORT + " " + roomname);
    } else if (topicMatching(readString, COMMAND_ROOMNAME_SHORT)) {
      sendAnswer(COMMAND_ROOMNAME_SHORT + " " + roomname_short);
    } else if (topicMatching(readString, COMMAND_JUDGE_COUNT)) {
      sendAnswer(COMMAND_JUDGE_COUNT + " " + judge_count);
    } else if (topicMatching(readString, COMMAND_BS_LA_ENABLE)) {
      sendAnswer(COMMAND_BS_LA_ENABLE + " " + bs_la_enable);
    } else if (topicMatching(readString, COMMAND_BS_LI_ENABLE)) {
      sendAnswer(COMMAND_BS_LI_ENABLE + " " + bs_li_enable);
    } else if (topicMatching(readString, COMMAND_BS_RI_ENABLE)) {
      sendAnswer(COMMAND_BS_RI_ENABLE + " " + bs_ri_enable);
    } else if (topicMatching(readString, COMMAND_BS_RA_ENABLE)) {
      sendAnswer(COMMAND_BS_RA_ENABLE + " " + bs_ra_enable);
    } else if (topicMatching(readString, COMMAND_SECOND_BS)) {
      sendAnswer(COMMAND_SECOND_BS + " " + second_bs);
    } else if (topicMatching(readString, COMMAND_PRESS_ENABLE)) {
      sendAnswer(COMMAND_PRESS_ENABLE + " " + press_enable);
    } else if (topicMatching(readString, COMMAND_DSP_CHANNEL_NAMES)) {
      dspChannelNaming();
    } else if (topicMatching(readString, COMMAND_VS_88_IO_LABLE)) {
      vs88ioNaming();
    } else if (topicMatching(readString, COMMAND_DSP_ALL_ENABLE)) {
      dsp_all_enabele();
    } else if (topicMatching(readString, COMMAND_PTZ_PRESET_LABLE)) {
      ptz_preset_lable();
    } else if (topicMatching(readString, COMMAND_TV_VOLUME)) {
      sendAnswer(COMMAND_TV_VOLUME + "-TP-590TXR," +  tv_volume_tp_590txr);
      sendAnswer(COMMAND_TV_VOLUME + "-VP-440X," +  tv_volume_vp_440x);
    } else if (topicMatching(readString, COMMAND_PTZ_ENABLE)) {
      sendAnswer(COMMAND_PTZ_ENABLE + " " +  ptz_enable);
    } else if (topicMatching(readString, COMMAND_CAM_SCENE_NAMES)) {
      cam_scene_names();
    } else {
      sendAnswer(ERROR_MESSAGE);
    }
    readString = "";
  }
}

Hello everyone I have ESP-32 board and using Commands on Hercules. Normally I change in Code the const Strings and then set with Command. Now I want to know if there is a way to set the Command directly not in Code byself rather in program Hercules. For Example now I type ##ROOMNAME and the Roomname will set but now I´m searching for a way to type ##ROOMNAME test

Source: Windows Questions C++

LEAVE A COMMENT