21 #ifndef RC_MAVLINK_UDP_H 22 #define RC_MAVLINK_UDP_H 31 #include <rc/mavlink/common/mavlink.h> 32 #include <rc/mavlink/mavlink_types.h> 35 #define RC_MAV_DEFAULT_UDP_PORT 14551 36 #define RC_MAV_DEFAULT_CONNECTION_TIMEOUT_US 2000000 69 int rc_mav_init(uint8_t system_id,
const char* dest_ip, uint16_t port, uint64_t connection_timeout_us);
272 #endif // RC_MAVLINK_UDP_H int rc_mav_set_callback_all(void(*func)(void))
Sets a callback function which is called when any packet arrives.
int rc_mav_set_system_id(uint8_t system_id)
Sets the system identifier.
Definition: mavlink_udp.h:45
int rc_mav_cleanup(void)
Closes UDP port and stops network port listening thread.
int rc_mav_get_msg(int msg_id, mavlink_message_t *msg)
Fetches the last received message of type msg_id.
int rc_mav_msg_id_of_last_msg(void)
Returns the msg_id of the last received packet.
Definition: mavlink_udp.h:46
int64_t rc_mav_ns_since_last_msg_any(void)
Fetches the number of nanoseconds since any packet has been received.
int rc_mav_send_msg(mavlink_message_t msg)
Sends any user-packed mavlink message.
rc_mav_connection_state_t rc_mav_get_connection_state(void)
Gets the connection state as determined by received heartbeat packets.
int64_t rc_mav_ns_since_last_msg(int msg_id)
Fetches the number of nanoseconds since the last message of type msg_id has been received.
int rc_mav_set_callback(int msg_id, void(*func)(void))
assign a callback function to be called when a particular message is received.
uint8_t rc_mav_get_sys_id_of_last_msg(int msg_id)
Fetches the system ID of the sender of the last received message. of type msg_id. ...
int rc_mav_init(uint8_t system_id, const char *dest_ip, uint16_t port, uint64_t connection_timeout_us)
Initialize a UDP port for sending and receiving.
uint8_t rc_mav_get_sys_id_of_last_msg_any(void)
Fetches the system ID of the sender of the last received message.
int rc_mav_set_callback_connection_lost(void(*func)(void))
Sets a callback function to be called when connection_timeout has been reached without receiving any ...
int rc_mav_is_new_msg(int msg_id)
Inidcates if a particular message type has been received by not read by the user yet.
rc_mav_connection_state_t
Definition: mavlink_udp.h:43
Definition: mavlink_udp.h:44
int rc_mav_set_dest_ip(const char *dest_ip)
Sets the destination ip address for sent packets.
int rc_mav_print_msg_name(int msg_id)
Prints to stdout a human-readable name for a message type.