mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 17:48:53 +08:00
MavlinkFTP: remove MavlinkStream inheritance
This commit is contained in:
@@ -49,10 +49,10 @@
|
||||
//#define MAVLINK_FTP_DEBUG
|
||||
|
||||
MavlinkFTP::MavlinkFTP(Mavlink *mavlink) :
|
||||
MavlinkStream(mavlink),
|
||||
_session_info{},
|
||||
_utRcvMsgFunc{},
|
||||
_worker_data{}
|
||||
_worker_data{},
|
||||
_mavlink(mavlink)
|
||||
{
|
||||
// initialize session
|
||||
_session_info.fd = -1;
|
||||
@@ -63,18 +63,6 @@ MavlinkFTP::~MavlinkFTP()
|
||||
|
||||
}
|
||||
|
||||
const char *
|
||||
MavlinkFTP::get_name() const
|
||||
{
|
||||
return "MAVLINK_FTP";
|
||||
}
|
||||
|
||||
uint16_t
|
||||
MavlinkFTP::get_id()
|
||||
{
|
||||
return MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL;
|
||||
}
|
||||
|
||||
unsigned
|
||||
MavlinkFTP::get_size()
|
||||
{
|
||||
@@ -86,12 +74,6 @@ MavlinkFTP::get_size()
|
||||
}
|
||||
}
|
||||
|
||||
MavlinkStream *
|
||||
MavlinkFTP::new_instance(Mavlink *mavlink)
|
||||
{
|
||||
return new MavlinkFTP(mavlink);
|
||||
}
|
||||
|
||||
#ifdef MAVLINK_FTP_UNIT_TEST
|
||||
void
|
||||
MavlinkFTP::set_unittest_worker(ReceiveMessageFunc_t rcvMsgFunc, void *worker_data)
|
||||
|
||||
@@ -40,21 +40,25 @@
|
||||
#include <queue.h>
|
||||
|
||||
#include <systemlib/err.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
#include "mavlink_stream.h"
|
||||
#include "mavlink_bridge_header.h"
|
||||
|
||||
class MavlinkFtpTest;
|
||||
class Mavlink;
|
||||
|
||||
/// MAVLink remote file server. Support FTP like commands using MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL message.
|
||||
class MavlinkFTP : public MavlinkStream
|
||||
class MavlinkFTP
|
||||
{
|
||||
public:
|
||||
/// @brief Constructor is only public so unit test code can new objects.
|
||||
MavlinkFTP(Mavlink *mavlink);
|
||||
~MavlinkFTP();
|
||||
|
||||
static MavlinkStream *new_instance(Mavlink *mavlink);
|
||||
/**
|
||||
* Handle sending of messages. Call this regularly at a fixed frequency.
|
||||
* @param t current time
|
||||
*/
|
||||
void send(const hrt_abstime t);
|
||||
|
||||
/// Handle possible FTP message
|
||||
void handle_message(const mavlink_message_t *msg);
|
||||
@@ -115,10 +119,7 @@ public:
|
||||
kErrUnknownCommand ///< Unknown command opcode
|
||||
};
|
||||
|
||||
// MavlinkStream overrides
|
||||
virtual const char *get_name(void) const;
|
||||
virtual uint16_t get_id(void);
|
||||
virtual unsigned get_size(void);
|
||||
unsigned get_size();
|
||||
|
||||
private:
|
||||
char *_data_as_cstring(PayloadHeader *payload);
|
||||
@@ -145,9 +146,6 @@ private:
|
||||
uint8_t _getServerComponentId(void);
|
||||
uint8_t _getServerChannel(void);
|
||||
|
||||
// Overrides from MavlinkStream
|
||||
virtual void send(const hrt_abstime t);
|
||||
|
||||
static const char kDirentFile = 'F'; ///< Identifies File returned from List command
|
||||
static const char kDirentDir = 'D'; ///< Identifies Directory returned from List command
|
||||
static const char kDirentSkip = 'S'; ///< Identifies Skipped entry from List command
|
||||
@@ -169,6 +167,8 @@ private:
|
||||
ReceiveMessageFunc_t _utRcvMsgFunc; ///< Unit test override for mavlink message sending
|
||||
void *_worker_data; ///< Additional parameter to _utRcvMsgFunc;
|
||||
|
||||
Mavlink *_mavlink;
|
||||
|
||||
/* do not allow copying this class */
|
||||
MavlinkFTP(const MavlinkFTP &);
|
||||
MavlinkFTP operator=(const MavlinkFTP &);
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
class Mavlink;
|
||||
class MavlinkStream;
|
||||
|
||||
class MavlinkStream
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user