Browse Source

New LinkManager::[connect|disconnect]Link usage

QGC4.4
Don Gagne 11 years ago
parent
commit
a61aead38c
  1. 34
      src/comm/MAVLinkSimulationLink.cc
  2. 15
      src/comm/MAVLinkSimulationLink.h

34
src/comm/MAVLinkSimulationLink.cc

@ -853,7 +853,7 @@ void MAVLinkSimulationLink::readBytes() @@ -853,7 +853,7 @@ void MAVLinkSimulationLink::readBytes()
* @return True if connection has been disconnected, false if connection
* couldn't be disconnected.
**/
bool MAVLinkSimulationLink::disconnect()
bool MAVLinkSimulationLink::_disconnect(void)
{
if(isConnected())
@ -877,7 +877,7 @@ bool MAVLinkSimulationLink::disconnect() @@ -877,7 +877,7 @@ bool MAVLinkSimulationLink::disconnect()
* @return True if connection has been established, false if connection
* couldn't be established.
**/
bool MAVLinkSimulationLink::connect()
bool MAVLinkSimulationLink::_connect(void)
{
_isConnected = true;
emit connected();
@ -893,36 +893,6 @@ bool MAVLinkSimulationLink::connect() @@ -893,36 +893,6 @@ bool MAVLinkSimulationLink::connect()
}
/**
* Connect the link.
*
* @param connect true connects the link, false disconnects it
* @return True if connection has been established, false if connection
* couldn't be established.
**/
void MAVLinkSimulationLink::connectLink()
{
this->connect();
}
/**
* Connect the link.
*
* @param connect true connects the link, false disconnects it
* @return True if connection has been established, false if connection
* couldn't be established.
**/
bool MAVLinkSimulationLink::connectLink(bool connect)
{
_isConnected = connect;
if(connect) {
this->connect();
}
return true;
}
/**
* Check if connection is active.
*
* @return True if link is connected, false otherwise.

15
src/comm/MAVLinkSimulationLink.h

@ -54,8 +54,6 @@ public: @@ -54,8 +54,6 @@ public:
void run();
void requestReset() { }
bool connect();
bool disconnect();
// Extensive statistics for scientific purposes
qint64 getConnectionSpeed() const;
@ -70,14 +68,17 @@ public: @@ -70,14 +68,17 @@ public:
int getParityType() const;
int getDataBitsType() const;
int getStopBitsType() const;
// These are left unimplemented in order to cause linker errors which indicate incorrect usage of
// connect/disconnect on link directly. All connect/disconnect calls should be made through LinkManager.
bool connect(void);
bool disconnect(void);
public slots:
void writeBytes(const char* data, qint64 size);
void readBytes();
/** @brief Mainloop simulating the mainloop of the MAV */
virtual void mainloop();
bool connectLink(bool connect);
void connectLink();
void sendMAVLinkMessage(const mavlink_message_t* msg);
@ -129,7 +130,11 @@ protected: @@ -129,7 +130,11 @@ protected:
signals:
void valueChanged(int uasId, QString curve, double value, quint64 usec);
void messageReceived(const mavlink_message_t& message);
private:
// From LinkInterface
virtual bool _connect(void);
virtual bool _disconnect(void);
};
#endif // MAVLINKSIMULATIONLINK_H

Loading…
Cancel
Save