Advertisement
aspsda

mav_unpack

May 20th, 2022
1,185
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //function called by arduino to read any MAVlink messages sent by serial communication from flight controller to arduino
  2. uint8_t received_sysid;
  3. uint8_t received_compid;
  4. uint8_t received_msgid;
  5.  
  6. void px_to_mp() {
  7.   if(Serial2.available()) {
  8.     mavlink_message_t msg;
  9.     mavlink_status_t status;
  10.     uint8_t c = Serial2.read();
  11.     if(mavlink_parse_char(MAVLINK_COMM_0, c, &msg, &status)) {
  12.       switch(msg.msgid) {
  13.         case 0: {
  14.           mavlink_heartbeat_t packet;
  15.           mavlink_msg_heartbeat_decode(&msg, &packet);
  16.           received_sysid = msg.sysid; // sysid compid msgid terpaksa dibuat -
  17.           received_compid = msg.compid; // variabel tersendiri untuk menghindari -
  18.           received_msgid = msg.msgid; // kerusakan data. belum diketahui penyebab -
  19.                                       // 3 byte ini riskan rusak.
  20.           struct combine {
  21.             header head_data;
  22.             hb payload_data;
  23.           }__attribute__((packed)); struct combine merge; // paket header dan payload digabung 1 frame
  24.                                                           // paket checksum digabungkan dengan payload
  25.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  26.           merge.payload_data = {packet.custom_mode, packet.type, packet.autopilot, packet.base_mode,
  27.             packet.system_status, packet.mavlink_version, msg.checksum};
  28.           //payloadSize digunakan untuk pembentukan keystream dan tag
  29.           //sizeMerge adalah total data dari head-cksum yang dikirim ke MP
  30.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  31.           char _data[sizeof(merge)];
  32.           memcpy(_data, &merge, sizeof(merge));
  33.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  34.         }break;
  35.  
  36.         case 1: {
  37.           mavlink_sys_status_t packet;
  38.           mavlink_msg_sys_status_decode(&msg, &packet);
  39.           received_sysid = msg.sysid;
  40.           received_compid = msg.compid;
  41.           received_msgid = msg.msgid;
  42.  
  43.           struct combine {
  44.             header head_data;
  45.             sys payload_data;
  46.           }__attribute__((packed)); struct combine merge;
  47.          
  48.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  49.           merge.payload_data = {packet.onboard_control_sensors_present, packet.onboard_control_sensors_enabled,
  50.             packet.onboard_control_sensors_health, packet.load, packet.voltage_battery, packet.current_battery,
  51.             packet.drop_rate_comm, packet.errors_comm, packet.errors_count1, packet.errors_count2,
  52.             packet.errors_count3, packet.errors_count4, packet.battery_remaining, msg.checksum};
  53.            
  54.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  55.           char _data[sizeof(merge)];
  56.           memcpy(_data, &merge, sizeof(merge));
  57.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  58.         }break;
  59.  
  60.         case 2: {
  61.           mavlink_system_time_t packet;
  62.           mavlink_msg_system_time_decode(&msg, &packet);
  63.           received_sysid = msg.sysid;
  64.           received_compid = msg.compid;
  65.           received_msgid = msg.msgid;
  66.  
  67.           struct combine {
  68.             header head_data;
  69.             system_time payload_data;
  70.           }__attribute__((packed)); struct combine merge;
  71.          
  72.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  73.           merge.payload_data = {packet.time_unix_usec, packet.time_boot_ms, msg.checksum};
  74.  
  75.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  76.           char _data[sizeof(merge)];
  77.           memcpy(_data, &merge, sizeof(merge));
  78.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  79.         }break;
  80.  
  81.         case 4: {
  82.           mavlink_ping_t packet;
  83.           mavlink_msg_ping_decode(&msg, &packet);
  84.           received_sysid = msg.sysid;
  85.           received_compid = msg.compid;
  86.           received_msgid = msg.msgid;
  87.  
  88.           struct combine {
  89.             header head_data;
  90.             ping payload_data;
  91.           }__attribute__((packed)); struct combine merge;
  92.          
  93.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  94.           merge.payload_data = {packet.time_usec, packet.seq, packet.target_system, packet.target_component, msg.checksum};
  95.  
  96.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  97.           char _data[sizeof(merge)];
  98.           memcpy(_data, &merge, sizeof(merge));
  99.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  100.         }break;
  101.  
  102.         case 5: {
  103.           mavlink_change_operator_control_t packet;
  104.           mavlink_msg_change_operator_control_decode(&msg, &packet);
  105.           received_sysid = msg.sysid;
  106.           received_compid = msg.compid;
  107.           received_msgid = msg.msgid;
  108.  
  109.           struct combine {
  110.             header head_data;
  111.             op_control payload_data;
  112.           }__attribute__((packed)); struct combine merge;
  113.          
  114.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  115.           merge.payload_data = {packet.target_system, packet.control_request,
  116.             packet.version, {packet.passkey}, msg.checksum};
  117.  
  118.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  119.           char _data[sizeof(merge)];
  120.           memcpy(_data, &merge, sizeof(merge));
  121.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  122.         }break;
  123.  
  124.         case 6: {
  125.           mavlink_change_operator_control_ack_t packet;
  126.           mavlink_msg_change_operator_control_ack_decode(&msg, &packet);
  127.           received_sysid = msg.sysid;
  128.           received_compid = msg.compid;
  129.           received_msgid = msg.msgid;
  130.  
  131.           struct combine {
  132.             header head_data;
  133.             control_ack payload_data;
  134.           }__attribute__((packed)); struct combine merge;
  135.          
  136.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  137.           merge.payload_data = {packet.gcs_system_id, packet.control_request, packet.ack, msg.checksum};
  138.  
  139.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  140.           char _data[sizeof(merge)];
  141.           memcpy(_data, &merge, sizeof(merge));
  142.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  143.         }break;
  144.  
  145.         case 7: {
  146.           mavlink_auth_key_t packet;
  147.           mavlink_msg_auth_key_decode(&msg, &packet);
  148.           received_sysid = msg.sysid;
  149.           received_compid = msg.compid;
  150.           received_msgid = msg.msgid;
  151.          
  152.           struct combine {
  153.             header head_data;
  154.             mavkey payload_data;
  155.           }__attribute__((packed)); struct combine merge;
  156.          
  157.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  158.           merge.payload_data = {{packet.key}, msg.checksum};
  159.  
  160.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  161.           char _data[sizeof(merge)];
  162.           memcpy(_data, &merge, sizeof(merge));
  163.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  164.         }break;
  165.  
  166.         case 8: {
  167.           mavlink_link_node_status_t packet;
  168.           mavlink_msg_link_node_status_decode(&msg, &packet);
  169.           received_sysid = msg.sysid;
  170.           received_compid = msg.compid;
  171.           received_msgid = msg.msgid;
  172.          
  173.           struct combine {
  174.             header head_data;
  175.             node payload_data;
  176.           }__attribute__((packed)); struct combine merge;
  177.          
  178.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  179.           merge.payload_data = {packet.timestamp, packet.tx_rate, packet.rx_rate, packet.messages_sent,
  180.             packet.messages_received, packet.messages_lost, packet.rx_parse_err, packet.tx_overflows,
  181.             packet.rx_overflows, packet.tx_buf, packet.rx_buf, msg.checksum};
  182.  
  183.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  184.           char _data[sizeof(merge)];
  185.           memcpy(_data, &merge, sizeof(merge));
  186.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  187.         }break;
  188.  
  189.         case 11: {
  190.           mavlink_set_mode_t packet;
  191.           mavlink_msg_set_mode_decode(&msg, &packet);
  192.           received_sysid = msg.sysid;
  193.           received_compid = msg.compid;
  194.           received_msgid = msg.msgid;
  195.          
  196.           struct combine {
  197.             header head_data;
  198.             setmode payload_data;
  199.           }__attribute__((packed)); struct combine merge;
  200.          
  201.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  202.           merge.payload_data = {packet.custom_mode, packet.target_system, packet.base_mode,
  203.             msg.checksum};
  204.  
  205.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  206.           char _data[sizeof(merge)];
  207.           memcpy(_data, &merge, sizeof(merge));
  208.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  209.         }break;
  210.  
  211.         case 20: {
  212.           mavlink_param_request_read_t packet;
  213.           mavlink_msg_param_request_read_decode(&msg, &packet);
  214.           received_sysid = msg.sysid;
  215.           received_compid = msg.compid;
  216.           received_msgid = msg.msgid;
  217.          
  218.           struct combine {
  219.             header head_data;
  220.             paramreq payload_data;
  221.           }__attribute__((packed)); struct combine merge;
  222.          
  223.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  224.           merge.payload_data = {packet.param_index, packet.target_system, packet.target_component,
  225.             {packet.param_id}, msg.checksum};
  226.  
  227.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  228.           char _data[sizeof(merge)];
  229.           memcpy(_data, &merge, sizeof(merge));
  230.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  231.         }break;
  232.        
  233.         case 21: {
  234.           mavlink_param_request_list_t packet;
  235.           mavlink_msg_param_request_list_decode(&msg, &packet);
  236.           received_sysid = msg.sysid;
  237.           received_compid = msg.compid;
  238.           received_msgid = msg.msgid;
  239.          
  240.           struct combine {
  241.             header head_data;
  242.             paramreqlist payload_data;
  243.           }__attribute__((packed)); struct combine merge;
  244.          
  245.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  246.           merge.payload_data = {packet.target_system, packet.target_component, msg.checksum};
  247.  
  248.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  249.           char _data[sizeof(merge)];
  250.           memcpy(_data, &merge, sizeof(merge));
  251.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  252.         }break;
  253.  
  254.         case 22: {
  255.           mavlink_param_value_t packet;
  256.           mavlink_msg_param_value_decode(&msg, &packet);
  257.           received_sysid = msg.sysid;
  258.           received_compid = msg.compid;
  259.           received_msgid = msg.msgid;
  260.          
  261.           struct combine {
  262.             header head_data;
  263.             paramvalue payload_data;
  264.           }__attribute__((packed)); struct combine merge;
  265.          
  266.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  267.           merge.payload_data = {packet.param_value, packet.param_count, packet.param_index,
  268.             {packet.param_id}, packet.param_type, msg.checksum};
  269.  
  270.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  271.           char _data[sizeof(merge)];
  272.           memcpy(_data, &merge, sizeof(merge));
  273.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  274.         }break;
  275.  
  276.         case 23: {
  277.           mavlink_param_set_t packet;
  278.           mavlink_msg_param_set_decode(&msg, &packet);
  279.           received_sysid = msg.sysid;
  280.           received_compid = msg.compid;
  281.           received_msgid = msg.msgid;
  282.          
  283.           struct combine {
  284.             header head_data;
  285.             paramset payload_data;
  286.           }__attribute__((packed)); struct combine merge;
  287.          
  288.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  289.           merge.payload_data = {packet.param_value, packet.target_system, packet.target_component,
  290.             {packet.param_id}, packet.param_type, msg.checksum};
  291.            
  292.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  293.           char _data[sizeof(merge)];
  294.           memcpy(_data, &merge, sizeof(merge));
  295.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  296.         }break;
  297.  
  298.         case 24: {
  299.           mavlink_gps_raw_int_t packet;
  300.           mavlink_msg_gps_raw_int_decode(&msg, &packet);
  301.          
  302.           struct combine {
  303.             header head_data;
  304.             gpsraw payload_data;
  305.           }__attribute__((packed)); struct combine merge;
  306.          
  307.           merge.head_data = {msg.magic, msg.len, msg.seq, msg.sysid, msg.compid, msg.msgid};
  308.           merge.payload_data = {packet.time_usec, packet.lat, packet.lon, packet.alt, packet.eph,
  309.             packet.epv, packet.vel, packet.cog, packet.fix_type,
  310.             packet.satellites_visible, msg.checksum};
  311.  
  312.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  313.           char _data[sizeof(merge)];
  314.           memcpy(_data, &merge, sizeof(merge));
  315.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  316.         }break;
  317.  
  318.         case 25: {
  319.           mavlink_gps_status_t packet;
  320.           mavlink_msg_gps_status_decode(&msg, &packet);
  321.           received_sysid = msg.sysid;
  322.           received_compid = msg.compid;
  323.           received_msgid = msg.msgid;
  324.          
  325.           struct combine {
  326.             header head_data;
  327.             gpsstat payload_data;
  328.           }__attribute__((packed)); struct combine merge;
  329.          
  330.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  331.           merge.payload_data = {packet.satellites_visible, {packet.satellite_prn}, {packet.satellite_used},
  332.             {packet.satellite_elevation}, {packet.satellite_azimuth}, {packet.satellite_snr}, msg.checksum};
  333.  
  334.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  335.           char _data[sizeof(merge)];
  336.           memcpy(_data, &merge, sizeof(merge));
  337.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  338.         }break;
  339.  
  340.         case 26: {
  341.           mavlink_scaled_imu_t packet;
  342.           mavlink_msg_scaled_imu_decode(&msg, &packet);
  343.           received_sysid = msg.sysid;
  344.           received_compid = msg.compid;
  345.           received_msgid = msg.msgid;
  346.          
  347.           struct combine {
  348.             header head_data;
  349.             scaleimu payload_data;
  350.           }__attribute__((packed)); struct combine merge;
  351.          
  352.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  353.           merge.payload_data = {packet.time_boot_ms, packet.xacc, packet.yacc, packet.zacc,
  354.             packet.xgyro, packet.ygyro, packet.zgyro, packet.xmag, packet.ymag,
  355.             packet.zmag, msg.checksum};
  356.  
  357.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  358.           char _data[sizeof(merge)];
  359.           memcpy(_data, &merge, sizeof(merge));
  360.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  361.         }break;
  362.  
  363.         case 27: {
  364.           mavlink_raw_imu_t packet;
  365.           mavlink_msg_raw_imu_decode(&msg, &packet);
  366.           received_sysid = msg.sysid;
  367.           received_compid = msg.compid;
  368.           received_msgid = msg.msgid;
  369.          
  370.           struct combine {
  371.             header head_data;
  372.             rawimu payload_data;
  373.           }__attribute__((packed)); struct combine merge;
  374.          
  375.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  376.           merge.payload_data = {packet.time_usec, packet.xacc, packet.yacc, packet.zacc,
  377.             packet.xgyro, packet.ygyro, packet.zgyro, packet.xmag, packet.ymag, packet.zmag, msg.checksum};
  378.  
  379.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  380.           char _data[sizeof(merge)];
  381.           memcpy(_data, &merge, sizeof(merge));
  382.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  383.         }break;
  384.  
  385.         case 28: {
  386.           mavlink_raw_pressure_t packet;
  387.           mavlink_msg_raw_pressure_decode(&msg, &packet);
  388.           received_sysid = msg.sysid;
  389.           received_compid = msg.compid;
  390.           received_msgid = msg.msgid;
  391.          
  392.           struct combine {
  393.             header head_data;
  394.             rawpress payload_data;
  395.           }__attribute__((packed)); struct combine merge;
  396.          
  397.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  398.           merge.payload_data = {packet.time_usec, packet.press_abs, packet.press_diff1,
  399.             packet.press_diff2, packet.temperature, msg.checksum};
  400.  
  401.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  402.           char _data[sizeof(merge)];
  403.           memcpy(_data, &merge, sizeof(merge));
  404.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  405.         }break;
  406.  
  407.         case 29: {
  408.           mavlink_scaled_pressure_t packet;
  409.           mavlink_msg_scaled_pressure_decode(&msg, &packet);
  410.           received_sysid = msg.sysid;
  411.           received_compid = msg.compid;
  412.           received_msgid = msg.msgid;
  413.          
  414.           struct combine {
  415.             header head_data;
  416.             scalepress payload_data;
  417.           }__attribute__((packed)); struct combine merge;
  418.          
  419.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  420.           merge.payload_data = {packet.time_boot_ms, packet.press_abs, packet.press_diff,
  421.             packet.temperature, msg.checksum};
  422.  
  423.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  424.           char _data[sizeof(merge)];
  425.           memcpy(_data, &merge, sizeof(merge));
  426.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  427.         }break;
  428.  
  429.         case 30: {
  430.           mavlink_attitude_t packet;
  431.           mavlink_msg_attitude_decode(&msg, &packet);
  432.           received_sysid = msg.sysid;
  433.           received_compid = msg.compid;
  434.           received_msgid = msg.msgid;
  435.          
  436.           struct combine {
  437.             header head_data;
  438.             attitude payload_data;
  439.           }__attribute__((packed)); struct combine merge;
  440.          
  441.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  442.           merge.payload_data = {packet.time_boot_ms, packet.roll, packet.pitch, packet.yaw,
  443.             packet.rollspeed, packet.pitchspeed, packet.yawspeed, msg.checksum};
  444.  
  445.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  446.           char _data[sizeof(merge)];
  447.           memcpy(_data, &merge, sizeof(merge));
  448.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  449.         }break;
  450.  
  451.         case 31: {
  452.           mavlink_attitude_quaternion_t packet;
  453.           mavlink_msg_attitude_quaternion_decode(&msg, &packet);
  454.           received_sysid = msg.sysid;
  455.           received_compid = msg.compid;
  456.           received_msgid = msg.msgid;
  457.          
  458.           struct combine {
  459.             header head_data;
  460.             attitude_quaternion payload_data;
  461.           }__attribute__((packed)); struct combine merge;
  462.          
  463.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  464.           merge.payload_data = {packet.time_boot_ms, packet.q1, packet.q2, packet.q3,
  465.             packet.q4, packet.rollspeed, packet.pitchspeed, packet.yawspeed, msg.checksum};
  466.  
  467.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  468.           char _data[sizeof(merge)];
  469.           memcpy(_data, &merge, sizeof(merge));
  470.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  471.         }break;
  472.  
  473.         case 32: {
  474.           mavlink_local_position_ned_t packet;
  475.           mavlink_msg_local_position_ned_decode(&msg, &packet);
  476.           received_sysid = msg.sysid;
  477.           received_compid = msg.compid;
  478.           received_msgid = msg.msgid;
  479.          
  480.           struct combine {
  481.             header head_data;
  482.             locposned payload_data;
  483.           }__attribute__((packed)); struct combine merge;
  484.          
  485.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  486.           merge.payload_data = {packet.time_boot_ms, packet.x, packet.y, packet.z, packet.vx,
  487.             packet.vy, packet.vz, msg.checksum};
  488.  
  489.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  490.           char _data[sizeof(merge)];
  491.           memcpy(_data, &merge, sizeof(merge));
  492.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  493.         }break;
  494.  
  495.         case 33: {
  496.           mavlink_global_position_int_t packet;
  497.           mavlink_msg_global_position_int_decode(&msg, &packet);
  498.           received_sysid = msg.sysid;
  499.           received_compid = msg.compid;
  500.           received_msgid = msg.msgid;
  501.          
  502.           struct combine {
  503.             header head_data;
  504.             gpsint payload_data;
  505.           }__attribute__((packed)); struct combine merge;
  506.          
  507.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  508.           merge.payload_data = {packet.time_boot_ms, packet.lat, packet.lon, packet.alt,
  509.             packet.relative_alt, packet.vx, packet.vy, packet.vz, packet.hdg, msg.checksum};
  510.  
  511.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  512.           char _data[sizeof(merge)];
  513.           memcpy(_data, &merge, sizeof(merge));
  514.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  515.         }break;
  516.  
  517.         case 34: {
  518.           mavlink_rc_channels_scaled_t packet;
  519.           mavlink_msg_rc_channels_scaled_decode(&msg, &packet);
  520.           received_sysid = msg.sysid;
  521.           received_compid = msg.compid;
  522.           received_msgid = msg.msgid;
  523.          
  524.           struct combine {
  525.             header head_data;
  526.             rcchscale payload_data;
  527.           }__attribute__((packed)); struct combine merge;
  528.          
  529.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  530.           merge.payload_data = {packet.time_boot_ms, packet.chan1_scaled, packet.chan2_scaled,
  531.             packet.chan3_scaled, packet.chan4_scaled, packet.chan5_scaled, packet.chan6_scaled,
  532.             packet.chan7_scaled, packet.chan8_scaled, packet.port, packet.rssi, msg.checksum};
  533.  
  534.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  535.           char _data[sizeof(merge)];
  536.           memcpy(_data, &merge, sizeof(merge));
  537.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  538.         }break;
  539.  
  540.         case 35: {
  541.           mavlink_rc_channels_raw_t packet;
  542.           mavlink_msg_rc_channels_raw_decode(&msg, &packet);
  543.           received_sysid = msg.sysid;
  544.           received_compid = msg.compid;
  545.           received_msgid = msg.msgid;
  546.          
  547.           struct combine {
  548.             header head_data;
  549.             rcchraw payload_data;
  550.           }__attribute__((packed)); struct combine merge;
  551.          
  552.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  553.           merge.payload_data = {packet.time_boot_ms, packet.chan1_raw, packet.chan2_raw,
  554.             packet.chan3_raw, packet.chan4_raw, packet.chan5_raw, packet.chan6_raw,
  555.             packet.chan7_raw, packet.chan8_raw, packet.port, packet.rssi, msg.checksum};
  556.  
  557.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  558.           char _data[sizeof(merge)];
  559.           memcpy(_data, &merge, sizeof(merge));
  560.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  561.         }break;
  562.  
  563.         case 36: {
  564.           mavlink_servo_output_raw_t packet;
  565.           mavlink_msg_servo_output_raw_decode(&msg, &packet);
  566.           received_sysid = msg.sysid;
  567.           received_compid = msg.compid;
  568.           received_msgid = msg.msgid;
  569.          
  570.           struct combine {
  571.             header head_data;
  572.             servooutraw payload_data;
  573.           }__attribute__((packed)); struct combine merge;
  574.          
  575.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  576.           merge.payload_data = {packet.time_usec, packet.servo1_raw, packet.servo2_raw,
  577.             packet.servo3_raw, packet.servo4_raw, packet.servo5_raw, packet.servo6_raw,
  578.             packet.servo7_raw, packet.servo8_raw, packet.port, msg.checksum};
  579.  
  580.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  581.           char _data[sizeof(merge)];
  582.           memcpy(_data, &merge, sizeof(merge));
  583.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  584.         }break;
  585.  
  586.         case 37: {
  587.           mavlink_mission_request_partial_list_t packet;
  588.           mavlink_msg_mission_request_partial_list_decode(&msg, &packet);
  589.           received_sysid = msg.sysid;
  590.           received_compid = msg.compid;
  591.           received_msgid = msg.msgid;
  592.          
  593.           struct combine {
  594.             header head_data;
  595.             mission_request_partial_list payload_data;
  596.           }__attribute__((packed)); struct combine merge;
  597.          
  598.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  599.           merge.payload_data = {packet.start_index, packet.end_index, packet.target_system,
  600.             packet.target_component, msg.checksum};
  601.  
  602.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  603.           char _data[sizeof(merge)];
  604.           memcpy(_data, &merge, sizeof(merge));
  605.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  606.         }break;
  607.  
  608.         case 38: {
  609.           mavlink_mission_write_partial_list_t packet;
  610.           mavlink_msg_mission_write_partial_list_decode(&msg, &packet);
  611.           received_sysid = msg.sysid;
  612.           received_compid = msg.compid;
  613.           received_msgid = msg.msgid;
  614.          
  615.           struct combine {
  616.             header head_data;
  617.             mission_write_partial_list payload_data;
  618.           }__attribute__((packed)); struct combine merge;
  619.          
  620.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  621.           merge.payload_data = {packet.start_index, packet.end_index, packet.target_system,
  622.             packet.target_component, msg.checksum};
  623.  
  624.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  625.           char _data[sizeof(merge)];
  626.           memcpy(_data, &merge, sizeof(merge));
  627.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  628.         }break;
  629.  
  630.         case 39: {
  631.           mavlink_mission_item_t packet;
  632.           mavlink_msg_mission_item_decode(&msg, &packet);
  633.           received_sysid = msg.sysid;
  634.           received_compid = msg.compid;
  635.           received_msgid = msg.msgid;
  636.          
  637.           struct combine {
  638.             header head_data;
  639.             mission_item payload_data;
  640.           }__attribute__((packed)); struct combine merge;
  641.          
  642.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  643.           merge.payload_data = {packet.param1, packet.param2, packet.param3, packet.param4,
  644.             packet.x, packet.y, packet.z, packet.seq, packet.command, packet.target_system,
  645.             packet.target_component, packet.frame, packet.current, packet.autocontinue, msg.checksum};
  646.  
  647.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  648.           char _data[sizeof(merge)];
  649.           memcpy(_data, &merge, sizeof(merge));
  650.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  651.         }break;
  652.  
  653.         case 40: {
  654.           mavlink_mission_request_t packet;
  655.           mavlink_msg_mission_request_decode(&msg, &packet);
  656.           received_sysid = msg.sysid;
  657.           received_compid = msg.compid;
  658.           received_msgid = msg.msgid;
  659.          
  660.           struct combine {
  661.             header head_data;
  662.             missionreq payload_data;
  663.           }__attribute__((packed)); struct combine merge;
  664.          
  665.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  666.           merge.payload_data = {packet.seq, packet.target_system, packet.target_component, msg.checksum};
  667.  
  668.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  669.           char _data[sizeof(merge)];
  670.           memcpy(_data, &merge, sizeof(merge));
  671.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  672.         }break;
  673.  
  674.         case 41: {
  675.           mavlink_mission_set_current_t packet;
  676.           mavlink_msg_mission_set_current_decode(&msg, &packet);
  677.           received_sysid = msg.sysid;
  678.           received_compid = msg.compid;
  679.           received_msgid = msg.msgid;
  680.          
  681.           struct combine {
  682.             header head_data;
  683.             mission_set_current payload_data;
  684.           }__attribute__((packed)); struct combine merge;
  685.          
  686.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  687.           merge.payload_data = {packet.seq, packet.target_system, packet.target_component, msg.checksum};
  688.  
  689.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  690.           char _data[sizeof(merge)];
  691.           memcpy(_data, &merge, sizeof(merge));
  692.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  693.         }break;
  694.  
  695.         case 42: {
  696.           mavlink_mission_current_t packet;
  697.           mavlink_msg_mission_current_decode(&msg, &packet);
  698.           received_sysid = msg.sysid;
  699.           received_compid = msg.compid;
  700.           received_msgid = msg.msgid;
  701.          
  702.           struct combine {
  703.             header head_data;
  704.             missioncurr payload_data;
  705.           }__attribute__((packed)); struct combine merge;
  706.          
  707.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  708.           merge.payload_data = {packet.seq, msg.checksum};
  709.  
  710.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  711.           char _data[sizeof(merge)];
  712.           memcpy(_data, &merge, sizeof(merge));
  713.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  714.         }break;
  715.  
  716.         case 43: {
  717.           mavlink_mission_request_list_t packet;
  718.           mavlink_msg_mission_request_list_decode(&msg, &packet);
  719.           received_sysid = msg.sysid;
  720.           received_compid = msg.compid;
  721.           received_msgid = msg.msgid;
  722.          
  723.           struct combine {
  724.             header head_data;
  725.             missionreqlist payload_data;
  726.           }__attribute__((packed)); struct combine merge;
  727.          
  728.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  729.           merge.payload_data = {packet.target_system, packet.target_component, msg.checksum};
  730.  
  731.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  732.           char _data[sizeof(merge)];
  733.           memcpy(_data, &merge, sizeof(merge));
  734.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  735.         }break;
  736.  
  737.         case 44: {
  738.           mavlink_mission_count_t packet;
  739.           mavlink_msg_mission_count_decode(&msg, &packet);
  740.           received_sysid = msg.sysid;
  741.           received_compid = msg.compid;
  742.           received_msgid = msg.msgid;
  743.          
  744.           struct combine {
  745.             header head_data;
  746.             missioncount payload_data;
  747.           }__attribute__((packed)); struct combine merge;
  748.          
  749.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  750.           merge.payload_data = {packet.count, packet.target_system, packet.target_component, msg.checksum};
  751.  
  752.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  753.           char _data[sizeof(merge)];
  754.           memcpy(_data, &merge, sizeof(merge));
  755.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  756.         }break;
  757.  
  758.         case 45: {
  759.           mavlink_mission_clear_all_t packet;
  760.           mavlink_msg_mission_clear_all_decode(&msg, &packet);
  761.           received_sysid = msg.sysid;
  762.           received_compid = msg.compid;
  763.           received_msgid = msg.msgid;
  764.          
  765.           struct combine {
  766.             header head_data;
  767.             missionclear payload_data;
  768.           }__attribute__((packed)); struct combine merge;
  769.          
  770.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  771.           merge.payload_data = {packet.target_system, packet.target_component, msg.checksum};
  772.  
  773.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  774.           char _data[sizeof(merge)];
  775.           memcpy(_data, &merge, sizeof(merge));
  776.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  777.         }break;
  778.  
  779.         case 46: {
  780.           mavlink_mission_item_reached_t packet;
  781.           mavlink_msg_mission_item_reached_decode(&msg, &packet);
  782.           received_sysid = msg.sysid;
  783.           received_compid = msg.compid;
  784.           received_msgid = msg.msgid;
  785.          
  786.           struct combine {
  787.             header head_data;
  788.             mission_item_reached payload_data;
  789.           }__attribute__((packed)); struct combine merge;
  790.          
  791.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  792.           merge.payload_data = {packet.seq, msg.checksum};
  793.  
  794.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  795.           char _data[sizeof(merge)];
  796.           memcpy(_data, &merge, sizeof(merge));
  797.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  798.         }break;
  799.  
  800.         case 47: {
  801.           mavlink_mission_ack_t packet;
  802.           mavlink_msg_mission_ack_decode(&msg, &packet);
  803.           received_sysid = msg.sysid;
  804.           received_compid = msg.compid;
  805.           received_msgid = msg.msgid;
  806.          
  807.           struct combine {
  808.             header head_data;
  809.             missionack payload_data;
  810.           }__attribute__((packed)); struct combine merge;
  811.          
  812.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  813.           merge.payload_data = {packet.target_system, packet.target_component,
  814.             packet.type, msg.checksum};
  815.  
  816.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  817.           char _data[sizeof(merge)];
  818.           memcpy(_data, &merge, sizeof(merge));
  819.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  820.         }break;
  821.  
  822.         case 48: {
  823.           mavlink_set_gps_global_origin_t packet;
  824.           mavlink_msg_set_gps_global_origin_decode(&msg, &packet);
  825.           received_sysid = msg.sysid;
  826.           received_compid = msg.compid;
  827.           received_msgid = msg.msgid;
  828.          
  829.           struct combine {
  830.             header head_data;
  831.             set_gps_global_origin payload_data;
  832.           }__attribute__((packed)); struct combine merge;
  833.          
  834.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  835.           merge.payload_data = {packet.latitude, packet.longitude, packet.altitude,
  836.             packet.target_system, msg.checksum};
  837.  
  838.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  839.           char _data[sizeof(merge)];
  840.           memcpy(_data, &merge, sizeof(merge));
  841.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  842.         }break;
  843.  
  844.         case 49: {
  845.           mavlink_gps_global_origin_t packet;
  846.           mavlink_msg_gps_global_origin_decode(&msg, &packet);
  847.           received_sysid = msg.sysid;
  848.           received_compid = msg.compid;
  849.           received_msgid = msg.msgid;
  850.          
  851.           struct combine {
  852.             header head_data;
  853.             gps_global_ori payload_data;
  854.           }__attribute__((packed)); struct combine merge;
  855.          
  856.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  857.           merge.payload_data = {packet.latitude, packet.longitude, packet.altitude, msg.checksum};
  858.  
  859.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  860.           char _data[sizeof(merge)];
  861.           memcpy(_data, &merge, sizeof(merge));
  862.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  863.         }break;
  864.  
  865.         case 50: {
  866.           mavlink_param_map_rc_t packet;
  867.           mavlink_msg_param_map_rc_decode(&msg, &packet);
  868.           received_sysid = msg.sysid;
  869.           received_compid = msg.compid;
  870.           received_msgid = msg.msgid;
  871.          
  872.           struct combine {
  873.             header head_data;
  874.             param_map_rc payload_data;
  875.           }__attribute__((packed)); struct combine merge;
  876.          
  877.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  878.           merge.payload_data = {packet.param_value0, packet.scale, packet.param_value_min,
  879.             packet.param_value_max, packet.param_index, packet.target_system, packet.target_component,
  880.             {packet.param_id}, packet.parameter_rc_channel_index, msg.checksum};
  881.  
  882.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  883.           char _data[sizeof(merge)];
  884.           memcpy(_data, &merge, sizeof(merge));
  885.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  886.         }break;
  887.  
  888.         case 51: {
  889.           mavlink_mission_request_int_t packet;
  890.           mavlink_msg_mission_request_int_decode(&msg, &packet);
  891.           received_sysid = msg.sysid;
  892.           received_compid = msg.compid;
  893.           received_msgid = msg.msgid;
  894.          
  895.           struct combine {
  896.             header head_data;
  897.             missionreqint payload_data;
  898.           }__attribute__((packed)); struct combine merge;
  899.          
  900.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  901.           merge.payload_data = {packet.seq, packet.target_system, packet.target_component, msg.checksum};
  902.  
  903.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  904.           char _data[sizeof(merge)];
  905.           memcpy(_data, &merge, sizeof(merge));
  906.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  907.         }break;
  908.  
  909.         case 54: {
  910.           mavlink_safety_set_allowed_area_t packet;
  911.           mavlink_msg_safety_set_allowed_area_decode(&msg, &packet);
  912.           received_sysid = msg.sysid;
  913.           received_compid = msg.compid;
  914.           received_msgid = msg.msgid;
  915.          
  916.           struct combine {
  917.             header head_data;
  918.             safety_set_allowed_area payload_data;
  919.           }__attribute__((packed)); struct combine merge;
  920.          
  921.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  922.           merge.payload_data = {packet.p1x, packet.p1y, packet.p1z, packet.p2x, packet.p2y,
  923.             packet.p2z, packet.target_system, packet.target_component, packet.frame, msg.checksum};
  924.  
  925.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  926.           char _data[sizeof(merge)];
  927.           memcpy(_data, &merge, sizeof(merge));
  928.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  929.         }break;
  930.  
  931.         case 55: {
  932.           mavlink_safety_allowed_area_t packet;
  933.           mavlink_msg_safety_allowed_area_decode(&msg, &packet);
  934.           received_sysid = msg.sysid;
  935.           received_compid = msg.compid;
  936.           received_msgid = msg.msgid;
  937.          
  938.           struct combine {
  939.             header head_data;
  940.             safety_allowed_area payload_data;
  941.           }__attribute__((packed)); struct combine merge;
  942.          
  943.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  944.           merge.payload_data = {packet.p1x, packet.p1y, packet.p1z, packet.p2x,
  945.             packet.p2y, packet.p2z, packet.frame, msg.checksum};
  946.  
  947.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  948.           char _data[sizeof(merge)];
  949.           memcpy(_data, &merge, sizeof(merge));
  950.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  951.         }break;
  952.  
  953.         case 61: {
  954.           mavlink_attitude_quaternion_cov_t packet;
  955.           mavlink_msg_attitude_quaternion_cov_decode(&msg, &packet);
  956.           received_sysid = msg.sysid;
  957.           received_compid = msg.compid;
  958.           received_msgid = msg.msgid;
  959.          
  960.           struct combine {
  961.             header head_data;
  962.             attitude_quaternion_cov payload_data;
  963.           }__attribute__((packed)); struct combine merge;
  964.          
  965.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  966.           merge.payload_data = {packet.time_usec, {packet.q}, packet.rollspeed, packet.pitchspeed,
  967.             packet.yawspeed, {packet.covariance}, msg.checksum};
  968.  
  969.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  970.           char _data[sizeof(merge)];
  971.           memcpy(_data, &merge, sizeof(merge));
  972.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  973.         }break;
  974.  
  975.         case 62: {
  976.           mavlink_nav_controller_output_t packet;
  977.           mavlink_msg_nav_controller_output_decode(&msg, &packet);
  978.           received_sysid = msg.sysid;
  979.           received_compid = msg.compid;
  980.           received_msgid = msg.msgid;
  981.          
  982.           struct combine {
  983.             header head_data;
  984.             navcontrol_output payload_data;
  985.           }__attribute__((packed)); struct combine merge;
  986.          
  987.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  988.           merge.payload_data = {packet.nav_roll, packet.nav_pitch, packet.alt_error,
  989.             packet.aspd_error, packet.xtrack_error, packet.nav_bearing, packet.target_bearing,
  990.             packet.wp_dist, msg.checksum};
  991.  
  992.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  993.           char _data[sizeof(merge)];
  994.           memcpy(_data, &merge, sizeof(merge));
  995.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  996.         }break;
  997.  
  998.         case 63: {
  999.           mavlink_global_position_int_cov_t packet;
  1000.           mavlink_msg_global_position_int_cov_decode(&msg, &packet);
  1001.           received_sysid = msg.sysid;
  1002.           received_compid = msg.compid;
  1003.           received_msgid = msg.msgid;
  1004.          
  1005.           struct combine {
  1006.             header head_data;
  1007.             gpsint_cov payload_data;
  1008.           }__attribute__((packed)); struct combine merge;
  1009.          
  1010.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1011.           merge.payload_data = {packet.time_usec, packet.lat, packet.lon, packet.alt,
  1012.             packet.relative_alt, packet.vx, packet.vy, packet.vz, {packet.covariance},
  1013.             packet.estimator_type, msg.checksum};
  1014.  
  1015.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1016.           char _data[sizeof(merge)];
  1017.           memcpy(_data, &merge, sizeof(merge));
  1018.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1019.         }break;
  1020.  
  1021.         case 64: {
  1022.           mavlink_local_position_ned_cov_t packet;
  1023.           mavlink_msg_local_position_ned_cov_decode(&msg, &packet);
  1024.           received_sysid = msg.sysid;
  1025.           received_compid = msg.compid;
  1026.           received_msgid = msg.msgid;
  1027.          
  1028.           struct combine {
  1029.             header head_data;
  1030.             locposned_cov payload_data;
  1031.           }__attribute__((packed)); struct combine merge;
  1032.          
  1033.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1034.           merge.payload_data = {packet.time_usec, packet.x, packet.y, packet.z,
  1035.             packet.vx, packet.vy, packet.vz, packet.ax, packet.ay, packet.az,
  1036.             {packet.covariance}, packet.estimator_type, msg.checksum};
  1037.  
  1038.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1039.           char _data[sizeof(merge)];
  1040.           memcpy(_data, &merge, sizeof(merge));
  1041.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1042.         }break;
  1043.  
  1044.         case 65: {
  1045.           mavlink_rc_channels_t packet;
  1046.           mavlink_msg_rc_channels_decode(&msg, &packet);
  1047.           received_sysid = msg.sysid;
  1048.           received_compid = msg.compid;
  1049.           received_msgid = msg.msgid;
  1050.          
  1051.           struct combine {
  1052.             header head_data;
  1053.             rcchs payload_data;
  1054.           }__attribute__((packed)); struct combine merge;
  1055.          
  1056.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1057.           merge.payload_data = {packet.time_boot_ms, packet.chan1_raw, packet.chan2_raw, packet.chan3_raw,
  1058.             packet.chan4_raw, packet.chan5_raw, packet.chan6_raw, packet.chan7_raw,
  1059.             packet.chan8_raw, packet.chan9_raw, packet.chan10_raw, packet.chan11_raw,
  1060.             packet.chan12_raw, packet.chan13_raw, packet.chan14_raw, packet.chan15_raw,
  1061.             packet.chan16_raw, packet.chan17_raw, packet.chan18_raw, packet.chancount,
  1062.             packet.rssi, msg.checksum};
  1063.  
  1064.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1065.           char _data[sizeof(merge)];
  1066.           memcpy(_data, &merge, sizeof(merge));
  1067.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1068.         }break;
  1069.  
  1070.         case 66: {
  1071.           mavlink_request_data_stream_t packet;
  1072.           mavlink_msg_request_data_stream_decode(&msg, &packet);
  1073.           received_sysid = msg.sysid;
  1074.           received_compid = msg.compid;
  1075.           received_msgid = msg.msgid;
  1076.          
  1077.           struct combine {
  1078.             header head_data;
  1079.             reqdata_stream payload_data;
  1080.           }__attribute__((packed)); struct combine merge;
  1081.          
  1082.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1083.           merge.payload_data = {packet.req_message_rate, packet.target_system,
  1084.             packet.target_component, packet.req_stream_id, packet.start_stop, msg.checksum};
  1085.  
  1086.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1087.           char _data[sizeof(merge)];
  1088.           memcpy(_data, &merge, sizeof(merge));
  1089.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1090.         }break;
  1091.  
  1092.         case 67: {
  1093.           mavlink_data_stream_t packet;
  1094.           mavlink_msg_data_stream_decode(&msg, &packet);
  1095.           received_sysid = msg.sysid;
  1096.           received_compid = msg.compid;
  1097.           received_msgid = msg.msgid;
  1098.          
  1099.           struct combine {
  1100.             header head_data;
  1101.             data_stream payload_data;
  1102.           }__attribute__((packed)); struct combine merge;
  1103.          
  1104.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1105.           merge.payload_data = {packet.message_rate, packet.stream_id, packet.on_off, msg.checksum};
  1106.  
  1107.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1108.           char _data[sizeof(merge)];
  1109.           memcpy(_data, &merge, sizeof(merge));
  1110.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1111.         }break;
  1112.  
  1113.         case 69: {
  1114.           mavlink_manual_control_t packet;
  1115.           mavlink_msg_manual_control_decode(&msg, &packet);
  1116.           received_sysid = msg.sysid;
  1117.           received_compid = msg.compid;
  1118.           received_msgid = msg.msgid;
  1119.          
  1120.           struct combine {
  1121.             header head_data;
  1122.             manctrl payload_data;
  1123.           }__attribute__((packed)); struct combine merge;
  1124.          
  1125.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1126.           merge.payload_data = {packet.x, packet.y, packet.z, packet.buttons,
  1127.             packet.target, msg.checksum};
  1128.  
  1129.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1130.           char _data[sizeof(merge)];
  1131.           memcpy(_data, &merge, sizeof(merge));
  1132.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1133.         }break;
  1134.  
  1135.         case 70: {
  1136.           mavlink_rc_channels_override_t packet;
  1137.           mavlink_msg_rc_channels_override_decode(&msg, &packet);
  1138.           received_sysid = msg.sysid;
  1139.           received_compid = msg.compid;
  1140.           received_msgid = msg.msgid;
  1141.          
  1142.           struct combine {
  1143.             header head_data;
  1144.             rcchs_override payload_data;
  1145.           }__attribute__((packed)); struct combine merge;
  1146.          
  1147.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1148.           merge.payload_data = {packet.chan1_raw, packet.chan2_raw, packet.chan3_raw,
  1149.             packet.chan4_raw, packet.chan5_raw, packet.chan6_raw, packet.chan7_raw,
  1150.             packet.chan8_raw, packet.target_system, packet.target_component, msg.checksum};
  1151.  
  1152.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1153.           char _data[sizeof(merge)];
  1154.           memcpy(_data, &merge, sizeof(merge));
  1155.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1156.         }break;
  1157.  
  1158.         case 73: {
  1159.           mavlink_mission_item_int_t packet;
  1160.           mavlink_msg_mission_item_int_decode(&msg, &packet);
  1161.           received_sysid = msg.sysid;
  1162.           received_compid = msg.compid;
  1163.           received_msgid = msg.msgid;
  1164.          
  1165.           struct combine {
  1166.             header head_data;
  1167.             missionitem_int payload_data;
  1168.           }__attribute__((packed)); struct combine merge;
  1169.          
  1170.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1171.           merge.payload_data = {packet.param1, packet.param2, packet.param3,
  1172.             packet.param4, packet.x, packet.y, packet.z, packet.seq, packet.command,
  1173.             packet.target_system, packet.target_component, packet.frame,
  1174.             packet.current, packet.autocontinue, msg.checksum};
  1175.  
  1176.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1177.           char _data[sizeof(merge)];
  1178.           memcpy(_data, &merge, sizeof(merge));
  1179.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1180.         }break;
  1181.  
  1182.         case 74: {
  1183.           mavlink_vfr_hud_t packet;
  1184.           mavlink_msg_vfr_hud_decode(&msg, &packet);
  1185.           received_sysid = msg.sysid;
  1186.           received_compid = msg.compid;
  1187.           received_msgid = msg.msgid;
  1188.          
  1189.           struct combine {
  1190.             header head_data;
  1191.             vfrhud payload_data;
  1192.           }__attribute__((packed)); struct combine merge;
  1193.          
  1194.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1195.           merge.payload_data = {packet.airspeed, packet.groundspeed, packet.alt,
  1196.             packet.climb, packet.heading, packet.throttle, msg.checksum};
  1197.  
  1198.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1199.           char _data[sizeof(merge)];
  1200.           memcpy(_data, &merge, sizeof(merge));
  1201.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1202.         }break;
  1203.  
  1204.         case 75: {
  1205.           mavlink_command_int_t packet;
  1206.           mavlink_msg_command_int_decode(&msg, &packet);
  1207.           received_sysid = msg.sysid;
  1208.           received_compid = msg.compid;
  1209.           received_msgid = msg.msgid;
  1210.          
  1211.           struct combine {
  1212.             header head_data;
  1213.             cmdint payload_data;
  1214.           }__attribute__((packed)); struct combine merge;
  1215.          
  1216.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1217.           merge.payload_data = {packet.param1, packet.param2, packet.param3,
  1218.             packet.param4, packet.x, packet.y, packet.z, packet.command,
  1219.             packet.target_system, packet.target_component, packet.frame, packet.current,
  1220.             packet.autocontinue, msg.checksum};
  1221.  
  1222.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1223.           char _data[sizeof(merge)];
  1224.           memcpy(_data, &merge, sizeof(merge));
  1225.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1226.         }break;
  1227.  
  1228.         case 76: {
  1229.           mavlink_command_long_t packet;
  1230.           mavlink_msg_command_long_decode(&msg, &packet);
  1231.           received_sysid = msg.sysid;
  1232.           received_compid = msg.compid;
  1233.           received_msgid = msg.msgid;
  1234.          
  1235.           struct combine {
  1236.             header head_data;
  1237.             cmdlong payload_data;
  1238.           }__attribute__((packed)); struct combine merge;
  1239.          
  1240.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1241.           merge.payload_data = {packet.param1, packet.param2, packet.param3,
  1242.             packet.param4, packet.param5, packet.param6, packet.param7, packet.command,
  1243.             packet.target_system, packet.target_component, packet.confirmation, msg.checksum};
  1244.  
  1245.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1246.           char _data[sizeof(merge)];
  1247.           memcpy(_data, &merge, sizeof(merge));
  1248.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1249.         }break;
  1250.  
  1251.         case 77: {
  1252.           mavlink_command_ack_t packet;
  1253.           mavlink_msg_command_ack_decode(&msg, &packet);
  1254.           received_sysid = msg.sysid;
  1255.           received_compid = msg.compid;
  1256.           received_msgid = msg.msgid;
  1257.          
  1258.           struct combine {
  1259.             header head_data;
  1260.             cmdack payload_data;
  1261.           }__attribute__((packed)); struct combine merge;
  1262.          
  1263.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1264.           merge.payload_data = {packet.command, packet.result, msg.checksum};
  1265.  
  1266.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1267.           char _data[sizeof(merge)];
  1268.           memcpy(_data, &merge, sizeof(merge));
  1269.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1270.         }break;
  1271.  
  1272.         case 80: {
  1273.           mavlink_command_cancel_t packet;
  1274.           mavlink_msg_command_cancel_decode(&msg, &packet);
  1275.           received_sysid = msg.sysid;
  1276.           received_compid = msg.compid;
  1277.           received_msgid = msg.msgid;
  1278.          
  1279.           struct combine {
  1280.             header head_data;
  1281.             cmdcancel payload_data;
  1282.           }__attribute__((packed)); struct combine merge;
  1283.          
  1284.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1285.           merge.payload_data = {packet.command, packet.target_system,
  1286.             packet.target_component, msg.checksum};
  1287.  
  1288.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1289.           char _data[sizeof(merge)];
  1290.           memcpy(_data, &merge, sizeof(merge));
  1291.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1292.         }break;
  1293.  
  1294.         case 81: {
  1295.           mavlink_manual_setpoint_t packet;
  1296.           mavlink_msg_manual_setpoint_decode(&msg, &packet);
  1297.           received_sysid = msg.sysid;
  1298.           received_compid = msg.compid;
  1299.           received_msgid = msg.msgid;
  1300.          
  1301.           struct combine {
  1302.             header head_data;
  1303.             manual_setpoint payload_data;
  1304.           }__attribute__((packed)); struct combine merge;
  1305.          
  1306.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1307.           merge.payload_data = {packet.time_boot_ms, packet.roll, packet.pitch,
  1308.             packet.yaw, packet.thrust, packet.mode_switch, packet.manual_override_switch,
  1309.             msg.checksum};
  1310.  
  1311.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1312.           char _data[sizeof(merge)];
  1313.           memcpy(_data, &merge, sizeof(merge));
  1314.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1315.         }break;
  1316.  
  1317.         case 82: {
  1318.           mavlink_set_attitude_target_t packet;
  1319.           mavlink_msg_set_attitude_target_decode(&msg, &packet);
  1320.           received_sysid = msg.sysid;
  1321.           received_compid = msg.compid;
  1322.           received_msgid = msg.msgid;
  1323.          
  1324.           struct combine {
  1325.             header head_data;
  1326.             set_attitude_target payload_data;
  1327.           }__attribute__((packed)); struct combine merge;
  1328.          
  1329.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1330.           merge.payload_data = {packet.time_boot_ms, {packet.q}, packet.body_roll_rate,
  1331.             packet.body_pitch_rate, packet.body_yaw_rate, packet.thrust,
  1332.             packet.target_system, packet.target_component, packet.type_mask, msg.checksum};
  1333.  
  1334.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1335.           char _data[sizeof(merge)];
  1336.           memcpy(_data, &merge, sizeof(merge));
  1337.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1338.         }break;
  1339.  
  1340.         case 83: {
  1341.           mavlink_attitude_target_t packet;
  1342.           mavlink_msg_attitude_target_decode(&msg, &packet);
  1343.           received_sysid = msg.sysid;
  1344.           received_compid = msg.compid;
  1345.           received_msgid = msg.msgid;
  1346.          
  1347.           struct combine {
  1348.             header head_data;
  1349.             attitude_target payload_data;
  1350.           }__attribute__((packed)); struct combine merge;
  1351.          
  1352.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1353.           merge.payload_data = {packet.time_boot_ms, {packet.q}, packet.body_roll_rate,
  1354.             packet.body_pitch_rate, packet.body_yaw_rate, packet.thrust,
  1355.             packet.type_mask, msg.checksum};
  1356.  
  1357.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1358.           char _data[sizeof(merge)];
  1359.           memcpy(_data, &merge, sizeof(merge));
  1360.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1361.         }break;
  1362.  
  1363.         case 84: {
  1364.           mavlink_set_position_target_local_ned_t packet;
  1365.           mavlink_msg_set_position_target_local_ned_decode(&msg, &packet);
  1366.           received_sysid = msg.sysid;
  1367.           received_compid = msg.compid;
  1368.           received_msgid = msg.msgid;
  1369.          
  1370.           struct combine {
  1371.             header head_data;
  1372.             set_position_target_local_ned payload_data;
  1373.           }__attribute__((packed)); struct combine merge;
  1374.          
  1375.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1376.           merge.payload_data = {packet.time_boot_ms, packet.x, packet.y, packet.z,
  1377.             packet.vx, packet.vy, packet.vz, packet.afx, packet.afy, packet.afz,
  1378.             packet.yaw, packet.yaw_rate, packet.type_mask, packet.target_system,
  1379.             packet.target_component, packet.coordinate_frame, msg.checksum};
  1380.  
  1381.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1382.           char _data[sizeof(merge)];
  1383.           memcpy(_data, &merge, sizeof(merge));
  1384.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1385.         }break;
  1386.  
  1387.         case 85: {
  1388.           mavlink_position_target_local_ned_t packet;
  1389.           mavlink_msg_position_target_local_ned_decode(&msg, &packet);
  1390.           received_sysid = msg.sysid;
  1391.           received_compid = msg.compid;
  1392.           received_msgid = msg.msgid;
  1393.          
  1394.           struct combine {
  1395.             header head_data;
  1396.             position_target_local_ned payload_data;
  1397.           }__attribute__((packed)); struct combine merge;
  1398.          
  1399.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1400.           merge.payload_data = {packet.time_boot_ms, packet.x, packet.y, packet.z,
  1401.             packet.vx, packet.vy, packet.vz, packet.afx, packet.afy, packet.afz, packet.yaw,
  1402.             packet.yaw_rate, packet.type_mask, packet.coordinate_frame, msg.checksum};
  1403.  
  1404.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1405.           char _data[sizeof(merge)];
  1406.           memcpy(_data, &merge, sizeof(merge));
  1407.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1408.         }break;
  1409.  
  1410.         case 86: {
  1411.           mavlink_set_position_target_global_int_t packet;
  1412.           mavlink_msg_set_position_target_global_int_decode(&msg, &packet);
  1413.           received_sysid = msg.sysid;
  1414.           received_compid = msg.compid;
  1415.           received_msgid = msg.msgid;
  1416.          
  1417.           struct combine {
  1418.             header head_data;
  1419.             set_position_target_global_int payload_data;
  1420.           }__attribute__((packed)); struct combine merge;
  1421.          
  1422.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1423.           merge.payload_data = {packet.time_boot_ms, packet.lat_int, packet.lon_int,
  1424.             packet.alt, packet.vx, packet.vy, packet.vz, packet.afx, packet.afy,
  1425.             packet.afz, packet.yaw, packet.yaw_rate, packet.type_mask,
  1426.             packet.target_system, packet.target_component, packet.coordinate_frame, msg.checksum};
  1427.  
  1428.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1429.           char _data[sizeof(merge)];
  1430.           memcpy(_data, &merge, sizeof(merge));
  1431.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1432.         }break;
  1433.  
  1434.         case 87: {
  1435.           mavlink_position_target_global_int_t packet;
  1436.           mavlink_msg_position_target_global_int_decode(&msg, &packet);
  1437.           received_sysid = msg.sysid;
  1438.           received_compid = msg.compid;
  1439.           received_msgid = msg.msgid;
  1440.          
  1441.           struct combine {
  1442.             header head_data;
  1443.             position_target_global_int payload_data;
  1444.           }__attribute__((packed)); struct combine merge;
  1445.          
  1446.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1447.           merge.payload_data = {packet.time_boot_ms, packet.lat_int, packet.lon_int,
  1448.             packet.alt, packet.vx, packet.vy, packet.vz, packet.afx, packet.afy,
  1449.             packet.afz, packet.yaw, packet.yaw_rate, packet.type_mask,
  1450.             packet.coordinate_frame, msg.checksum};
  1451.  
  1452.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1453.           char _data[sizeof(merge)];
  1454.           memcpy(_data, &merge, sizeof(merge));
  1455.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1456.         }break;
  1457.  
  1458.         case 89: {
  1459.           mavlink_local_position_ned_system_global_offset_t packet;
  1460.           mavlink_msg_local_position_ned_system_global_offset_decode(&msg, &packet);
  1461.           received_sysid = msg.sysid;
  1462.           received_compid = msg.compid;
  1463.           received_msgid = msg.msgid;
  1464.          
  1465.           struct combine {
  1466.             header head_data;
  1467.             local_position_ned_system_global_offset payload_data;
  1468.           }__attribute__((packed)); struct combine merge;
  1469.          
  1470.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1471.           merge.payload_data = {packet.time_boot_ms, packet.x, packet.y, packet.z,
  1472.             packet.roll, packet.pitch, packet.yaw, msg.checksum};
  1473.  
  1474.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1475.           char _data[sizeof(merge)];
  1476.           memcpy(_data, &merge, sizeof(merge));
  1477.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1478.         }break;
  1479.  
  1480.         case 90: {
  1481.           mavlink_hil_state_t packet;
  1482.           mavlink_msg_hil_state_decode(&msg, &packet);
  1483.           received_sysid = msg.sysid;
  1484.           received_compid = msg.compid;
  1485.           received_msgid = msg.msgid;
  1486.          
  1487.           struct combine {
  1488.             header head_data;
  1489.             hilstate payload_data;
  1490.           }__attribute__((packed)); struct combine merge;
  1491.          
  1492.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1493.           merge.payload_data = {packet.time_usec, packet.roll, packet.pitch, packet.yaw,
  1494.             packet.rollspeed, packet.pitchspeed, packet.yawspeed, packet.lat, packet.lon,
  1495.             packet.alt, packet.vx, packet.vy, packet.vz, packet.xacc, packet.yacc,
  1496.             packet.zacc, msg.checksum};
  1497.  
  1498.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1499.           char _data[sizeof(merge)];
  1500.           memcpy(_data, &merge, sizeof(merge));
  1501.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1502.         }break;
  1503.  
  1504.         case 91: {
  1505.           mavlink_hil_controls_t packet;
  1506.           mavlink_msg_hil_controls_decode(&msg, &packet);
  1507.           received_sysid = msg.sysid;
  1508.           received_compid = msg.compid;
  1509.           received_msgid = msg.msgid;
  1510.          
  1511.           struct combine {
  1512.             header head_data;
  1513.             hilctrl payload_data;
  1514.           }__attribute__((packed)); struct combine merge;
  1515.          
  1516.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1517.           merge.payload_data = {packet.time_usec, packet.roll_ailerons,
  1518.             packet.pitch_elevator, packet.yaw_rudder, packet.throttle, packet.aux1,
  1519.             packet.aux2, packet.aux3, packet.aux4, packet.mode, packet.nav_mode, msg.checksum};
  1520.  
  1521.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1522.           char _data[sizeof(merge)];
  1523.           memcpy(_data, &merge, sizeof(merge));
  1524.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1525.         }break;
  1526.  
  1527.         case 92: {
  1528.           mavlink_hil_rc_inputs_raw_t packet;
  1529.           mavlink_msg_hil_rc_inputs_raw_decode(&msg, &packet);(&msg, &packet);
  1530.           received_sysid = msg.sysid;
  1531.           received_compid = msg.compid;
  1532.           received_msgid = msg.msgid;
  1533.          
  1534.           struct combine {
  1535.             header head_data;
  1536.             hilrcinraw payload_data;
  1537.           }__attribute__((packed)); struct combine merge;
  1538.          
  1539.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1540.           merge.payload_data = {packet.time_usec, packet.chan1_raw, packet.chan2_raw,
  1541.             packet.chan3_raw, packet.chan4_raw, packet.chan5_raw, packet.chan6_raw,
  1542.             packet.chan7_raw, packet.chan8_raw, packet.chan9_raw, packet.chan10_raw,
  1543.             packet.chan11_raw, packet.chan12_raw, packet.rssi, msg.checksum};
  1544.  
  1545.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1546.           char _data[sizeof(merge)];
  1547.           memcpy(_data, &merge, sizeof(merge));
  1548.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1549.         }break;
  1550.  
  1551.         case 93: {
  1552.           mavlink_hil_actuator_controls_t packet;
  1553.           mavlink_msg_hil_actuator_controls_decode(&msg, &packet);
  1554.           received_sysid = msg.sysid;
  1555.           received_compid = msg.compid;
  1556.           received_msgid = msg.msgid;
  1557.          
  1558.           struct combine {
  1559.             header head_data;
  1560.             hilact_ctrl payload_data;
  1561.           }__attribute__((packed)); struct combine merge;
  1562.          
  1563.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1564.           merge.payload_data = {packet.time_usec, packet.flags, {packet.controls},
  1565.             packet.mode, msg.checksum};
  1566.  
  1567.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1568.           char _data[sizeof(merge)];
  1569.           memcpy(_data, &merge, sizeof(merge));
  1570.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1571.         }break;
  1572.  
  1573.         case 100: {
  1574.           mavlink_optical_flow_t packet;
  1575.           mavlink_msg_optical_flow_decode(&msg, &packet);
  1576.           received_sysid = msg.sysid;
  1577.           received_compid = msg.compid;
  1578.           received_msgid = msg.msgid;
  1579.          
  1580.           struct combine {
  1581.             header head_data;
  1582.             opticflow payload_data;
  1583.           }__attribute__((packed)); struct combine merge;
  1584.          
  1585.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1586.           merge.payload_data = {packet.time_usec, packet.flow_comp_m_x,
  1587.             packet.flow_comp_m_y, packet.ground_distance, packet.flow_x, packet.flow_y,
  1588.             packet.sensor_id, packet.quality, msg.checksum};
  1589.  
  1590.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1591.           char _data[sizeof(merge)];
  1592.           memcpy(_data, &merge, sizeof(merge));
  1593.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1594.         }break;
  1595.  
  1596.         case 101: {
  1597.           mavlink_global_vision_position_estimate_t packet;
  1598.           mavlink_msg_global_vision_position_estimate_decode(&msg, &packet);
  1599.           received_sysid = msg.sysid;
  1600.           received_compid = msg.compid;
  1601.           received_msgid = msg.msgid;
  1602.          
  1603.           struct combine {
  1604.             header head_data;
  1605.             global_vision_position_estimate payload_data;
  1606.           }__attribute__((packed)); struct combine merge;
  1607.          
  1608.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1609.           merge.payload_data = {packet.usec, packet.x, packet.y, packet.z, packet.roll,
  1610.             packet.pitch, packet.yaw, msg.checksum};
  1611.  
  1612.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1613.           char _data[sizeof(merge)];
  1614.           memcpy(_data, &merge, sizeof(merge));
  1615.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1616.         }break;
  1617.  
  1618.         case 102: {
  1619.           mavlink_vision_position_estimate_t packet;
  1620.           mavlink_msg_vision_position_estimate_decode(&msg, &packet);
  1621.           received_sysid = msg.sysid;
  1622.           received_compid = msg.compid;
  1623.           received_msgid = msg.msgid;
  1624.          
  1625.           struct combine {
  1626.             header head_data;
  1627.             vision_position_estimate payload_data;
  1628.           }__attribute__((packed)); struct combine merge;
  1629.          
  1630.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1631.           merge.payload_data = {packet.usec, packet.x, packet.y, packet.z, packet.roll,
  1632.             packet.pitch, packet.yaw, msg.checksum};
  1633.  
  1634.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1635.           char _data[sizeof(merge)];
  1636.           memcpy(_data, &merge, sizeof(merge));
  1637.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1638.         }break;
  1639.  
  1640.         case 103: {
  1641.           mavlink_vision_speed_estimate_t packet;
  1642.           mavlink_msg_vision_speed_estimate_decode(&msg, &packet);
  1643.           received_sysid = msg.sysid;
  1644.           received_compid = msg.compid;
  1645.           received_msgid = msg.msgid;
  1646.          
  1647.           struct combine {
  1648.             header head_data;
  1649.             visspd_estim payload_data;
  1650.           }__attribute__((packed)); struct combine merge;
  1651.          
  1652.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1653.           merge.payload_data = {packet.usec, packet.x, packet.y, packet.z, msg.checksum};
  1654.  
  1655.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1656.           char _data[sizeof(merge)];
  1657.           memcpy(_data, &merge, sizeof(merge));
  1658.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1659.         }break;
  1660.  
  1661.         case 104: {
  1662.           mavlink_vicon_position_estimate_t packet;
  1663.           mavlink_msg_vicon_position_estimate_decode(&msg, &packet);
  1664.           received_sysid = msg.sysid;
  1665.           received_compid = msg.compid;
  1666.           received_msgid = msg.msgid;
  1667.          
  1668.           struct combine {
  1669.             header head_data;
  1670.             viconpos_estim payload_data;
  1671.           }__attribute__((packed)); struct combine merge;
  1672.          
  1673.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1674.           merge.payload_data = {packet.usec, packet.x, packet.y, packet.z, packet.roll,
  1675.             packet.pitch, packet.yaw, msg.checksum};
  1676.  
  1677.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1678.           char _data[sizeof(merge)];
  1679.           memcpy(_data, &merge, sizeof(merge));
  1680.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1681.         }break;
  1682.  
  1683.         case 105: {
  1684.           mavlink_highres_imu_t packet;
  1685.           mavlink_msg_highres_imu_decode(&msg, &packet);
  1686.           received_sysid = msg.sysid;
  1687.           received_compid = msg.compid;
  1688.           received_msgid = msg.msgid;
  1689.          
  1690.           struct combine {
  1691.             header head_data;
  1692.             highres_imu payload_data;
  1693.           }__attribute__((packed)); struct combine merge;
  1694.          
  1695.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1696.           merge.payload_data = {packet.time_usec, packet.xacc, packet.yacc, packet.zacc,
  1697.             packet.xgyro, packet.ygyro, packet.zgyro, packet.xmag, packet.ymag, packet.zmag,
  1698.             packet.abs_pressure, packet.diff_pressure, packet.pressure_alt, packet.temperature,
  1699.             packet.fields_updated, msg.checksum};
  1700.  
  1701.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1702.           char _data[sizeof(merge)];
  1703.           memcpy(_data, &merge, sizeof(merge));
  1704.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1705.         }break;
  1706.  
  1707.         case 106: {
  1708.           mavlink_optical_flow_rad_t packet;
  1709.           mavlink_msg_optical_flow_rad_decode(&msg, &packet);
  1710.           received_sysid = msg.sysid;
  1711.           received_compid = msg.compid;
  1712.           received_msgid = msg.msgid;
  1713.          
  1714.           struct combine {
  1715.             header head_data;
  1716.             opticflowrad payload_data;
  1717.           }__attribute__((packed)); struct combine merge;
  1718.          
  1719.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1720.           merge.payload_data = {packet.time_usec, packet.integration_time_us,
  1721.             packet.integrated_x, packet.integrated_y, packet.integrated_xgyro,
  1722.             packet.integrated_ygyro, packet.integrated_zgyro,
  1723.             packet.time_delta_distance_us, packet.distance, packet.temperature,
  1724.             packet.sensor_id, packet.quality, msg.checksum};
  1725.  
  1726.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1727.           char _data[sizeof(merge)];
  1728.           memcpy(_data, &merge, sizeof(merge));
  1729.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1730.         }break;
  1731.  
  1732.         case 107: {
  1733.           mavlink_hil_sensor_t packet;
  1734.           mavlink_msg_hil_sensor_decode(&msg, &packet);
  1735.           received_sysid = msg.sysid;
  1736.           received_compid = msg.compid;
  1737.           received_msgid = msg.msgid;
  1738.          
  1739.           struct combine {
  1740.             header head_data;
  1741.             hilsens payload_data;
  1742.           }__attribute__((packed)); struct combine merge;
  1743.          
  1744.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1745.           merge.payload_data = {packet.time_usec, packet.xacc, packet.yacc, packet.zacc,
  1746.             packet.xgyro, packet.ygyro, packet.zgyro, packet.xmag, packet.ymag, packet.zmag,
  1747.             packet.abs_pressure, packet.diff_pressure, packet.pressure_alt, packet.temperature,
  1748.             packet.fields_updated, msg.checksum};
  1749.  
  1750.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1751.           char _data[sizeof(merge)];
  1752.           memcpy(_data, &merge, sizeof(merge));
  1753.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1754.         }break;
  1755.  
  1756.         case 108: {
  1757.           mavlink_sim_state_t packet;
  1758.           mavlink_msg_sim_state_decode(&msg, &packet);
  1759.           received_sysid = msg.sysid;
  1760.           received_compid = msg.compid;
  1761.           received_msgid = msg.msgid;
  1762.          
  1763.           struct combine {
  1764.             header head_data;
  1765.             sim_state payload_data;
  1766.           }__attribute__((packed)); struct combine merge;
  1767.          
  1768.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1769.           merge.payload_data = {packet.q1, packet.q2, packet.q3, packet.q4, packet.roll,
  1770.             packet.pitch, packet.yaw, packet.xacc, packet.yacc, packet.zacc, packet.xgyro,
  1771.             packet.ygyro, packet.zgyro, packet.lat, packet.lon, packet.alt, packet.std_dev_horz,
  1772.             packet.std_dev_vert, packet.vn, packet.ve, packet.vd, msg.checksum};
  1773.  
  1774.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1775.           char _data[sizeof(merge)];
  1776.           memcpy(_data, &merge, sizeof(merge));
  1777.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1778.         }break;
  1779.  
  1780.         case 109: {
  1781.           mavlink_radio_status_t packet;
  1782.           mavlink_msg_radio_status_decode(&msg, &packet);
  1783.           received_sysid = msg.sysid;
  1784.           received_compid = msg.compid;
  1785.           received_msgid = msg.msgid;
  1786.          
  1787.           struct combine {
  1788.             header head_data;
  1789.             radio_status payload_data;
  1790.           }__attribute__((packed)); struct combine merge;
  1791.          
  1792.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1793.           merge.payload_data = {packet.rxerrors, packet.fixed, packet.rssi, packet.remrssi,
  1794.             packet.txbuf, packet.noise, packet.remnoise, msg.checksum};
  1795.  
  1796.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1797.           char _data[sizeof(merge)];
  1798.           memcpy(_data, &merge, sizeof(merge));
  1799.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1800.         }break;
  1801.  
  1802.         case 110: {
  1803.           mavlink_file_transfer_protocol_t packet;
  1804.           mavlink_msg_file_transfer_protocol_decode(&msg, &packet);
  1805.           received_sysid = msg.sysid;
  1806.           received_compid = msg.compid;
  1807.           received_msgid = msg.msgid;
  1808.          
  1809.           struct combine {
  1810.             header head_data;
  1811.             FTP payload_data;
  1812.           }__attribute__((packed)); struct combine merge;
  1813.          
  1814.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1815.           merge.payload_data = {packet.target_network, packet.target_system,
  1816.             packet.target_component, {packet.payload}, msg.checksum};
  1817.  
  1818.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1819.           char _data[sizeof(merge)];
  1820.           memcpy(_data, &merge, sizeof(merge));
  1821.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1822.         }break;
  1823.        
  1824.         case 111: {
  1825.           mavlink_timesync_t packet;
  1826.           mavlink_msg_timesync_decode(&msg, &packet);
  1827.           received_sysid = msg.sysid;
  1828.           received_compid = msg.compid;
  1829.           received_msgid = msg.msgid;
  1830.          
  1831.           struct combine {
  1832.             header head_data;
  1833.             timesync payload_data;
  1834.           }__attribute__((packed)); struct combine merge;
  1835.          
  1836.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1837.           merge.payload_data = {packet.tc1, packet.ts1, msg.checksum};
  1838.  
  1839.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1840.           char _data[sizeof(merge)];
  1841.           memcpy(_data, &merge, sizeof(merge));
  1842.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1843.         }break;
  1844.  
  1845.         case 112: {
  1846.           mavlink_camera_trigger_t packet;
  1847.           mavlink_msg_camera_trigger_decode(&msg, &packet);
  1848.           received_sysid = msg.sysid;
  1849.           received_compid = msg.compid;
  1850.           received_msgid = msg.msgid;
  1851.          
  1852.           struct combine {
  1853.             header head_data;
  1854.             camtrigg payload_data;
  1855.           }__attribute__((packed)); struct combine merge;
  1856.          
  1857.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1858.           merge.payload_data = {packet.time_usec, packet.seq, msg.checksum};
  1859.  
  1860.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1861.           char _data[sizeof(merge)];
  1862.           memcpy(_data, &merge, sizeof(merge));
  1863.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1864.         }break;
  1865.  
  1866.         case 113: {
  1867.           mavlink_hil_gps_t packet;
  1868.           mavlink_msg_hil_gps_decode(&msg, &packet);
  1869.           received_sysid = msg.sysid;
  1870.           received_compid = msg.compid;
  1871.           received_msgid = msg.msgid;
  1872.          
  1873.           struct combine {
  1874.             header head_data;
  1875.             hilgps payload_data;
  1876.           }__attribute__((packed)); struct combine merge;
  1877.          
  1878.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1879.           merge.payload_data = {packet.time_usec, packet.lat, packet.lon, packet.alt,
  1880.             packet.eph, packet.epv, packet.vel, packet.vn, packet.ve, packet.vd,
  1881.             packet.cog, packet.fix_type, packet.satellites_visible, msg.checksum};
  1882.  
  1883.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1884.           char _data[sizeof(merge)];
  1885.           memcpy(_data, &merge, sizeof(merge));
  1886.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1887.         }break;
  1888.  
  1889.         case 114: {
  1890.           mavlink_hil_optical_flow_t packet;
  1891.           mavlink_msg_hil_optical_flow_decode(&msg, &packet);
  1892.           received_sysid = msg.sysid;
  1893.           received_compid = msg.compid;
  1894.           received_msgid = msg.msgid;
  1895.          
  1896.           struct combine {
  1897.             header head_data;
  1898.             hilopticflow payload_data;
  1899.           }__attribute__((packed)); struct combine merge;
  1900.          
  1901.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1902.           merge.payload_data = {packet.time_usec, packet.integration_time_us,
  1903.             packet.integrated_x, packet.integrated_y, packet.integrated_xgyro,
  1904.             packet.integrated_ygyro, packet.integrated_zgyro, packet.time_delta_distance_us,
  1905.             packet.distance, packet.temperature, packet.sensor_id, packet.quality, msg.checksum};
  1906.  
  1907.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1908.           char _data[sizeof(merge)];
  1909.           memcpy(_data, &merge, sizeof(merge));
  1910.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1911.         }break;
  1912.  
  1913.         case 115: {
  1914.           mavlink_hil_state_quaternion_t packet;
  1915.           mavlink_msg_hil_state_quaternion_decode(&msg, &packet);
  1916.           received_sysid = msg.sysid;
  1917.           received_compid = msg.compid;
  1918.           received_msgid = msg.msgid;
  1919.          
  1920.           struct combine {
  1921.             header head_data;
  1922.             hil_state_quaternion payload_data;
  1923.           }__attribute__((packed)); struct combine merge;
  1924.          
  1925.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1926.           merge.payload_data = {packet.time_usec, {packet.attitude_quaternion},
  1927.             packet.rollspeed, packet.pitchspeed, packet.yawspeed, packet.lat,
  1928.             packet.lon, packet.alt, packet.vx, packet.vy, packet.vz, packet.ind_airspeed,
  1929.             packet.true_airspeed, packet.xacc, packet.yacc, packet.zacc, msg.checksum};
  1930.  
  1931.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1932.           char _data[sizeof(merge)];
  1933.           memcpy(_data, &merge, sizeof(merge));
  1934.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1935.         }break;
  1936.  
  1937.         case 116: {
  1938.           mavlink_scaled_imu2_t packet;
  1939.           mavlink_msg_scaled_imu2_decode(&msg, &packet);
  1940.           received_sysid = msg.sysid;
  1941.           received_compid = msg.compid;
  1942.           received_msgid = msg.msgid;
  1943.          
  1944.           struct combine {
  1945.             header head_data;
  1946.             scaleimu2 payload_data;
  1947.           }__attribute__((packed)); struct combine merge;
  1948.          
  1949.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1950.           merge.payload_data = {packet.time_boot_ms, packet.xacc, packet.yacc, packet.zacc,
  1951.             packet.xgyro, packet.ygyro, packet.zgyro, packet.xmag, packet.ymag, packet.zmag,
  1952.             msg.checksum};
  1953.  
  1954.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1955.           char _data[sizeof(merge)];
  1956.           memcpy(_data, &merge, sizeof(merge));
  1957.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1958.         }break;
  1959.  
  1960.         case 117: {
  1961.           mavlink_log_request_list_t packet;
  1962.           mavlink_msg_log_request_list_decode(&msg, &packet);
  1963.           received_sysid = msg.sysid;
  1964.           received_compid = msg.compid;
  1965.           received_msgid = msg.msgid;
  1966.          
  1967.           struct combine {
  1968.             header head_data;
  1969.             logreqlist payload_data;
  1970.           }__attribute__((packed)); struct combine merge;
  1971.          
  1972.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1973.           merge.payload_data = {packet.start, packet.end, packet.target_system,
  1974.             packet.target_component, msg.checksum};
  1975.  
  1976.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1977.           char _data[sizeof(merge)];
  1978.           memcpy(_data, &merge, sizeof(merge));
  1979.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  1980.         }break;
  1981.  
  1982.         case 118: {
  1983.           mavlink_log_entry_t packet;
  1984.           mavlink_msg_log_entry_decode(&msg, &packet);
  1985.           received_sysid = msg.sysid;
  1986.           received_compid = msg.compid;
  1987.           received_msgid = msg.msgid;
  1988.          
  1989.           struct combine {
  1990.             header head_data;
  1991.             logentry payload_data;
  1992.           }__attribute__((packed)); struct combine merge;
  1993.          
  1994.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  1995.           merge.payload_data = {packet.time_utc, packet.size, packet.id, packet.num_logs,
  1996.             packet.last_log_num, msg.checksum};
  1997.  
  1998.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  1999.           char _data[sizeof(merge)];
  2000.           memcpy(_data, &merge, sizeof(merge));
  2001.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2002.         }break;
  2003.  
  2004.         case 119: {
  2005.           mavlink_log_request_data_t packet;
  2006.           mavlink_msg_log_request_data_decode(&msg, &packet);
  2007.           received_sysid = msg.sysid;
  2008.           received_compid = msg.compid;
  2009.           received_msgid = msg.msgid;
  2010.          
  2011.           struct combine {
  2012.             header head_data;
  2013.             logreqdata payload_data;
  2014.           }__attribute__((packed)); struct combine merge;
  2015.          
  2016.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2017.           merge.payload_data = {packet.ofs, packet.count, packet.id,
  2018.             packet.target_system, packet.target_component, msg.checksum};
  2019.  
  2020.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2021.           char _data[sizeof(merge)];
  2022.           memcpy(_data, &merge, sizeof(merge));
  2023.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2024.         }break;
  2025.  
  2026.         case 120: {
  2027.           mavlink_log_data_t packet;
  2028.           mavlink_msg_log_data_decode(&msg, &packet);
  2029.           received_sysid = msg.sysid;
  2030.           received_compid = msg.compid;
  2031.           received_msgid = msg.msgid;
  2032.          
  2033.           struct combine {
  2034.             header head_data;
  2035.             logdata payload_data;
  2036.           }__attribute__((packed)); struct combine merge;
  2037.          
  2038.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2039.           merge.payload_data = {packet.ofs, packet.id, packet.count, {packet.data}, msg.checksum};
  2040.  
  2041.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2042.           char _data[sizeof(merge)];
  2043.           memcpy(_data, &merge, sizeof(merge));
  2044.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2045.         }break;
  2046.  
  2047.         case 121: {
  2048.           mavlink_log_erase_t packet;
  2049.           mavlink_msg_log_erase_decode(&msg, &packet);
  2050.           received_sysid = msg.sysid;
  2051.           received_compid = msg.compid;
  2052.           received_msgid = msg.msgid;
  2053.          
  2054.           struct combine {
  2055.             header head_data;
  2056.             logerase payload_data;
  2057.           }__attribute__((packed)); struct combine merge;
  2058.          
  2059.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2060.           merge.payload_data = {packet.target_system, packet.target_component, msg.checksum};
  2061.  
  2062.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2063.           char _data[sizeof(merge)];
  2064.           memcpy(_data, &merge, sizeof(merge));
  2065.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2066.         }break;
  2067.  
  2068.         case 122: {
  2069.           mavlink_log_request_end_t packet;
  2070.           mavlink_msg_log_request_end_decode(&msg, &packet);
  2071.           received_sysid = msg.sysid;
  2072.           received_compid = msg.compid;
  2073.           received_msgid = msg.msgid;
  2074.          
  2075.           struct combine {
  2076.             header head_data;
  2077.             logreqend payload_data;
  2078.           }__attribute__((packed)); struct combine merge;
  2079.          
  2080.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2081.           merge.payload_data = {packet.target_system, packet.target_component, msg.checksum};
  2082.  
  2083.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2084.           char _data[sizeof(merge)];
  2085.           memcpy(_data, &merge, sizeof(merge));
  2086.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2087.         }break;
  2088.  
  2089.         case 123: {
  2090.           mavlink_gps_inject_data_t packet;
  2091.           mavlink_msg_gps_inject_data_decode(&msg, &packet);
  2092.           received_sysid = msg.sysid;
  2093.           received_compid = msg.compid;
  2094.           received_msgid = msg.msgid;
  2095.          
  2096.           struct combine {
  2097.             header head_data;
  2098.             gps_inject_data payload_data;
  2099.           }__attribute__((packed)); struct combine merge;
  2100.          
  2101.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2102.           merge.payload_data = {packet.target_system, packet.target_component,
  2103.             packet.len, {packet.data}, msg.checksum};
  2104.  
  2105.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2106.           char _data[sizeof(merge)];
  2107.           memcpy(_data, &merge, sizeof(merge));
  2108.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2109.         }break;
  2110.  
  2111.         case 124: {
  2112.           mavlink_gps2_raw_t packet;
  2113.           mavlink_msg_gps2_raw_decode(&msg, &packet);
  2114.           received_sysid = msg.sysid;
  2115.           received_compid = msg.compid;
  2116.           received_msgid = msg.msgid;
  2117.          
  2118.           struct combine {
  2119.             header head_data;
  2120.             gps2raw payload_data;
  2121.           }__attribute__((packed)); struct combine merge;
  2122.          
  2123.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2124.           merge.payload_data = {packet.time_usec, packet.lat, packet.lon, packet.alt,
  2125.             packet.dgps_age, packet.eph, packet.epv, packet.vel, packet.cog,
  2126.             packet.fix_type, packet.satellites_visible, packet.dgps_numch, msg.checksum};
  2127.  
  2128.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2129.           char _data[sizeof(merge)];
  2130.           memcpy(_data, &merge, sizeof(merge));
  2131.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2132.         }break;
  2133.  
  2134.         case 125: {
  2135.           mavlink_power_status_t packet;
  2136.           mavlink_msg_power_status_decode(&msg, &packet);
  2137.           received_sysid = msg.sysid;
  2138.           received_compid = msg.compid;
  2139.           received_msgid = msg.msgid;
  2140.          
  2141.           struct combine {
  2142.             header head_data;
  2143.             powerstat payload_data;
  2144.           }__attribute__((packed)); struct combine merge;
  2145.          
  2146.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2147.           merge.payload_data = {packet.Vcc, packet.Vservo, packet.flags, msg.checksum};
  2148.  
  2149.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2150.           char _data[sizeof(merge)];
  2151.           memcpy(_data, &merge, sizeof(merge));
  2152.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2153.         }break;
  2154.  
  2155.         case 126: {
  2156.           mavlink_serial_control_t packet;
  2157.           mavlink_msg_serial_control_decode(&msg, &packet);
  2158.           received_sysid = msg.sysid;
  2159.           received_compid = msg.compid;
  2160.           received_msgid = msg.msgid;
  2161.          
  2162.           struct combine {
  2163.             header head_data;
  2164.             serctrl payload_data;
  2165.           }__attribute__((packed)); struct combine merge;
  2166.          
  2167.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2168.           merge.payload_data = {packet.baudrate, packet.timeout, packet.device, packet.flags,
  2169.             packet.count, {packet.data}, msg.checksum};
  2170.  
  2171.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2172.           char _data[sizeof(merge)];
  2173.           memcpy(_data, &merge, sizeof(merge));
  2174.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2175.         }break;
  2176.  
  2177.         case 127: {
  2178.           mavlink_gps_rtk_t packet;
  2179.           mavlink_msg_gps_rtk_decode(&msg, &packet);
  2180.           received_sysid = msg.sysid;
  2181.           received_compid = msg.compid;
  2182.           received_msgid = msg.msgid;
  2183.          
  2184.           struct combine {
  2185.             header head_data;
  2186.             gpsrtk payload_data;
  2187.           }__attribute__((packed)); struct combine merge;
  2188.          
  2189.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2190.           merge.payload_data = {packet.time_last_baseline_ms, packet.tow,
  2191.             packet.baseline_a_mm, packet.baseline_b_mm, packet.baseline_c_mm,
  2192.             packet.accuracy, packet.iar_num_hypotheses, packet.wn,
  2193.             packet.rtk_receiver_id, packet.rtk_health, packet.rtk_rate, packet.nsats,
  2194.             packet.baseline_coords_type, msg.checksum};
  2195.  
  2196.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2197.           char _data[sizeof(merge)];
  2198.           memcpy(_data, &merge, sizeof(merge));
  2199.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2200.         }break;
  2201.  
  2202.         case 128: {
  2203.           mavlink_gps2_rtk_t packet;
  2204.           mavlink_msg_gps2_rtk_decode(&msg, &packet);
  2205.           received_sysid = msg.sysid;
  2206.           received_compid = msg.compid;
  2207.           received_msgid = msg.msgid;
  2208.          
  2209.           struct combine {
  2210.             header head_data;
  2211.             gps2rtk payload_data;
  2212.           }__attribute__((packed)); struct combine merge;
  2213.          
  2214.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2215.           merge.payload_data = {packet.time_last_baseline_ms, packet.tow,
  2216.             packet.baseline_a_mm, packet.baseline_b_mm, packet.baseline_c_mm,
  2217.             packet.accuracy, packet.iar_num_hypotheses, packet.wn,
  2218.             packet.rtk_receiver_id, packet.rtk_health, packet.rtk_rate,
  2219.             packet.nsats, packet.baseline_coords_type, msg.checksum};
  2220.  
  2221.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2222.           char _data[sizeof(merge)];
  2223.           memcpy(_data, &merge, sizeof(merge));
  2224.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2225.         }break;
  2226.  
  2227.         case 129: {
  2228.           mavlink_scaled_imu3_t packet;
  2229.           mavlink_msg_scaled_imu3_decode(&msg, &packet);
  2230.           received_sysid = msg.sysid;
  2231.           received_compid = msg.compid;
  2232.           received_msgid = msg.msgid;
  2233.          
  2234.           struct combine {
  2235.             header head_data;
  2236.             scaleimu3 payload_data;
  2237.           }__attribute__((packed)); struct combine merge;
  2238.          
  2239.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2240.           merge.payload_data = {packet.time_boot_ms, packet.xacc, packet.yacc, packet.zacc,
  2241.             packet.xgyro, packet.ygyro, packet.zgyro, packet.xmag, packet.ymag,
  2242.             packet.zmag, msg.checksum};
  2243.  
  2244.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2245.           char _data[sizeof(merge)];
  2246.           memcpy(_data, &merge, sizeof(merge));
  2247.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2248.         }break;
  2249.  
  2250.         case 130: {
  2251.           mavlink_data_transmission_handshake_t packet;
  2252.           mavlink_msg_data_transmission_handshake_decode(&msg, &packet);
  2253.           received_sysid = msg.sysid;
  2254.           received_compid = msg.compid;
  2255.           received_msgid = msg.msgid;
  2256.          
  2257.           struct combine {
  2258.             header head_data;
  2259.             data_transmission_handshake payload_data;
  2260.           }__attribute__((packed)); struct combine merge;
  2261.          
  2262.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2263.           merge.payload_data = {packet.size, packet.width, packet.height, packet.packets,
  2264.             packet.type, packet.payload, packet.jpg_quality, msg.checksum};
  2265.  
  2266.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2267.           char _data[sizeof(merge)];
  2268.           memcpy(_data, &merge, sizeof(merge));
  2269.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2270.         }break;
  2271.  
  2272.         case 131: {
  2273.           mavlink_encapsulated_data_t packet;
  2274.           mavlink_msg_encapsulated_data_decode(&msg, &packet);
  2275.           received_sysid = msg.sysid;
  2276.           received_compid = msg.compid;
  2277.           received_msgid = msg.msgid;
  2278.          
  2279.           struct combine {
  2280.             header head_data;
  2281.             encapsdata payload_data;
  2282.           }__attribute__((packed)); struct combine merge;
  2283.          
  2284.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2285.           merge.payload_data = {packet.seqnr, {packet.data}, msg.checksum};
  2286.  
  2287.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2288.           char _data[sizeof(merge)];
  2289.           memcpy(_data, &merge, sizeof(merge));
  2290.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2291.         }break;
  2292.  
  2293.         case 132: {
  2294.           mavlink_distance_sensor_t packet;
  2295.           mavlink_msg_distance_sensor_decode(&msg, &packet);
  2296.           received_sysid = msg.sysid;
  2297.           received_compid = msg.compid;
  2298.           received_msgid = msg.msgid;
  2299.          
  2300.           struct combine {
  2301.             header head_data;
  2302.             distance_sens payload_data;
  2303.           }__attribute__((packed)); struct combine merge;
  2304.          
  2305.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2306.           merge.payload_data = {packet.time_boot_ms, packet.min_distance,
  2307.             packet.max_distance, packet.current_distance, packet.type, packet.id,
  2308.             packet.orientation, packet.covariance, msg.checksum};
  2309.  
  2310.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2311.           char _data[sizeof(merge)];
  2312.           memcpy(_data, &merge, sizeof(merge));
  2313.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2314.         }break;
  2315.  
  2316.         case 133: {
  2317.           mavlink_terrain_request_t packet;
  2318.           mavlink_msg_terrain_request_decode(&msg, &packet);
  2319.           received_sysid = msg.sysid;
  2320.           received_compid = msg.compid;
  2321.           received_msgid = msg.msgid;
  2322.          
  2323.           struct combine {
  2324.             header head_data;
  2325.             terrain_request payload_data;
  2326.           }__attribute__((packed)); struct combine merge;
  2327.          
  2328.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2329.           merge.payload_data = {packet.mask, packet.lat, packet.lon,
  2330.             packet.grid_spacing, msg.checksum};
  2331.  
  2332.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2333.           char _data[sizeof(merge)];
  2334.           memcpy(_data, &merge, sizeof(merge));
  2335.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2336.         }break;
  2337.  
  2338.         case 134: {
  2339.           mavlink_terrain_data_t packet;
  2340.           mavlink_msg_terrain_data_decode(&msg, &packet);
  2341.           received_sysid = msg.sysid;
  2342.           received_compid = msg.compid;
  2343.           received_msgid = msg.msgid;
  2344.          
  2345.           struct combine {
  2346.             header head_data;
  2347.             terrain_dat payload_data;
  2348.           }__attribute__((packed)); struct combine merge;
  2349.          
  2350.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2351.           merge.payload_data = {packet.lat, packet.lon, packet.grid_spacing,
  2352.             {packet.data}, packet.gridbit, msg.checksum};
  2353.  
  2354.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2355.           char _data[sizeof(merge)];
  2356.           memcpy(_data, &merge, sizeof(merge));
  2357.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2358.         }break;
  2359.  
  2360.         case 135: {
  2361.           mavlink_terrain_check_t packet;
  2362.           mavlink_msg_terrain_check_decode(&msg, &packet);
  2363.           received_sysid = msg.sysid;
  2364.           received_compid = msg.compid;
  2365.           received_msgid = msg.msgid;
  2366.          
  2367.           struct combine {
  2368.             header head_data;
  2369.             terrain_chk payload_data;
  2370.           }__attribute__((packed)); struct combine merge;
  2371.          
  2372.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2373.           merge.payload_data = {packet.lat, packet.lon, msg.checksum};
  2374.  
  2375.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2376.           char _data[sizeof(merge)];
  2377.           memcpy(_data, &merge, sizeof(merge));
  2378.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2379.         }break;
  2380.  
  2381.         case 136: {
  2382.           mavlink_terrain_report_t packet;
  2383.           mavlink_msg_terrain_report_decode(&msg, &packet);
  2384.           received_sysid = msg.sysid;
  2385.           received_compid = msg.compid;
  2386.           received_msgid = msg.msgid;
  2387.          
  2388.           struct combine {
  2389.             header head_data;
  2390.             terrain_report payload_data;
  2391.           }__attribute__((packed)); struct combine merge;
  2392.          
  2393.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2394.           merge.payload_data = {packet.lat, packet.lon, packet.terrain_height,
  2395.             packet.current_height, packet.spacing, packet.pending, packet.loaded, msg.checksum};
  2396.  
  2397.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2398.           char _data[sizeof(merge)];
  2399.           memcpy(_data, &merge, sizeof(merge));
  2400.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2401.         }break;
  2402.  
  2403.         case 137: {
  2404.           mavlink_scaled_pressure2_t packet;
  2405.           mavlink_msg_scaled_pressure2_decode(&msg, &packet);
  2406.           received_sysid = msg.sysid;
  2407.           received_compid = msg.compid;
  2408.           received_msgid = msg.msgid;
  2409.          
  2410.           struct combine {
  2411.             header head_data;
  2412.             scalepres2 payload_data;
  2413.           }__attribute__((packed)); struct combine merge;
  2414.          
  2415.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2416.           merge.payload_data = {packet.time_boot_ms, packet.press_abs, packet.press_diff,
  2417.             packet.temperature, msg.checksum};
  2418.  
  2419.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2420.           char _data[sizeof(merge)];
  2421.           memcpy(_data, &merge, sizeof(merge));
  2422.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2423.         }break;
  2424.  
  2425.         case 138: {
  2426.           mavlink_att_pos_mocap_t packet;
  2427.           mavlink_msg_att_pos_mocap_decode(&msg, &packet);
  2428.           received_sysid = msg.sysid;
  2429.           received_compid = msg.compid;
  2430.           received_msgid = msg.msgid;
  2431.          
  2432.           struct combine {
  2433.             header head_data;
  2434.             att_pos_mocap payload_data;
  2435.           }__attribute__((packed)); struct combine merge;
  2436.          
  2437.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2438.           merge.payload_data = {packet.time_usec, {packet.q}, packet.x,
  2439.             packet.y, packet.z, msg.checksum};
  2440.  
  2441.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2442.           char _data[sizeof(merge)];
  2443.           memcpy(_data, &merge, sizeof(merge));
  2444.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2445.         }break;
  2446.  
  2447.         case 139: {
  2448.           mavlink_set_actuator_control_target_t packet;
  2449.           mavlink_msg_set_actuator_control_target_decode(&msg, &packet);
  2450.           received_sysid = msg.sysid;
  2451.           received_compid = msg.compid;
  2452.           received_msgid = msg.msgid;
  2453.          
  2454.           struct combine {
  2455.             header head_data;
  2456.             set_actuator_control_target payload_data;
  2457.           }__attribute__((packed)); struct combine merge;
  2458.          
  2459.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2460.           merge.payload_data = {packet.time_usec, {packet.controls}, packet.group_mlx,
  2461.             packet.target_system, packet.target_component, msg.checksum};
  2462.  
  2463.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2464.           char _data[sizeof(merge)];
  2465.           memcpy(_data, &merge, sizeof(merge));
  2466.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2467.         }break;
  2468.  
  2469.         case 140: {
  2470.           mavlink_actuator_control_target_t packet;
  2471.           mavlink_msg_actuator_control_target_decode(&msg, &packet);
  2472.           received_sysid = msg.sysid;
  2473.           received_compid = msg.compid;
  2474.           received_msgid = msg.msgid;
  2475.          
  2476.           struct combine {
  2477.             header head_data;
  2478.             actuator_control_target payload_data;
  2479.           }__attribute__((packed)); struct combine merge;
  2480.          
  2481.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2482.           merge.payload_data = {packet.time_usec, {packet.controls}, packet.group_mlx, msg.checksum};
  2483.  
  2484.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2485.           char _data[sizeof(merge)];
  2486.           memcpy(_data, &merge, sizeof(merge));
  2487.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2488.         }break;
  2489.  
  2490.         case 141: {
  2491.           mavlink_altitude_t packet;
  2492.           mavlink_msg_altitude_decode(&msg, &packet);
  2493.           received_sysid = msg.sysid;
  2494.           received_compid = msg.compid;
  2495.           received_msgid = msg.msgid;
  2496.          
  2497.           struct combine {
  2498.             header head_data;
  2499.             alt payload_data;
  2500.           }__attribute__((packed)); struct combine merge;
  2501.          
  2502.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2503.           merge.payload_data = {packet.time_usec, packet.altitude_monotonic,
  2504.             packet.altitude_amsl, packet.altitude_local, packet.altitude_relative,
  2505.             packet.altitude_terrain, packet.bottom_clearance, msg.checksum};
  2506.  
  2507.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2508.           char _data[sizeof(merge)];
  2509.           memcpy(_data, &merge, sizeof(merge));
  2510.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2511.          
  2512.         }break;
  2513.  
  2514.         case 142: {
  2515.           mavlink_resource_request_t packet;
  2516.           mavlink_msg_resource_request_decode(&msg, &packet);
  2517.           received_sysid = msg.sysid;
  2518.           received_compid = msg.compid;
  2519.           received_msgid = msg.msgid;
  2520.          
  2521.           struct combine {
  2522.             header head_data;
  2523.             rscreq payload_data;
  2524.           }__attribute__((packed)); struct combine merge;
  2525.          
  2526.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2527.           merge.payload_data = {packet.request_id, packet.uri_type, {packet.uri},
  2528.             packet.transfer_type, {packet.storage}, msg.checksum};
  2529.  
  2530.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2531.           char _data[sizeof(merge)];
  2532.           memcpy(_data, &merge, sizeof(merge));
  2533.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2534.         }break;
  2535.  
  2536.         case 143: {
  2537.           mavlink_scaled_pressure3_t packet;
  2538.           mavlink_msg_scaled_pressure3_decode(&msg, &packet);
  2539.           received_sysid = msg.sysid;
  2540.           received_compid = msg.compid;
  2541.           received_msgid = msg.msgid;
  2542.          
  2543.           struct combine {
  2544.             header head_data;
  2545.             scalepress3 payload_data;
  2546.           }__attribute__((packed)); struct combine merge;
  2547.          
  2548.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2549.           merge.payload_data = {packet.time_boot_ms, packet.press_abs,
  2550.             packet.press_diff, packet.temperature, msg.checksum};
  2551.  
  2552.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2553.           char _data[sizeof(merge)];
  2554.           memcpy(_data, &merge, sizeof(merge));
  2555.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2556.         }break;
  2557.  
  2558.         case 144: {
  2559.           mavlink_follow_target_t packet;
  2560.           mavlink_msg_follow_target_decode(&msg, &packet);
  2561.           received_sysid = msg.sysid;
  2562.           received_compid = msg.compid;
  2563.           received_msgid = msg.msgid;
  2564.          
  2565.           struct combine {
  2566.             header head_data;
  2567.             fol_target payload_data;
  2568.           }__attribute__((packed)); struct combine merge;
  2569.          
  2570.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2571.           merge.payload_data = {packet.timestamp, packet.custom_state, packet.lat,
  2572.             packet.lon, packet.alt, {packet.vel}, {packet.acc}, {packet.attitude_q}, {packet.rates},
  2573.             {packet.position_cov}, packet.est_capabilities, msg.checksum};
  2574.  
  2575.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2576.           char _data[sizeof(merge)];
  2577.           memcpy(_data, &merge, sizeof(merge));
  2578.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2579.         }break;
  2580.  
  2581.         case 146: {
  2582.           mavlink_control_system_state_t packet;
  2583.           mavlink_msg_control_system_state_decode(&msg, &packet);
  2584.           received_sysid = msg.sysid;
  2585.           received_compid = msg.compid;
  2586.           received_msgid = msg.msgid;
  2587.          
  2588.           struct combine {
  2589.             header head_data;
  2590.             ctrlsys_state payload_data;
  2591.           }__attribute__((packed)); struct combine merge;
  2592.          
  2593.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2594.           merge.payload_data = {packet.time_usec, packet.x_acc, packet.y_acc,
  2595.             packet.z_acc, packet.x_vel, packet.y_vel, packet.z_vel, packet.x_pos,
  2596.             packet.y_pos, packet.z_pos, packet.airspeed, {packet.vel_variance},
  2597.             {packet.pos_variance}, {packet.q}, packet.roll_rate, packet.pitch_rate,
  2598.             packet.yaw_rate, msg.checksum};
  2599.  
  2600.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2601.           char _data[sizeof(merge)];
  2602.           memcpy(_data, &merge, sizeof(merge));
  2603.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2604.         }break;
  2605.  
  2606.         case 147: {
  2607.           mavlink_battery_status_t packet;
  2608.           mavlink_msg_battery_status_decode(&msg, &packet);
  2609.           received_sysid = msg.sysid;
  2610.           received_compid = msg.compid;
  2611.           received_msgid = msg.msgid;
  2612.          
  2613.           struct combine {
  2614.             header head_data;
  2615.             battstat payload_data;
  2616.           }__attribute__((packed)); struct combine merge;
  2617.          
  2618.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2619.           merge.payload_data = {packet.current_consumed, packet.energy_consumed,
  2620.             packet.temperature, {packet.voltages}, packet.current_battery, packet.id,
  2621.             packet.battery_function, packet.type, packet.battery_remaining, msg.checksum};
  2622.  
  2623.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2624.           char _data[sizeof(merge)];
  2625.           memcpy(_data, &merge, sizeof(merge));
  2626.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2627.         }break;
  2628.  
  2629.         case 148: {
  2630.           mavlink_autopilot_version_t packet;
  2631.           mavlink_msg_autopilot_version_decode(&msg, &packet);
  2632.           received_sysid = msg.sysid;
  2633.           received_compid = msg.compid;
  2634.           received_msgid = msg.msgid;
  2635.          
  2636.           struct combine {
  2637.             header head_data;
  2638.             autopilotver payload_data;
  2639.           }__attribute__((packed)); struct combine merge;
  2640.          
  2641.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2642.           merge.payload_data = {packet.capabilities, packet.uid, packet.flight_sw_version,
  2643.             packet.middleware_sw_version, packet.os_sw_version, packet.board_version,
  2644.             packet.vendor_id, packet.product_id, {packet.flight_custom_version},
  2645.             {packet.middleware_custom_version}, {packet.os_custom_version}, msg.checksum};
  2646.  
  2647.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2648.           char _data[sizeof(merge)];
  2649.           memcpy(_data, &merge, sizeof(merge));
  2650.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2651.         }break;
  2652.  
  2653.         case 149: {
  2654.           mavlink_landing_target_t packet;
  2655.           mavlink_msg_landing_target_decode(&msg, &packet);
  2656.           received_sysid = msg.sysid;
  2657.           received_compid = msg.compid;
  2658.           received_msgid = msg.msgid;
  2659.          
  2660.           struct combine {
  2661.             header head_data;
  2662.             ldg_target payload_data;
  2663.           }__attribute__((packed)); struct combine merge;
  2664.          
  2665.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2666.           merge.payload_data = {packet.time_usec, packet.angle_x, packet.angle_y,
  2667.             packet.distance, packet.size_x, packet.size_y, packet.target_num,
  2668.             packet.frame, msg.checksum};
  2669.  
  2670.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2671.           char _data[sizeof(merge)];
  2672.           memcpy(_data, &merge, sizeof(merge));
  2673.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2674.         }break;
  2675.  
  2676.         case 162: {
  2677.           mavlink_fence_status_t packet;
  2678.           mavlink_msg_fence_status_decode(&msg, &packet);
  2679.           received_sysid = msg.sysid;
  2680.           received_compid = msg.compid;
  2681.           received_msgid = msg.msgid;
  2682.          
  2683.           struct combine {
  2684.             header head_data;
  2685.             fencestat payload_data;
  2686.           }__attribute__((packed)); struct combine merge;
  2687.          
  2688.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2689.           merge.payload_data = {packet.breach_time, packet.breach_count, packet.breach_status,
  2690.             packet.breach_type, msg.checksum};
  2691.  
  2692.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2693.           char _data[sizeof(merge)];
  2694.           memcpy(_data, &merge, sizeof(merge));
  2695.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2696.         }break;
  2697.  
  2698.         case 192: {
  2699.           mavlink_mag_cal_report_t packet;
  2700.           mavlink_msg_mag_cal_report_decode(&msg, &packet);
  2701.           received_sysid = msg.sysid;
  2702.           received_compid = msg.compid;
  2703.           received_msgid = msg.msgid;
  2704.          
  2705.           struct combine {
  2706.             header head_data;
  2707.             mag_cal_report payload_data;
  2708.           }__attribute__((packed)); struct combine merge;
  2709.          
  2710.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2711.           merge.payload_data = {packet.fitness, packet.ofs_x, packet.ofs_y,
  2712.             packet.ofs_z, packet.diag_x, packet.diag_y, packet.diag_z, packet.offdiag_x,
  2713.             packet.offdiag_y, packet.offdiag_z, packet.compass_id, packet.cal_mask,
  2714.             packet.cal_status, packet.autosaved, msg.checksum};
  2715.  
  2716.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2717.           char _data[sizeof(merge)];
  2718.           memcpy(_data, &merge, sizeof(merge));
  2719.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2720.         }break;
  2721.  
  2722.         case 225: {
  2723.           mavlink_efi_status_t packet;
  2724.           mavlink_msg_efi_status_decode(&msg, &packet);
  2725.           received_sysid = msg.sysid;
  2726.           received_compid = msg.compid;
  2727.           received_msgid = msg.msgid;
  2728.          
  2729.           struct combine {
  2730.             header head_data;
  2731.             efistat payload_data;
  2732.           }__attribute__((packed)); struct combine merge;
  2733.          
  2734.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2735.           merge.payload_data = {packet.ecu_index, packet.rpm, packet.fuel_consumed,
  2736.             packet.fuel_flow, packet.engine_load, packet.throttle_position,
  2737.             packet.spark_dwell_time, packet.barometric_pressure, packet.intake_manifold_pressure,
  2738.             packet.intake_manifold_temperature, packet.cylinder_head_temperature,
  2739.             packet.ignition_timing, packet.injection_time, packet.exhaust_gas_temperature,
  2740.             packet.throttle_out, packet.pt_compensation, packet.health, msg.checksum};
  2741.  
  2742.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2743.           char _data[sizeof(merge)];
  2744.           memcpy(_data, &merge, sizeof(merge));
  2745.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2746.         }break;
  2747.  
  2748.         case 230: {
  2749.           mavlink_estimator_status_t packet;
  2750.           mavlink_msg_estimator_status_decode(&msg, &packet);
  2751.           received_sysid = msg.sysid;
  2752.           received_compid = msg.compid;
  2753.           received_msgid = msg.msgid;
  2754.          
  2755.           struct combine {
  2756.             header head_data;
  2757.             estimstat payload_data;
  2758.           }__attribute__((packed)); struct combine merge;
  2759.          
  2760.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2761.           merge.payload_data = {packet.time_usec, packet.vel_ratio,
  2762.             packet.pos_horiz_ratio, packet.pos_vert_ratio, packet.mag_ratio,
  2763.             packet.hagl_ratio, packet.tas_ratio, packet.pos_horiz_accuracy,
  2764.             packet.pos_vert_accuracy, packet.flags, msg.checksum};
  2765.  
  2766.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2767.           char _data[sizeof(merge)];
  2768.           memcpy(_data, &merge, sizeof(merge));
  2769.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2770.         }break;
  2771.  
  2772.         case 231: {
  2773.           mavlink_wind_cov_t packet;
  2774.           mavlink_msg_wind_cov_decode(&msg, &packet);
  2775.           received_sysid = msg.sysid;
  2776.           received_compid = msg.compid;
  2777.           received_msgid = msg.msgid;
  2778.          
  2779.           struct combine {
  2780.             header head_data;
  2781.             windcov payload_data;
  2782.           }__attribute__((packed)); struct combine merge;
  2783.          
  2784.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2785.           merge.payload_data = {packet.time_usec, packet.wind_x, packet.wind_y,
  2786.             packet.wind_z, packet.var_horiz, packet.var_vert, packet.wind_alt,
  2787.             packet.horiz_accuracy, packet.vert_accuracy, msg.checksum};
  2788.  
  2789.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2790.           char _data[sizeof(merge)];
  2791.           memcpy(_data, &merge, sizeof(merge));
  2792.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2793.         }break;
  2794.  
  2795.         case 232: {
  2796.           mavlink_gps_input_t packet;
  2797.           mavlink_msg_gps_input_decode(&msg, &packet);
  2798.           received_sysid = msg.sysid;
  2799.           received_compid = msg.compid;
  2800.           received_msgid = msg.msgid;
  2801.          
  2802.           struct combine {
  2803.             header head_data;
  2804.             gpsin payload_data;
  2805.           }__attribute__((packed)); struct combine merge;
  2806.          
  2807.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2808.           merge.payload_data = {packet.time_usec, packet.time_week_ms, packet.lat,
  2809.             packet.lon, packet.alt, packet.hdop, packet.vdop, packet.vn, packet.ve,
  2810.             packet.vd, packet.speed_accuracy, packet.horiz_accuracy, packet.vert_accuracy,
  2811.             packet.ignore_flags, packet.time_week, packet.gps_id, packet.fix_type,
  2812.             packet.satellites_visible, msg.checksum};
  2813.  
  2814.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2815.           char _data[sizeof(merge)];
  2816.           memcpy(_data, &merge, sizeof(merge));
  2817.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2818.         }break;
  2819.  
  2820.         case 233: {
  2821.           mavlink_gps_rtcm_data_t packet;
  2822.           mavlink_msg_gps_rtcm_data_decode(&msg, &packet);
  2823.           received_sysid = msg.sysid;
  2824.           received_compid = msg.compid;
  2825.           received_msgid = msg.msgid;
  2826.          
  2827.           struct combine {
  2828.             header head_data;
  2829.             gps_rtcm_data payload_data;
  2830.           }__attribute__((packed)); struct combine merge;
  2831.          
  2832.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2833.           merge.payload_data = {packet.flags, packet.len, {packet.data}, msg.checksum};
  2834.  
  2835.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2836.           char _data[sizeof(merge)];
  2837.           memcpy(_data, &merge, sizeof(merge));
  2838.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2839.         }break;
  2840.  
  2841.         case 234: {
  2842.           mavlink_high_latency_t packet;
  2843.           mavlink_msg_high_latency_decode(&msg, &packet);
  2844.           received_sysid = msg.sysid;
  2845.           received_compid = msg.compid;
  2846.           received_msgid = msg.msgid;
  2847.          
  2848.           struct combine {
  2849.             header head_data;
  2850.             highlaten payload_data;
  2851.           }__attribute__((packed)); struct combine merge;
  2852.          
  2853.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2854.           merge.payload_data = {packet.custom_mode, packet.latitude, packet.longitude,
  2855.             packet.roll, packet.pitch, packet.heading, packet.heading_sp,
  2856.             packet.altitude_amsl, packet.altitude_sp, packet.wp_distance, packet.base_mode,
  2857.             packet.landed_state, packet.throttle, packet.airspeed, packet.airspeed_sp,
  2858.             packet.groundspeed, packet.climb_rate, packet.gps_nsat, packet.gps_fix_type,
  2859.             packet.battery_remaining, packet.temperature, packet.temperature_air,
  2860.             packet.failsafe, packet.wp_num, msg.checksum};
  2861.  
  2862.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2863.           char _data[sizeof(merge)];
  2864.           memcpy(_data, &merge, sizeof(merge));
  2865.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2866.         }break;
  2867.  
  2868.         case 235: {
  2869.           mavlink_high_latency2_t packet;
  2870.           mavlink_msg_high_latency2_decode(&msg, &packet);
  2871.           received_sysid = msg.sysid;
  2872.           received_compid = msg.compid;
  2873.           received_msgid = msg.msgid;
  2874.          
  2875.           struct combine {
  2876.             header head_data;
  2877.             highlaten2 payload_data;
  2878.           }__attribute__((packed)); struct combine merge;
  2879.          
  2880.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2881.           merge.payload_data = {packet.timestamp, packet.latitude, packet.longitude,
  2882.             packet.custom_mode, packet.altitude, packet.target_altitude, packet.target_distance,
  2883.             packet.wp_num, packet.failure_flags, packet.type, packet.autopilot, packet.heading,
  2884.             packet.target_heading, packet.throttle, packet.airspeed, packet.airspeed_sp,
  2885.             packet.groundspeed, packet.windspeed, packet.wind_heading, packet.eph,
  2886.             packet.epv, packet.temperature_air, packet.climb_rate, packet.battery, packet.custom0,
  2887.             packet.custom1, packet.custom2, msg.checksum};
  2888.  
  2889.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2890.           char _data[sizeof(merge)];
  2891.           memcpy(_data, &merge, sizeof(merge));
  2892.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2893.         }break;
  2894.  
  2895.         case 241: {
  2896.           mavlink_vibration_t packet;
  2897.           mavlink_msg_vibration_decode(&msg, &packet);
  2898.           received_sysid = msg.sysid;
  2899.           received_compid = msg.compid;
  2900.           received_msgid = msg.msgid;
  2901.          
  2902.           struct combine {
  2903.             header head_data;
  2904.             vibrat payload_data;
  2905.           }__attribute__((packed)); struct combine merge;
  2906.          
  2907.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2908.           merge.payload_data = {packet.time_usec, packet.vibration_x,
  2909.             packet.vibration_y, packet.vibration_z, packet.clipping_0, packet.clipping_1,
  2910.             packet.clipping_2, msg.checksum};
  2911.  
  2912.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2913.           char _data[sizeof(merge)];
  2914.           memcpy(_data, &merge, sizeof(merge));
  2915.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2916.         }break;
  2917.  
  2918.         case 242: {
  2919.           mavlink_home_position_t packet;
  2920.           mavlink_msg_home_position_decode(&msg, &packet);
  2921.           received_sysid = msg.sysid;
  2922.           received_compid = msg.compid;
  2923.           received_msgid = msg.msgid;
  2924.          
  2925.           struct combine {
  2926.             header head_data;
  2927.             homepos payload_data;
  2928.           }__attribute__((packed)); struct combine merge;
  2929.          
  2930.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2931.           merge.payload_data = {packet.latitude, packet.longitude, packet.altitude,
  2932.             packet.x, packet.y, packet.z, {packet.q}, packet.approach_x,
  2933.             packet.approach_y, packet.approach_z, msg.checksum};
  2934.  
  2935.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2936.           char _data[sizeof(merge)];
  2937.           memcpy(_data, &merge, sizeof(merge));
  2938.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2939.         }break;
  2940.  
  2941.         case 243: {
  2942.           mavlink_set_home_position_t packet;
  2943.           mavlink_msg_set_home_position_decode(&msg, &packet);
  2944.           received_sysid = msg.sysid;
  2945.           received_compid = msg.compid;
  2946.           received_msgid = msg.msgid;
  2947.          
  2948.           struct combine {
  2949.             header head_data;
  2950.             sethome_pos payload_data;
  2951.           }__attribute__((packed)); struct combine merge;
  2952.          
  2953.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2954.           merge.payload_data = {packet.latitude, packet.longitude, packet.altitude,
  2955.             packet.x, packet.y, packet.z, {packet.q}, packet.approach_x, packet.approach_y,
  2956.             packet.approach_z, packet.target_system, msg.checksum};
  2957.  
  2958.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2959.           char _data[sizeof(merge)];
  2960.           memcpy(_data, &merge, sizeof(merge));
  2961.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2962.         }break;
  2963.  
  2964.         case 244: {
  2965.           mavlink_message_interval_t packet;
  2966.           mavlink_msg_message_interval_decode(&msg, &packet);
  2967.           received_sysid = msg.sysid;
  2968.           received_compid = msg.compid;
  2969.           received_msgid = msg.msgid;
  2970.          
  2971.           struct combine {
  2972.             header head_data;
  2973.             message_interval payload_data;
  2974.           }__attribute__((packed)); struct combine merge;
  2975.          
  2976.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2977.           merge.payload_data = {packet.interval_us, packet.message_id, msg.checksum};
  2978.  
  2979.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  2980.           char _data[sizeof(merge)];
  2981.           memcpy(_data, &merge, sizeof(merge));
  2982.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  2983.         }break;
  2984.  
  2985.         case 245: {
  2986.           mavlink_extended_sys_state_t packet;
  2987.           mavlink_msg_extended_sys_state_decode(&msg, &packet);
  2988.           received_sysid = msg.sysid;
  2989.           received_compid = msg.compid;
  2990.           received_msgid = msg.msgid;
  2991.          
  2992.           struct combine {
  2993.             header head_data;
  2994.             extended_sys_state payload_data;
  2995.           }__attribute__((packed)); struct combine merge;
  2996.          
  2997.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  2998.           merge.payload_data = {packet.vtol_state, packet.landed_state, msg.checksum};
  2999.  
  3000.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  3001.           char _data[sizeof(merge)];
  3002.           memcpy(_data, &merge, sizeof(merge));
  3003.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  3004.         }break;
  3005.  
  3006.         case 246: {
  3007.           mavlink_adsb_vehicle_t packet;
  3008.           mavlink_msg_adsb_vehicle_decode(&msg, &packet);
  3009.           received_sysid = msg.sysid;
  3010.           received_compid = msg.compid;
  3011.           received_msgid = msg.msgid;
  3012.          
  3013.           struct combine {
  3014.             header head_data;
  3015.             adsb_vehicle payload_data;
  3016.           }__attribute__((packed)); struct combine merge;
  3017.          
  3018.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  3019.           merge.payload_data = {packet.ICAO_address, packet.lat, packet.lon,
  3020.             packet.altitude, packet.heading, packet.hor_velocity, packet.ver_velocity, packet.flags,
  3021.             packet.squawk, packet.altitude_type, {packet.callsign}, packet.emitter_type,
  3022.             packet.tslc, msg.checksum};
  3023.  
  3024.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  3025.           char _data[sizeof(merge)];
  3026.           memcpy(_data, &merge, sizeof(merge));
  3027.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  3028.         }break;
  3029.  
  3030.         case 247: {
  3031.           mavlink_collision_t packet;
  3032.           mavlink_msg_collision_decode(&msg, &packet);
  3033.           received_sysid = msg.sysid;
  3034.           received_compid = msg.compid;
  3035.           received_msgid = msg.msgid;
  3036.          
  3037.           struct combine {
  3038.             header head_data;
  3039.             collision payload_data;
  3040.           }__attribute__((packed)); struct combine merge;
  3041.          
  3042.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  3043.           merge.payload_data = {packet.id, packet.time_to_minimum_delta,
  3044.             packet.altitude_minimum_delta, packet.horizontal_minimum_delta, packet.src,
  3045.             packet.action, packet.threat_level, msg.checksum};
  3046.  
  3047.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  3048.           char _data[sizeof(merge)];
  3049.           memcpy(_data, &merge, sizeof(merge));
  3050.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  3051.         }break;
  3052.  
  3053.         case 248: {
  3054.           mavlink_v2_extension_t packet;
  3055.           mavlink_msg_v2_extension_decode(&msg, &packet);
  3056.           received_sysid = msg.sysid;
  3057.           received_compid = msg.compid;
  3058.           received_msgid = msg.msgid;
  3059.          
  3060.           struct combine {
  3061.             header head_data;
  3062.             v2ext payload_data;
  3063.           }__attribute__((packed)); struct combine merge;
  3064.          
  3065.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  3066.           merge.payload_data = {packet.message_type, packet.target_network,
  3067.             packet.target_system, packet.target_component, {packet.payload}, msg.checksum};
  3068.  
  3069.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  3070.           char _data[sizeof(merge)];
  3071.           memcpy(_data, &merge, sizeof(merge));
  3072.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  3073.         }break;
  3074.  
  3075.         case 249: {
  3076.           mavlink_memory_vect_t packet;
  3077.           mavlink_msg_memory_vect_decode(&msg, &packet);
  3078.           received_sysid = msg.sysid;
  3079.           received_compid = msg.compid;
  3080.           received_msgid = msg.msgid;
  3081.          
  3082.           struct combine {
  3083.             header head_data;
  3084.             mem_vect payload_data;
  3085.           }__attribute__((packed)); struct combine merge;
  3086.          
  3087.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  3088.           merge.payload_data = {packet.address, packet.ver, packet.type, {packet.value}, msg.checksum};
  3089.  
  3090.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  3091.           char _data[sizeof(merge)];
  3092.           memcpy(_data, &merge, sizeof(merge));
  3093.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  3094.         }break;
  3095.  
  3096.         case 250: {
  3097.           mavlink_debug_vect_t packet;
  3098.           mavlink_msg_debug_vect_decode(&msg, &packet);
  3099.           received_sysid = msg.sysid;
  3100.           received_compid = msg.compid;
  3101.           received_msgid = msg.msgid;
  3102.          
  3103.           struct combine {
  3104.             header head_data;
  3105.             debug_vect payload_data;
  3106.           }__attribute__((packed)); struct combine merge;
  3107.          
  3108.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  3109.           merge.payload_data = {packet.time_usec, packet.x, packet.y, packet.z,
  3110.             {packet.name}, msg.checksum};
  3111.  
  3112.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  3113.           char _data[sizeof(merge)];
  3114.           memcpy(_data, &merge, sizeof(merge));
  3115.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  3116.         }break;
  3117.  
  3118.         case 251: {
  3119.           mavlink_named_value_float_t packet;
  3120.           mavlink_msg_named_value_float_decode(&msg, &packet);
  3121.           received_sysid = msg.sysid;
  3122.           received_compid = msg.compid;
  3123.           received_msgid = msg.msgid;
  3124.          
  3125.           struct combine {
  3126.             header head_data;
  3127.             namedval_float payload_data;
  3128.           }__attribute__((packed)); struct combine merge;
  3129.          
  3130.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  3131.           merge.payload_data = {packet.time_boot_ms, packet.value, {packet.name}, msg.checksum};
  3132.  
  3133.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  3134.           char _data[sizeof(merge)];
  3135.           memcpy(_data, &merge, sizeof(merge));
  3136.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  3137.         }break;
  3138.  
  3139.         case 252: {
  3140.           mavlink_named_value_int_t packet;
  3141.           mavlink_msg_named_value_int_decode(&msg, &packet);
  3142.           received_sysid = msg.sysid;
  3143.           received_compid = msg.compid;
  3144.           received_msgid = msg.msgid;
  3145.          
  3146.           struct combine {
  3147.             header head_data;
  3148.             namedval_int payload_data;
  3149.           }__attribute__((packed)); struct combine merge;
  3150.          
  3151.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  3152.           merge.payload_data = {packet.time_boot_ms, packet.value, {packet.name}, msg.checksum};
  3153.  
  3154.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  3155.           char _data[sizeof(merge)];
  3156.           memcpy(_data, &merge, sizeof(merge));
  3157.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  3158.         }break;
  3159.  
  3160.         case 253: {
  3161.           mavlink_statustext_t packet;
  3162.           mavlink_msg_statustext_decode(&msg, &packet);
  3163.           received_sysid = msg.sysid;
  3164.           received_compid = msg.compid;
  3165.           received_msgid = msg.msgid;
  3166.          
  3167.           struct combine {
  3168.             header head_data;
  3169.             statustext payload_data;
  3170.           }__attribute__((packed)); struct combine merge;
  3171.          
  3172.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  3173.           merge.payload_data = {packet.severity, {packet.text}, msg.checksum};
  3174.  
  3175.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  3176.           char _data[sizeof(merge)];
  3177.           memcpy(_data, &merge, sizeof(merge));
  3178.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  3179.         }break;
  3180.  
  3181.         case 254: {
  3182.           mavlink_debug_t packet;
  3183.           mavlink_msg_debug_decode(&msg, &packet);
  3184.           received_sysid = msg.sysid;
  3185.           received_compid = msg.compid;
  3186.           received_msgid = msg.msgid;
  3187.          
  3188.           struct combine {
  3189.             header head_data;
  3190.             debugging payload_data;
  3191.           }__attribute__((packed)); struct combine merge;
  3192.          
  3193.           merge.head_data = {msg.magic, msg.len, msg.seq, received_sysid, received_compid, received_msgid};
  3194.           merge.payload_data = {packet.time_boot_ms, packet.value, packet.ind, msg.checksum};
  3195.  
  3196.          
  3197.           //sizeMerge = sizeof(merge); payloadSize = sizeof(merge.payload_data);
  3198.           char _data[sizeof(merge)];
  3199.           memcpy(_data, &merge, sizeof(merge));
  3200.           encryption_start(_data, sizeof(merge), sizeof(merge.payload_data));
  3201.         }break;
  3202.  
  3203.         default: {
  3204.           if ((Serial2.available()) && c == 0xFE) {
  3205.             uint8_t len = Serial2.read();
  3206.             /* +6 for stx, len, seq, sysid, compid, msgid;
  3207.             len for total payload;
  3208.             +2 for cksum */
  3209.             char mav[6+len+2];
  3210.             mav[0] = c;
  3211.             mav[1] = len;
  3212.  
  3213.             for (int x = 2; x < sizeof(mav); x++) {
  3214.               if (Serial2.available()) {
  3215.                 mav[x] = Serial2.read();
  3216.               }
  3217.             }
  3218.             encryption_start(mav, sizeof(mav), len+2);
  3219.           }
  3220.         }break;
  3221.       }
  3222.     }
  3223.   }
  3224. }
Advertisement
RAW Paste Data Copied
Advertisement