Plane: added SYSID_ENFORCE parameter

this allows safer sharing of telemetry links between aircraft
This commit is contained in:
Andrew Tridgell 2016-08-14 07:52:03 +10:00
parent f01f711ff6
commit 3a8e38ee12
4 changed files with 26 additions and 0 deletions

View File

@ -2432,3 +2432,17 @@ void Plane::gcs_retry_deferred(void)
gcs_send_message(MSG_RETRY_DEFERRED);
GCS_MAVLINK::service_statustext();
}
/*
return true if we will accept this packet. Used to implement SYSID_ENFORCE
*/
bool GCS_MAVLINK_Plane::accept_packet(const mavlink_status_t &status, mavlink_message_t &msg)
{
if (!plane.g2.sysid_enforce) {
return true;
}
if (msg.msgid == MAVLINK_MSG_ID_RADIO || msg.msgid == MAVLINK_MSG_ID_RADIO_STATUS) {
return true;
}
return (msg.sysid == plane.g.sysid_my_gcs);
}

View File

@ -13,6 +13,8 @@ protected:
uint32_t telem_delay() const override;
bool accept_packet(const mavlink_status_t &status, mavlink_message_t &msg) override;
private:
void handleMessage(mavlink_message_t * msg) override;

View File

@ -1382,6 +1382,13 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @Group: SERVO_
// @Path: ../libraries/RC_Channel/SRV_Channel.cpp
AP_SUBGROUPINFO(servo_channels, "SERVO", 3, ParametersG2, SRV_Channels),
// @Group: SYSID_ENFORCE
// @DisplayName: GCS sysid enforcement
// @Description: This controls whether packets from other than the expected GCS system ID will be accepted
// @Values: 0:NotEnforced,1:Enforced
// @User: Advanced
AP_GROUPINFO("SYSID_ENFORCE", 4, ParametersG2, sysid_enforce, 0),
AP_GROUPEND
};

View File

@ -588,6 +588,9 @@ public:
// control over servo output ranges
SRV_Channels servo_channels;
// whether to enforce acceptance of packets only from sysid_my_gcs
AP_Int8 sysid_enforce;
};
extern const AP_Param::Info var_info[];