Page 195 - MDP2022-2
P. 195

if(str.indexOf("IOT  INIT:")  !=  -1){
                    char  msg[51]  =  {0,  };
                    str.toCharArray(msg,  50);
                      client.publish("device/init",  msg);
                }
                else  if  (str.equals("led  ON"))
                {
                    client.publish("iot/LED",  "led  ON");
                }
                else  if  (str.equals("led  OFF"))
                {
                    client.publish("iot/LED",  "led  OFF");
                }


                else  if  (str.equals("curtain  ON"))
                {
                    client.publish("iot/curtain",  "curtain  ON");
                }
                else  if  (str.equals("curtain  OFF"))
                {
                    client.publish("iot/curtain",  "curtain  OFF");
                }


                else  if  (str.equals("heating_pad  ON"))
                {
                    client.publish("iot/heating_pad",  "heating_pad  ON");
                }
                else  if  (str.equals("heating_pad  OFF"))
                {
                    client.publish("iot/heating_pad",  "heating_pad  OFF");
                }


                else  if  (str.equals("door  ON"))
                {
                    client.publish("iot/door",  "door  ON");
                }
                else  if  (str.equals("door  OFF"))
                {
                    client.publish("iot/door",  "door  OFF");
                }


                else  if  (str.equals("door/keypad  ON"))
                {
                    client.publish("iot/door/keypad",  "door/keypad  ON");
                }
   190   191   192   193   194   195   196   197   198   199   200