void do_rem_bus(int opcao, int sock_cli, char *cmp, int *sock, char *buf, sockaddr_in *serv, hostent *he, int port) { if(!do_echo(sock, buf, serv, he, port)) return; receber(sock, cmp, 400); if(strcmp(cmp, "end")) { enviar(sock_cli, cmp); if(opcao) { while(strcmp(cmp, "end")) { receber(sock, cmp, 400); enviar(sock_cli, cmp); } } } }
int tttmain(int argc, char **argv) { int sockfd; int BUFFERSIZE = 50; char infobuf1[BUFFERSIZE]; char infobuf2[BUFFERSIZE]; char infobuf3[BUFFERSIZE]; receber(); recv(sockfd,infobuf1,BUFFERSIZE-1,0);//records from mem if(argc > 1) { recv(sockfd,infobuf2,BUFFERSIZE-1,0);//records from mem } else { recv(sockfd,infobuf3,BUFFERSIZE-1,0);//records from mem } return 0; }
void *PrintReceber(){ //printf("\nVai levantar o servidor\n"); receber("4200"); //printf("\nServidor no ar\n"); pthread_exit(NULL); }
void DevBot::controleRemoto() { if(!recebeuDados()) return; receber(); split(); if(strcmp("frente",command1)==0 || strcmp("fr",command1)==0 ) { motores.frente(atoi(parameter1)); } else if(strcmp("re",command1)==0 || strcmp("ré",command1)==0 ) { motores.re(atoi(parameter1)); } else if(strcmp("parar",command1)==0 || strcmp("pa",command1)==0 ) { motores.parar(); } else if(strcmp("esquerda",command1)==0 || strcmp("fe",command1)==0 ) { motores.esquerda(atoi(parameter1)); } else if(strcmp("direita",command1)==0 || strcmp("fd",command1)==0 ) { motores.direita(atoi(parameter1)); } else if(strcmp("reEsquerda",command1)==0 || strcmp("re",command1)==0 ) { motores.reEsquerda(atoi(parameter1)); } else if(strcmp("reDireita",command1)==0 || strcmp("rd",command1)==0 ) { motores.reDireita(atoi(parameter1)); } else if(strcmp("girar",command1)==0) { //aleatorio horário ou anti-horário motores.girar(atoi(parameter1)); } else if(strcmp("girarHorario",command1)==0 || strcmp("gh",command1)==0 ) { //aleatorio horário ou anti-horário motores.girar(atoi(parameter1),0); } else if(strcmp("girarAntiHorario",command1)==0 || strcmp("ga",command1)==0 ) { //aleatorio horário ou anti-horário motores.girar(atoi(parameter1),1); } else if(strcmp("aleatorio",command1)==0) { //aleatorio horário ou anti-horário motores.movimentoAleatorio(atoi(parameter1)); } else if(strcmp("sl",command1)==0) { Serial.print("l?"); Serial.println(robot.sensorLuz()); Serial.flush(); } else if(strcmp("st",command1)==0) { Serial.print("t?"); Serial.println(robot.sensorTemperatura()); Serial.flush(); } else if(strcmp("sd1",command1)==0) { Serial.print("d?"); Serial.println(robot.sensorDistancia1()); Serial.flush(); } else if(strcmp("servo",command1)==0) { mudarServo(atoi(parameter1)); } //38321548 //38343200vigilancia sana }