GCS_MAVLink: a send_text method on the GCS singleton
This commit is contained in:
parent
f9eeaacd6c
commit
02532af64b
17
libraries/GCS_MAVLink/GCS.cpp
Normal file
17
libraries/GCS_MAVLink/GCS.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "GCS.h"
|
||||||
|
|
||||||
|
extern const AP_HAL::HAL& hal;
|
||||||
|
|
||||||
|
/*
|
||||||
|
send a text message to all GCS
|
||||||
|
*/
|
||||||
|
void GCS::send_text(MAV_SEVERITY severity, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
char text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1] {};
|
||||||
|
va_list arg_list;
|
||||||
|
va_start(arg_list, fmt);
|
||||||
|
hal.util->vsnprintf((char *)text, sizeof(text)-1, fmt, arg_list);
|
||||||
|
va_end(arg_list);
|
||||||
|
text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN] = 0;
|
||||||
|
send_statustext(severity, GCS_MAVLINK::active_channel_mask() | GCS_MAVLINK::streaming_channel_mask(), text);
|
||||||
|
}
|
@ -429,6 +429,7 @@ public:
|
|||||||
return _singleton;
|
return _singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void send_text(MAV_SEVERITY severity, const char *fmt, ...);
|
||||||
virtual void send_statustext(MAV_SEVERITY severity, uint8_t dest_bitmask, const char *text);
|
virtual void send_statustext(MAV_SEVERITY severity, uint8_t dest_bitmask, const char *text);
|
||||||
void service_statustext(void);
|
void service_statustext(void);
|
||||||
virtual GCS_MAVLINK &chan(const uint8_t ofs) = 0;
|
virtual GCS_MAVLINK &chan(const uint8_t ofs) = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user