From ee02f26d8a3fb139ae6750192cc3a79db272ef25 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Mon, 22 Aug 2011 13:32:02 +0200 Subject: [PATCH] [UDP-HTTP] Change and fix SimpleResults format Use owl_result_to_csv_simple() from libowlps-result. --- owlps-udp-to-http/owlps-udp-to-http.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/owlps-udp-to-http/owlps-udp-to-http.c b/owlps-udp-to-http/owlps-udp-to-http.c index 98cae3a..0048abc 100644 --- a/owlps-udp-to-http/owlps-udp-to-http.c +++ b/owlps-udp-to-http/owlps-udp-to-http.c @@ -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,