[Aggregator] Send the capture time to Positioner

The Aggregator now transmits the capture timestamp of each packet to the
positioning server. For now this timestamp is not stored, only displayed
(in verbose mode) when a request is received.
This commit is contained in:
Matteo Cypriani 2012-01-26 12:55:03 +01:00
parent b60d0d380f
commit e98474e678
4 changed files with 10 additions and 0 deletions

View File

@ -108,6 +108,7 @@ typedef struct _owl_request_info
{ {
uint16_t packet_id ; // Number of the current packet uint16_t packet_id ; // Number of the current packet
uint8_t ap_mac_addr_bytes[ETHER_ADDR_LEN] ; // MAC of the listener 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) uint8_t ss_dbm ; // Signal strength measured by the listener (dBm)
} owl_request_info ; } owl_request_info ;

View File

@ -39,6 +39,8 @@ typedef struct _request_info_list
uint16_t packet_id ; uint16_t packet_id ;
// MAC address of the transmitter AP (in bytes): // MAC address of the transmitter AP (in bytes):
uint8_t ap_mac_addr_bytes[ETHER_ADDR_LEN] ; uint8_t ap_mac_addr_bytes[ETHER_ADDR_LEN] ;
// Timestamp of arrival on the listener:
owl_timestamp capture_time ;
// Signal strength received by the AP from the mobile: // Signal strength received by the AP from the mobile:
uint8_t ss_dbm ; uint8_t ss_dbm ;
struct _request_info_list *next ; struct _request_info_list *next ;

View File

@ -705,6 +705,8 @@ void* monitor_requests(void *NULL_value)
memcpy(info.ap_mac_addr_bytes, memcpy(info.ap_mac_addr_bytes,
request_info_ptr->ap_mac_addr_bytes, request_info_ptr->ap_mac_addr_bytes,
ETHER_ADDR_LEN) ; ETHER_ADDR_LEN) ;
info.capture_time = request_info_ptr->capture_time ;
owl_hton_timestamp(&info.capture_time) ;
info.ss_dbm = request_info_ptr->ss_dbm ; info.ss_dbm = request_info_ptr->ss_dbm ;
sendto(sockfd, &info, sizeof(info), sendto(sockfd, &info, sizeof(info),
0, (struct sockaddr *)&serv, serv_len) ; 0, (struct sockaddr *)&serv, serv_len) ;
@ -788,6 +790,7 @@ void got_request(owl_captured_request request)
tmp_info->packet_id = request.packet_id ; tmp_info->packet_id = request.packet_id ;
memcpy(tmp_info->ap_mac_addr_bytes, request.ap_mac_addr_bytes, memcpy(tmp_info->ap_mac_addr_bytes, request.ap_mac_addr_bytes,
ETHER_ADDR_LEN) ; ETHER_ADDR_LEN) ;
tmp_info->capture_time = request.capture_time ;
tmp_info->ss_dbm = request.ss_dbm ; tmp_info->ss_dbm = request.ss_dbm ;
tmp_info->next = NULL ; tmp_info->next = NULL ;

View File

@ -190,6 +190,9 @@ bool InputUDPSocket::fill_current_request()
owl_mac_bytes_to_string(request_info.ap_mac_addr_bytes)) ; owl_mac_bytes_to_string(request_info.ap_mac_addr_bytes)) ;
PosUtil::to_upper(mac_ap) ; PosUtil::to_upper(mac_ap) ;
owl_ntoh_timestamp(&request_info.capture_time) ;
Timestamp capture_time(request_info.capture_time) ;
// Substracting 256 is not mandatory here since it is done // Substracting 256 is not mandatory here since it is done
// automatically when casting from unsigned to signed, but // automatically when casting from unsigned to signed, but
// I write it anyway for the sake of clarity. // I write it anyway for the sake of clarity.
@ -200,6 +203,7 @@ bool InputUDPSocket::fill_current_request()
<< "\t* Packet received from the aggregator:" << "\t* Packet received from the aggregator:"
<< "\n\t\tPacket number: " << packet_id << "\n\t\tPacket number: " << packet_id
<< "\n\t\tAP MAC: " << mac_ap << "\n\t\tAP MAC: " << mac_ap
<< "\n\t\tCapture timestamp: " << capture_time
<< "\n\t\tSignal: " << "\n\t\tSignal: "
<< ss << " dBm" << ss << " dBm"
<< '\n' ; << '\n' ;