MAVLink app: Return result of network operation

This commit is contained in:
Lorenz Meier
2016-05-14 16:37:41 +02:00
parent 1775435ee5
commit 56e887c6c7
2 changed files with 9 additions and 6 deletions
+6 -5
View File
@@ -127,7 +127,7 @@ void mavlink_end_uart_send(mavlink_channel_t chan, int length)
{
Mavlink* m = Mavlink::get_instance((unsigned)chan);
if (m != nullptr) {
m->send_packet();
(void)m->send_packet();
}
}
@@ -864,13 +864,13 @@ Mavlink::get_free_tx_buf()
return buf_free;
}
void
int
Mavlink::send_packet()
{
#ifdef __PX4_POSIX
int ret = -1;
#ifdef __PX4_POSIX
if (get_protocol() == UDP) {
ret = sendto(_socket_fd, _network_buf, _network_buf_len, 0, (struct sockaddr *)&_src_addr, sizeof(_src_addr));
@@ -901,8 +901,9 @@ Mavlink::send_packet()
}
_network_buf_len = 0;
#endif
return ret;
}
void
+3 -1
View File
@@ -250,8 +250,10 @@ public:
/**
* Flush the transmit buffer and send one MAVLink packet
*
* @return the number of bytes sent or -1 in case of error
*/
void send_packet();
int send_packet();
/**
* Resend message as is, don't change sequence number and CRC.