Bonjour à tous,
je suis débutant et j'aurais voulu savoir si vous pouviez m'aider a ajouter une à cette librairie
Elle ne permets pas d'envoyer des données à un serveur et j'aimerais ajouter ceci:
mySerial.println("AT+CSQ");
delay(100);
ShowSerialData();// this code is to show the data from gprs shield,
//in order to easily see the process of
//how the gprs shield submit a http request, and the following is for this purpose too.
mySerial.println("AT+CGATT?");
delay(100);
ShowSerialData();
mySerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection
//type is using gprs
delay(1000);
ShowSerialData();
mySerial.println("AT+SAPBR=3,1,\"APN\",\"internet\"");//setting the APN,
//the second need you fill in your local apn server
delay(4000);
ShowSerialData();
mySerial.println("AT+SAPBR=1,1");//setting the SAPBR, for detail you can refer to
//the AT command mamual
delay(2000);
ShowSerialData();
mySerial.println("AT+HTTPINIT"); //init the HTTP request
delay(2000);
ShowSerialData();
mySerial.println("AT+HTTPPARA=\"URL\",\"yyy.dyndns.org/opt/updatesql.php?lat=1.1&long=2.2&alt=3.3&speed=4.4&course=W&date=2013-04-08&time=22:07:07 HTTP/1.1\"");// setting the httppara,
//the second parameter is the website you want to access
delay(1000);
ShowSerialData();
mySerial.println("AT+HTTPACTION=0");//submit the request
delay(8000);//the delay is very important, the delay time is base on the return from the website,
//if the return datas are very large, the time required longer.
//while(!mySerial.available());
ShowSerialData();
mySerial.println("AT+HTTPREAD");// read the data from the website you access
delay(300);
ShowSerialData();
checkForResponse();
mySerial.println("");
delay(100);
mySerial.println("AT+HTTPTERM");// read the data from the website you access
delay(300);
ShowSerialData();
Le probleme c'est qu'il y a les fonction ShowSerialData() et checkResponse(), et là je blocque.
Pouvez-vous m'aider?
Jusqu'à là j'ai cherché et je suis arrivé à ca (corrigez moi, si j'ai fait faut)
J'aimerais aujouter la function
SendData(), du meme genre que la function existante sendSMS(), mais avec une variable data.
Donc:
Dans le fichier GPRS_Shield.h
J'ai ajouté, dans la class GSM, ceci
char SendDATA(char *data);
void ShowSerialData();
void checkForResponse();
Dans le fichier GRPS_Shield.cpp
J'ai ajouté, j'ai ajouté
char GSM::SendDATA(char *data)
{
char ret_val = -1;
// check comm line
if (CLS_FREE != GetCommLineStatus()) return 0;
/*
ret_val = 0 : CommLineStatus KO
ret_val = 1 : not sent
ret_val = 2 : sent
*/
ret_val = 1;
mySerial.println("AT+CSQ");
delay(100);
ShowSerialData();// this code is to show the data from gprs shield,
//in order to easily see the process of
//how the gprs shield submit a http request, and the following is for this purpose too.
mySerial.println("AT+CGATT?");
delay(100);
ShowSerialData();
mySerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection
//type is using gprs
delay(1000);
ShowSerialData();
mySerial.println("AT+SAPBR=3,1,\"APN\",\"internet\"");//setting the APN,
//the second need you fill in your local apn server
delay(4000);
ShowSerialData();
mySerial.println("AT+SAPBR=1,1");//setting the SAPBR, for detail you can refer to
//the AT command mamual
delay(2000);
ShowSerialData();
mySerial.println("AT+HTTPINIT"); //init the HTTP request
delay(2000);
ShowSerialData();
mySerial.println("AT+HTTPPARA=\"URL\",\"yyy.dyndns.org/opt/updatesql.php?lat=1.1&long=2.2&alt=3.3&speed=4.4&course=W&date=2013-04-08&time=22:07:07 HTTP/1.1\"");// setting the httppara,
//the second parameter is the website you want to access
delay(1000);
ShowSerialData();
mySerial.println("AT+HTTPACTION=0");//submit the request
delay(8000);//the delay is very important, the delay time is base on the return from the website,
//if the return datas are very large, the time required longer.
//while(!mySerial.available());
ShowSerialData();
mySerial.println("AT+HTTPREAD");// read the data from the website you access
delay(300);
ShowSerialData();
checkForResponse();
mySerial.println("");
delay(100);
mySerial.println("AT+HTTPTERM");// read the data from the website you access
delay(300);
ShowSerialData();
return 2;
}
Aisni que ceci, tout en bas du meme fichier
char GSM::ShowSerialData()
{
/*
// CA NE MARCHE PAS
while(mySerial.available()!=0);
mySerial.write(mySerial.read(),1);
*/
}
void GSM::checkForResponse(){
}
Quand je compile, je n'ai pas de message d'erreurs mais la fonction ShowSerialData() n'affiche rien
je ne crois pas que je fais juste et normal, c'est las premiere fois que je fais ceci.
Pourriez-vous me guider et me corriger ou me dire comment ajouter un la fonction SendDATA() qui elle fait appel a deux autres fonctions??
Je vous remercie tout pleienemnt