[Client] Rename packet variables

This commit is contained in:
Matteo Cypriani 2010-08-03 12:13:09 +02:00
parent dcdab12c27
commit ac6998d798
1 changed files with 22 additions and 22 deletions

View File

@ -68,8 +68,8 @@ BOOL is_calibration_request = FALSE ;
int sockfd ; // Sending socket descriptor
struct sockaddr_in server ; // Server info
char *buf = NULL ; // Packet to send
int buf_size ; // Packet size
char *packet = NULL ; // Packet to send
int packet_size ; // Packet size
@ -283,8 +283,8 @@ inline void create_socket()
/* Creates the packet to send. */
void make_packet()
{
int buf_offset ; // Index used to create the packet
int buf_size ; // Packet size
int offset ; // Index used to create the packet
int size ; // Packet size
struct timeval request_time ;
gettimeofday(&request_time, NULL) ;
@ -293,33 +293,33 @@ void make_packet()
{
printf("Calibration time: %llu\n", timeval_to_ms(request_time)) ;
buf_offset = 0 ;
buf_size =
offset = 0 ;
size =
sizeof(char) * 2 + sizeof(struct timeval) + sizeof(float) * 3 ;
buf = malloc(buf_size) ;
packet = malloc(size) ;
buf[buf_offset++] = PACKET_TYPE_CALIBRATION ; // Packet type
memcpy(&buf[buf_offset], &request_time, sizeof(request_time)) ;
buf_offset += sizeof(request_time) ;
buf[buf_offset++] = options.direction ; // Direction
packet[offset++] = PACKET_TYPE_CALIBRATION ; // Packet type
memcpy(&packet[offset], &request_time, sizeof(request_time)) ;
offset += sizeof(request_time) ;
packet[offset++] = options.direction ; // Direction
#ifdef DEBUG
printf("Direction = %d, X = %f, Y = %f, Z = %f\n",
buf[buf_offset - 1], options.x, options.y, options.z) ;
packet[offset - 1], options.x, options.y, options.z) ;
#endif // DEBUG
memcpy(&buf[buf_offset], &options.x, sizeof(float)) ;
buf_offset += sizeof(float) ;
memcpy(&buf[buf_offset], &options.y, sizeof(float)) ;
buf_offset += sizeof(float) ;
memcpy(&buf[buf_offset], &options.z, sizeof(float)) ;
memcpy(&packet[offset], &options.x, sizeof(float)) ;
offset += sizeof(float) ;
memcpy(&packet[offset], &options.y, sizeof(float)) ;
offset += sizeof(float) ;
memcpy(&packet[offset], &options.z, sizeof(float)) ;
}
else // Standard packet
{
printf("Request time: %llu\n", timeval_to_ms(request_time)) ;
buf_size = sizeof(char) + sizeof(struct timeval) ;
buf = malloc(buf_size) ;
buf[0] = PACKET_TYPE_NORMAL ; // Packet type
memcpy(&buf[1], &request_time, sizeof(request_time)) ;
size = sizeof(char) + sizeof(struct timeval) ;
packet = malloc(size) ;
packet[0] = PACKET_TYPE_NORMAL ; // Packet type
memcpy(&packet[1], &request_time, sizeof(request_time)) ;
}
}
@ -327,7 +327,7 @@ void make_packet()
inline void send_request()
{
owlps_send_request(sockfd, &server, buf, buf_size,
owlps_send_request(sockfd, &server, packet, packet_size,
options.nb_pkt, options.delay) ;
}