Robot Control Library
mavlink_udp.h File Reference
#include <stdint.h>
#include <rc/mavlink/common/mavlink.h>
#include <rc/mavlink/mavlink_types.h>
#include <rc/mavlink_udp_helpers.h>

Go to the source code of this file.

Macros

#define RC_MAV_DEFAULT_UDP_PORT   14551
 
#define RC_MAV_DEFAULT_CONNECTION_TIMEOUT_US   2000000
 

Typedefs

typedef enum rc_mav_connection_state_t rc_mav_connection_state_t
 

Enumerations

enum  rc_mav_connection_state_t {
  MAV_CONNECTION_WAITING,
  MAV_CONNECTION_ACTIVE,
  MAV_CONNECTION_LOST
}
 

Functions

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. More...
 
int rc_mav_set_dest_ip (const char *dest_ip)
 Sets the destination ip address for sent packets. More...
 
int rc_mav_set_system_id (uint8_t system_id)
 Sets the system identifier. More...
 
int rc_mav_cleanup (void)
 Closes UDP port and stops network port listening thread. More...
 
int rc_mav_send_msg (mavlink_message_t msg)
 Sends any user-packed mavlink message. More...
 
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. More...
 
int rc_mav_get_msg (int msg_id, mavlink_message_t *msg)
 Fetches the last received message of type msg_id. More...
 
int rc_mav_set_callback (int msg_id, void(*func)(void))
 assign a callback function to be called when a particular message is received. More...
 
int rc_mav_set_callback_all (void(*func)(void))
 Sets a callback function which is called when any packet arrives. More...
 
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 messages. More...
 
rc_mav_connection_state_t rc_mav_get_connection_state (void)
 Gets the connection state as determined by received heartbeat packets. More...
 
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. More...
 
uint8_t rc_mav_get_sys_id_of_last_msg_any (void)
 Fetches the system ID of the sender of the last received message. More...
 
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. More...
 
int64_t rc_mav_ns_since_last_msg_any (void)
 Fetches the number of nanoseconds since any packet has been received. More...
 
int rc_mav_msg_id_of_last_msg (void)
 Returns the msg_id of the last received packet. More...
 
int rc_mav_print_msg_name (int msg_id)
 Prints to stdout a human-readable name for a message type. More...