|
|
|
@ -365,35 +365,45 @@ public:
@@ -365,35 +365,45 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
MavlinkOrbSubscription *_mavlink_log_sub; |
|
|
|
|
uint64_t _mavlink_log_time; |
|
|
|
|
|
|
|
|
|
/* do not allow top copying this class */ |
|
|
|
|
MavlinkStreamStatustext(MavlinkStreamStatustext &); |
|
|
|
|
MavlinkStreamStatustext& operator = (const MavlinkStreamStatustext &); |
|
|
|
|
|
|
|
|
|
unsigned write_err_count = 0; |
|
|
|
|
static const unsigned write_err_threshold = 5; |
|
|
|
|
#ifndef __PX4_QURT |
|
|
|
|
FILE *fp = nullptr; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
explicit MavlinkStreamStatustext(Mavlink *mavlink) : MavlinkStream(mavlink), |
|
|
|
|
_mavlink_log_sub(_mavlink->add_orb_subscription(ORB_ID(mavlink_log))) |
|
|
|
|
explicit MavlinkStreamStatustext(Mavlink *mavlink) : MavlinkStream(mavlink) |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
~MavlinkStreamStatustext() { |
|
|
|
|
#ifndef __PX4_QURT |
|
|
|
|
if (fp) { |
|
|
|
|
fclose(fp); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void send(const hrt_abstime t) |
|
|
|
|
{ |
|
|
|
|
struct mavlink_log_s mavlink_log; |
|
|
|
|
if (!_mavlink->get_logbuffer()->empty()) { |
|
|
|
|
|
|
|
|
|
if (_mavlink_log_sub->update(&_mavlink_log_time, &mavlink_log)) { |
|
|
|
|
struct mavlink_log_s mavlink_log; |
|
|
|
|
if (_mavlink->get_logbuffer()->get(&mavlink_log)) { |
|
|
|
|
|
|
|
|
|
mavlink_statustext_t msg; |
|
|
|
|
msg.severity = mavlink_log.severity; |
|
|
|
|
|
|
|
|
|
strncpy(msg.text, (const char *)mavlink_log.text, sizeof(msg.text)); |
|
|
|
|
|
|
|
|
|
_mavlink->send_message(MAVLINK_MSG_ID_STATUSTEXT, &msg); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: the logging doesn't work on Snapdragon yet because of file paths.
|
|
|
|
|
#ifndef __PX4_QURT |
|
|
|
|
/* write log messages in first instance to disk */ |
|
|
|
|
if (_mavlink->get_instance_id() == 0) { |
|
|
|
|
if (fp) { |
|
|
|
@ -440,6 +450,8 @@ protected:
@@ -440,6 +450,8 @@ protected:
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class MavlinkStreamCommandLong : public MavlinkStream |
|
|
|
|