Move the common mavlink_msg_camera_information_send call into
AP_Mount_Backend::send_camera_information(), following the same pattern as
send_gimbal_device_attitude_status(). Backends supply their specific data
via virtual getter overrides: get_camera_vendor_name(), get_camera_model_name(),
get_camera_firmware_version(), get_camera_focal_length_mm(), get_camera_lens_id(),
and get_camera_cap_flags(). Backends suppress sending by leaving
has_camera_information() returning false (the base class default); backends
with a known camera override it to return true. Siyi's previous
!_fw_version.received guard is dropped — the message now sends with
fw_version=0 until the version is received.
Also fixes the misaligned parameter comments in Viewpro's send call (focal_length
was labelled as sensor_size_h), since there is now only one copy of those comments.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Topotek gimbal_version_analyse: data_buf_len comes from char_to_hex(_msg_buff[5]),
which returns 255 for an invalid hex byte. Return early on that value to reject
the malformed packet; a valid length field is always a hex digit.
Viewpro QUERY_MODEL handler: cap the memcpy to MIN(buffer, data_bytes_received-1)
so a short response cannot cause stale bytes from a previous packet to appear in
_model_name.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace hardcoded buffer sizes (32, 140) with MAVLINK_MSG_CAMERA_INFORMATION_FIELD_*_LEN
defines in Siyi, Viewpro, Topotek, and Xacti backends. Use strncpy_noterm (which omits
the null terminator only when the string fills the field, as MAVLink allows) in place of
strncpy for copies into vendor_name and model_name send buffers. Also cap the Topotek
gimbal_model_name_analyse strncpy to sizeof(_model_name)-1 to ensure null termination,
and document _model_name as always null-terminated in both Viewpro and Topotek headers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
we prepared a buffer on the stack of the correct length but didn't use it.
The mavlink bindings memcpy out of this buffer according to the spec-defined length, so a buffer of at least that length should be supplied
The _model_name member in Viewpro and Topotek drivers holds a
null-terminated ASCII string, so char[] is the correct type.
Using uint8_t[] required pervasive (char*) and (const char*) casts
at every point of use. Switch to char[] and remove the now-redundant
casts, adding (const uint8_t*) only where the MAVLink API requires it.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Making _msg_buff_data_start static constexpr allowed the compiler to
constant-fold the source pointer in the strncpy call, exposing a
-Wstringop-truncation warning: the source buffer extends 62 bytes but
only 10 are copied. The truncation is intentional (bounding to the
destination size), so replace with memcpy + explicit null terminator
to make the intent clear and silence the warning.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>