diff --git a/libowlps/owlps.h b/libowlps/owlps.h index 9a9f9d6..a9f5e34 100644 --- a/libowlps/owlps.h +++ b/libowlps/owlps.h @@ -108,7 +108,7 @@ typedef struct _owl_captured_request uint8_t mobile_ip_addr_bytes[4] ; // IP of the mobile owl_timestamp request_time ; // Timestamp on the mobile owl_timestamp capture_time ; // Timestamp of arrival on the listener - uint8_t ss_dbm ; // Signal strength measured by the listener (dBm) + int8_t ss_dbm ; // Signal strength measured by the listener (dBm) /* Calibration data */ float x_position ; float y_position ; @@ -143,7 +143,7 @@ typedef struct _owl_request_info uint16_t packet_id ; // Number of the current packet uint8_t ap_mac_addr_bytes[ETHER_ADDR_LEN] ; // MAC of the listener owl_timestamp capture_time ; // Timestamp of arrival on the listener - uint8_t ss_dbm ; // Signal strength measured by the listener (dBm) + int8_t ss_dbm ; // Signal strength measured by the listener (dBm) } owl_request_info ; diff --git a/owlps-aggregator/owlps-aggregator.h b/owlps-aggregator/owlps-aggregator.h index 692e81a..ccbea51 100644 --- a/owlps-aggregator/owlps-aggregator.h +++ b/owlps-aggregator/owlps-aggregator.h @@ -76,7 +76,7 @@ typedef struct _request_info_list // Timestamp of arrival on the listener: owl_timestamp capture_time ; // Signal strength received by the AP from the mobile: - uint8_t ss_dbm ; + int8_t ss_dbm ; struct _request_info_list *next ; } request_info_list ; diff --git a/owlps-aggregator/owlps-aggregatord.c b/owlps-aggregator/owlps-aggregatord.c index 90d584a..66d7ffa 100644 --- a/owlps-aggregator/owlps-aggregatord.c +++ b/owlps-aggregator/owlps-aggregatord.c @@ -579,7 +579,7 @@ int read_loop(int sockfd) "\tMobile IP: %s\n" "\tRequest timestamp: %s\n" "\tRequest arrival time on the AP: %s\n" - "\tSignal: %d dBm\n" + "\tSignal: %"PRId8" dBm\n" "\tPosition X: %f\n" "\tPosition Y: %f\n" "\tPosition Z: %f\n" @@ -592,7 +592,7 @@ int read_loop(int sockfd) mobile_ip_str, request_time_str, capture_time_str, - request.ss_dbm - 256, + request.ss_dbm, request.x_position, request.y_position, request.z_position, @@ -761,10 +761,10 @@ void* monitor_requests(void *NULL_value) owl_mac_bytes_to_string_r(request_info_ptr-> ap_mac_addr_bytes, mac_str) ; - fprintf(fd, ";%s;%"PRIu16";%d", + fprintf(fd, ";%s;%"PRIu16";%"PRId8, mac_str, request_info_ptr->packet_id, - request_info_ptr->ss_dbm - 256) ; + request_info_ptr->ss_dbm) ; // Delete request request_info_ptr = request_info_ptr->next ; @@ -1421,9 +1421,9 @@ void print_request_info(request_info_list *info) owl_mac_bytes_to_string_r(info->ap_mac_addr_bytes, ap_mac_str) ; fprintf(stderr, "\tAP MAC: %s\n" - "\tSignal strength: %d dBm\n", + "\tSignal strength: %"PRId8" dBm\n", ap_mac_str, - info->ss_dbm - 256 + info->ss_dbm ) ; } #endif // NDEBUG diff --git a/owlps-listener/owlps-listenerd.c b/owlps-listener/owlps-listenerd.c index 43f31ae..35148f8 100644 --- a/owlps-listener/owlps-listenerd.c +++ b/owlps-listener/owlps-listenerd.c @@ -1201,7 +1201,7 @@ void read_packet(const struct pcap_pkthdr *pkt_header, "\tMobile IP: %s\n" "\tRequest timestamp: %s\n" "\tRequest arrival time on the AP: %s\n" - "\tSignal: %d dBm\n" + "\tSignal: %"PRId8" dBm\n" "\tPosition X: %f\n" "\tPosition Y: %f\n" "\tPosition Z: %f\n" @@ -1215,7 +1215,7 @@ void read_packet(const struct pcap_pkthdr *pkt_header, mobile_ip_str, request_time_str, capture_time_str, - rtap_fields[RTAP_ANTENNASIGNALDBM] ? request.ss_dbm - 256 : 0, + rtap_fields[RTAP_ANTENNASIGNALDBM] ? request.ss_dbm : 0, owl_ntohf(request.x_position), owl_ntohf(request.y_position), owl_ntohf(request.z_position), @@ -1340,8 +1340,7 @@ void extract_radiotap_data(const u_char *pkt_data, memcpy(&request->ss_dbm, &pkt_data[rtap_position], RTAP_L_ANTENNASIGNALDBM) ; if (VERBOSE_INFO) - printf("Antenna signal: %d dBm\n", - request->ss_dbm - 256); + printf("Antenna signal: %"PRId8" dBm\n", request->ss_dbm) ; rtap_position += RTAP_L_ANTENNASIGNALDBM ; break ; case RTAP_ANTENNANOISEDBM: diff --git a/owlps-positioner/src/inputudpsocket.cc b/owlps-positioner/src/inputudpsocket.cc index 2cbbd87..0439f34 100644 --- a/owlps-positioner/src/inputudpsocket.cc +++ b/owlps-positioner/src/inputudpsocket.cc @@ -227,10 +227,7 @@ bool InputUDPSocket::fill_current_request() owl_ntoh_timestamp(&request_info.capture_time) ; Timestamp capture_time(request_info.capture_time) ; - // Substracting 256 is not mandatory here since it is done - // automatically when casting from unsigned to signed, but - // I write it anyway for the sake of clarity. - ss_t ss = request_info.ss_dbm - 256 ; + ss_t ss = request_info.ss_dbm ; if (Configuration::is_configured("verbose")) cerr