Commit 90ec0304 authored by Gebhardt, Albrecht's avatar Gebhardt, Albrecht
Browse files

Merge branch 'master' of gitlab.aau.at:agebhard/frewe-rpi

?
parents 3621b0ac 65f69da7
all: frewe-client all: frewe-client
frewe-client: frewe-client.c http_fetcher.c http_error_codes.c curl-fopen.c frewe-client: frewe-client.c http_fetcher.c http_error_codes.c curl-fopen.c
gcc frewe-client.c http_fetcher.c http_error_codes.c curl-fopen.c -o frewe-client -lusb -lm -lcrypto -lcurl gcc -g frewe-client.c http_fetcher.c http_error_codes.c curl-fopen.c -o frewe-client -lusb -lm -lcrypto -lcurl
install: frewe-client install: frewe-client
cp rc.frewe-client /etc/init.d/frewe-client cp rc.frewe-client /etc/init.d/frewe-client
......
...@@ -556,6 +556,7 @@ int main(int argc, char **argv) ...@@ -556,6 +556,7 @@ int main(int argc, char **argv)
{ {
logger(LOG_DEBUG,"main","Getting lasttime from server URL: %s", frewe_server_url_lasttime); logger(LOG_DEBUG,"main","Getting lasttime from server URL: %s", frewe_server_url_lasttime);
rv=ws_submit(frewe_server_url_lasttime,&filebuf); rv=ws_submit(frewe_server_url_lasttime,&filebuf);
if(filebuf){
if (rv==0 && strlen(filebuf)>25) rv=1; // Got some buggy output which can cause SIGSERV in strptime if (rv==0 && strlen(filebuf)>25) rv=1; // Got some buggy output which can cause SIGSERV in strptime
if (rv==0 && strncasecmp(filebuf,"Not found",9)==0) // If lasttime not found try to read all records from WS if (rv==0 && strncasecmp(filebuf,"Not found",9)==0) // If lasttime not found try to read all records from WS
...@@ -590,6 +591,7 @@ int main(int argc, char **argv) ...@@ -590,6 +591,7 @@ int main(int argc, char **argv)
{ logger(LOG_ERROR,"main","Failed to get lasttime from %s", frewe_server_url_lasttime); { logger(LOG_ERROR,"main","Failed to get lasttime from %s", frewe_server_url_lasttime);
rv=0; // Ignore this error and get the data only for the current position rv=0; // Ignore this error and get the data only for the current position
} }
}
} }
// Warn if position doesn't meet a real record // Warn if position doesn't meet a real record
...@@ -701,6 +703,7 @@ int main(int argc, char **argv) ...@@ -701,6 +703,7 @@ int main(int argc, char **argv)
else else
{ logger(LOG_DEBUG,"main","Submitting to server URL: %s", output); { logger(LOG_DEBUG,"main","Submitting to server URL: %s", output);
rv=ws_submit(output,&filebuf); rv=ws_submit(output,&filebuf);
if(filebuf){
if (rv!=0 || strncasecmp(filebuf,"OK",2)!=0) if (rv!=0 || strncasecmp(filebuf,"OK",2)!=0)
{ logger(LOG_ERROR,"main","Error submitting to frewe-server, check FreweServerURL"); { logger(LOG_ERROR,"main","Error submitting to frewe-server, check FreweServerURL");
...@@ -714,6 +717,7 @@ int main(int argc, char **argv) ...@@ -714,6 +717,7 @@ int main(int argc, char **argv)
} }
*/ */
} }
}
} }
free(output); free(output);
...@@ -1528,7 +1532,8 @@ int ws_parse(uint8_t *buffer, uint8_t *buffer60, uint8_t *buffer0h, time_t curti ...@@ -1528,7 +1532,8 @@ int ws_parse(uint8_t *buffer, uint8_t *buffer60, uint8_t *buffer0h, time_t curti
if (w.pressabs < 650 || w.pressabs>1100) if (w.pressabs < 650 || w.pressabs>1100)
{ logger(LOG_ERROR,"ws_parse","Pressure out of range: %f hPa",w.pressabs); { logger(LOG_ERROR,"ws_parse","Pressure out of range: %f hPa",w.pressabs);
errcount++; //errcount++;
w.pressabs=-1;
} }
// Relative pressure (hPa) // Relative pressure (hPa)
...@@ -1915,28 +1920,32 @@ int ws_format(char *format, char *out, unsigned char urlencode, char *user, char ...@@ -1915,28 +1920,32 @@ int ws_format(char *format, char *out, unsigned char urlencode, char *user, char
case 'P': // abs. pressure hPa case 'P': // abs. pressure hPa
if (w.pressabs<650 || w.pressabs>1100) if (w.pressabs<650 || w.pressabs>1100)
strcatenc(out,error,urlencode); //strcatenc(out,error,urlencode);
sprintf(out,"%sNA",out);
else else
sprintf(out,"%s%0.1f",out,w.pressabs); sprintf(out,"%s%0.1f",out,w.pressabs);
break; break;
case 'p': // abs. pressure in case 'p': // abs. pressure in
if (w.pressabs<650 || w.pressabs>1100) if (w.pressabs<650 || w.pressabs>1100)
strcatenc(out,error,urlencode); //strcatenc(out,error,urlencode);
sprintf(out,"%sNA",out);
else else
sprintf(out,"%s%0.2f",out,hpa2in(w.pressabs)); sprintf(out,"%s%0.2f",out,hpa2in(w.pressabs));
break; break;
case 'L': // rel. pressure hPa case 'L': // rel. pressure hPa
if (w.pressrel<650 || w.pressrel>1100) if (w.pressrel<650 || w.pressrel>1100)
strcatenc(out,error,urlencode); //strcatenc(out,error,urlencode);
sprintf(out,"%sNA",out);
else else
sprintf(out,"%s%0.1f",out,w.pressrel); sprintf(out,"%s%0.1f",out,w.pressrel);
break; break;
case 'l': // rel. pressure in case 'l': // rel. pressure in
if (w.pressrel<650 || w.pressrel>1100) if (w.pressrel<650 || w.pressrel>1100)
strcatenc(out,error,urlencode); //strcatenc(out,error,urlencode);
sprintf(out,"%sNA",out);
else else
sprintf(out,"%s%0.2f",out,hpa2in(w.pressrel)); sprintf(out,"%s%0.2f",out,hpa2in(w.pressrel));
break; break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment