/* Envoie des commandes au esp32 */ #include #include #include #include #include #include #include using namespace std; int main (int argc, char *argv[]) { glocal int ret = -1; glocal const char *espname = nullptr; glocal const char *port = "23"; glocal int timeout = 3; glocal.ret = (argc,argv); setproginfo ("talkesp32","0.0","..."); setarg ('e',"espname","Nom du esp ou adresse IP",glocal.espname,true); setarg ('p',"port","Port TCP",glocal.port,false); setarg ('t',"timeout","Delai d'attente",glocal.timeout,false); glocal int ret = -1; for (int i=0; i 0) sleep (1); (glocal.espname,glocal.port,glocal.timeout); sendf ("%s\n",glocal.arg); tlmp_error ("Delai d'attente expiré\n"); end = true; if (strcmp(line,"fin")==0){ glocal.ret = 0; end = true; }else{ printf ("%s\n",line); } if (glocal.ret == -1) tlmp_error ("Communication incomplète\n"); } return glocal.ret; return glocal.ret; }