Skip to content

Instantly share code, notes, and snippets.

@steveatinfincia
Created December 24, 2019 23:58
Show Gist options
  • Save steveatinfincia/19e6fe2ac09a560c55c1a7ed0834fcc3 to your computer and use it in GitHub Desktop.
Save steveatinfincia/19e6fe2ac09a560c55c1a7ed0834fcc3 to your computer and use it in GitHub Desktop.
case MAVLINK_MSG_ID_PARAM_REQUEST_LIST: {
mavlink_param_request_list_t request;
mavlink_msg_param_request_list_decode(&msg, &request);
/* this is how you would load a setting for the component when
* replying to a settings request
*/
QSettings settings;
settings.beginGroup("OpenHDCamera");
auto keys = settings.allKeys();
auto param_count = keys.count();
auto len = 0;
auto sent = 0;
auto written = 0;
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
QStringList::const_iterator i = keys.constBegin();
while (i != keys.constEnd()) {
auto key = *i;
auto value = settings.value(key);
mavlink_message_t outgoing_msg;
mavlink_msg_param_value_pack(OPENHD_AIR_SYSID, MAV_COMP_ID_CAMERA, &outgoing_msg, key.toUtf8(), value.toFloat(), MAV_PARAM_TYPE_UINT8, param_count, sent);
len = mavlink_msg_to_send_buffer(buffer, &outgoing_msg);
written = socket->write((char*)buffer, len);
socket->flush();
sent += 1;
++i;
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment