mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
MAVLink app: Return result of network operation
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user