[UDP-HTTP] Change and fix SimpleResults format

Use owl_result_to_csv_simple() from libowlps-result.
This commit is contained in:
Matteo Cypriani 2011-08-22 13:32:02 +02:00
parent 6160eb9c98
commit ee02f26d8a
1 changed files with 7 additions and 5 deletions

View File

@ -16,12 +16,14 @@
*
* The only HTTP request currently implemented is "ReadSimpleResults".
* Answer in case of error:
* SimpleResults;NOK
* SimpleResults;NOK;Explanation
* Normal answer:
* SimpleResults;OK;Nb_results;Result_1;;Result_n
* Nb_results is the number of results in the answer.
* Nb_results is the number of results in the answer (number of mobiles).
* Result_i follows this format:
* Mobile_MAC;Algorithm_name;X;Y;Z;Area_name
* Mobile_MAC;X;Y;Z;Area_name
* Area_name is the name of the area or room in which the mobile is (may
* be empty).
*
* If a unknown request is received, the answer format is:
* UnknownRequest;NOK
@ -298,7 +300,7 @@ void* tcp_server(void *NULL_value)
answer_len += answer_begin_len ;
answer_buf_len =
answer_len + answer_begin_len +
answer_len +
nb_results * OWL_CSV_RESULT_STRLEN ;
answer = realloc(answer, answer_buf_len) ;
@ -307,7 +309,7 @@ void* tcp_server(void *NULL_value)
{
char result_str[OWL_CSV_RESULT_STRLEN] ;
size_t result_len ;
owl_result_to_csv(result_str, result->result) ;
owl_result_to_csv_simple(result_str, result->result) ;
result_len = strlen(result_str) ;
answer[answer_len++] = ';' ;
strncpy(answer + answer_len, result_str,