You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1015 lines
55 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /** @file
  2. * @brief MAVLink comm protocol testsuite generated from ASLUAV.xml
  3. * @see http://qgroundcontrol.org/mavlink/
  4. */
  5. #pragma once
  6. #ifndef ASLUAV_TESTSUITE_H
  7. #define ASLUAV_TESTSUITE_H
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #ifndef MAVLINK_TEST_ALL
  12. #define MAVLINK_TEST_ALL
  13. static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg);
  14. static void mavlink_test_ASLUAV(uint8_t, uint8_t, mavlink_message_t *last_msg);
  15. static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  16. {
  17. mavlink_test_common(system_id, component_id, last_msg);
  18. mavlink_test_ASLUAV(system_id, component_id, last_msg);
  19. }
  20. #endif
  21. #include "../common/testsuite.h"
  22. static void mavlink_test_command_int_stamped(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  23. {
  24. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  25. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  26. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMMAND_INT_STAMPED >= 256) {
  27. return;
  28. }
  29. #endif
  30. mavlink_message_t msg;
  31. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  32. uint16_t i;
  33. mavlink_command_int_stamped_t packet_in = {
  34. 93372036854775807ULL,963497880,101.0,129.0,157.0,185.0,963498920,963499128,269.0,19315,3,70,137,204,15
  35. };
  36. mavlink_command_int_stamped_t packet1, packet2;
  37. memset(&packet1, 0, sizeof(packet1));
  38. packet1.vehicle_timestamp = packet_in.vehicle_timestamp;
  39. packet1.utc_time = packet_in.utc_time;
  40. packet1.param1 = packet_in.param1;
  41. packet1.param2 = packet_in.param2;
  42. packet1.param3 = packet_in.param3;
  43. packet1.param4 = packet_in.param4;
  44. packet1.x = packet_in.x;
  45. packet1.y = packet_in.y;
  46. packet1.z = packet_in.z;
  47. packet1.command = packet_in.command;
  48. packet1.target_system = packet_in.target_system;
  49. packet1.target_component = packet_in.target_component;
  50. packet1.frame = packet_in.frame;
  51. packet1.current = packet_in.current;
  52. packet1.autocontinue = packet_in.autocontinue;
  53. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  54. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  55. // cope with extensions
  56. memset(MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMMAND_INT_STAMPED_MIN_LEN);
  57. }
  58. #endif
  59. memset(&packet2, 0, sizeof(packet2));
  60. mavlink_msg_command_int_stamped_encode(system_id, component_id, &msg, &packet1);
  61. mavlink_msg_command_int_stamped_decode(&msg, &packet2);
  62. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  63. memset(&packet2, 0, sizeof(packet2));
  64. mavlink_msg_command_int_stamped_pack(system_id, component_id, &msg , packet1.utc_time , packet1.vehicle_timestamp , packet1.target_system , packet1.target_component , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z );
  65. mavlink_msg_command_int_stamped_decode(&msg, &packet2);
  66. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  67. memset(&packet2, 0, sizeof(packet2));
  68. mavlink_msg_command_int_stamped_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.utc_time , packet1.vehicle_timestamp , packet1.target_system , packet1.target_component , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z );
  69. mavlink_msg_command_int_stamped_decode(&msg, &packet2);
  70. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  71. memset(&packet2, 0, sizeof(packet2));
  72. mavlink_msg_to_send_buffer(buffer, &msg);
  73. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  74. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  75. }
  76. mavlink_msg_command_int_stamped_decode(last_msg, &packet2);
  77. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  78. memset(&packet2, 0, sizeof(packet2));
  79. mavlink_msg_command_int_stamped_send(MAVLINK_COMM_1 , packet1.utc_time , packet1.vehicle_timestamp , packet1.target_system , packet1.target_component , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z );
  80. mavlink_msg_command_int_stamped_decode(last_msg, &packet2);
  81. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  82. }
  83. static void mavlink_test_command_long_stamped(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  84. {
  85. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  86. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  87. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMMAND_LONG_STAMPED >= 256) {
  88. return;
  89. }
  90. #endif
  91. mavlink_message_t msg;
  92. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  93. uint16_t i;
  94. mavlink_command_long_stamped_t packet_in = {
  95. 93372036854775807ULL,963497880,101.0,129.0,157.0,185.0,213.0,241.0,269.0,19315,3,70,137
  96. };
  97. mavlink_command_long_stamped_t packet1, packet2;
  98. memset(&packet1, 0, sizeof(packet1));
  99. packet1.vehicle_timestamp = packet_in.vehicle_timestamp;
  100. packet1.utc_time = packet_in.utc_time;
  101. packet1.param1 = packet_in.param1;
  102. packet1.param2 = packet_in.param2;
  103. packet1.param3 = packet_in.param3;
  104. packet1.param4 = packet_in.param4;
  105. packet1.param5 = packet_in.param5;
  106. packet1.param6 = packet_in.param6;
  107. packet1.param7 = packet_in.param7;
  108. packet1.command = packet_in.command;
  109. packet1.target_system = packet_in.target_system;
  110. packet1.target_component = packet_in.target_component;
  111. packet1.confirmation = packet_in.confirmation;
  112. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  113. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  114. // cope with extensions
  115. memset(MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMMAND_LONG_STAMPED_MIN_LEN);
  116. }
  117. #endif
  118. memset(&packet2, 0, sizeof(packet2));
  119. mavlink_msg_command_long_stamped_encode(system_id, component_id, &msg, &packet1);
  120. mavlink_msg_command_long_stamped_decode(&msg, &packet2);
  121. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  122. memset(&packet2, 0, sizeof(packet2));
  123. mavlink_msg_command_long_stamped_pack(system_id, component_id, &msg , packet1.utc_time , packet1.vehicle_timestamp , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 );
  124. mavlink_msg_command_long_stamped_decode(&msg, &packet2);
  125. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  126. memset(&packet2, 0, sizeof(packet2));
  127. mavlink_msg_command_long_stamped_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.utc_time , packet1.vehicle_timestamp , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 );
  128. mavlink_msg_command_long_stamped_decode(&msg, &packet2);
  129. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  130. memset(&packet2, 0, sizeof(packet2));
  131. mavlink_msg_to_send_buffer(buffer, &msg);
  132. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  133. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  134. }
  135. mavlink_msg_command_long_stamped_decode(last_msg, &packet2);
  136. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  137. memset(&packet2, 0, sizeof(packet2));
  138. mavlink_msg_command_long_stamped_send(MAVLINK_COMM_1 , packet1.utc_time , packet1.vehicle_timestamp , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 );
  139. mavlink_msg_command_long_stamped_decode(last_msg, &packet2);
  140. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  141. }
  142. static void mavlink_test_sens_power(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  143. {
  144. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  145. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  146. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_POWER >= 256) {
  147. return;
  148. }
  149. #endif
  150. mavlink_message_t msg;
  151. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  152. uint16_t i;
  153. mavlink_sens_power_t packet_in = {
  154. 17.0,45.0,73.0,101.0
  155. };
  156. mavlink_sens_power_t packet1, packet2;
  157. memset(&packet1, 0, sizeof(packet1));
  158. packet1.adc121_vspb_volt = packet_in.adc121_vspb_volt;
  159. packet1.adc121_cspb_amp = packet_in.adc121_cspb_amp;
  160. packet1.adc121_cs1_amp = packet_in.adc121_cs1_amp;
  161. packet1.adc121_cs2_amp = packet_in.adc121_cs2_amp;
  162. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  163. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  164. // cope with extensions
  165. memset(MAVLINK_MSG_ID_SENS_POWER_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_POWER_MIN_LEN);
  166. }
  167. #endif
  168. memset(&packet2, 0, sizeof(packet2));
  169. mavlink_msg_sens_power_encode(system_id, component_id, &msg, &packet1);
  170. mavlink_msg_sens_power_decode(&msg, &packet2);
  171. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  172. memset(&packet2, 0, sizeof(packet2));
  173. mavlink_msg_sens_power_pack(system_id, component_id, &msg , packet1.adc121_vspb_volt , packet1.adc121_cspb_amp , packet1.adc121_cs1_amp , packet1.adc121_cs2_amp );
  174. mavlink_msg_sens_power_decode(&msg, &packet2);
  175. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  176. memset(&packet2, 0, sizeof(packet2));
  177. mavlink_msg_sens_power_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.adc121_vspb_volt , packet1.adc121_cspb_amp , packet1.adc121_cs1_amp , packet1.adc121_cs2_amp );
  178. mavlink_msg_sens_power_decode(&msg, &packet2);
  179. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  180. memset(&packet2, 0, sizeof(packet2));
  181. mavlink_msg_to_send_buffer(buffer, &msg);
  182. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  183. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  184. }
  185. mavlink_msg_sens_power_decode(last_msg, &packet2);
  186. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  187. memset(&packet2, 0, sizeof(packet2));
  188. mavlink_msg_sens_power_send(MAVLINK_COMM_1 , packet1.adc121_vspb_volt , packet1.adc121_cspb_amp , packet1.adc121_cs1_amp , packet1.adc121_cs2_amp );
  189. mavlink_msg_sens_power_decode(last_msg, &packet2);
  190. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  191. }
  192. static void mavlink_test_sens_mppt(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  193. {
  194. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  195. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  196. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_MPPT >= 256) {
  197. return;
  198. }
  199. #endif
  200. mavlink_message_t msg;
  201. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  202. uint16_t i;
  203. mavlink_sens_mppt_t packet_in = {
  204. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,18899,19003,19107,247,58,125
  205. };
  206. mavlink_sens_mppt_t packet1, packet2;
  207. memset(&packet1, 0, sizeof(packet1));
  208. packet1.mppt_timestamp = packet_in.mppt_timestamp;
  209. packet1.mppt1_volt = packet_in.mppt1_volt;
  210. packet1.mppt1_amp = packet_in.mppt1_amp;
  211. packet1.mppt2_volt = packet_in.mppt2_volt;
  212. packet1.mppt2_amp = packet_in.mppt2_amp;
  213. packet1.mppt3_volt = packet_in.mppt3_volt;
  214. packet1.mppt3_amp = packet_in.mppt3_amp;
  215. packet1.mppt1_pwm = packet_in.mppt1_pwm;
  216. packet1.mppt2_pwm = packet_in.mppt2_pwm;
  217. packet1.mppt3_pwm = packet_in.mppt3_pwm;
  218. packet1.mppt1_status = packet_in.mppt1_status;
  219. packet1.mppt2_status = packet_in.mppt2_status;
  220. packet1.mppt3_status = packet_in.mppt3_status;
  221. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  222. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  223. // cope with extensions
  224. memset(MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN);
  225. }
  226. #endif
  227. memset(&packet2, 0, sizeof(packet2));
  228. mavlink_msg_sens_mppt_encode(system_id, component_id, &msg, &packet1);
  229. mavlink_msg_sens_mppt_decode(&msg, &packet2);
  230. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  231. memset(&packet2, 0, sizeof(packet2));
  232. mavlink_msg_sens_mppt_pack(system_id, component_id, &msg , packet1.mppt_timestamp , packet1.mppt1_volt , packet1.mppt1_amp , packet1.mppt1_pwm , packet1.mppt1_status , packet1.mppt2_volt , packet1.mppt2_amp , packet1.mppt2_pwm , packet1.mppt2_status , packet1.mppt3_volt , packet1.mppt3_amp , packet1.mppt3_pwm , packet1.mppt3_status );
  233. mavlink_msg_sens_mppt_decode(&msg, &packet2);
  234. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  235. memset(&packet2, 0, sizeof(packet2));
  236. mavlink_msg_sens_mppt_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.mppt_timestamp , packet1.mppt1_volt , packet1.mppt1_amp , packet1.mppt1_pwm , packet1.mppt1_status , packet1.mppt2_volt , packet1.mppt2_amp , packet1.mppt2_pwm , packet1.mppt2_status , packet1.mppt3_volt , packet1.mppt3_amp , packet1.mppt3_pwm , packet1.mppt3_status );
  237. mavlink_msg_sens_mppt_decode(&msg, &packet2);
  238. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  239. memset(&packet2, 0, sizeof(packet2));
  240. mavlink_msg_to_send_buffer(buffer, &msg);
  241. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  242. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  243. }
  244. mavlink_msg_sens_mppt_decode(last_msg, &packet2);
  245. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  246. memset(&packet2, 0, sizeof(packet2));
  247. mavlink_msg_sens_mppt_send(MAVLINK_COMM_1 , packet1.mppt_timestamp , packet1.mppt1_volt , packet1.mppt1_amp , packet1.mppt1_pwm , packet1.mppt1_status , packet1.mppt2_volt , packet1.mppt2_amp , packet1.mppt2_pwm , packet1.mppt2_status , packet1.mppt3_volt , packet1.mppt3_amp , packet1.mppt3_pwm , packet1.mppt3_status );
  248. mavlink_msg_sens_mppt_decode(last_msg, &packet2);
  249. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  250. }
  251. static void mavlink_test_aslctrl_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  252. {
  253. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  254. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  255. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASLCTRL_DATA >= 256) {
  256. return;
  257. }
  258. #endif
  259. mavlink_message_t msg;
  260. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  261. uint16_t i;
  262. mavlink_aslctrl_data_t packet_in = {
  263. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0,381.0,409.0,437.0,465.0,493.0,521.0,549.0,577.0,605.0,633.0,661.0,37,104
  264. };
  265. mavlink_aslctrl_data_t packet1, packet2;
  266. memset(&packet1, 0, sizeof(packet1));
  267. packet1.timestamp = packet_in.timestamp;
  268. packet1.h = packet_in.h;
  269. packet1.hRef = packet_in.hRef;
  270. packet1.hRef_t = packet_in.hRef_t;
  271. packet1.PitchAngle = packet_in.PitchAngle;
  272. packet1.PitchAngleRef = packet_in.PitchAngleRef;
  273. packet1.q = packet_in.q;
  274. packet1.qRef = packet_in.qRef;
  275. packet1.uElev = packet_in.uElev;
  276. packet1.uThrot = packet_in.uThrot;
  277. packet1.uThrot2 = packet_in.uThrot2;
  278. packet1.nZ = packet_in.nZ;
  279. packet1.AirspeedRef = packet_in.AirspeedRef;
  280. packet1.YawAngle = packet_in.YawAngle;
  281. packet1.YawAngleRef = packet_in.YawAngleRef;
  282. packet1.RollAngle = packet_in.RollAngle;
  283. packet1.RollAngleRef = packet_in.RollAngleRef;
  284. packet1.p = packet_in.p;
  285. packet1.pRef = packet_in.pRef;
  286. packet1.r = packet_in.r;
  287. packet1.rRef = packet_in.rRef;
  288. packet1.uAil = packet_in.uAil;
  289. packet1.uRud = packet_in.uRud;
  290. packet1.aslctrl_mode = packet_in.aslctrl_mode;
  291. packet1.SpoilersEngaged = packet_in.SpoilersEngaged;
  292. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  293. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  294. // cope with extensions
  295. memset(MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN);
  296. }
  297. #endif
  298. memset(&packet2, 0, sizeof(packet2));
  299. mavlink_msg_aslctrl_data_encode(system_id, component_id, &msg, &packet1);
  300. mavlink_msg_aslctrl_data_decode(&msg, &packet2);
  301. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  302. memset(&packet2, 0, sizeof(packet2));
  303. mavlink_msg_aslctrl_data_pack(system_id, component_id, &msg , packet1.timestamp , packet1.aslctrl_mode , packet1.h , packet1.hRef , packet1.hRef_t , packet1.PitchAngle , packet1.PitchAngleRef , packet1.q , packet1.qRef , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.nZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud );
  304. mavlink_msg_aslctrl_data_decode(&msg, &packet2);
  305. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  306. memset(&packet2, 0, sizeof(packet2));
  307. mavlink_msg_aslctrl_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.aslctrl_mode , packet1.h , packet1.hRef , packet1.hRef_t , packet1.PitchAngle , packet1.PitchAngleRef , packet1.q , packet1.qRef , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.nZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud );
  308. mavlink_msg_aslctrl_data_decode(&msg, &packet2);
  309. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  310. memset(&packet2, 0, sizeof(packet2));
  311. mavlink_msg_to_send_buffer(buffer, &msg);
  312. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  313. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  314. }
  315. mavlink_msg_aslctrl_data_decode(last_msg, &packet2);
  316. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  317. memset(&packet2, 0, sizeof(packet2));
  318. mavlink_msg_aslctrl_data_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.aslctrl_mode , packet1.h , packet1.hRef , packet1.hRef_t , packet1.PitchAngle , packet1.PitchAngleRef , packet1.q , packet1.qRef , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.nZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud );
  319. mavlink_msg_aslctrl_data_decode(last_msg, &packet2);
  320. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  321. }
  322. static void mavlink_test_aslctrl_debug(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  323. {
  324. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  325. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  326. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASLCTRL_DEBUG >= 256) {
  327. return;
  328. }
  329. #endif
  330. mavlink_message_t msg;
  331. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  332. uint16_t i;
  333. mavlink_aslctrl_debug_t packet_in = {
  334. 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,113,180
  335. };
  336. mavlink_aslctrl_debug_t packet1, packet2;
  337. memset(&packet1, 0, sizeof(packet1));
  338. packet1.i32_1 = packet_in.i32_1;
  339. packet1.f_1 = packet_in.f_1;
  340. packet1.f_2 = packet_in.f_2;
  341. packet1.f_3 = packet_in.f_3;
  342. packet1.f_4 = packet_in.f_4;
  343. packet1.f_5 = packet_in.f_5;
  344. packet1.f_6 = packet_in.f_6;
  345. packet1.f_7 = packet_in.f_7;
  346. packet1.f_8 = packet_in.f_8;
  347. packet1.i8_1 = packet_in.i8_1;
  348. packet1.i8_2 = packet_in.i8_2;
  349. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  350. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  351. // cope with extensions
  352. memset(MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN);
  353. }
  354. #endif
  355. memset(&packet2, 0, sizeof(packet2));
  356. mavlink_msg_aslctrl_debug_encode(system_id, component_id, &msg, &packet1);
  357. mavlink_msg_aslctrl_debug_decode(&msg, &packet2);
  358. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  359. memset(&packet2, 0, sizeof(packet2));
  360. mavlink_msg_aslctrl_debug_pack(system_id, component_id, &msg , packet1.i32_1 , packet1.i8_1 , packet1.i8_2 , packet1.f_1 , packet1.f_2 , packet1.f_3 , packet1.f_4 , packet1.f_5 , packet1.f_6 , packet1.f_7 , packet1.f_8 );
  361. mavlink_msg_aslctrl_debug_decode(&msg, &packet2);
  362. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  363. memset(&packet2, 0, sizeof(packet2));
  364. mavlink_msg_aslctrl_debug_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.i32_1 , packet1.i8_1 , packet1.i8_2 , packet1.f_1 , packet1.f_2 , packet1.f_3 , packet1.f_4 , packet1.f_5 , packet1.f_6 , packet1.f_7 , packet1.f_8 );
  365. mavlink_msg_aslctrl_debug_decode(&msg, &packet2);
  366. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  367. memset(&packet2, 0, sizeof(packet2));
  368. mavlink_msg_to_send_buffer(buffer, &msg);
  369. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  370. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  371. }
  372. mavlink_msg_aslctrl_debug_decode(last_msg, &packet2);
  373. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  374. memset(&packet2, 0, sizeof(packet2));
  375. mavlink_msg_aslctrl_debug_send(MAVLINK_COMM_1 , packet1.i32_1 , packet1.i8_1 , packet1.i8_2 , packet1.f_1 , packet1.f_2 , packet1.f_3 , packet1.f_4 , packet1.f_5 , packet1.f_6 , packet1.f_7 , packet1.f_8 );
  376. mavlink_msg_aslctrl_debug_decode(last_msg, &packet2);
  377. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  378. }
  379. static void mavlink_test_asluav_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  380. {
  381. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  382. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  383. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASLUAV_STATUS >= 256) {
  384. return;
  385. }
  386. #endif
  387. mavlink_message_t msg;
  388. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  389. uint16_t i;
  390. mavlink_asluav_status_t packet_in = {
  391. 17.0,17,84,{ 151, 152, 153, 154, 155, 156, 157, 158 }
  392. };
  393. mavlink_asluav_status_t packet1, packet2;
  394. memset(&packet1, 0, sizeof(packet1));
  395. packet1.Motor_rpm = packet_in.Motor_rpm;
  396. packet1.LED_status = packet_in.LED_status;
  397. packet1.SATCOM_status = packet_in.SATCOM_status;
  398. mav_array_memcpy(packet1.Servo_status, packet_in.Servo_status, sizeof(uint8_t)*8);
  399. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  400. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  401. // cope with extensions
  402. memset(MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN);
  403. }
  404. #endif
  405. memset(&packet2, 0, sizeof(packet2));
  406. mavlink_msg_asluav_status_encode(system_id, component_id, &msg, &packet1);
  407. mavlink_msg_asluav_status_decode(&msg, &packet2);
  408. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  409. memset(&packet2, 0, sizeof(packet2));
  410. mavlink_msg_asluav_status_pack(system_id, component_id, &msg , packet1.LED_status , packet1.SATCOM_status , packet1.Servo_status , packet1.Motor_rpm );
  411. mavlink_msg_asluav_status_decode(&msg, &packet2);
  412. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  413. memset(&packet2, 0, sizeof(packet2));
  414. mavlink_msg_asluav_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.LED_status , packet1.SATCOM_status , packet1.Servo_status , packet1.Motor_rpm );
  415. mavlink_msg_asluav_status_decode(&msg, &packet2);
  416. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  417. memset(&packet2, 0, sizeof(packet2));
  418. mavlink_msg_to_send_buffer(buffer, &msg);
  419. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  420. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  421. }
  422. mavlink_msg_asluav_status_decode(last_msg, &packet2);
  423. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  424. memset(&packet2, 0, sizeof(packet2));
  425. mavlink_msg_asluav_status_send(MAVLINK_COMM_1 , packet1.LED_status , packet1.SATCOM_status , packet1.Servo_status , packet1.Motor_rpm );
  426. mavlink_msg_asluav_status_decode(last_msg, &packet2);
  427. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  428. }
  429. static void mavlink_test_ekf_ext(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  430. {
  431. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  432. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  433. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_EKF_EXT >= 256) {
  434. return;
  435. }
  436. #endif
  437. mavlink_message_t msg;
  438. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  439. uint16_t i;
  440. mavlink_ekf_ext_t packet_in = {
  441. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0
  442. };
  443. mavlink_ekf_ext_t packet1, packet2;
  444. memset(&packet1, 0, sizeof(packet1));
  445. packet1.timestamp = packet_in.timestamp;
  446. packet1.Windspeed = packet_in.Windspeed;
  447. packet1.WindDir = packet_in.WindDir;
  448. packet1.WindZ = packet_in.WindZ;
  449. packet1.Airspeed = packet_in.Airspeed;
  450. packet1.beta = packet_in.beta;
  451. packet1.alpha = packet_in.alpha;
  452. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  453. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  454. // cope with extensions
  455. memset(MAVLINK_MSG_ID_EKF_EXT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_EKF_EXT_MIN_LEN);
  456. }
  457. #endif
  458. memset(&packet2, 0, sizeof(packet2));
  459. mavlink_msg_ekf_ext_encode(system_id, component_id, &msg, &packet1);
  460. mavlink_msg_ekf_ext_decode(&msg, &packet2);
  461. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  462. memset(&packet2, 0, sizeof(packet2));
  463. mavlink_msg_ekf_ext_pack(system_id, component_id, &msg , packet1.timestamp , packet1.Windspeed , packet1.WindDir , packet1.WindZ , packet1.Airspeed , packet1.beta , packet1.alpha );
  464. mavlink_msg_ekf_ext_decode(&msg, &packet2);
  465. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  466. memset(&packet2, 0, sizeof(packet2));
  467. mavlink_msg_ekf_ext_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.Windspeed , packet1.WindDir , packet1.WindZ , packet1.Airspeed , packet1.beta , packet1.alpha );
  468. mavlink_msg_ekf_ext_decode(&msg, &packet2);
  469. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  470. memset(&packet2, 0, sizeof(packet2));
  471. mavlink_msg_to_send_buffer(buffer, &msg);
  472. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  473. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  474. }
  475. mavlink_msg_ekf_ext_decode(last_msg, &packet2);
  476. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  477. memset(&packet2, 0, sizeof(packet2));
  478. mavlink_msg_ekf_ext_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.Windspeed , packet1.WindDir , packet1.WindZ , packet1.Airspeed , packet1.beta , packet1.alpha );
  479. mavlink_msg_ekf_ext_decode(last_msg, &packet2);
  480. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  481. }
  482. static void mavlink_test_asl_obctrl(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  483. {
  484. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  485. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  486. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASL_OBCTRL >= 256) {
  487. return;
  488. }
  489. #endif
  490. mavlink_message_t msg;
  491. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  492. uint16_t i;
  493. mavlink_asl_obctrl_t packet_in = {
  494. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,101
  495. };
  496. mavlink_asl_obctrl_t packet1, packet2;
  497. memset(&packet1, 0, sizeof(packet1));
  498. packet1.timestamp = packet_in.timestamp;
  499. packet1.uElev = packet_in.uElev;
  500. packet1.uThrot = packet_in.uThrot;
  501. packet1.uThrot2 = packet_in.uThrot2;
  502. packet1.uAilL = packet_in.uAilL;
  503. packet1.uAilR = packet_in.uAilR;
  504. packet1.uRud = packet_in.uRud;
  505. packet1.obctrl_status = packet_in.obctrl_status;
  506. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  507. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  508. // cope with extensions
  509. memset(MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN);
  510. }
  511. #endif
  512. memset(&packet2, 0, sizeof(packet2));
  513. mavlink_msg_asl_obctrl_encode(system_id, component_id, &msg, &packet1);
  514. mavlink_msg_asl_obctrl_decode(&msg, &packet2);
  515. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  516. memset(&packet2, 0, sizeof(packet2));
  517. mavlink_msg_asl_obctrl_pack(system_id, component_id, &msg , packet1.timestamp , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.uAilL , packet1.uAilR , packet1.uRud , packet1.obctrl_status );
  518. mavlink_msg_asl_obctrl_decode(&msg, &packet2);
  519. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  520. memset(&packet2, 0, sizeof(packet2));
  521. mavlink_msg_asl_obctrl_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.uAilL , packet1.uAilR , packet1.uRud , packet1.obctrl_status );
  522. mavlink_msg_asl_obctrl_decode(&msg, &packet2);
  523. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  524. memset(&packet2, 0, sizeof(packet2));
  525. mavlink_msg_to_send_buffer(buffer, &msg);
  526. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  527. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  528. }
  529. mavlink_msg_asl_obctrl_decode(last_msg, &packet2);
  530. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  531. memset(&packet2, 0, sizeof(packet2));
  532. mavlink_msg_asl_obctrl_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.uAilL , packet1.uAilR , packet1.uRud , packet1.obctrl_status );
  533. mavlink_msg_asl_obctrl_decode(last_msg, &packet2);
  534. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  535. }
  536. static void mavlink_test_sens_atmos(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  537. {
  538. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  539. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  540. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_ATMOS >= 256) {
  541. return;
  542. }
  543. #endif
  544. mavlink_message_t msg;
  545. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  546. uint16_t i;
  547. mavlink_sens_atmos_t packet_in = {
  548. 93372036854775807ULL,73.0,101.0
  549. };
  550. mavlink_sens_atmos_t packet1, packet2;
  551. memset(&packet1, 0, sizeof(packet1));
  552. packet1.timestamp = packet_in.timestamp;
  553. packet1.TempAmbient = packet_in.TempAmbient;
  554. packet1.Humidity = packet_in.Humidity;
  555. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  556. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  557. // cope with extensions
  558. memset(MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN);
  559. }
  560. #endif
  561. memset(&packet2, 0, sizeof(packet2));
  562. mavlink_msg_sens_atmos_encode(system_id, component_id, &msg, &packet1);
  563. mavlink_msg_sens_atmos_decode(&msg, &packet2);
  564. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  565. memset(&packet2, 0, sizeof(packet2));
  566. mavlink_msg_sens_atmos_pack(system_id, component_id, &msg , packet1.timestamp , packet1.TempAmbient , packet1.Humidity );
  567. mavlink_msg_sens_atmos_decode(&msg, &packet2);
  568. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  569. memset(&packet2, 0, sizeof(packet2));
  570. mavlink_msg_sens_atmos_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.TempAmbient , packet1.Humidity );
  571. mavlink_msg_sens_atmos_decode(&msg, &packet2);
  572. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  573. memset(&packet2, 0, sizeof(packet2));
  574. mavlink_msg_to_send_buffer(buffer, &msg);
  575. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  576. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  577. }
  578. mavlink_msg_sens_atmos_decode(last_msg, &packet2);
  579. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  580. memset(&packet2, 0, sizeof(packet2));
  581. mavlink_msg_sens_atmos_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.TempAmbient , packet1.Humidity );
  582. mavlink_msg_sens_atmos_decode(last_msg, &packet2);
  583. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  584. }
  585. static void mavlink_test_sens_batmon(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  586. {
  587. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  588. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  589. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_BATMON >= 256) {
  590. return;
  591. }
  592. #endif
  593. mavlink_message_t msg;
  594. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  595. uint16_t i;
  596. mavlink_sens_batmon_t packet_in = {
  597. 93372036854775807ULL,73.0,963498088,963498296,18275,18379,18483,18587,18691,18795,18899,19003,19107,19211,125
  598. };
  599. mavlink_sens_batmon_t packet1, packet2;
  600. memset(&packet1, 0, sizeof(packet1));
  601. packet1.batmon_timestamp = packet_in.batmon_timestamp;
  602. packet1.temperature = packet_in.temperature;
  603. packet1.safetystatus = packet_in.safetystatus;
  604. packet1.operationstatus = packet_in.operationstatus;
  605. packet1.voltage = packet_in.voltage;
  606. packet1.current = packet_in.current;
  607. packet1.batterystatus = packet_in.batterystatus;
  608. packet1.serialnumber = packet_in.serialnumber;
  609. packet1.cellvoltage1 = packet_in.cellvoltage1;
  610. packet1.cellvoltage2 = packet_in.cellvoltage2;
  611. packet1.cellvoltage3 = packet_in.cellvoltage3;
  612. packet1.cellvoltage4 = packet_in.cellvoltage4;
  613. packet1.cellvoltage5 = packet_in.cellvoltage5;
  614. packet1.cellvoltage6 = packet_in.cellvoltage6;
  615. packet1.SoC = packet_in.SoC;
  616. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  617. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  618. // cope with extensions
  619. memset(MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN);
  620. }
  621. #endif
  622. memset(&packet2, 0, sizeof(packet2));
  623. mavlink_msg_sens_batmon_encode(system_id, component_id, &msg, &packet1);
  624. mavlink_msg_sens_batmon_decode(&msg, &packet2);
  625. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  626. memset(&packet2, 0, sizeof(packet2));
  627. mavlink_msg_sens_batmon_pack(system_id, component_id, &msg , packet1.batmon_timestamp , packet1.temperature , packet1.voltage , packet1.current , packet1.SoC , packet1.batterystatus , packet1.serialnumber , packet1.safetystatus , packet1.operationstatus , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 );
  628. mavlink_msg_sens_batmon_decode(&msg, &packet2);
  629. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  630. memset(&packet2, 0, sizeof(packet2));
  631. mavlink_msg_sens_batmon_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.batmon_timestamp , packet1.temperature , packet1.voltage , packet1.current , packet1.SoC , packet1.batterystatus , packet1.serialnumber , packet1.safetystatus , packet1.operationstatus , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 );
  632. mavlink_msg_sens_batmon_decode(&msg, &packet2);
  633. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  634. memset(&packet2, 0, sizeof(packet2));
  635. mavlink_msg_to_send_buffer(buffer, &msg);
  636. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  637. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  638. }
  639. mavlink_msg_sens_batmon_decode(last_msg, &packet2);
  640. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  641. memset(&packet2, 0, sizeof(packet2));
  642. mavlink_msg_sens_batmon_send(MAVLINK_COMM_1 , packet1.batmon_timestamp , packet1.temperature , packet1.voltage , packet1.current , packet1.SoC , packet1.batterystatus , packet1.serialnumber , packet1.safetystatus , packet1.operationstatus , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 );
  643. mavlink_msg_sens_batmon_decode(last_msg, &packet2);
  644. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  645. }
  646. static void mavlink_test_fw_soaring_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  647. {
  648. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  649. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  650. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FW_SOARING_DATA >= 256) {
  651. return;
  652. }
  653. #endif
  654. mavlink_message_t msg;
  655. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  656. uint16_t i;
  657. mavlink_fw_soaring_data_t packet_in = {
  658. 93372036854775807ULL,93372036854776311ULL,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0,381.0,409.0,437.0,465.0,493.0,521.0,549.0,577.0,605.0,633.0,661.0,689.0,49,116
  659. };
  660. mavlink_fw_soaring_data_t packet1, packet2;
  661. memset(&packet1, 0, sizeof(packet1));
  662. packet1.timestamp = packet_in.timestamp;
  663. packet1.timestampModeChanged = packet_in.timestampModeChanged;
  664. packet1.xW = packet_in.xW;
  665. packet1.xR = packet_in.xR;
  666. packet1.xLat = packet_in.xLat;
  667. packet1.xLon = packet_in.xLon;
  668. packet1.VarW = packet_in.VarW;
  669. packet1.VarR = packet_in.VarR;
  670. packet1.VarLat = packet_in.VarLat;
  671. packet1.VarLon = packet_in.VarLon;
  672. packet1.LoiterRadius = packet_in.LoiterRadius;
  673. packet1.LoiterDirection = packet_in.LoiterDirection;
  674. packet1.DistToSoarPoint = packet_in.DistToSoarPoint;
  675. packet1.vSinkExp = packet_in.vSinkExp;
  676. packet1.z1_LocalUpdraftSpeed = packet_in.z1_LocalUpdraftSpeed;
  677. packet1.z2_DeltaRoll = packet_in.z2_DeltaRoll;
  678. packet1.z1_exp = packet_in.z1_exp;
  679. packet1.z2_exp = packet_in.z2_exp;
  680. packet1.ThermalGSNorth = packet_in.ThermalGSNorth;
  681. packet1.ThermalGSEast = packet_in.ThermalGSEast;
  682. packet1.TSE_dot = packet_in.TSE_dot;
  683. packet1.DebugVar1 = packet_in.DebugVar1;
  684. packet1.DebugVar2 = packet_in.DebugVar2;
  685. packet1.ControlMode = packet_in.ControlMode;
  686. packet1.valid = packet_in.valid;
  687. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  688. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  689. // cope with extensions
  690. memset(MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN);
  691. }
  692. #endif
  693. memset(&packet2, 0, sizeof(packet2));
  694. mavlink_msg_fw_soaring_data_encode(system_id, component_id, &msg, &packet1);
  695. mavlink_msg_fw_soaring_data_decode(&msg, &packet2);
  696. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  697. memset(&packet2, 0, sizeof(packet2));
  698. mavlink_msg_fw_soaring_data_pack(system_id, component_id, &msg , packet1.timestamp , packet1.timestampModeChanged , packet1.xW , packet1.xR , packet1.xLat , packet1.xLon , packet1.VarW , packet1.VarR , packet1.VarLat , packet1.VarLon , packet1.LoiterRadius , packet1.LoiterDirection , packet1.DistToSoarPoint , packet1.vSinkExp , packet1.z1_LocalUpdraftSpeed , packet1.z2_DeltaRoll , packet1.z1_exp , packet1.z2_exp , packet1.ThermalGSNorth , packet1.ThermalGSEast , packet1.TSE_dot , packet1.DebugVar1 , packet1.DebugVar2 , packet1.ControlMode , packet1.valid );
  699. mavlink_msg_fw_soaring_data_decode(&msg, &packet2);
  700. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  701. memset(&packet2, 0, sizeof(packet2));
  702. mavlink_msg_fw_soaring_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.timestampModeChanged , packet1.xW , packet1.xR , packet1.xLat , packet1.xLon , packet1.VarW , packet1.VarR , packet1.VarLat , packet1.VarLon , packet1.LoiterRadius , packet1.LoiterDirection , packet1.DistToSoarPoint , packet1.vSinkExp , packet1.z1_LocalUpdraftSpeed , packet1.z2_DeltaRoll , packet1.z1_exp , packet1.z2_exp , packet1.ThermalGSNorth , packet1.ThermalGSEast , packet1.TSE_dot , packet1.DebugVar1 , packet1.DebugVar2 , packet1.ControlMode , packet1.valid );
  703. mavlink_msg_fw_soaring_data_decode(&msg, &packet2);
  704. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  705. memset(&packet2, 0, sizeof(packet2));
  706. mavlink_msg_to_send_buffer(buffer, &msg);
  707. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  708. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  709. }
  710. mavlink_msg_fw_soaring_data_decode(last_msg, &packet2);
  711. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  712. memset(&packet2, 0, sizeof(packet2));
  713. mavlink_msg_fw_soaring_data_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.timestampModeChanged , packet1.xW , packet1.xR , packet1.xLat , packet1.xLon , packet1.VarW , packet1.VarR , packet1.VarLat , packet1.VarLon , packet1.LoiterRadius , packet1.LoiterDirection , packet1.DistToSoarPoint , packet1.vSinkExp , packet1.z1_LocalUpdraftSpeed , packet1.z2_DeltaRoll , packet1.z1_exp , packet1.z2_exp , packet1.ThermalGSNorth , packet1.ThermalGSEast , packet1.TSE_dot , packet1.DebugVar1 , packet1.DebugVar2 , packet1.ControlMode , packet1.valid );
  714. mavlink_msg_fw_soaring_data_decode(last_msg, &packet2);
  715. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  716. }
  717. static void mavlink_test_sensorpod_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  718. {
  719. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  720. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  721. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENSORPOD_STATUS >= 256) {
  722. return;
  723. }
  724. #endif
  725. mavlink_message_t msg;
  726. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  727. uint16_t i;
  728. mavlink_sensorpod_status_t packet_in = {
  729. 93372036854775807ULL,17651,163,230,41,108,175,242
  730. };
  731. mavlink_sensorpod_status_t packet1, packet2;
  732. memset(&packet1, 0, sizeof(packet1));
  733. packet1.timestamp = packet_in.timestamp;
  734. packet1.free_space = packet_in.free_space;
  735. packet1.visensor_rate_1 = packet_in.visensor_rate_1;
  736. packet1.visensor_rate_2 = packet_in.visensor_rate_2;
  737. packet1.visensor_rate_3 = packet_in.visensor_rate_3;
  738. packet1.visensor_rate_4 = packet_in.visensor_rate_4;
  739. packet1.recording_nodes_count = packet_in.recording_nodes_count;
  740. packet1.cpu_temp = packet_in.cpu_temp;
  741. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  742. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  743. // cope with extensions
  744. memset(MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN);
  745. }
  746. #endif
  747. memset(&packet2, 0, sizeof(packet2));
  748. mavlink_msg_sensorpod_status_encode(system_id, component_id, &msg, &packet1);
  749. mavlink_msg_sensorpod_status_decode(&msg, &packet2);
  750. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  751. memset(&packet2, 0, sizeof(packet2));
  752. mavlink_msg_sensorpod_status_pack(system_id, component_id, &msg , packet1.timestamp , packet1.visensor_rate_1 , packet1.visensor_rate_2 , packet1.visensor_rate_3 , packet1.visensor_rate_4 , packet1.recording_nodes_count , packet1.cpu_temp , packet1.free_space );
  753. mavlink_msg_sensorpod_status_decode(&msg, &packet2);
  754. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  755. memset(&packet2, 0, sizeof(packet2));
  756. mavlink_msg_sensorpod_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.visensor_rate_1 , packet1.visensor_rate_2 , packet1.visensor_rate_3 , packet1.visensor_rate_4 , packet1.recording_nodes_count , packet1.cpu_temp , packet1.free_space );
  757. mavlink_msg_sensorpod_status_decode(&msg, &packet2);
  758. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  759. memset(&packet2, 0, sizeof(packet2));
  760. mavlink_msg_to_send_buffer(buffer, &msg);
  761. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  762. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  763. }
  764. mavlink_msg_sensorpod_status_decode(last_msg, &packet2);
  765. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  766. memset(&packet2, 0, sizeof(packet2));
  767. mavlink_msg_sensorpod_status_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.visensor_rate_1 , packet1.visensor_rate_2 , packet1.visensor_rate_3 , packet1.visensor_rate_4 , packet1.recording_nodes_count , packet1.cpu_temp , packet1.free_space );
  768. mavlink_msg_sensorpod_status_decode(last_msg, &packet2);
  769. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  770. }
  771. static void mavlink_test_sens_power_board(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  772. {
  773. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  774. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  775. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_POWER_BOARD >= 256) {
  776. return;
  777. }
  778. #endif
  779. mavlink_message_t msg;
  780. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  781. uint16_t i;
  782. mavlink_sens_power_board_t packet_in = {
  783. 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,137,204
  784. };
  785. mavlink_sens_power_board_t packet1, packet2;
  786. memset(&packet1, 0, sizeof(packet1));
  787. packet1.timestamp = packet_in.timestamp;
  788. packet1.pwr_brd_system_volt = packet_in.pwr_brd_system_volt;
  789. packet1.pwr_brd_servo_volt = packet_in.pwr_brd_servo_volt;
  790. packet1.pwr_brd_digital_volt = packet_in.pwr_brd_digital_volt;
  791. packet1.pwr_brd_mot_l_amp = packet_in.pwr_brd_mot_l_amp;
  792. packet1.pwr_brd_mot_r_amp = packet_in.pwr_brd_mot_r_amp;
  793. packet1.pwr_brd_analog_amp = packet_in.pwr_brd_analog_amp;
  794. packet1.pwr_brd_digital_amp = packet_in.pwr_brd_digital_amp;
  795. packet1.pwr_brd_ext_amp = packet_in.pwr_brd_ext_amp;
  796. packet1.pwr_brd_aux_amp = packet_in.pwr_brd_aux_amp;
  797. packet1.pwr_brd_status = packet_in.pwr_brd_status;
  798. packet1.pwr_brd_led_status = packet_in.pwr_brd_led_status;
  799. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  800. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  801. // cope with extensions
  802. memset(MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN);
  803. }
  804. #endif
  805. memset(&packet2, 0, sizeof(packet2));
  806. mavlink_msg_sens_power_board_encode(system_id, component_id, &msg, &packet1);
  807. mavlink_msg_sens_power_board_decode(&msg, &packet2);
  808. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  809. memset(&packet2, 0, sizeof(packet2));
  810. mavlink_msg_sens_power_board_pack(system_id, component_id, &msg , packet1.timestamp , packet1.pwr_brd_status , packet1.pwr_brd_led_status , packet1.pwr_brd_system_volt , packet1.pwr_brd_servo_volt , packet1.pwr_brd_digital_volt , packet1.pwr_brd_mot_l_amp , packet1.pwr_brd_mot_r_amp , packet1.pwr_brd_analog_amp , packet1.pwr_brd_digital_amp , packet1.pwr_brd_ext_amp , packet1.pwr_brd_aux_amp );
  811. mavlink_msg_sens_power_board_decode(&msg, &packet2);
  812. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  813. memset(&packet2, 0, sizeof(packet2));
  814. mavlink_msg_sens_power_board_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.pwr_brd_status , packet1.pwr_brd_led_status , packet1.pwr_brd_system_volt , packet1.pwr_brd_servo_volt , packet1.pwr_brd_digital_volt , packet1.pwr_brd_mot_l_amp , packet1.pwr_brd_mot_r_amp , packet1.pwr_brd_analog_amp , packet1.pwr_brd_digital_amp , packet1.pwr_brd_ext_amp , packet1.pwr_brd_aux_amp );
  815. mavlink_msg_sens_power_board_decode(&msg, &packet2);
  816. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  817. memset(&packet2, 0, sizeof(packet2));
  818. mavlink_msg_to_send_buffer(buffer, &msg);
  819. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  820. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  821. }
  822. mavlink_msg_sens_power_board_decode(last_msg, &packet2);
  823. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  824. memset(&packet2, 0, sizeof(packet2));
  825. mavlink_msg_sens_power_board_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.pwr_brd_status , packet1.pwr_brd_led_status , packet1.pwr_brd_system_volt , packet1.pwr_brd_servo_volt , packet1.pwr_brd_digital_volt , packet1.pwr_brd_mot_l_amp , packet1.pwr_brd_mot_r_amp , packet1.pwr_brd_analog_amp , packet1.pwr_brd_digital_amp , packet1.pwr_brd_ext_amp , packet1.pwr_brd_aux_amp );
  826. mavlink_msg_sens_power_board_decode(last_msg, &packet2);
  827. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  828. }
  829. static void mavlink_test_gsm_link_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  830. {
  831. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  832. mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
  833. if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GSM_LINK_STATUS >= 256) {
  834. return;
  835. }
  836. #endif
  837. mavlink_message_t msg;
  838. uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
  839. uint16_t i;
  840. mavlink_gsm_link_status_t packet_in = {
  841. 93372036854775807ULL,29,96,163,230,41,108
  842. };
  843. mavlink_gsm_link_status_t packet1, packet2;
  844. memset(&packet1, 0, sizeof(packet1));
  845. packet1.timestamp = packet_in.timestamp;
  846. packet1.gsm_modem_type = packet_in.gsm_modem_type;
  847. packet1.gsm_link_type = packet_in.gsm_link_type;
  848. packet1.rssi = packet_in.rssi;
  849. packet1.rsrp_rscp = packet_in.rsrp_rscp;
  850. packet1.sinr_ecio = packet_in.sinr_ecio;
  851. packet1.rsrq = packet_in.rsrq;
  852. #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
  853. if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
  854. // cope with extensions
  855. memset(MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GSM_LINK_STATUS_MIN_LEN);
  856. }
  857. #endif
  858. memset(&packet2, 0, sizeof(packet2));
  859. mavlink_msg_gsm_link_status_encode(system_id, component_id, &msg, &packet1);
  860. mavlink_msg_gsm_link_status_decode(&msg, &packet2);
  861. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  862. memset(&packet2, 0, sizeof(packet2));
  863. mavlink_msg_gsm_link_status_pack(system_id, component_id, &msg , packet1.timestamp , packet1.gsm_modem_type , packet1.gsm_link_type , packet1.rssi , packet1.rsrp_rscp , packet1.sinr_ecio , packet1.rsrq );
  864. mavlink_msg_gsm_link_status_decode(&msg, &packet2);
  865. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  866. memset(&packet2, 0, sizeof(packet2));
  867. mavlink_msg_gsm_link_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.gsm_modem_type , packet1.gsm_link_type , packet1.rssi , packet1.rsrp_rscp , packet1.sinr_ecio , packet1.rsrq );
  868. mavlink_msg_gsm_link_status_decode(&msg, &packet2);
  869. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  870. memset(&packet2, 0, sizeof(packet2));
  871. mavlink_msg_to_send_buffer(buffer, &msg);
  872. for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
  873. comm_send_ch(MAVLINK_COMM_0, buffer[i]);
  874. }
  875. mavlink_msg_gsm_link_status_decode(last_msg, &packet2);
  876. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  877. memset(&packet2, 0, sizeof(packet2));
  878. mavlink_msg_gsm_link_status_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.gsm_modem_type , packet1.gsm_link_type , packet1.rssi , packet1.rsrp_rscp , packet1.sinr_ecio , packet1.rsrq );
  879. mavlink_msg_gsm_link_status_decode(last_msg, &packet2);
  880. MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
  881. }
  882. static void mavlink_test_ASLUAV(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
  883. {
  884. mavlink_test_command_int_stamped(system_id, component_id, last_msg);
  885. mavlink_test_command_long_stamped(system_id, component_id, last_msg);
  886. mavlink_test_sens_power(system_id, component_id, last_msg);
  887. mavlink_test_sens_mppt(system_id, component_id, last_msg);
  888. mavlink_test_aslctrl_data(system_id, component_id, last_msg);
  889. mavlink_test_aslctrl_debug(system_id, component_id, last_msg);
  890. mavlink_test_asluav_status(system_id, component_id, last_msg);
  891. mavlink_test_ekf_ext(system_id, component_id, last_msg);
  892. mavlink_test_asl_obctrl(system_id, component_id, last_msg);
  893. mavlink_test_sens_atmos(system_id, component_id, last_msg);
  894. mavlink_test_sens_batmon(system_id, component_id, last_msg);
  895. mavlink_test_fw_soaring_data(system_id, component_id, last_msg);
  896. mavlink_test_sensorpod_status(system_id, component_id, last_msg);
  897. mavlink_test_sens_power_board(system_id, component_id, last_msg);
  898. mavlink_test_gsm_link_status(system_id, component_id, last_msg);
  899. }
  900. #ifdef __cplusplus
  901. }
  902. #endif // __cplusplus
  903. #endif // ASLUAV_TESTSUITE_H