티스토리 뷰

 

 

void b_PostprocessWebCommand(char CommandType1, char CommandType2, String CommandString){
  switch(CommandType1){
    case 'P': // Port control of WiFi device
    {
      int PortValue = 0;
      int PortNo = 0;
      PortValue = (int) CommandString.toInt();
      if(CommandType2 == 'R'){ // Port control for RELAY
        PortNo = PIN_RELAY;
        if(PortValue == 1) IsPowerON = true;
        if(PortValue == 0) IsPowerON = false;
      }else if(CommandType2 == 'O'){ // Port control for RELAY
        PortNo = PIN_BUZZER;
      }else{
        PortNo = (int)(String(CommandType2).toInt());
        if(PortNo == 0) return;
      }
      if(PortValue == 1) digitalWrite(PortNo, HIGH);
      if(PortValue == 0) digitalWrite(PortNo, LOW);
    }
      break;
    case 'R': // Request
    {
      switch(CommandType2){
        case '0':  // for THE WiFi device
          b_CheckAnalogInput();
          break;
        case 'L': // list of sub devices
          b_SendDeviceList();
          break;
        case 'D': // Data
          RxCommand_WiFi = CommandString;
          IsCommandFromWeb = true;
          break;
        case 'C': // Command
          RxCommand_WiFi = CommandString;
          IsCommandFromWeb = true;
          break;
      }
    }  
      break;
  }
}

 

반응형

'SWDesk > Firmware' 카테고리의 다른 글

[BMS] Command Process for CD Devices  (0) 2020.07.19
[BMS] Command Process for LoRa Device  (0) 2020.07.19
[BPM] Firmware Source for Master  (0) 2020.06.15
IFTTT with Arduino  (0) 2020.05.10
[BMS] Firmware for Measurement Device  (0) 2020.04.29