mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 12:51:37 +08:00
Purge PROTOCOL_VERSION
This commit is contained in:
@@ -1135,22 +1135,6 @@ Mavlink::send_autopilot_capabilities()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Mavlink::send_protocol_version()
|
|
||||||
{
|
|
||||||
mavlink_protocol_version_t msg = {};
|
|
||||||
|
|
||||||
msg.version = _protocol_version * 100;
|
|
||||||
msg.min_version = 100;
|
|
||||||
msg.max_version = 203;
|
|
||||||
uint64_t mavlink_lib_git_version_binary = px4_mavlink_lib_version_binary();
|
|
||||||
// TODO add when available
|
|
||||||
//memcpy(&msg.spec_version_hash, &mavlink_spec_git_version_binary, sizeof(msg.spec_version_hash));
|
|
||||||
memcpy(&msg.library_version_hash, &mavlink_lib_git_version_binary, sizeof(msg.library_version_hash));
|
|
||||||
|
|
||||||
mavlink_msg_protocol_version_send_struct(get_channel(), &msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
Mavlink::configure_stream(const char *stream_name, const float rate)
|
Mavlink::configure_stream(const char *stream_name, const float rate)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -371,10 +371,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool send_autopilot_capabilities();
|
bool send_autopilot_capabilities();
|
||||||
|
|
||||||
/**
|
|
||||||
* Send the protocol version of MAVLink
|
|
||||||
*/
|
|
||||||
void send_protocol_version();
|
|
||||||
|
|
||||||
List<MavlinkStream *> &get_streams() { return _streams; }
|
List<MavlinkStream *> &get_streams() { return _streams; }
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,6 @@
|
|||||||
#include "streams/PING.hpp"
|
#include "streams/PING.hpp"
|
||||||
#include "streams/POSITION_TARGET_GLOBAL_INT.hpp"
|
#include "streams/POSITION_TARGET_GLOBAL_INT.hpp"
|
||||||
#include "streams/POSITION_TARGET_LOCAL_NED.hpp"
|
#include "streams/POSITION_TARGET_LOCAL_NED.hpp"
|
||||||
#include "streams/PROTOCOL_VERSION.hpp"
|
|
||||||
#include "streams/RAW_RPM.hpp"
|
#include "streams/RAW_RPM.hpp"
|
||||||
#include "streams/RC_CHANNELS.hpp"
|
#include "streams/RC_CHANNELS.hpp"
|
||||||
#include "streams/SCALED_IMU.hpp"
|
#include "streams/SCALED_IMU.hpp"
|
||||||
@@ -471,9 +470,6 @@ static const StreamListItem streams_list[] = {
|
|||||||
#if defined(AUTOPILOT_VERSION_HPP)
|
#if defined(AUTOPILOT_VERSION_HPP)
|
||||||
create_stream_list_item<MavlinkStreamAutopilotVersion>(),
|
create_stream_list_item<MavlinkStreamAutopilotVersion>(),
|
||||||
#endif // AUTOPILOT_VERSION_HPP
|
#endif // AUTOPILOT_VERSION_HPP
|
||||||
#if defined(PROTOCOL_VERSION_HPP)
|
|
||||||
create_stream_list_item<MavlinkStreamProtocolVersion>(),
|
|
||||||
#endif // PROTOCOL_VERSION_HPP
|
|
||||||
#if defined(FLIGHT_INFORMATION_HPP)
|
#if defined(FLIGHT_INFORMATION_HPP)
|
||||||
create_stream_list_item<MavlinkStreamFlightInformation>(),
|
create_stream_list_item<MavlinkStreamFlightInformation>(),
|
||||||
#endif // FLIGHT_INFORMATION_HPP
|
#endif // FLIGHT_INFORMATION_HPP
|
||||||
|
|||||||
@@ -444,7 +444,6 @@ MavlinkReceiver::evaluate_target_ok(int command, int target_system, int target_c
|
|||||||
switch (command) {
|
switch (command) {
|
||||||
|
|
||||||
case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES:
|
case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES:
|
||||||
case MAV_CMD_REQUEST_PROTOCOL_VERSION:
|
|
||||||
/* broadcast and ignore component */
|
/* broadcast and ignore component */
|
||||||
target_ok = (target_system == 0) || (target_system == mavlink_system.sysid);
|
target_ok = (target_system == 0) || (target_system == mavlink_system.sysid);
|
||||||
break;
|
break;
|
||||||
@@ -569,9 +568,6 @@ void MavlinkReceiver::handle_message_command_both(mavlink_message_t *msg, const
|
|||||||
if (cmd_mavlink.command == MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES) {
|
if (cmd_mavlink.command == MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES) {
|
||||||
result = handle_request_message_command(MAVLINK_MSG_ID_AUTOPILOT_VERSION);
|
result = handle_request_message_command(MAVLINK_MSG_ID_AUTOPILOT_VERSION);
|
||||||
|
|
||||||
} else if (cmd_mavlink.command == MAV_CMD_REQUEST_PROTOCOL_VERSION) {
|
|
||||||
result = handle_request_message_command(MAVLINK_MSG_ID_PROTOCOL_VERSION);
|
|
||||||
|
|
||||||
} else if (cmd_mavlink.command == MAV_CMD_GET_HOME_POSITION) {
|
} else if (cmd_mavlink.command == MAV_CMD_GET_HOME_POSITION) {
|
||||||
result = handle_request_message_command(MAVLINK_MSG_ID_HOME_POSITION);
|
result = handle_request_message_command(MAVLINK_MSG_ID_HOME_POSITION);
|
||||||
|
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef PROTOCOL_VERSION_HPP
|
|
||||||
#define PROTOCOL_VERSION_HPP
|
|
||||||
|
|
||||||
class MavlinkStreamProtocolVersion : public MavlinkStream
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static MavlinkStream *new_instance(Mavlink *mavlink) { return new MavlinkStreamProtocolVersion(mavlink); }
|
|
||||||
|
|
||||||
static constexpr const char *get_name_static() { return "PROTOCOL_VERSION"; }
|
|
||||||
static constexpr uint16_t get_id_static() { return MAVLINK_MSG_ID_PROTOCOL_VERSION; }
|
|
||||||
|
|
||||||
const char *get_name() const override { return get_name_static(); }
|
|
||||||
uint16_t get_id() override { return get_id_static(); }
|
|
||||||
|
|
||||||
unsigned get_size() override
|
|
||||||
{
|
|
||||||
return MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
explicit MavlinkStreamProtocolVersion(Mavlink *mavlink) : MavlinkStream(mavlink) {}
|
|
||||||
|
|
||||||
bool send() override
|
|
||||||
{
|
|
||||||
_mavlink->send_protocol_version();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // PROTOCOL_VERSION_HPP
|
|
||||||
Reference in New Issue
Block a user